CentOS 7 防火墙开启状态下,解决zookeeper不能访问

启动zookeeper,查看zookeeper状态,显示如下:

Error contacting service. It is probably not running.

不知所云,查看日志,zkServer同目录有一文件zookeeper.out,点他,看起来

Cannot open channel to 2 at election address node200/192.168.197.129:3888
java.net.ConnectException: Connection refused (Connection refused)
	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:606)
	at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:558)
	at org.apache.zookeeper.server.quorum.QuorumCnxManager.toSend(QuorumCnxManager.java:534)
	at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.process(FastLeaderElection.java:454)
	at org.apache.zookeeper.server.quorum.FastLeaderElection$Messenger$WorkerSender.run(FastLeaderElection.java:435)
	at java.lang.Thread.run(Thread.java:748)

反正就是报错,一开始以为是自己设置的3888端口在防火墙没有打开,于是打开它,顺便还是2888也被我打开了,然后没什么用,怎么也没有想到会是2181端口的问题,其实还要打开2181端口。

firewall-cmd --zone=public --add-port=2181/tcp --permanent

于是就好了!我知道直接关闭防火墙简单粗暴有效,不过我就想开着防火墙还想用zookeeper。

发布了99 篇原创文章 · 获赞 17 · 访问量 6万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 书香水墨 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览