安装
- 镜像站下载:http://mirror.bit.edu.cn/apache/zookeeper/
- 配置环境变量(我这里是用户级别)
- 进入conf目录,复制zoo_sample.cfg为zoo.cfg(必须是这个文件)
- 修改zoo.cfg的dataDir目录为已经存在的目录
vim ~/.bash_profile
export ZK_HOME=/root/zookeeper-3.3.6
export PATH=$PATH:$ZK_HOME/bin
source ~/.bash_profile
echo $ZK_HOME
查看帮助
官网帮助文档:http://zookeeper.apache.org/doc/current/zookeeperStarted.html
zkServer.sh
zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}
启动ZooKeeper
./zkServer.sh start
查看ZooKeeper运行状态
./zkServer.sh status
关闭ZooKeeper
./zkServer.sh stop
连接到ZooKeeper
zkCli.sh -server 127.0.0.1:2181
参考博客
[1]https://blog.csdn.net/zknxx/article/details/52601554
[2]http://www.cnblogs.com/wuxl360/category/874409.html