1:在/usr/local目录下下载zookeeper: wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
2:解压压缩包: tar -xvf zookeeper-3.4.14.tar.gz
3:修改文件夹名称: mv zookeeper-3.4.14 zookeeper
4:创建数据目录及日志目录: mkdir -p /usr/local/zookeeper/data ; mkdir -p /usr/local/zookeeper/logs
5:进入/usr/local/zookeeper/conf目录: mv zoo_sample.cfg zoo.cfg
6:修改zoo.cfg文件内容: (vim zoo.cfg)
修改以下内容:
dataDir=/usr/local/zookeeper/data
dataLogDir=/usr/local/zookeeper/logs
7:配置全局变量
vim /etc/profile添加以下内容
export ZOOKEEPER_HOME=/usr/local/zookeeper/
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
8:启动zookeeper
cd /usr/local/zookeeper/bin & ./zkServer.sh start
cd /usr/local/zookeeper/bin & ./zkServer.sh stop(停止)
cd /usr/local/zookeeper/bin & ./zkServer.sh restart(重启)