Ubuntu – How to add second ZooKeeper to same machine

Ubuntuzookeeper

I am running 2 dedicated servers on which I plan to install Solrcloud. I have installed ZooKeeper using apt-get install zookeeperd and ZooKeeper is running on both systems.

From solr docs I learned that 3 zookeepers are recommended for production.

How could I add a second zookeeper to one machine? The config only allows one.

Best Answer

You could download two tar.gz zookeeper packages, extract them to a directory /path/to/zookeepers as zookeeper_one and zookeeper_two. Subsequently you could copy the zookeeper service script that resides in the apt-get package, modify the path and port and start two zookeepers. Note that it is strongly recommended to use one zookeeper per node as if multiple zookeepers are running on the same node and the node goes down the whole quorum goes down.

Technically I agree with @Navern to use containers as this is an option to run multiple zookeepers on the same machine. However, from a Zookeeper quorum perspective maximum one zookeeper server should be installed on one node. E.g., using 5 zookeepers means that 2 nodes can go down without any problem. 5 zookeepers on two nodes means that if the node goes down that contains 3 zookeepers that the quorum goes down, i.e. SPOF