1.搭建基础环境
阿里云安装出现的一些问题解决
1. [signal SIGSEGV: segmentation violation code=0x1 addr=xxx pc=xxx] 类似的错误:原始错误的代码(来自peer节点):
2020-02-09 22:43:43.665 CST [couchdb] handleRequest -> WARN 016 Retrying couchdb request in 125ms. Attempt:1 Error:Get http://couchdb:5984/: dial tcp 172.18.0.4:5984: getsockopt: connection refused 2020-02-09 22:43:43.790 CST [couchdb] handleRequest -> DEBU 017 HTTP Request: GET / HTTP/1.1 | Host: couchdb:5984 | User-Agent: Go-http-client/1.1 | Accept: multipart/related | Accept-Encoding: gzip | | fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f17e8243259] runtime stack: runtime.throw(0xf11259, 0x2a) /opt/go/src/runtime/panic.go:605 +0x95 runtime.sigpanic() /opt/go/src/runtime/signal_unix.go:351 +0x2b8 goroutine 88 [syscall, locked to thread]: runtime.cgocall(0xbf3800, 0xc42028fac8, 0xf0fa21)
修改自己阿里云ecs机器里面的/etc/resolv.conf,把里面的 options timeout:2 attempts:3 rotate single-request-reopen 这一行内容注释掉 :解决方法:
例如我的/etc/resolv.conf :
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 100.100.2.136 nameserver 100.100.2.138 #options timeout:2 attempts:3 rotate single-request-reopen
原因解析:然后问题就解决了
这个问题是出在go的DNS解析问题,由于go的Resolver不支持options single-request-reopen
从而走了CGO Resolver
方法导致失败了,因此只需要把/etc/resolv.conf
里面的single-request-reopen
这一行注释掉即可
参考为什么通过CGO Resolver失败的原因: Static Cgo Builds, What Could Go Wrong?
2.禁止访问
Build your first network (BYFN) end-to-end test
Channel name : mychannel
Creating channel...
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=1
+ set +x
2020-02-10 05:29:16.805 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: got unexpected status: FORBIDDEN -- implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Writers' sub-policies to be satisfied: permission denied
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
ERROR !!!! Test failed
查看一下orderer的日志,看清楚它到底是具体的哪一个部分有问题,看到大多数的问题在于:
报错信息:
2020-02-10 05:29:15.706 UTC [nodeCmd] serve -> INFO 01e Started peer with ID=[name:"peer0.org1.example.com" ], network ID=[dev], address=[peer0.org1.example.com:7051] 2020-02-10 05:29:15.706 UTC [kvledger] LoadPreResetHeight -> INFO 01f Loading prereset height from path [/var/hyperledger/production/ledgersData/chains] 2020-02-10 05:29:15.706 UTC [fsblkstorage] LoadPreResetHeight -> INFO 020 Loading Pre-reset heights 2020-02-10 05:29:15.706 UTC [fsblkstorage] preRestHtFiles -> INFO 021 Dir [/var/hyperledger/production/ledgersData/chains/chains] missing... exiting 2020-02-10 05:29:15.706 UTC [fsblkstorage] LoadPreResetHeight -> INFO 022 Pre-reset heights loaded 2020-02-10 05:29:15.706 UTC [nodeCmd] func7 -> INFO 023 Starting profiling server with listenAddress = 0.0.0.0:6060 fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f67665ee259]
错误原因:没有删除干净的环境中启动复用的之前的volume
解决方案:执行如下命令删除卷
docker-compose -f docker-compose-cli.yaml down --volumes --remove-orphans docker rm -f $(docker ps -a | grep "hyperledger/*" | awk "{print \$1}") docker volume prune
3.orderer节点无法启动
2020-02-11 09:20:13.057 UTC [orderer.common.server] Start -> PANI 003 Failed validating bootstrap block: initializing channelconfig failed:
could not create channel Orderer sub-group config: setting up the MSP manager failed: the supplied identity is not valid: x509: certificate signed by unknown authority panic: Failed validating bootstrap block: initializing channelconfig failed:
could not create channel Orderer sub-group config: setting up the MSP manager failed: the supplied identity is not valid: x509: certificate signed by unknown authority
错误原因:之前搭建过网络没清除干净
解决方法:清除网络重新再来
./byfn.sh -m down
4.链码实例化失败
情况1
报错信息:
root@f36b56f939d7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')" 2020-02-11 15:33:28.712 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc 2020-02-11 15:33:28.712 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc Error: could not assemble transaction, err proposal response was not successful, error code 500, msg chaincode registration failed: timeout expired while starting chaincode mycc:1.0 for transaction
或者一直卡在这里
root@d44eb17e9375:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')" 2020-02-13 13:02:25.792 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc 2020-02-13 13:02:25.792 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
错误原因:
因为防火墙的原因node无法下载部分依赖包
解决方法:
设置你的网络挂载VPN或者用其他语言(Go/Java)链码
情况2
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (404): network _byfn not found !!!!!!!!!!!!!!! Chaincode instantiation on peer0.org2 on channel 'mychannel' failed !!!!!!!!!!!!!!!! ========= ERROR !!! FAILED to execute End-2-End Scenario ===========
5.无法创建一个带有私有数据的弹珠
错误信息
输入
export MARBLE=$(echo -n "{"name":"marble1","color":"blue","size":35,"owner":"tom","price":99}" | base64 | tr -d \n)
peer chaincode invoke -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n marblesp -c '{"Args":["initMarble"]}' --transient "{"marble":"$MARBLE"}"
输出
root@451d8e400f25:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n marblesp -c '{"Args":["initMarble"]}' --transient "{"marble":"$MARBLE"}" Error: error parsing transient string: invalid character 'm' looking for beginning of object key string - proposal response: <nil>
错误原因
未进行转义
解决方法
推荐阅读
- 27、模板方法模式(模板方法设计模式)详解
- 1、JavaScript是什么?JavaScript简介
- 32、观察者模式(Observer模式)详解
- 28、策略模式(策略设计模式)详解
- NS3 日志(Logging)、命令行参数、Tracing系统概述(转载)
- LTE Module User Documentation(翻译1)——背景、使用概述、基本的仿真程序和配置LTE模型参数
- LTE 测试文档(翻译)
- LTE Module User Documentation(翻译15)——示例程序、参考场景以及故障检测和调试技巧
- LTE Module User Documentation(翻译12)——X2切换(X2-based handover)
- LTE Module User Documentation(翻译3)——仿真输出