两个月前,我使用 Hyperledger Fabric 编写了一个应用程序。现在,我尝试再次运行它,但出现错误并且无法解决。所以我再次查看 Hyperledger Fabric 文档(https://hyperledger-fabric.readthedocs.io/en/latest/install.html),并重新安装所有内容(包括 cmd 工具、docker 映像甚至我的 MacOS)。
我尝试了两个版本(v2.0.1 和 v2.1.0),我的节点版本是 v12。我要做的是:
curl -sSL https://xxx/2ysbOFE | bash -s -- 2.1.0 1.4.6 0.4.18
使用 cmd ( )下载 fabric-samples repo并进入 fabcar/ 目录并运行
./startFabric.sh
并进入 fabrcar/javascript/ 目录并运行
npm install && node enrollAdmin.js && node registerUser.js && node invoke.js
但是,我再次遇到此错误:
2020-05-07T06:39:28.354Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com, url:grpcs://localhost:7051
2020-05-07T06:39:28.356Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://localhost:7051 timeout:3000
2020-05-07T06:39:28.360Z - error: [NetworkConfig]: buildPeer - Unable to connect to the endorser peer0.org1.example.com due to Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com, url:grpcs://localhost:7051
at checkState (/Users/xiebei/code/fabric-samples/fabcar/javascript/node_modules/grpc/src/client.js:883:16) {
connectFailed: true
}
2020-05-07T06:39:31.363Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Discoverer- name: peer0.org1.example.com, url:grpcs://localhost:7051
2020-05-07T06:39:31.363Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com url:grpcs://localhost:7051 timeout:3000
Failed to evaluate transaction: Error: Failed to connect before the deadline on Discoverer- name: peer0.org1.example.com, url:grpcs://localhost:7051
我使用 docker ps: 在此处输入图像描述
似乎一切顺利。排序节点 docker logs 是:
2020-05-07 06:12:07.554 UTC [orderer.consensus.etcdraft] propose -> INFO 059 Created block [5], there are 0 blocks in flight channel=mychannel node=1
2020-05-07 06:12:07.558 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 05a Writing block [5] (Raft index: 7) to ledger channel=mychannel node=1
2020-05-07 06:12:07.788 UTC [orderer.common.broadcast] Handle -> WARN 05b Error reading from 172.18.0.1:36216: rpc error: code = Canceled desc = context canceled
2020-05-07 06:12:07.789 UTC [comm.grpc.server] 1 -> INFO 05c streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.18.0.1:36216 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=2.257323471s
2020-05-07 06:12:14.117 UTC [orderer.common.broadcast] Handle -> WARN 05d Error reading from 172.18.0.1:36256: rpc error: code = Canceled desc = context canceled
2020-05-07 06:12:14.117 UTC [comm.grpc.server] 1 -> INFO 05e streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=172.18.0.1:36256 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=61.170986ms
2020-05-07 06:12:16.114 UTC [orderer.consensus.etcdraft] propose -> INFO 05f Created block [6], there are 0 blocks in flight channel=mychannel node=1
2020-05-07 06:12:16.117 UTC [orderer.consensus.etcdraft] writeBlock -> INFO 060 Writing block [6] (Raft index: 8) to ledger channel=mychannel node=1
似乎订购者无法连接到某些东西(可能是对等节点)。所以我认为有一些可能的问题:
- 也许对等节点的网络出现故障,我们无法连接到它。
- 也许 NodeJS Fabric SDK 有问题,它的 GRPC 客户端不能正常工作。
- 也许我的电脑出了问题。
请你帮助我好吗?谢谢!!!