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