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

原文地址:https://www.cnblogs.com/zhian/p/14963668.html