Created 12-22-2016 10:18 PM
Hi ,
We have 5 node zookeeper Quorum. What is the best way to auto start, if zookeeper service goes down on one of the node.
I really appreciate, if someone has the script to monitor zookeeper services and autostart the zookeeper , when it goes down (please share with me)
Thanks
Jacqualin
Created 12-22-2016 10:59 PM
I dont think that there is a autostart script...rather you would have to go and start it from..Ambari...Scripting wise, it is better to run a while true script and contingent on the fact that ZK is not up and running, start it and send an email also
Created 12-23-2016 04:57 AM
@Jacqualin jasmin you can run some supervisor process to supervise zookeeper, e.g.
monit to monitor a process
https://mmonit.com/wiki/Monit/FAQ#pidfile
the other option is to run Supervisord which can do process restart if it died.
Created 12-23-2016 05:19 AM
You can try the following:
Create a shell script with the use of ambari API to start the Zookeeper and the put it inside the "/etc/rc.d/rc.local" as following:
curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Start ZooKeeper Server","operation_level":{"level":"HOST_COMPONENT","cluster_name":"ErieCluster","host_name":"erie3.example.com","service_name":"ZOOKEEPER"}},"Body":{"HostRoles":{"state":"STARTED"}}}' http://erie1.example.com:8080/api/v1/clusters/ErieCluster/hosts/erie3.example.com/host_components/ZO...?
Here "erie3.example.com" is the host in which zookeeper need to be started. You can use the shell script logic to dynamically find the host name as well. like echo `hostname -f`
erie1.example.com: is the ambari server hostname
.
For more information please see the article:
And
the new feature of ambari 2.4 for
"recovery_enabled" : "true"