1迄本、前置條件
centos 7 java 1.8
2杂腰、創(chuàng)建zookeeper腳本文件:
? ? 進(jìn)入到指定文件夾執(zhí)行命令:cd /etc/rc.d/init.d
? ? 創(chuàng)建文件:touch?zookeeper
? ? 將zookeeper授權(quán)為可執(zhí)行性文件:chmod +x?zookeeper
3、編輯zookeeper文件铺敌,文件內(nèi)容如下:
#!/bin/bash
#chkconfig:2345 10 90
#description:service zookeeper
export ZOOKEEPER_HOME=/opt/zookeeper
export JAVA_HOME=/usr/local/java
${ZOOKEEPER_HOME}/bin/zkServer.sh start
4、將zookeeper文件加入到添加到開(kāi)機(jī)啟動(dòng)項(xiàng)里面
執(zhí)行命令:chkconfig ?--add ? zookeeper
5、查看是否將zookeeper文件加入到添加到開(kāi)機(jī)啟動(dòng)項(xiàng)里面
執(zhí)行命令:chkconfig ?--list
結(jié)果圖:
6历等、重啟系統(tǒng):
? ? 命令:reboot
結(jié)果:
servicezookeeper ? status