Cannot open channel to 2 at election address zookeeper2.example.com/192.168.3.162:3888
java.net.ConnectException: Connection refused (Connection refused)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:558)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.handleConnection(QuorumCnxManager.java:486)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.receiveConnection(QuorumCnxManager.java:386)
at org.apache.zookeeper.server.quorum.QuorumCnxManager$Listener.run(QuorumCnxManager.java:754)
因为要搭建fabric1.4的,orderer节点,kafka共识,zookeeper注册,出现问题考虑几个原因
1.防火墙问题
service iptable status
service firewalld status
若开启直接关闭
2.host问题
若是多机器物理环境,记得配置host
根据设置的docker网络模式修改
docker网络模式为host,直接物理机修改 vi /etc/hosts
docker桥接网络,新增docker容器配置
docker run -d --name test1 \ --add-host test1.a:1.2.3.4 \ local/test
docker-compose配置
test2: build: local/test extra_hosts: test1.a: 1.2.3.4 test1.b: 4.3.2.1
比如这里采用的新增docker-compose配置
3.本机服务0.0.0.0绑定问题
本示例三台物理机zookeeper,每个本机的服务地址都修改为0.0.0.0即可,网络环境复杂,写成域名可能会导致接收不到消息,zookeeper1的配置对应修改为0.0.0.0,2的把域名修改为0.0.0.0,3的修改3的域名为0.0.0.0