在这个特定的错误上,我正在努力使用 Node.js Hyperledger Fabric 客户端库:
我的区块链网络(Hyperledger Fabric 1.4)部署在一台服务器上,IP 和所有需要的端口都从另一台服务器可见。文档中可用的所有示例/示例均通过 localhost 引用网络。
如何启动客户端应用程序并将其指向网络的 IP 地址而不是 localhost 或对等容器名称(例如 peer0.org1.example.com)?
每个客户端应用程序是否必须将管理员和用户注册到其本地持久性存储中,或者它只能由网络本身完成一次(并且可能在稍后阶段从网络安装到应用程序)?我们在这里讨论一台主机上的 Dockerized 网络和另一台主机上的客户端应用程序(同样是 Dockerized)。
此外,如果调用方法时需要.pem 证书文件,如何启动应用程序并连接到通过GRCPS 订购的例如createPeer
?
我将非常感谢这里提供的任何帮助。
编辑,2020 年 3 月 12 日:
我正在使用对我的网络进行更改的基本网络示例来创建 3 个组织,每个组织有 3 个对等点和 5 个 Raft 订购者。我复制了 connection-org1.json 文件,将 localhost 更改为我的外部服务器 IP,但出现以下错误:
2020-03-12T12:45:31.503Z - error: [SingleQueryHandler]: evaluate: message=No peers available to query. Errors: ["14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed"], stack=FabricError: No peers available to query. Errors: ["14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed"]
at SingleQueryHandler.evaluate ((...)/network_files/javascript/node_modules/fabric-network/lib/impl/query/singlequeryhandler.js:44:17), name=FabricError
Failed to evaluate transaction: FabricError: No peers available to query. Errors: ["14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed","14 UNAVAILABLE: DNS resolution failed"]
我能够使用托管在外部 IP 上的网络在本地计算机上成功注册和注册管理员和用户。但我无法使用连接配置文件查询链码。
这是我的连接配置文件:
{
"name": "first-network-org1",
"version": "1.0.0",
"client": {
"organization": "Org1",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
}
}
}
},
"organizations": {
"Org1": {
"mspid": "Org1MSP",
"peers": [
"peer0.org1.example.com",
"peer1.org1.example.com",
"peer2.org1.example.com"
],
"certificateAuthorities": [
"ca.org1.example.com"
]
}
},
"peers": {
"peer0.org1.example.com": {
"url": "grpcs://<IP>:7051",
"tlsCACerts": {
"pem": "<CERT>"
},
"grpcOptions": {
"ssl-target-name-override": "peer0.org1.example.com",
"hostnameOverride": "peer0.org1.example.com"
},
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true
},
"peer1.org1.example.com": {
"url": "grpcs://<IP>:8051",
"tlsCACerts": {
"pem": "<CERT>"
},
"grpcOptions": {
"ssl-target-name-override": "peer1.org1.example.com",
"hostnameOverride": "peer1.org1.example.com"
}
},
"peer2.org1.example.com": {
"url": "grpcs://<IP>:9051",
"tlsCACerts": {
"pem": "<CERT>"
},
"grpcOptions": {
"ssl-target-name-override": "peer2.org1.example.com",
"hostnameOverride": "peer2.org1.example.com"
}
}
},
"certificateAuthorities": {
"ca.org1.example.com": {
"url": "https://<IP>:7054",
"caName": "ca-org1",
"tlsCACerts": {
"pem": "<CERT>"
},
"httpOptions": {
"verify": false
}
}
}
}