我有两台运行Zookeeper的计算机。 zookeeper.properties文件的配置如下:
"hour" "countPerHour"
"1" 1
"3" 2
"4" 1
"5" 3
"6" 1
"7" 6
"8" 5
"9" 7
"10" 6
"11" 3
"12" 4
"13" 4
"14" 5
"15" 4
"16" 3
"17" 2
"18" 1
"19" 1
"21" 1
"22" 1
"23" 1
"20" 0
"2" 0
"0" 0
最重要的是,我使用Kafka。即使我使计算机脱机,我也希望卡夫卡仍然可以工作。但是,当我关闭一个Zookeeper节点时,另一个Zookeeper控制台窗口将显示:
tickTime=2000
dataDir=/tmp/zookeeper
clientPort=2181
initLimit=100
syncLimit=1
server.1 = (ip 1):2888:3888
server.2 = 0.0.0.0:2888:3888
maxClientCnxns=10
当我在激活Zookeeper的情况下尝试在计算机上启动Kafka时,我得到:
INFO Notification time out: 51200 (org.apache.zookeeper.server.quorum.FastLeaderElection)
在Kafka控制台上,我得到:
WARN Cannot open channel to f2 at election address /(closed ip):3888 (org.apache.zookeeper.server.quorum.QuorumCnxManager)
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:562)
at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:614)
at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:843)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:913