The ZooKeeper ServiceGroup driver works by using ZooKeeper
ephemeral nodes. ZooKeeper, in contrast to databases, is a
distributed system. Its load is divided among several servers.
At a compute worker node, after establishing a ZooKeeper session,
the driver creates an ephemeral znode in the group directory. Ephemeral
znodes have the same lifespan as the session. If the worker node
or the nova-compute
daemon crashes, or a network
partition is in place between the worker and the ZooKeeper server quorums,
the ephemeral znodes are removed automatically. The driver
gets the group membership by running the ls command in the group directory.
To use the ZooKeeper driver, you must install ZooKeeper servers and client libraries. Setting up ZooKeeper servers is outside the scope of this guide (for more information, see Apache Zookeeper).
To use ZooKeeper, you must install client-side Python libraries on every nova node:
python-zookeeper
– the official Zookeeper Python binding
and evzookeeper
– the library to make the binding work with the
eventlet threading model.
The following example assumes the ZooKeeper server addresses and ports are
192.168.2.1:2181
, 192.168.2.2:2181
, and
192.168.2.3:2181
.
The following values in the /etc/nova/nova.conf
file (on every
node) are required for the ZooKeeper
driver:
# Driver for the ServiceGroup serice servicegroup_driver="zk" [zookeeper] address="192.168.2.1:2181,192.168.2.2:2181,192.168.2.3:2181"
To customize the Compute Service groups, use the following configuration option settings:
Configuration option = Default value | Description |
---|---|
[zookeeper] | |
address = None | (StrOpt) The ZooKeeper addresses for servicegroup service in the format of host1:port,host2:port,host3:port |
recv_timeout = 4000 | (IntOpt) The recv_timeout parameter for the zk session |
sg_prefix = /servicegroups | (StrOpt) The prefix used in ZooKeeper to store ephemeral nodes |
sg_retry_interval = 5 | (IntOpt) Number of seconds to wait until retrying to join the session |