zookeeper启动出现错误:Error contacting service. It is probably not running

问题截图如下:

[mayday@hadoop101 zookeeper-3.5.7]$ bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Error contacting service. It is probably not running.

首先查看了一下2181端口的 状态

# 启动zookeeper
[mayday@hadoop101 zookeeper-3.5.7]$ bin/zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

# 查看zookeeper的状态
[mayday@hadoop102 zookeeper-3.5.7]$ bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Error contacting service. It is probably not running.

# 出现error信息,查看端口状态
[mayday@hadoop101 zookeeper-3.5.7]$ lsof -i:2181
COMMAND   PID   USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
java    93673 mayday   48u  IPv6 45147274      0t0  TCP *:eforward (LISTEN)

#查看防火墙的状态
[mayday@hadoop102 zookeeper-3.5.7]$ systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since 四 2021-03-11 10:48:34 CST; 6 days ago
     Docs: man:firewalld(1)
 Main PID: 862 (firewalld)
    Tasks: 2
   CGroup: /system.slice/firewalld.service
           └─862 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

解决方法: 

1、关闭防火墙,systemctl stop firewalld.service,重启zookeeper。

2、通过命令进入cd /usr/local/zookeeper/data中找到zookeeper_server.pid文件进行删除,然后重新启动zookeeper即可

再次查看zookeeper的状态

[mayday@hadoop101 zookeeper-3.5.7]$ bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower

mode已经变为了follower,其中应该还有一个节点为leader,,在102上查看zookpeeper的状态

[mayday@hadoop102 zookeeper-3.5.7]$ bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.5.7/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: leader

此时说明我们的zookeeper已经正常启动了。 

 

你可能感兴趣的:(Hadoop)