如何在不丢失现有数据的情况下重新启动结构编辑器?

问题描述 投票:8回答:4

我在本地尝试过“ carauction-network”示例。但是,当我使用“ startFabric.sh”文件启动网络时,由于此旧数据丢失了,它正在删除Couch数据库并再次创建Couch DB。请提出我们如何在不清除数据的情况下启动结构服务器。

hyperledger-composer
4个回答
20
投票

fabric-dev-servers下的[startFabric.sh(以前称为fabric-tools)不仅可以启动Fabric,还可以删除现有的Fabric容器并从Docker镜像中重新创建新的Container。这样的影响是,您将从结构中丢失了所有数据和业务网络。现在,除PeerAdmin @ hlfv1之外的所有商务网卡都将无效。

如果要在创建Fabric之后停止并启动它,请按照以下命令保留您的业务网络和数据:

    更改到docker-compose.yml文件所在的目录(例如/home/<user>/fabric-tools/fabric-scripts/hlfv1/composer
  • 运行docker-compose stop到织物容器的顶部
  • 运行docker-compose start从上次中断的地方重新启动。
  • 在使用docker-compose命令之前,将

    必要

  • 放在正确的文件夹中。

    版本更新

    使用Composer v0.20.x(对于Fabric 1.2,文件夹的名称/版本已更改:

    /home/<user>/fabric-dev-servers/fabric-scripts/hlfv12/composer

    使用Composer v0.19.x(对于Fabric v1.1为旧版本,文件夹名称/版本已更改:

    /home/<user>/fabric-dev-servers/fabric-scripts/hlfv11/composer


    5
    投票
    如下所示在fabric-dev-server / fabric-scripts / hlfv11中编辑您的startFabric.sh

    #!/bin/bash # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Exit on first error, print all commands. set -e Usage() { echo "" echo "Usage: ./startFabric.sh [-d || --dev]" echo "" echo "Options:" echo -e "\t-d or --dev: (Optional) enable fabric development mode" echo "" echo "Example: ./startFabric.sh" echo "" exit 1 } Parse_Arguments() { while [ $# -gt 0 ]; do case $1 in --help) HELPINFO=true ;; --dev | -d) FABRIC_DEV_MODE=true ;; esac shift done } Parse_Arguments $@ if [ "${HELPINFO}" == "true" ]; then Usage fi #Detect architecture ARCH=`uname -m` # Grab the current directory DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ "${FABRIC_DEV_MODE}" == "true" ]; then DOCKER_FILE="${DIR}"/composer/docker-compose-dev.yml else DOCKER_FILE="${DIR}"/composer/docker-compose.yml fi ARCH=$ARCH docker-compose -f "${DOCKER_FILE}" stop ARCH=$ARCH docker-compose -f "${DOCKER_FILE}" up -d # wait for Hyperledger Fabric to start # incase of errors when running later commands, issue export FABRIC_START_TIMEOUT=<larger number> echo "sleeping for ${FABRIC_START_TIMEOUT} seconds to wait for fabric to complete start up" sleep ${FABRIC_START_TIMEOUT} # Create the channel #docker exec peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c composerchannel -f /etc/hyperledger/configtx/composer-channel.tx # Join peer0.org1.example.com to the channel. #docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/[email protected]/msp" peer0.org1.example.com peer channel join -b composerchannel.block if [ "${FABRIC_DEV_MODE}" == "true" ]; then echo "Fabric Network started in chaincode development mode" fi


    5
    投票
    为了扩展R Thatcher的解决方案,如果您可以访问bash shell,则可以将此脚本放入fabric-dev-server文件夹中。它将按照上述步骤重新启动网络,而不会丢失数据。只需将cd插入正确的目录并运行docker-compose stop和docker-compose start。重新启动以恢复网络后,也可以正常运行。

    #!/bin/bash cd ./fabric-scripts/hlfv1/composer docker-compose stop docker-compose start

    似乎微不足道,并且没有为讨论增加太多,但节省了时间。

    0
    投票
    我已经在结构1.2上尝试了此解决方案,但是当我在/ home // fabric-dev-servers / fabric-scripts / hlfv12 / composer下运行docker-compose start时,只有councdb和同级无法启动有什么想法吗?
    © www.soinside.com 2019 - 2024. All rights reserved.