Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to start Zookeeper automatically on Ubuntu Server 14.04?

I have installed Zookeeper using sudo apt-get install zookeeper on an Ubuntu server 14.04. I am having trouble understanding how to configure Zookeeper to start automatically, on boot. Also, I can manually start it successfully only with root priviledges.

I have looked at the documentation from the official page and it seems the solution is to make sure the zkServer.sh or something similar is run at start-up. I have been searching on how to execute scripts on start-up on Ubuntu, and found a few approaches: using Upstart, using System V, Cron jobs and even found a Python utility a kind soul shared for watching processes and restarting them when they crash. Given I am a beginner in Linux programming and spent way too much time working on Windows (where this kind of situation it's pretty straight forward to solve!), all seem a bit complicated and not sure which one is the best?

Any help will be much appreciated. Thank you.

like image 652
user2916547 Avatar asked Mar 12 '15 17:03

user2916547


People also ask

How do I start my own ZooKeeper server?

To start the ZooKeeper server on a Linux system, use the Zookeeper/zookeeper/bin/zkServer.sh restart command from your Watson Explorer installation directory. On Microsoft Windows systems, use the Zookeeper\zookeeper\bin\zkServer. cmd command.


1 Answers

There's a separate package providing ZooKeeper init scripts:

apt-get install zookeeperd

Which will automatically start ZooKeeper. You can manage it with:

service zookeeper # {start|stop|status|restart|force-reload}
like image 153
Tombart Avatar answered Oct 29 '22 03:10

Tombart