zookeeper #1

Supports: xenial


Apache ZooKeeper is a centralized, reliable application for maintaining configuration information, naming, synchronization, and group services. All of these kinds of services are used in some form or another by distributed applications. In order to install and configure Apache HBase and other Hadoop ecosystem components, you need ZooKeeper. This charm provides version 3.4.6 of the Zookeeper application from Apache Bigtop.


Apache ZooKeeper is a high-performance coordination service for distributed applications. It exposes common services such as naming, configuration management, synchronization, and group services in a simple interface. Use it off-the-shelf to implement consensus, group management, leader election, and presence protocols. Learn more at zookeeper.apache.org.

This charm provides version 3.4.6 of the Zookeeper component from Apache Bigtop.


This charm requires Juju 2.0 or greater. If Juju is not yet set up, please follow the getting-started instructions prior to deploying this charm.

Deploy a Zookeeper unit. With only one unit, the application will be running in standalone mode:

juju deploy zookeeper

Network-Restricted Environments

Charms can be deployed in environments with limited network access. To deploy in this environment, configure a Juju model with appropriate proxy and/or mirror options. See Configuring Models for more information.

Configuring Network Interfaces

In some network environments, zookeeper may need to be restricted to listen for incoming connections on a specific network interface (e.g.: for security reasons). To do so, configure zookeeper with either a network interface name or a CIDR range specifying a subnet. For example:

juju config zookeeper network_interface=eth0
juju config zookeeper network_interface=

Each zookeeper unit in the cluster will lookup the IP address of that network interface, or find the first network interface with an IP address in the specified subnet, and bind Zookeeper to that address.

If a mistake is made and an invalid name for the network interface is configured, recover by re-configuring with the correct name and then run "juju resolved" on any failed units:

juju config zookeeper network_interface=eth0
juju resolved zookeeper/0

To go back to listening on all interfaces, configure zookeeper with network_interface=

juju config zookeeper network_interface=



Apache Bigtop charms provide extended status reporting to indicate when they are ready:

juju status

This is particularly useful when combined with watch to track the on-going progress of the deployment:

watch -n 2 juju status

The message column will provide information about a given unit's state. This charm is ready for use once the status message indicates that it is ready.

Smoke Test

This charm provides a smoke-test action that can be used to verify the application is functioning as expected. Run the action as follows:

juju run-action zookeeper/0 smoke-test

Watch the progress of the smoke test actions with:

watch -n 2 juju show-action-status

Eventually, the action should settle to status: completed. If it reports status: failed, the application is not working as expected. Get more information about a specific smoke test with:

juju show-action-output <action-id>


This charm includes Zookeeper command line utilities that can also be used to verify that the application is running as expected. Check the status of the Zookeeper daemon with zkServer.sh:

juju run --application=zookeeper '/usr/lib/zookeeper/bin/zkServer.sh status'

A successful deployment will report the service mode as either standalone (if only one Zookeeper unit has been deployed) or leader / follower (if a Zookeeper quorum has been formed).


Running ZooKeeper in standalone mode is convenient for evaluation, some development, and testing. In production, however, ZooKeeper should be run in replicated mode. A replicated group of servers in the same application is called a quorum, and in replicated mode, all servers in the quorum have copies of the same configuration file.

In order to add new Zookeeper servers to the quorum, simply add more units. For example, add two more zookeeper units with:

juju add-unit -n 2 zookeeper

The Zookeeper nodes will automatically perform a rolling restart to update the Zookeeper quorum without losing any jobs in progress. Once the rolling restart has completed, all of the Zookeeper nodes should report the following status:

ready (n units)

(Where 'n' is the total number of Zookeeper units in the quorum.)


To integrate Zookeeper into solutions with other charms, update the charms that require Zookeeper as follows:

1) Add following lines to metadata.yaml:

     interface: zookeeper

2) Add a zookeeper-relation-changed hook. Example contents:

from charmhelpers.core.hookenv import relation_get
ZK_hostname = relation_get('private-address')
ZK_port = relation_get('port')


Apache Bigtop tracks issues using JIRA (Apache account required). File an issue for this charm at:


Ensure Bigtop is selected as the project. Typically, charm issues are filed in the deployment component with the latest stable release selected as the affected version. Any uncertain fields may be left blank.

Contact Information



(string) The time interval in hours for which the purge task has to be triggered. Set to a positive integer (1 and above) to enable the auto purging. Defaults to 24.
(string) When enabled, ZooKeeper auto purge feature retains the snapRetainCount most recent snapshots and the corresponding transaction logs in the dataDir and dataLogDir respectively and deletes the rest. Defaults to 3. Minimum value is 3.
(int) The allowed average latency before a critical alert is triggered.
(int) The allowed average latency before a warning alert is triggered.
(string) Apache Bigtop release version. The default, '1.4.0' will use the current GA release, Bigtop 1.4.0, for all hiera data, puppet recipes, and installable packages. Set this to 'master' to use the latest upstream bits.
(string) Version of the cuda-repo deb to install. Valid options can be found at: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64
(int) The allowed ephemerals count before a critical alert is triggered.
(int) The allowed ephemerals count before a warning alert is triggered.
(string) Space separated list of extra deb packages to install.
(boolean) Install the CUDA binaries if capable hardware is present (True by default). Set to False to disable CUDA installation regardless of capable hardware.
(string) List of signing keys for install_sources package sources, per charmhelpers standard format (a yaml list of strings encoded as a string). The keys should be the full ASCII armoured GPG public keys. While GPG key ids are also supported and looked up on a keyserver, operators should be aware that this mechanism is insecure. null can be used if a standard package signing key is used that will already be installed on the machine, and for PPA sources where the package signing key is securely retrieved from Launchpad.
(string) List of extra apt sources, per charm-helpers standard format (a yaml list of strings encoded as a string). Each source may be either a line that can be added directly to sources.list(5), or in the form ppa:<user>/<ppa-name> for adding Personal Package Archives, or a distribution component to enable.
(int) The allowed maximum latency before a critical alert is triggered.
(int) The allowed maximum latency before a warning alert is triggered.
(int) The allowed minimum latency before a critical alert is triggered.
(int) The allowed minimum latency before a warning alert is triggered.
(string) Used by the nrpe subordinate charms. A string that will be prepended to instance name to set the host name in nagios. So for instance the hostname would be something like: juju-myservice-0 If you're running multiple environments with the same services in them this allows you to differentiate between them.
(string) A comma-separated list of nagios servicegroups. If left empty, the nagios_context will be used as the servicegroup
(string) Network interface to bind the Zookeeper client port to. Defaults to accepting connections on all interfaces. Accepts either the name of an interface (e.g., 'eth0'), or a CIDR range. If the latter, we\'ll bind to the first interface that we find with an IP address in that range.
(int) The allowed open file descriptor count before a critical alert is triggered.
(int) The allowed open file descriptor count before a warning alert is triggered.
(int) The allowed outstanding requests before a critical alert is triggered.
(int) The allowed outstanding requests before a warning alert is triggered.
(string) The status of service-affecting packages will be set to this value in the dpkg database. Valid values are "install" and "hold".
(int) The allowed watch count before a critical alert is triggered.
(int) The allowed watch count before a warning alert is triggered.