美文网首页
Hyperledger Fabric部署的坑(更新中)

Hyperledger Fabric部署的坑(更新中)

作者: 枕溪研书 | 来源:发表于2018-11-06 11:07 被阅读0次

    1.镜像需与fabric版本一致

    fabric运行所需要的镜像一共是12种

    可以通过输入docker images查看你已下载的镜像。

    如果发现有少的镜像则用下述语句下载,每条语句对应下载每一个镜像,请根据所缺失的镜像选择语句并执行:

    docker pull hyperledger/fabric-tools:x86_64-1.0.0
    docker pull hyperledger/fabric-couchdb:x86_64-1.0.0
    docker pull hyperledger/fabric-kafka:x86_64-1.0.0
    docker pull hyperledger/fabric-orderer:x86_64-1.0.0
    docker pull hyperledger/fabric-peer:x86_64-1.0.0
    docker pull hyperledger/fabric-ca:x86_64-1.0.0
    docker pull hyperledger/fabric-ccenv:x86_64-1.0.0
    docker pull hyperledger/fabric-baseimage:x86_64-0.4.7
    docker pull hyperledger/fabric-baseos:x86_64-0.4.7
    docker pull hyperledger/fabric-zookeeper:x86_64-1.0.0
    docker pull hyperledger/fabric-javaenv:x86_64-1.0.0
    docker pull hyperledger/fabric-membersrvc:latest
    

    请注意每个镜像的版本号!大多数往往缺少baseimage,baseos,membersrvc这三种。

    2 错误汇总

    1.ERRO 001 Cannot run peer because error when setting up MSP from directory........msp.......
    2.ERRO 001 Cannot run peer because error when setting up MSP from directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp......
    

    解决办法:

    这两个问题都是因为fabric版本和docker镜像版本不一致
    查看fabric branch:git branch -a

    结果带*就是你的branch,如果不是v1.0.0,就
    git checkout v1.0.0

    当然,也可以下载对应的镜像(如果版本为v 1.1):

    cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli/
    source download-dockerimages.sh -c x86_64-1.1.0 -f x86_64-1.1.0
    

    再查看下fabric目录下: make cryptogen。如果返回

    CGO_CFLAGS=" " GOBIN=/opt/gopath/src/github.com/hyperledger/fabric/build/bin go install -tags "" -ldflags "-X github.com/hyperledger/fabric/common/tools/cryptogen/metadata.Version=1.0.1" github.com/hyperledger/fabric/common/tools/cryptogen
    github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11
    vendor/github.com/miekg/pkcs11/pkcs11.go:29:18: fatal error: ltdl.h: No such file or directory
    compilation terminated.
    Makefile:227: recipe for target 'build/bin/cryptogen' failed
    make: *** [build/bin/cryptogen] Error 2
    

    表明缺少ltdl.h文件。执行以下命令:

    apt-get install libtool libltdl-dev
    make cryptogen
    

    3 如果出现:

    Error: Error endorsing chaincode: rpc error: code = Unknown desc = Error starting container: API error (404): {"message":"network e2ecli_default not found"}

    解决办法:

    cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli/base
    gedit peer-base.yaml
    打开文件后将e2ecli_default修改为e2e_cli_default
    

    4 go语言的环境问题

    注意:cd ~cd /home是不一样的!!!

    7 docker删除相同的镜像出错解决:

    [图片上传中...(微信截图_20181101174638.png-77585f-1541473389553-0)]

    8 出现DEBU 001 Returning existing local MSP

    微信截图_20181101174638.png

    有一种解决方法是:

    执行一下命令  vim /etc/hosts
    增加以下内容
    172.16.10.188 orderer.example.com
    

    但是,我觉的这种方法没有什么效果,因为我执行了这句话后,也没解决问题

    后来,看到一篇帖子,终于解决了:

    是因为环境遗留的问题

    解决方式,重新关闭网络

    ./network_setup.sh down mychannel
    
    root@cc-fibric:/home/cc/go/src/github.com/hyperledger/fabric/examples/e2e_cli# ./network_setup.sh down mychannel
    WARNING: The CHANNEL_NAME variable is not set. Defaulting to a blank string.
    WARNING: The TIMEOUT variable is not set. Defaulting to a blank string.
    Stopping cli                    ... done
    Stopping kafka3                 ... done
    Stopping kafka0                 ... done
    Stopping kafka1                 ... done
    Stopping kafka2                 ... done
    Stopping peer1.org2.example.com ... done
    Stopping zookeeper0             ... done
    Stopping zookeeper2             ... done
    Stopping zookeeper1             ... done
    Stopping peer0.org1.example.com ... done
    Stopping peer0.org2.example.com ... done
    Stopping peer1.org1.example.com ... done
    Removing cli                    ... done
    Removing orderer.example.com    ... done
    Removing kafka3                 ... done
    Removing kafka0                 ... done
    Removing kafka1                 ... done
    Removing kafka2                 ... done
    Removing peer1.org2.example.com ... done
    Removing zookeeper0             ... done
    Removing zookeeper2             ... done
    Removing zookeeper1             ... done
    Removing peer0.org1.example.com ... done
    Removing peer0.org2.example.com ... done
    Removing peer1.org1.example.com ... done
    Removing network e2e_cli_default
    ---- No containers available for deletion ----
    ---- No images available for deletion ----
    

    当然,也有可能是e2e_cli文件没有权限读写

    后记:

    我一开始是版本错了,是v1.1 的版,下的docker镜像却是v1.0.0;

    接下来,估计是由于前面运行过一次./network_setup.sh up ,所以有环境残余。
    在执行完./network_setup.sh down mychannel后,
    再启动

    ./network_setup.sh up
    
    root@cc-fibric:/home/cc/go/src/github.com/hyperledger/fabric/examples/e2e_cli# ./network_setup.sh up
    setting to default channel 'mychannel'
    mychannel
    
    Using cryptogen -> /home/cc/go/src/github.com/hyperledger/fabric/examples/e2e_cli/../../release/linux-amd64/bin/cryptogen
    
    ##########################################################
    ##### Generate certificates using cryptogen tool #########
    ##########################################################
    org1.example.com
    org2.example.com
    
    Using configtxgen -> /home/cc/go/src/github.com/hyperledger/fabric/examples/e2e_cli/../../release/linux-amd64/bin/configtxgen
    ##########################################################
    #########  Generating Orderer Genesis block ##############
    ##########################################################
    

    相关文章

      网友评论

          本文标题:Hyperledger Fabric部署的坑(更新中)

          本文链接:https://www.haomeiwen.com/subject/mbwyxqtx.html