Hyperledger-fabric blockchain Multi Host

倾然丶 夕夏残阳落幕 提交于 2019-12-14 03:32:38

问题


I am working on hyperledger fabric and I would like to have some guidance in using hyperledger fabric with multiple hosts. I have an orderer, a ca, two peers (Peer 0 and Peer 1) and two hosts (10.10.10.x and 10.10.11.x). I have the orderer, ca and Peer0 in host - 1 and Peer1 in a separate host (i.e) Peer 0 in host-1 and Peer 1 alone on host-2.

I need to connect Peer1 in host 2 to Peer0 in host 1. I can achieve this scenario while having multiple hosts in the same network using docker swarm and overlay network (i.e) hosts are in same IP range (10.10.10.x), but while trying to do this in a host in a different network (10.10.11.X) I am unable to connect the peer to the host present in Machine-1. I had done the multihost network by referring this link.

Docker Version used:
[root@node2 composer]# docker -v
Docker version 18.03.1-ce, build 9ee9f40

回答1:


Add extra_host entry in docker-compose.yml file like this:

extra_hosts:
      - "peer0.org2.example.com:192.168.1.28" 
      - "ca.org2.example.com:192.168.1.28"   
      - "peer0.org3.example.com:192.168.1.15"
      - "ca.org3.example.com:192.168.1.15"

Like this do entries for all orderers, CA, peers on both machines(hosts)

And do same host entry in host file: sudo nano /etc/hosts - edit this file

192.168.1.28     peer0.org2.example.com
192.168.1.28     ca.org2.example.com
192.168.1.15     peer0.org3.example.com
192.168.1.15     ca.org3.example.com

Like this do entries for all orderers, CA, peers...on both machines(hosts)




回答2:


Can you ping you machines?, maybe they can connect Other thing that could be, you have to add an extra-hosts section to your docker-compose.yml files. That map your IP to the domain name in your docker containers.

extra_hosts:
- "peer1.org1.example.com:<Second machine IP address>"

I figured out how to setup a multihost Hyperledger Fabric not using Docker Swarm, and using the basic-network example included in the Hyperledger Fabric examples.

You can review it here, hope it helps you.

https://medium.com/1950labs/setup-hyperledger-fabric-in-multiple-physical-machines-d8f3710ed9b4



来源:https://stackoverflow.com/questions/51816525/hyperledger-fabric-blockchain-multi-host

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!