我正在尝试在作为Org1和Org2的两个不同节点上运行两个组织示例。我能够查询链码。接下来我尝试在其上安装composer。除非我尝试ping网络,否则所有步骤都是成功的。它给了我ENDORSEMENT_POLICY_FAILURE错误。对于仅Org1和仅Org2的连接配置文件,我仅使用localhost。此外,即使有认可失败错误,我可以看到使用区块链资源管理器和日志块在两台机器中使用ping命令生成。 Org1连接配置文件如下:
{
"name": "byfn-network-org1",
"type": "hlfv1",
"mspID": "Org1MSP",
"peers": [
{
"requestURL": "grpcs://localhost:7051",
"eventURL": "grpcs://localhost:7053",
"cert": "/home/user/fabric-samples/multi-org-multi-node/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt",
"hostnameOverride": "peer0.org1.example.com"
},
{
"requestURL": "grpcs://localhost:8051",
"eventURL": "grpcs://localhost:8053",
"cert": "/home/user/fabric-samples/multi-org-multi-node/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt",
"hostnameOverride": "peer1.org1.example.com"
},
{
"requestURL": "grpcs://<PC2-IP>:9051",
"cert": "/home/user/fabric-samples/multi-org-multi-node/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt",
"hostnameOverride": "peer0.org2.example.com"
},
{
"requestURL": "grpcs://<PC2-IP>:10051",
"cert": "/home/user/fabric-samples/multi-org-multi-node/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt",
"hostnameOverride": "peer1.org2.example.com"
}
],
"ca": {
"url": "https://localhost:7054",
"name": "ca-org1",
"cert": "/home/user/fabric-samples/multi-org-multi-node/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt",
"hostnameOverride": "ca.org1.example.com"
},
"orderers": [
{
"url" : "grpcs://localhost:7050",
"cert": "/home/user/fabric-samples/multi-org-multi-node/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt",
"hostnameOverride": "orderer.example.com"
}
],
"channel": "mychannel",
"timeout": 300
}
Orderer在PC 1上,所以我使用了localhost
答案 0 :(得分:0)
连接配置文件由Composer用于连接到Peer Containers等,但Peer Containers(和Orderer)也需要进行通信。因此,您需要在容器中进行地址解析。
当您在单个机器上遵循MultiOrg教程时,可以创建一个专用的网桥,允许所有容器通过fqdn进行寻址和通信。当您分离出2台机器时,您需要对其进行管理。 Docker Compose的extra_hosts
功能可以提供帮助,但仍有一些端口需要管理。
在不同机器上相互通信docker容器的真正解决方案是使用Kubernetes或Docker Swarm。