1. 程式人生 > 其它 >zookeeper Caused by: java.lang.IllegalArgumentException: myid file is missing

zookeeper Caused by: java.lang.IllegalArgumentException: myid file is missing

zookeeper 安裝叢集,配置檔案和data和其它都沒有問題。

則需要在data裡面下新增一個myid 檔案

myid裡面的資料個service一致

比如.cnf裡面配置是

dataDir=/usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/data
dataLogDir=/usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/logs
# 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
###叢集資訊
server.1=192.168.0.79:3188:3288
server.2=192.168.0.118:3188:3288
server.3=192.168.0.81:3188:3288

對應service.1 service.2 service.3 上分別建立檔案
比如192.168.0.79
echo "1" >/usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/data/myid

192.168.0.118 上
echo "2" > /usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/data/myid
192.168.0.81上
echo "3" > /usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/data/myid

啟動zookeeper

/usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/bin/zkServer.sh start

ps -ef | grep zookeeper

dataDir=/usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/data

dataLogDir=/usr/local/src/zookeeper/apache-zookeeper-3.6.3-bin/logs

# 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

###叢集資訊

server.1=192.168.0.79:3188:3288

server.2=192.168.0.118:3188:3288

server.3=192.168.0.81:3188:3288