1. 程式人生 > >Zookeeper叢集啟動錯誤

Zookeeper叢集啟動錯誤

1.錯誤提示

ERROR [main:[email protected]] - Invalid config, exiting abnormally
[[email protected] 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
[[email protected] bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /hadoop/zookeeper-3.4.13/bin/../conf/zoo.cfg
Mode: leader