1. 程式人生 > >Hyperledger e2e_cli 示例部署遇到問題及解決方法

Hyperledger e2e_cli 示例部署遇到問題及解決方法

先決條件安裝方法vim bootstrap.shchmod +x bootstrap.sh將 url中的拷入 bootstrap.sh中然後執行node安裝注意node版本 tar -zvxf node-v6.9.5-linux-x64.tar.gz 86 mv node-v6.9.5-linux-x64/ /usr/local/Cellar/nodeGO安裝yum install golangfind / -name golang設定路徑/usr/lib/golang手動安裝golang export GOROOT=/usr/local/golang //這個是你的golang解壓後的路徑
export GOBIN=$GOROOT/binexport GOPATH=$GOROOT //這個目錄後面自己會創建出來,不要忘了在該目錄下建立bin, src, pkg三個目錄export PATH=$PATH:$GOBINexport GOROOT=/usr/lib/golangexport GOPATH=/usr/lib/golang [[email protected] fabric]# make dockermkdir -p build/image/peer/payloadcp build/docker/bin/peer build/sampleconfig.tar.bz2 build/image/peer/payloadmkdir -p build/image/ccenv/payloadcp build/docker/gotools/bin/protoc-gen-go build/bin/chaintool build/goshim.tar.bz2
build/image/ccenv/payloadcp: cannot stat ‘build/docker/gotools/bin/protoc-gen-go’: No such file or directorymake: *** [build/image/ccenv/payload] Error 1[[email protected] fabric]# cd /usr/lib/golang/api/ bin/ favicon.ico lib/ pkg/ robots.txt src/ test/ VERSION [
[email protected]
fabric]# cd /usr/lib/golang/bin/gomkdir -p build/image/peer/payloadcp build/docker/bin/peer build/sampleconfig.tar.bz2 build/image/peer/payloadmkdir -p build/image/ccenv/payloadcp build/docker/gotools/bin/protoc-gen-go build/bin/chaintool build/goshim.tar.bz2 build/image/ccenv/payloadBuilding docker ccenv-imagedocker build -t hyperledger/fabric-ccenv build/image/ccenvSending build context to Docker daemon 19.49MBStep 1/5 : FROM hyperledger/fabric-baseimage:x86_64-0.3.1 ---> 9f2e9ec7c527Step 2/5 : COPY payload/chaintool payload/protoc-gen-go /usr/local/bin/ ---> 41dea3a0fcbdStep 3/5 : ADD payload/goshim.tar.bz2 $GOPATH/src/ ---> 97834de49ef6Step 4/5 : RUN mkdir -p /chaincode/input /chaincode/output ---> Running in b1fa11f78fedRemoving intermediate container b1fa11f78fed ---> 506ce0a82af4Step 5/5 : LABEL org.hyperledger.fabric.version=1.0.0 org.hyperledger.fabric.base.version=0.3.1 ---> Running in 229c44fbd9dfRemoving intermediate container 229c44fbd9df ---> 9be913467b7eSuccessfully built 9be913467b7eSuccessfully tagged hyperledger/fabric-ccenv:latestdocker tag hyperledger/fabric-ccenv hyperledger/fabric-ccenv:x86_64-1.0.0Creating build/javashim.tar.bz2tar (child): bzip2:無法 exec: 沒有那個檔案或目錄tar (child): Error is not recoverable: exiting nowmake: *** [build/javashim.tar.bz2] 錯誤 141[[email protected] fabric]# 缺少bzip2包yum install -y bzip2/bin/sh: 1: core/chaincode/shim/java/javabuild.sh: not foundThe command '/bin/sh -c core/chaincode/shim/java/javabuild.sh' returned a non-zero code: 127make: *** [build/image/javaenv/.dummy-x86_64-1.0.0] 錯誤 127錯誤:執行make docker遇到:core/chaincode/shim/java/javabuild.sh: line 51: gradle: command not found解決辦法:刪除openjdk安裝:oracle jdk1.8手動gradle,註釋掉core/chaincode/shim/java/javabuild.sh裡面的gradle命令啟動 ./network_setup.sh up錯誤:2017-09-12 14:17:49.952 UTC [grpc] Printf -> DEBU 003 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 211.139.178.49:7050: i/o timeout"; Reconnecting to {orderer.example.com:7050 <nil>}!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!================== ERROR !!! FAILED to execute End-2-End Scenario ==================解決辦法:修改宿主機hosts /etc/hosts ,在實際環境中,建議通過配置 DNS 而不是修改 /etc/hosts 檔案127.0.0.1 orderer.example.com修改 base/peer-base.yaml,新增 volumes:volumes:-/etc/hosts:/etc/hostsCORE_PEER_ADDRESS=peer0.org1.example.com:70512018-02-03 01:37:24.238 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP2018-02-03 01:37:24.238 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity2018-02-03 01:37:24.241 UTC [grpc] Printf -> DEBU 003 Failed to dial orderer.example.com:7050: connection error: desc = "transport: authentication handshake failed: x509: certificate signed by unknown authority (possibly because of \"x509: ECDSA verification failure\" while trying to verify candidate authority certificate \"tlsca.example.com\")"; please retry.Error: Error connecting due to rpc error: code = Internal desc = connection error: desc = "transport: authentication handshake failed: x509: certificate signed by unknown authority (possibly because of \"x509: ECDSA verification failure\" while trying to verify candidate authority certificate \"tlsca.example.com\")"Usage: peer channel create [flags]Flags: -c, --channelID string In case of a newChain command, the channel ID to create. -f, --file string Configuration transaction file generated by a tool such as configtxgen for submitting to orderer -t, --timeout int Channel creation timeout (default 5)Global Flags: --cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint --logging-level string Default logging level and overrides, see core.yaml for full syntax -o, --orderer string Ordering service endpoint --test.coverprofile string Done (default "coverage.cov") --tls Use TLS when communicating with the orderer endpoint -v, --version Display current version of fabric peer server!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!================== ERROR !!! FAILED to execute End-2-End Scenario ==================解決方法:peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem錯誤:不能生成創世塊解決辦法:[email protected]:~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/channel-artifacts# lschannel.tx genesis.block Org1MSPanchors.tx Org2MSPanchors.tx[email protected]:~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/channel-artifacts# rm -rf genesis.block/錯誤:[[email protected] e2e_cli]# ../../build/bin/configtxgen -profile TwoOrgsOrdererGenesis 2017-09-17 05:54:50.525 PDT [common/configtx/tool] main -> INFO 001 Loading configuration2017-09-17 05:54:50.525 PDT [common/configtx/tool/localconfig] Load -> CRIT 002 Error reading configuration: Unsupported Config Type ""2017-09-17 05:54:50.525 PDT [common/configtx/tool] func1 -> ERRO 003 Could not find configtx.yaml. Please make sure that FABRIC_CFG_PATH is set to a path which contains configtx.yaml解決辦法:[[email protected] e2e_cli]# export FABRIC_CFG_PATH=$PWD[[email protected] e2e_cli]# ../../build/bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block錯誤:cli | 2017-09-19 14:58:59.485 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608B3E184CE0522...EBE756E2B3F85609A68E923C9B9499B3 cli | 2017-09-19 14:58:59.485 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 57743FC2DDB7C9C207351F728119716FF214994F050D89C3D19805B9923A5DA4 cli | Error: Got unexpected status: BAD_REQUESTcli | Usage:cli | peer channel create [flags]cli | cli | Flags:cli | -c, --channelID string In case of a newChain command, the channel ID to create.cli | -f, --file string Configuration transaction file generated by a tool such as configtxgen for submitting to orderercli | -t, --timeout int Channel creation timeout (default 5)cli | cli | Global Flags:cli | --cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpointcli | --logging-level string Default logging level and overrides, see core.yaml for full syntaxcli | -o, --orderer string Ordering service endpointcli | --test.coverprofile string Done (default "coverage.cov")cli | --tls Use TLS when communicating with the orderer endpointcli | -v, --version Display current version of fabric peer servercli | cli | !!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!cli | ================== ERROR !!! FAILED to execute End-2-End Scenario ==================cli | cli | sleep: missing operandcli | Try 'sleep --help' for more information.解決辦法:類似這樣的錯誤,是因為channel已經建立,命名衝突 <EXACT_TIMESTAMP> UTC [msp] Sign-> DEBU 064 Sign: digest: 5ABA6805B3CDBAF16C6D0DCD6DC439F92793D55C82DB130206E35791BCF18E5FError: Gotunexpectedstatus: BAD_REQUESTUsage: peerchannelcreate [flags]解決辦法:移除docker,重新啟動。執行最後一個命令即可 1)刪除一個容器 docker rm 2)強制刪除一個容器 docker rm -f 3)強制刪除全部容器 docker rm -f $(docker ps -aq)$GOPATHcp: cannot stat 'build/docker/gotools/bin/protoc-gen-go': No such file or directory(找不到protoc-gen-go檔案)編譯生成 protoc-gen-go#編譯生成 protoc-gen-go cd $GOPATHgopm get -g -d github.com/golang/protobuf/protoc-gen-gogo install github.com/golang/protobuf/protoc-gen-go#確認在$GOPATH/bin出現protoc-gen-go執行檔案如果出現檔案或者命令沒找到的錯誤,複製go 的相關檔案到 fabric 編譯環境cp $GOPATH/bin/protoc-gen-go $GOPATH/src/github.com/hyperledger/fabric/build/docker/gotools/bin/ cp $GOPATH/bin/gocov $GOPATH/src/github.com/hyperledger/fabric/build/docker/gotools/bin/ 部署過程中的注意go的安裝路徑,記錄下問題,希望能給大家一些幫助與提示!!!



歡迎大家一起加入討論!!!