在Centos 中将zookeeper设置成开机启动
部署了Zookeeper之后,当需要重启机器时,开机后往往需要花一点时间对zookeeper集群进行启动,
由于zookeeper没有主节点的概念,且一个节点的重启不会对集群造成什么影像,
所以可以考虑把zookeeper设置成开机启动,具体流程如下
1 准备工作
1) 切换到/etc/rc.d/init.d/目录下
2) 创建zookeeper文件:touch zookeeper
3)更新权限:chmod +x zookeeper
4)编辑文件,在zookeeper里面输入如下内容
2 chkconfig zookeeper on
3 验证
chkconfig --add zookeeper
chkconfig --list zookeeper
这个时候我们就可以用servicezookeeper start/stop来启动停止zookeeper服务了
使用chkconfig--add zookeeper命令把zookeeper添加到开机启动里面
添加完成之后接这个使用chkconfig--list 来看看我们添加的zookeeper是否在里面
如果上面的操作都正常的话;你就可以重启你的linux服务器了