Hyperledger fabric 远程访问结构示例结构网络
在测试网络功能的帮助下,我使用Fabric samples项目在远程主机上部署了一个Fabric网络 我是这样做的:Hyperledger fabric 远程访问结构示例结构网络,hyperledger-fabric,Hyperledger Fabric,在测试网络功能的帮助下,我使用Fabric samples项目在远程主机上部署了一个Fabric网络 我是这样做的: ./network.sh up createChannel -ca ./network.sh deployCC -ccl typescript -ccp ~/blockchain/ -cci initLedger 因此,我在网络中部署了我自己的区块链,并使用init函数 我开发了一个调用网络的应用程序,在我的计算机上进行测试时,它运行良好。 我想在远程VM上部署我的结构网络和链
./network.sh up createChannel -ca
./network.sh deployCC -ccl typescript -ccp ~/blockchain/ -cci initLedger
因此,我在网络中部署了我自己的区块链,并使用init函数
我开发了一个调用网络的应用程序,在我的计算机上进行测试时,它运行良好。我想在远程VM上部署我的结构网络和链码,以便我的同事可以继续开发应用程序并调用相同的结构网络 为此,我在远程VM上部署了网络,并在本地计算机上下载了
结构示例/test network/organizations/peerOrganizations/org1.example.com
文件夹,以检索生成的证书和连接信息。我编辑了
org1.example.com/connection-org1.json
文件,将本地主机地址更改为远程VM的IP
将应用程序配置为使用正确的connection-org1.json
和fabric ca client config.yaml
文件后,我启动应用程序。我可以注册管理员并在网络上创建新用户。
但是当我想要提交或评估一个事务时,我会得到以下错误
2020-12-18T12:15:46.586Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpcs://orderer.example.com:7050, connected:false, connectAttempted:true
2020-12-18T12:15:46.587Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer.example.com:7050 url:grpcs://orderer.example.com:7050 timeout:3000
2020-12-18T12:15:46.587Z - error: [DiscoveryService]: _buildOrderer[mychannel] - Unable to connect to the discovered orderer orderer.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpcs://orderer.example.com:7050, connected:false, connectAttempted:true
2020-12-18T12:15:49.591Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com:7051, url:grpcs://peer0.org1.example.com:7051, connected:false, connectAttempted:true
2020-12-18T12:15:49.591Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server peer0.org1.example.com:7051 url:grpcs://peer0.org1.example.com:7051 timeout:3000
2020-12-18T12:15:49.591Z - error: [DiscoveryService]: _buildPeer[mychannel] - Unable to connect to the discovered peer peer0.org1.example.com:7051 due to Error: Failed to connect before the deadline on Endorser- name: peer0.org1.example.com:7051, url:grpcs://peer0.org1.example.com:7051, connected:false, connectAttempted:true
它似乎在寻找grpcs://peer0.org1.example.com:7051 而不是我放在配置文件中的ip
为了不从本地主机调用网络,测试网络文件中是否还有其他配置文件需要检索或修改?我找到了窍门
只需将结构示例使用的dns添加到/etc/主机中,如下所示:
1.2.3.4 orderer.example.com
1.2.3.4 peer0.org1.example.com
1.2.3.4 peer0.org2.example.com
1.2.3.4 ca.example.com
瞧 这成功了!我也有同样的问题,唯一的区别是应用程序不是在本地主机中,而是在Kubernetes吊舱中。因此,我必须使用
.spec.hostAlias
添加主机名。