AWS上的Zookeeper群集

时间:2016-10-19 16:37:51

标签: amazon-web-services amazon-ec2 apache-zookeeper bigdata

我正在尝试在3台AWS ec2计算机上设置zookeeper群集,但不断收到相同的错误:

2016-10-19 16:30:23,177 [myid:2] - WARN  [QuorumPeer[myid=2]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@382] - Cannot open channel to 3 at election address /xxx.31.34.102:3888
java.net.SocketTimeoutException: connect timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    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:368)
    at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:402)
    at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:840)
    at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:762)
2016-10-19 16:30:23,185 [myid:2] - INFO  [QuorumPeer[myid=2]/0:0:0:0:0:0:0:0:2181:FastLeaderElection@849] - Notification time out: 60000

1)我对所有三台机器都有相同的安全组 2)在conf中使用私人机器ips

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/opt/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeIinterval=1
server.1=0.0.0.0:2888:3888
server.2=x.31.34.105:2888:3888
server.3=x.31.34.102:2888:3888

3)甚至使用自己机器的实际私有IP而不是" 0.0.0.0"进行测试。

无法确定出现了什么问题。

1 个答案:

答案 0 :(得分:3)

对于每个节点,您必须确保已将0.0.0.0指定为节点的IP地址。

:对于服务器01

server.1=0.0.0.0:2888:3888
server.2=192.168.10.10:2888:3888
server.3=192.168.2.1:2888:3888

对于服务器02

server.1=192.168.x.x:2888:3888
server.2=0.0.0.0:2888:3888
server.3=192.168.2.1:2888:3888

对于服务器

server.1=192.168.x.x:2888:3888
server.2=192.168.10.10:2888:3888
server.3=0.0.0.0:2888:3888