zookeeper #3

Supports: bionic
Add to new model

Description

ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.


Overview

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 so you don't have to write them from scratch. You can use it off-the-shelf to implement consensus, group management, leader election, and presence protocols.

Usage

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

juju deploy cs:~/narindergupta/zookeeper zookeeper

Scaling

Running ZooKeeper in standalone mode is convenient for evaluation, some development, and testing. But in production, you should run ZooKeeper 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.

Scaling Zookeeper to create a quorum is trivial. The following will add two additional Zookeeper units and will automatically configure them with knowledge of the other quorum members based on their peer relation to one another:

juju add-unit -n 2 zookeeper

Test the deployment

Test if the Zookeeper service is running by using the zkServer.sh script:

juju run --unit zookeeper/0 '/usr/share/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).

Integrate Zookeeper into another charm

1) Add following lines to your charm's metadata.yaml:

requires:
  zookeeper:
     interface: zookeeper

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

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

Help


Configuration

autopurge_purge_interval
(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.
24
autopurge_snap_retain_count
(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.
3
extra_packages
(string) Space separated list of extra deb packages to install.
install_keys
(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.
install_sources
(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.
jmx_port
(string) JMX port where JMX data would be exported which can be utilized by telegraf to send it to prometheus for trending.
9999
nagios_context
(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.
juju
nagios_servicegroups
(string) A comma-separated list of nagios servicegroups. If left empty, the nagios_context will be used as the servicegroup
package_status
(string) The status of service-affecting packages will be set to this value in the dpkg database. Valid values are "install" and "hold".
install