本文介绍了Hyperledger-fabric区块链多主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Hyperledger Fabric,我想对将Hyperledger Fabric与多个主机一起使用有一些指导。我有一个订购者,一个ca,两个对等端(对等0和对等1)和两个主机(10.10.10.x和10.10.11.x)。我在主机中有订购者ca和Peer0-在单独的主机中有1和Peer1(即)主机1中的Peer 0和主机2上的Peer 1。

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.

我需要将主机2中的Peer1连接到主机1中的Peer0。我可以在使用docker swarm和overlay网络在同一网络中拥有多个主机的情况下实现此方案)主机处于同一IP范围(10.10.10.x),但是尝试在其他网络(10.10.11.X)中的主机中执行此操作时,我无法将对等方连接到Machine-1中存在的主机。我通过引用链接来完成多主机网络。

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


推荐答案

在docker中添加extra_host条目-compose.yml文件,例如:

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"

像这样为两台计算机上的所有订购者,CA和对等对象执行输入主机)

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

并在主机文件中执行相同的主机条目:
sudo nano / etc / 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

就像在所有两台计算机(主机)上为所有订购者,CA,对等方所做的输入一样

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

这篇关于Hyperledger-fabric区块链多主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 02:07