打开 https://zookeeper.apache.org/releases.html
选择最新版本
Apache ZooKeeper 3.6.1
Apache ZooKeeper 3.6.1(asc, sha512)
Apache ZooKeeper 3.6.1 Source Release(asc, sha512)
记住: 选择上面那个,启动的时候会报错
错误: 找不到或无法加载主类org.apache.zookeeper.server.quorum.QuorumPeerMain
参照:https://blog.csdn.net/jiangxiulilinux/article/details/96433560
下载 wget https://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.6.1/apache-zookeeper-3.6.1-bin.tar.gz
然后解压 tar -zxvf 文件.
然后 进去安装目录 cd 到conf
cp zoo_sample.cfg zoo.cfg
vim zoo.cfg
#dataDir=/tmp/zookeeper
dataDir=/home/larance/soft/zookeeper/data
dataLogDir=/home/larance/soft/zookeeper/log
# the port at which the clients will connect
clientPort=2181
server.1=127.0.0.1:2888:3888
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
然后创建相关目录
在data 目录下
touch myid
vim myid 填写内容1,就是zoo.cfg文件里server.1的数字对应
启动服务端
切换bin 目录
启动 ./zkServer.sh start
关闭 ./zkServer.sh stop
启动客户端
./zkCli.sh -server 127.0.0.1:2181
参考 https://www.cnblogs.com/expiator/p/9853378.html
https://blog.csdn.net/fengchen0123456789/article/details/82220522