Zookeeper集群启动错误

版权声明:本文为博主原创文章,欢迎转载。 https://blog.csdn.net/u011095110/article/details/84072125

1.错误提示

ERROR [main:QuorumPeerMain@88] - Invalid config, exiting abnormally
[root@slave2 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /hadoop/zookeeper-3.4.13/bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

2.原因

因为myid文件没有配置,或者myid配置文件的目录不对,应该放在dataDir指定的目录之下才对。

3.解决方案

  • 查看/修改zoo.cfg配置文件里dataDir目录
    看见默认的dataDir目录是在/tmp/zookeeper之下;
    修改为/hadoop/data之下,并添加myid文件,然后启动成功。
#dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
dataDir=/hadoop/data
server.1=master.hadoop:2888:3888
server.2=slave1.hadoop:2888:3888
server.3=slave2.hadoop:2888:3888

4.验证启动结果

  • ./zkServer.sh status
[root@slave2 bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /hadoop/zookeeper-3.4.13/bin/../conf/zoo.cfg
Mode: leader

猜你喜欢

转载自blog.csdn.net/u011095110/article/details/84072125