after deploying the zookeeper, when it is necessary to restart the machine, it often takes a little time to boot the zookeeper cluster, because zookeeper does not have the concept of a master node, and the restart of a node does not cause any image to the cluster, so you can consider Zookeeper is set to boot, the specific process is as follows
- preparation
- switch to/etc/rc.d/init.d/directory
- Create Zookeeper file: Touch zookeeper
- Update permissions: chmod +x zookeeper
- edit file, Enter the following in zookeeper
#!/bin/bash
#chkconfig: 2345
#description: Zookeeper
#processname: Zookeeper
Export java_home=/opt/cloud/jdk1.7.0_55
Export path= $JAVA _home/bin: $PATH
Case $ in
start) Su root/opt/cloud/zookeeper-3.4.6/bin/zkserver.sh start;
stop) su root/opt/cloud/zookeeper-3.4.6/bin/zkserver.sh stop;;
status) su root/opt/cloud/zookeeper-3.4.6/bin/zkserver.sh status;;
restart) su root/opt/cloud/zookeeper-3.4.6/bin/zkserver.sh restart;;
*) echo "require Start|stop|status|restart";;
Esac
2. Verification
- At this point we can start the Stop Zookeeper service with service zookeeper Start/stop.
- Use the Chkconfig--add Zookeeper command to add zookeeper to the boot boot
- After the add is complete, use chkconfig--list to see if the zookeeper we added is inside.
- If the above operation is normal, you can restart your Linux server.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Set zookeeper to boot on CentOS