我们需要在docker容器的网络之外运行“composer”命令。 当我在/ etc / hosts文件中指定orderer和peer主机名(例如peer0.org1.example.com)时,“composer”命令似乎有效。
但是,如果我指定服务器的IP地址,则它不起作用。这是样本。
$ composer network list -p hlfv1 -n info-share-bc -i PeerAdmin -s secret
✖ List business network info-share-bc
Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
Command succeeded
当我在/ etc / hosts中指定主机名时,这是一个命令示例。
$ composer network list -p hlfv1 -n info-share-bc -i PeerAdmin -s secret
✔ List business network info-share-bc
name: info-share-bc
models:
- org.hyperledger.composer.system
- bc.share.info
<snip>
我相信当无法解析服务器名称时,我们将指定名为“ssl-target-name-override”的选项,hyperledger node.js SDK,如此处所述。
https://jimthematrix.github.io/Remote.html
- ssl-target-name-override {string} Used in test environment only,
when the server certificate's hostname (in the 'CN' field) does not
match the actual host endpoint that the server process runs at,
the application can work around the client TLS verify failure by
setting this property to the value of the server certificate's hostname
是否有任何选项可以在连接配置文件(connection.json)中指定主机名?
答案 0 :(得分:1)
找到解决方法:连接配置文件中的hostnameOverride
选项解决了连接问题。
"eventURL": "grpcs://<target-host>:17053",
"hostnameOverride": "peer0.org1.example.com",