我在AWS EKS集群版本1.15中以复制模式(总共3个zookeeper节点)运行Zookeeper 3.6.0。我正在从Docker集线器中获取zookeeper:最新图像。
这是节点1(prd-zoo1)的zoo.cfg文件。除了指定了其他Zoo服务器的最后三个条目之外,其他节点具有类似的配置。
zoo.cfg Node 1:
dataDir=/data
dataLogDir=/datalog
tickTime=2000
initLimit=5
syncLimit=2
autopurge.snapRetainCount=3
autopurge.purgeInterval=0
maxClientCnxns=60
standaloneEnabled=true
admin.enableServer=true
server.1=0.0.0.0:2888:3888;2181
server.2=prd-zoo2:2888:3888;prd-zoo2:2181
server.3=prd-zoo3:2888:3888;prd-zoo3:2181
zoo.cfg Node 2:
<same as node1>
server.1=prd-zoo1:2888:3888;prd-zoo1:2181
server.2=0.0.0.0:2888:3888;2181
server.3=prd-zoo3:2888:3888;prd-zoo3:2181
zoo.cfg Node 3:
<same as node1>
server.1=prd-zoo1:2888:3888;prd-zoo1:2181
server.2=prd-zoo2:2888:3888;prd-zoo2:2181
server.3=0.0.0.0:2888:3888;2181
动物园节点似乎能够彼此通信并完成领导者选举。但是,当我检查日志时,看到了反复出现的java.lang.IllegalArgumentException错误。我已验证每个服务都有其端点IP和端口
领导人选举,3888,TCP
客户端,2181,TCP
服务器,2888,TCP
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@857] - Peer state changed: following
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@1453] - FOLLOWING
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):ZooKeeperServer@1246] - minSessionTimeout set to 4000
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):ZooKeeperServer@1255] - maxSessionTimeout set to 40000
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):ResponseCache@45] - Response cache size is initialized with value 400.
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):ResponseCache@45] - Response cache size is initialized with value 400.
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):RequestPathMetricsCollector@111] - zookeeper.pathStats.slotCapacity = 60
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):RequestPathMetricsCollector@112] - zookeeper.pathStats.slotDuration = 15
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):RequestPathMetricsCollector@113] - zookeeper.pathStats.maxDepth = 6
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):RequestPathMetricsCollector@114] - zookeeper.pathStats.initialDelay = 5
2020-04-13 17:20:17,793 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):RequestPathMetricsCollector@115] - zookeeper.pathStats.delay = 5
2020-04-13 17:20:17,794 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):RequestPathMetricsCollector@116] - zookeeper.pathStats.enabled = false
2020-04-13 17:20:17,794 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):ZooKeeperServer@1470] - The max bytes for all large requests are set to 104857600
2020-04-13 17:20:17,794 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):ZooKeeperServer@1484] - The large request threshold is set to -1
2020-04-13 17:20:17,794 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):ZooKeeperServer@329] - Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 clientPortListenBacklog -1 datadir /datalog/version-2 snapdir /data/version-2
2020-04-13 17:20:17,794 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):Follower@75] - FOLLOWING - LEADER ELECTION TOOK - 1381 MS
2020-04-13 17:20:17,794 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@863] - Peer state changed: following - discovery
2020-04-13 17:20:18,595 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection$Messenger$WorkerReceiver@376] - Notification: my state:FOLLOWING; n.sid:3, n.state:LOOKING, n.leader:3, n.round:0x254, n.peerEpoch:0x0, n.zxid:0x0, message format version:0x2, n.config version:0x0
2020-04-13 17:20:18,795 [myid:1] - WARN [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):Follower@129] - Exception when following the leader
java.lang.IllegalArgumentException
at java.base/java.util.concurrent.ThreadPoolExecutor.<init>(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.<init>(Unknown Source)
at java.base/java.util.concurrent.Executors.newFixedThreadPool(Unknown Source)
at org.apache.zookeeper.server.quorum.Learner.connectToLeader(Learner.java:275)
at org.apache.zookeeper.server.quorum.Follower.followLeader(Follower.java:87)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:1455)
2020-04-13 17:20:18,795 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):Follower@292] - shutdown Follower
2020-04-13 17:20:18,795 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@863] - Peer state changed: looking
2020-04-13 17:20:18,795 [myid:1] - WARN [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@1501] - PeerState set to LOOKING
2020-04-13 17:20:18,795 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@1371] - LOOKING
2020-04-13 17:20:18,795 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):FastLeaderElection@931] - New election. My id = 1, proposed zxid=0x0
2020-04-13 17:20:18,795 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection$Messenger$WorkerReceiver@376] - Notification: my state:LOOKING; n.sid:1, n.state:LOOKING, n.leader:1, n.round:0x254, n.peerEpoch:0x0, n.zxid:0x0, message format version:0x2, n.config version:0x0
2020-04-13 17:20:18,796 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection$Messenger$WorkerReceiver@376] - Notification: my state:LOOKING; n.sid:3, n.state:LOOKING, n.leader:3, n.round:0x254, n.peerEpoch:0x0, n.zxid:0x0, message format version:0x2, n.config version:0x0
2020-04-13 17:20:18,796 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection$Messenger$WorkerReceiver@376] - Notification: my state:LOOKING; n.sid:1, n.state:LOOKING, n.leader:3, n.round:0x254, n.peerEpoch:0x0, n.zxid:0x0, message format version:0x2, n.config version:0x0
2020-04-13 17:20:18,797 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection$Messenger$WorkerReceiver@376] - Notification: my state:LOOKING; n.sid:2, n.state:LEADING, n.leader:2, n.round:0x253, n.peerEpoch:0x0, n.zxid:0x0, message format version:0x2, n.config version:0x0
2020-04-13 17:20:18,797 [myid:1] - INFO [WorkerReceiver[myid=1]:FastLeaderElection$Messenger$WorkerReceiver@376] - Notification: my state:LOOKING; n.sid:2, n.state:LEADING, n.leader:2, n.round:0x253, n.peerEpoch:0x0, n.zxid:0x0, message format version:0x2, n.config version:0x0
2020-04-13 17:20:18,997 [myid:1] - INFO [QuorumPeer[myid=1](plain=0.0.0.0:2181)(secure=disabled):QuorumPeer@857] - Peer state changed: following
它不断循环:完成领导者选举,领导者跟随错误,关闭,开始寻找,跟随...
最佳答案
0.0.0.0
不是主机名;您似乎知道主机名,因为在每个其他配置文件中该主机名均被编码为prd-zoo1
,prd-zoo2
和prd-zoo3
,因此请使用其实际名称代替无意义的IP地址
关于java - Zookeeper-跟随领导者java.lang.IllegalArgumentException时发生异常,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/61197466/