作者:--多么哇噻的姑娘 | 来源:互联网 | 2023-10-13 10:52
启动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。