我目前正在为我正在研究的Hyperledger Composer项目建立自定义Hyperledger Fabric网络。
Composer文件已经可以使用提供的现成的dev结构服务器(即./startFabric.sh
)完美运行。我已经按照tutorial的方法,使用给定的byfn.sh
将现有业务网络部署到多组织情况,并且网络已成功安装(composer network install ...
已成功安装{{ 1}}在光纤网络上。
现在,我尝试修改.bna
以支持3(三个)组织,每个组织只有一个同级。其他文件(crypto-config.yaml
,configtx.yaml
,scripts/script.sh
和docker compose文件)也进行了相应的修改。
byfn.sh
中的e2e测试实际上已经成功运行(直到出现“ END” ASCII码),这使我认为结构网络已成功建立。 script/script.sh
命令也shows表示Docker容器正在运行。
但是,当我尝试在安装结构上执行docker ps
时,它会输出以下内容:
composer network install
即使端到端测试运行正常,为什么也会出现此错误?我怀疑connection.json file的配置不正确,因为e2e运行得很好(( “ $ composer network install -c PeerAdmin@example-org1 -a stockchainz.bna
✖ Installing business network. This may take a minute...
Error: Error trying install business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: Failed to connect before the deadline
Command failed
”和“ INSERT_..._CA_CERT
”已替换为正确的值)
答案 0 :(得分:1)
浏览日志后,我发现grpc找不到对等方。原来这是一个证书问题,我的怀疑是正确的。设置GRPC_VERBOSITY=DEBUG
会在重新执行composer network install
时显示日志:
...
D0507 12:21:21.934229064 14853 security_handshaker.cc:127] Security handshake failed: {"created":"@1557231681.934207000","description":"Peer name localhost is not in peer certificate","file":"../deps/grpc/src/core/lib/security/security_connector/security_connector.cc","file_line":780}
...
connection.json
将所有对等方的URL设置为grpcs://localhost:<port>
。而不是这样:
...
"peer0.org1.example.com": {
"url": "grpcs://localhost:7051",
"tlsCACerts" : {
"pem": "INSERT_ORG1_CA_CERT"
}
},
...
我将其更改为此:
...
"peer0.org1.example.com": {
"url": "grpcs://localhost:7051",
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com"
},
"tlsCACerts" : {
"pem": "INSERT_ORG1_CA_CERT"
}
},
...
这样做之后,业务网络归档文件已成功安装:
$ composer network install --card PeerAdmin@example-org1 --archiveFile business-net.bna
⠋ Installing business network. This may take a minute...D0507 12:45:04.640298851 15321 dns_resolver.cc:331] Using native dns resolver
E0507 12:45:04.640363346 15321 trace.cc:57] Unknown trace var: 'transport_security'
⠸ Installing business network. This may take a minute...I0507 12:45:07.172482196 15321 subchannel.cc:605] New connected subchannel at 0x2c208d0 for subchannel 0x2b83880
I0507 12:45:07.173478121 15321 subchannel.cc:605] New connected subchannel at 0x2b10fa0 for subchannel 0x2b572f0
I0507 12:45:07.174495644 15321 subchannel.cc:605] New connected subchannel at 0x2c0b0e0 for subchannel 0x2b5bbe0
I0507 12:45:07.176448759 15321 subchannel.cc:605] New connected subchannel at 0x2bac9c0 for subchannel 0x2b17bc0
⠼ Installing business network. This may take a minute...I0507 12:45:07.205505423 15321 subchannel.cc:605] New connected subchannel at 0x2d6d400 for subchannel 0x2d65330
I0507 12:45:07.206441632 15321 subchannel.cc:605] New connected subchannel at 0x2c21970 for subchannel 0x2d69b80
⠧ Installing business network. This may take a minute...I0507 12:45:08.365612394 15321 subchannel.cc:605] New connected subchannel at 0x2c8efa0 for subchannel 0x2b37020
I0507 12:45:08.369911016 15321 subchannel.cc:605] New connected subchannel at 0x2bb2660 for subchannel 0x2c9d510
✔ Installing business network. This may take a minute...
Successfully installed business network business-net, version 0.1.0
Command succeeded