一.下载地址:https://zookeeper.apache.org/
二.安装前准备
- 安装jdk
- 通过SecureCRT工具拷贝zookeeper到linux系统下
- 修改tar包权限 chmod u+x zookeeper-3.4.10.tar.gz
- 解压到指定目录 [at@hadoop102 software]$ tar -zxvf zookeeper-3.4.10.tar.gz -C /opt/module/
三. 配置修改
将/opt/module/zookeeper-3.4.10/conf这个路径下的zoo_sample.cfg修改为zoo.cfg;
进入zoo.cfg文件:vim zoo.cfg
修改dataDir路径为dataDir=/opt/module/zookeeper-3.4.10/zkData
在/opt/module/zookeeper-3.4.10/这个目录上创建zkData文件夹
mkdir zkData
四. 操作zookeeper
- 启动zookeeper [at@hadoop102 zookeeper-3.4.10]$ bin/zkServer.sh start
- 查看进程是否启动
[at@hadoop102 zookeeper-3.4.10]$ jps
4020 Jps
4001 QuorumPeerMain
- 查看状态:
[at@hadoop102 zookeeper-3.4.10]$ bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/module/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: standalone
- 启动客户端:[at@hadoop102 zookeeper-3.4.10]$ bin/zkCli.sh
- 退出客户端:[zk: localhost:2181(CONNECTED) 0] quit
- 停止zookeeper [at@hadoop102 zookeeper-3.4.10]$ bin/zkServer.sh stop