查看zookeeper日志报错: ERROR org.apache.zookeeper.server.quorum.Leader: Couldn't bind to port 3181

其中一台cdh1报错如下:

2016-12-15 14:56:37,224 INFO org.apache.zookeeper.server.quorum.QuorumPeer: LEADING

2016-12-15 14:56:37,224 INFO org.apache.zookeeper.server.ZooKeeperServer: Created server with tickTime 2000 minSessionTimeout 4000 maxSessionTimeout 40000 datadir /datafs/var/lib/zookeeper/version-2 snapdir /datafs/var/lib/zookeeper/version-2
2016-12-15 14:56:37,224 ERROR org.apache.zookeeper.server.quorum.Leader: Couldn't bind to port 3181
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:330)
at org.apache.zookeeper.server.quorum.Leader.<init>(Leader.java:187)
at org.apache.zookeeper.server.quorum.QuorumPeer.makeLeader(QuorumPeer.java:561)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:752)
2016-12-15 14:56:37,225 WARN org.apache.zookeeper.server.quorum.QuorumPeer: Unexpected exception
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:376)
at java.net.ServerSocket.bind(ServerSocket.java:330)
at org.apache.zookeeper.server.quorum.Leader.<init>(Leader.java:187)
at org.apache.zookeeper.server.quorum.QuorumPeer.makeLeader(QuorumPeer.java:561)

at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:752)


另外2个节点报错:

WARN org.apache.zookeeper.server.quorum.Learner: Exception when following the leader
java.net.SocketTimeoutException: Read timed out

INFO org.apache.zookeeper.server.quorum.Learner: shutdown called
java.lang.Exception: shutdown Follower


解决方法: 查询 netstat -anp |grep 3181   发现被进程PatrolAgent占用了,查看配置:

more  /opt/cm-5.8.3/run/cloudera-scm-agent/process/135-zookeeper-server/zoo.cfg

需要修改3181改成3182

server.1=cdh3:3182:4181
server.2=cdh2:3182:4181
server.3=cdh1:3182:4181

直接通过cdh manager修改然后重启  zookeeper服务即可!!!!!!


问题解决:zookeeper 督查端口冲突啦!!!!!! 百度查也查不到结果,自己尝试试出来的,仅供参考!!!

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐