HyperLedge Fabric V1.0.4 踩坑汇总

HyperLedger Fabric 问题汇总

在阅读文档《write first app》时,在执行./startFabric.sh可能会遇到以下错误

Error: Error getting endorser client channel: PER:404 - Error trying to connect to local peer
/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.GetEndorserClient
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/channel.go:149 github.com/hyperledger/fabric/peer/channel.InitCmdFactory
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:138 github.com/hyperledger/fabric/peer/channel.join
/opt/gopath/src/github.com/hyperledger/fabric/peer/channel/join.go:42 github.com/hyperledger/fabric/peer/channel.joinCmd.func1
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute
/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main
/opt/go/src/runtime/proc.go:192 runtime.main
/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit
Caused by: context deadline exceeded
Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block

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 serv

解决方法,修改

fabric-samples/basic-network/start.sh

export FABRIC_START_TIMEOUT=300  //适当调大此值可以改善此问题

之后重新执行./startFabric.sh

golang开发环境问题

在根据网络上的教程下载部分插件的时候,会由于网络原因造成部分插件不能正常安装,其实可以发现是因为go-tools无法下载造成,可以参考以下链接提供的方法解决
https://studygolang.com/articles/7922

文档《Building Your First Network》问题

在根据该文档进行手动建立Network时,需要修改docker-compose-cli.yaml 注释掉下面所示的行

...
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    #command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME} ${DELAY} ${LANG}; sleep $TIMEOUT'
    volumes:
        - /var/run/:/host/var/run/
...

编辑文件byfn.sh
修改CLI_TIMEOUT=10000

关于docker

一定一定要配阿里docker镜像库。可以参考《https://www.cnblogs.com/anliven/p/6218741.html》

关于chaincode-docker-devmode

在运行这个示例的时候直接启动总是不能正常启动。报如下错误

ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).

这个错误对我们后续的流程并不影响。
如果不想看到这个错误只需要将docker-compose-simple.yaml文件中的tty= true全部注释掉就可以了。
但根据官方文档中在”Terminal 2 - Build & start the chaincode” 这一步中命令CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./sacc总是报以下错误

2018-03-19 05:57:10.162 UTC [shim] SetupChaincodeLogging -> INFO 001 Chaincode log level not provided; defaulting to: INFO
2018-03-19 05:57:10.163 UTC [shim] SetupChaincodeLogging -> INFO 002 Chaincode (build level: ) starting up ...
2018-03-19 05:57:13.164 UTC [shim] userChaincodeStreamGetter -> ERRO 003 Error trying to connect to local peer: context deadline exceeded
Error starting SimpleAsset chaincode: Error trying to connect to local peer: context deadline exceeded

应该上述命令应该改成CORE_PEER_ADDRESS=peer:7051 CORE_CHAINCODE_ID_NAME=mycc:0 ./sacc
注意是peer:7051而不是peer:7052(文档里面写错了,也许以后会改成正确的)

如果跳过这一步直接部署并启动Chaincode时会报

Error: Error endorsing chaincode: rpc error: code = Unknown desc = Failed to init chaincode(handler not found for chaincode mycc:0)
Usage:
  peer chaincode instantiate [flags]

因此这一步不能省略。

你可能感兴趣的:(HyperLedger,Fabric,Hyperledger,Fabric)