This article provides a detailed guide of deploying Zookeeper to AWS using Exhibitor for cluster management. Exhibitor is a great help for managing your cluster but getting things up and running is not well documented. Hopefully this article corrects that deficiency.
tldr; Full source for this project can be found on Github.
We are going to use Ansible for provisioning our server. If you aren’t familiar with Ansible this article can serve as a practical guide to getting started.
The first step is downloading and installing Zookeeper. This is a fairly
straight-forward process of downloading the tarball from Apache and unzipping it
to your installation directory. Our first provisioning file installs the required
packages using apt, creates a
zookeeper user and group, and downloads and
unpacks the Zookeeper tarball. Save this file as
We use Packer to create an AMI based on this
provisioning script that can be deployed to AWS. You will need to fill in your
own source AMI, subnet and security group depending on your own AWS setup. When
making an AMI with Packer, Packer will launch an EC2 instance, run your script
using that instance, and then create the AMI. As such, you will need to begin
your provisioner by installing Ansible so that the playbook can be run on the
EC2 host. Once installed you can use the
Ansible provisioner to
run our script and produce an AMI. Save this file as
At this point you can create a Makefile encapsulating the steps for building your AMI.
You can then deploy the AMI using EC2.
Given this starting point, you can expand the Ansible playbook to install Exhibitor. The details of this are left out of this article, consult the Github repo for the full source code.
Configuring Zookeeper with Exhibitor
- Your Zookeeper/Exhibitor instances have an IAM Role with full S3 access.
- Your Zookeeper/Exhibitor instances have public IP addresses.
- Your security group allows access to port 8080.
Now you can navigate to port 8080 of one of your instances with your browser. You will be presented with the Exhibitor Control Panel listing your instances and their status.
If you’ve gotten this far, it’s time to configure your
instances. Navigate to the
Enter edit mode to make changes to your configuration. All changes will be saved to S3 and shared between running Zookeeper instances.
The changes you want to make are to the list of servers in the cluster. The
S signifies a server node,
specifies a unique identifier for the node, and
IpAddress is the ip of the
node. For the
IpAddress field, enter the private IP for your nodes. You only
need to enter these values from one node and all nodes will see the changes
Here’s an example for configuring three nodes with ids 1, 2, and 3 that have Private DNS entries like the following:
When saving this configuration, the Zookeeper instances will restart and use the new configuration copied from S3.
You can verify the status of your cluster using the Exhibitor Control Panel UI.
At this point you have a running Zookeeper cluster and Exhibitor will ensure the Zookeeper process is running.