Linux:CentOS 7.x
zookeeper:apache-zookeeper-3.5.5.tar.gz
一. 將zookeeper上傳到linux /opt路徑下:
解壓命令:tar -zxvf apache-zookeeper-3.5.5.tar.gz

二. 將zookeeper移動到/opt/zookeeper路徑下
mv apache-zookeeper-3.5.5-bin zookeeper

三. 配置zoo.conf
1. 在zookeeper路徑下創建data,用於存儲zookeeper數據
mkdir data
2. 進入zookeeper/conf,新建zoo.cfg
cp zoo_sample.cfg zoo.cfg
3. 修改zoo.cfg中數據保存位置:

四. 配置zookeeper開機啟動
1. 制作開機啟動腳本
vi /etc/init.d/zookeeper
將以下腳本復制進去:
#!/bin/bash #chkconfig:2345 20 90 #description:zookeeper #processname:zookeeper ZK_PATH=/opt/zookeeper export JAVA_HOME=/opt/jdk1.8.0_152 case $1 in start) sh $ZK_PATH/bin/zkServer.sh start;; stop) sh $ZK_PATH/bin/zkServer.sh stop;; status) sh $ZK_PATH/bin/zkServer.sh status;; restart) sh $ZK_PATH/bin/zkServer.sh restart;; *) echo "require start|stop|status|restart" ;; esac
2. 將腳本注冊成service
chkconfig --add zookeeper
chkconfig --list

3. 給腳本賦予可執行權限

五. 啟動zookeeper

表示啟動成功
