zheng2 zookeeper-3.4.11安装

一、将zookeeper-3.4.11.tar.gz解压到/usr/local目录下

 

tar -zxvfzookeeper-3.4.6.tar.gz /usr/local/

二、把zoo_sample.cfg改名为zoo.cfg

 cd /usr/local/zookeeper-3.4.11
 mkdir data
 mkdir logs
 cd conf/
mv zoo_sample.cfg zoo.cfg

三、修改dataDir和dataLogDir属性

vim zoo.cfg
dataDir=/usr/local/zookeeper-3.4.11/data
dataLogDir=/usr/local/zookeeper-3.4.11/logs

zheng2 zookeeper-3.4.11安装_第1张图片

四、启动zookeeper

 cd /usr/local/zookeeper-3.4.11/bin
 ./zkServer.sh start

 

zheng2 zookeeper-3.4.11安装_第2张图片

 

五、将ZooKeeper设置为开机启动

cd    /etc/rc.d/init.d
touch    zookeeper
vim zookeeper

添加如下代码:

#!/bin/bash  
#chkconfig:2345 20 90  
#description:zookeeper  
#processname:zookeeper  
export JAVA_HOME=/usr/java/jdk1.8.0_162  
case $1 in  
        start) su root /usr/local/zookeeper-3.4.11/bin/zkServer.sh start;;  
        stop) su root /usr/local/zookeeper-3.4.11/bin/zkServer.sh stop;;  
        status) su root /usr/local/zookeeper-3.4.11/bin/zkServer.sh status;;  
        restart) su /usr/local/zookeeper-3.4.11/bin/zkServer.sh restart;;  
        *) echo "require start|stop|status|restart" ;;  
esac   
 

为新建的/etc/rc.d/init.d/zookeeper文件添加可执行权限,命令是:

chmod  +x  /etc/rc.d/init.d/zookeeper

把zookeeper这个脚本添加到开机启动项里面,命令是:

chkconfig  --add   zookeeper

 

你可能感兴趣的:(JAVA)