Linux下zookeeper單節點安裝

安裝zookeeper以前,須要先安裝jdk,能夠參考以前我寫的文章html

Ubuntu快速安裝JDKjava

Centos快速安裝JDKbash

1.獲取zookeeper

在這裏下載zookeeper:https://download.csdn.net/download/ccgshigao/12705620app

 

2.解壓zookeeper壓縮包

tar xvf zookeeper.tar

 

3.拷貝zookeeper到指定目錄

cp zookeeper /opt/ -r

 

4.修改zookeeper的可執行權限

chmod +x /opt/zookeeper

 

5. 修改配置文件

mkdir  -p /etc/zookeeper
cp /opt/zookeeper/conf/zoo.cfg /etc/zookeeper/

 

6.修改配置文件

6.1 獲取本機ip

執行ifconfig,查看eth0對應ip:172.31.11.77這裏你的網卡可能叫別的名字,好比ens0等jvm

6.2 修改zoo.cfg

echo server.1=172.31.11.772888:3888 >> /etc/zookeeper/
echo clientPort=2181 >> /etc/zookeeper/zoo.cfg

6.3 修改zk編號 

mkdir -p /data/zookeeper/data/
echo 1 > /data/zookeeper/data/myid

 

7. 編寫zookeeper啓動腳本

這裏注意JAVA_HOME替換成你實際的JAVA_HOME測試

cat << EOF > /etc/init.d/zookeeper

#!/bin/sh

export JAVA_HOME='/usr/lib/jvm/java-8-openjdk-amd64'
export ZOOKEEPER_HOME='/opt/zookeeper'

/opt/zookeeper/bin/zkServer.sh --config /etc/zookeeper \$@
EOF
 

8.修改腳本啓動權限

chmod +x  /etc/init.d/zookeeper

 

9. 啓動zookeeper

/etc/init.d/zookeeper start

/etc/init.d/zookeeper status

博主:測試生財spa

座右銘:用測試完成原始積累,用投資奔向財務自由.net

csdn:https://blog.csdn.net/ccgshigao3d

博客園:https://www.cnblogs.com/qa-freeroad/code

51cto:https://blog.51cto.com/14900374

相關文章
相關標籤/搜索