Zookeeper Ensemble of 3 Nodes On Mac

By Chakravarthy Yeleswarapu 3 min read

Normally, each zk instance resides on separate machine to avoid SPoF
From zk admin guide
To create a deployment that can tolerate the failure of F machines, you should count on deploying 2xF+1 machines

For this reason, ZooKeeper deployments are usually made up of an odd number of machines. Often on employer issued MacBook Pro, users do not have root privileges.
Use sudo when creating directories and invoking scripts.
Ensure Java/jdk installed. I’ve used Jdk 1.8 with this install. I also have Jdk 1.7 and switch between them when I need.

In my home (~) directory I have.bash_profile and it has following contents.


And when I need to switch to jdk 7, I’d simply type use-java 7 in command prompt.

Download Zookeeper tar to the directory of your choice, for example, ~/zookeeper-3.4.6.tar.gz Merely double clicking on this file will uncompress it. Rename folder as needed, in this case, ZK installed in ~/zookeeper-3.4.6

I’ve chosen /var/lib/zookeeper directory where ZK node’s config files reside. So, ZK node1

  • sudo mkdir /var/lib/zookeeper
  • Create zoo.cfg in ~/zookeeper-3.4.6/conf/
  • sudo mkdir /var/lib/zookeeper/1

For an ensemble, each ZK node needs to know and able to communicate with other nodes. The zoo.cfg enables this capability with the following config.
Similarly for ZK2 and ZK3create 3 following directories representing ‘dataDir’ for node2 and node3.

sudo mkdir /var/lib/zookeeper/2
sudo mkdir /var/lib/zookeeper/3

Create node1 myid file (with out file extension) and insert number 1 (nothing else in the file)
sudo vi /var/lib/zookeeper/1/myid
Create node2 myid file (with out file extension) and insert number 2 (nothing else in the file)
sudo vi /var/lib/zookeeper/2/myid
Create node3 myid file (with out file extension) and insert number 3 (nothing else in the file)
sudo vi /var/lib/zookeeper/3/myid

From Solr documentation the significance of myid file is

The id in the myid file on each machine must match the “server.X” definition. So, the ZooKeeper instance (or machine) named “server.1” in the above example must have a myid file containing the value “1”.

Create two more copies of zoo.cfg for node2 and node3 and update the dataDir and clientPort properties as follows.

cd ~/zookeeper-3.4.6/conf
cp zoo.cfg zoo2.cfg
cp zoo.cfg zoo3.cfg

Ensure zoo2.cfg & zoo2.cfg files have following properties set.


Now, start each zk instance (provide your mac password for sudo when asked)

cd ~/zookeeper-3.4.6/bin
sudo ./zkServer.sh start zoo.cfg
sudo ./zkServer.sh start zoo2.cfg
sudo ./zkServer.sh start zoo3.cfg

To stop each zk instance

sudo ./zkServer.sh start zoo.cfg
sudo ./zkServer.sh start zoo2.cfg
sudo ./zkServer.sh start zoo3.cfg

Check zk processes are running on your Mac
ps -ef | grep zoo

Explore Additional Resources

Learn how you can select the best Digital Experience platform for your business.

If you’d like to learn more about Adobe Experience Manager, visit our Adobe Practice.


Over the past 20 years, we have completed thousands of digital projects globally. We have one of the largest and deepest multi-solutions digital consulting teams in the world. Our proprietary processes and years of Digital Experience expertise have earned us a 97% customer satisfaction rating with our clients ranging from Global Fortune 1000 to Mid-Market Enterprises, leading educational institutions, and Non-Profits

About TA Digital

TA Digital is the only global boutique agency that delivers the “best of both worlds” to clients seeking to achieve organizational success through digital transformation. Unlike smaller, regional agencies that lack the ability to scale or large organizations that succumb to a quantity-over-quality approach, we offer resource diversity while also providing meticulous attention to the details that enable strategic success.

Over the past 20 years, TA Digital has positioned clients to achieve digital maturity by focusing on data, customer-centricity and exponential return on investment; by melding exceptional user experience and data-driven methodologies with artificial intelligence and machine learning, we enable digital transformations that intelligently build upon the strategies we set into motion. We are known as a global leader that assists marketing and technology executives in understanding the digital ecosystem while identifying cultural and operational gaps within their business – ultimately ushering organizations toward a more mature model and profitable digital landscape.

Recognized in 2013, 2014, 2015, 2019, and 2020 Inc. 5000 list as one of the most successful technology companies in the United States, TA Digital is pleased also to share high-level strategic partnerships with world class digital experience platform companies like Adobe, SAP and Salesforce and possess global partnerships with industry leaders such as Sitecore, Episerver, Elastic Path, BigCommerce, AWS, Azure and Coveo.

Chakravarthy Yeleswarapu

Written By

Chakravarthy Yeleswarapu

More Blogs by the author

Solr Json Facet API
Solr Json Facet API Chakravarthy Yeleswarapu 2 min read
SolrCloud setup on Mac
SolrCloud setup on Mac Chakravarthy Yeleswarapu 3 min read