Use the following procedures to
configure a ZooKeeper ensemble (cluster) for a multi-host Control Center
deployment that includes a minimum of three hosts.
ZooKeeper and Control Center
Control Center relies on Apache ZooKeeper to distribute
and manage application services. ZooKeeper maintains the definitions of
each service and the list of services assigned to each host. The
scheduler, which runs on the master host, determines assignments and
sends them to the ZooKeeper node that is serving as the ensemble leader.
The leader replicates the assignments to the other ensemble nodes, so
that the other nodes can assume the role of leader if the leader node
fails.
All Control Center hosts retrieve assignments and service definitions
from the ZooKeeper ensemble leader and then start services in Docker
containers as required. So, the Control Center configuration files of
all Control Center hosts must include a definition for the
SERVICED_ZK
variable, which specifies the ZooKeeper endpoints of the ensemble nodes.
Additional variables are required on ensemble nodes.
A ZooKeeper ensemble requires a minimum of three nodes, which is
sufficient for most environments. An odd number of nodes is recommended
and an even number of nodes is strongly discouraged. A five-node
ensemble improves failover protection during maintenance windows but
larger ensembles yield no benefits.
The Control Center master host is always an ensemble node. All ensemble
nodes should be on the same subnet.
ZooKeeper security
The default configuration of Zookeeper is insecure, in two ways.
Default Zookeeper configuration
Optional Control Center configuration
During the leader-election phase, communication among ensemble servers is not authenticated.
The procedures in this section instruct you to create temporary
variables that are used as building blocks, to construct Control Center
configuration variables accurately. You append the Control Center
variables to /etc/default/serviced, and then edit the file to move
the variables to more appropriate locations.
The most important temporary variables specify the IP address or
hostname of each host in the ZooKeeper ensemble. The following table
identifies these important variables, the names and values of which must
be identical on every Control Center host.
Variable name
Placeholder value
Actual value
node1
Master
The IP address or hostname of the master host.
node2
Delegate-A
The IP address or hostname of delegate host A.
node3
Delegate-B
The IP address or hostname of delegate host B.
All ensemble hosts should be on the same subnet.
ZooKeeper variables
The variables in the following table are set only on ZooKeeper ensemble
nodes, except
SERVICED_ZK,
which must be identical on all Control Center hosts.
This example shows the ZooKeeper variables in the /etc/default/serviced
configuration file of each host in a 4-node Control Center deployment.
For convenience, the relevant settings for each node or host are also
included in subsequent procedures.
Master host and ZooKeeper ensemble node, 198.51.100.135:
This procedure configures the Control Center master host as a node in a
ZooKeeper ensemble.
Log in to the master host as root or as a user with superuser
privileges.
Define the IP address variables for each node in the ZooKeeper
ensemble.Replace Master with the IP address or hostname of the
Control Center master host, and replace Delegate-A and Delegate-B
with the IP addresses or hostnames of the delegate hosts to include
in the ensemble:
Specify the nodes in the ZooKeeper quorum.
ZooKeeper requires a unique quorum definition for each node in its
ensemble. To achieve this, replace the IP address or hostname of the
master host with 0.0.0.0.You can copy the following text and paste
it in your console:
Use this procedure to configure the delegate host designated as
Delegate-A as a ZooKeeper node.
Log in to the delegate host as root or as a user with superuser
privileges.
Define the IP address variables for each node in the ZooKeeper
ensemble.Replace Master with the IP address or hostname of the
Control Center master host, and replace Delegate-A and Delegate-B
with the IP addresses or hostnames of the delegate hosts to include
in the ensemble:
node1=Master
node2=Delegate-A
node3=Delegate-B
Set the ID of this node in the ZooKeeper ensemble.
Specify the nodes in the ZooKeeper quorum.
ZooKeeper requires a unique quorum definition for each node in its
ensemble. To achieve this, replace the IP address or hostname of
delegate host A with 0.0.0.0.You can copy the following text and
paste it in your console:
Navigate to the end of the file, and cut the line that contains
the SERVICED_ZK variable declaration at that location.
Locate the original SERVICED_ZK variable declaration, and then
paste the cut line immediately below it.
Comment the original SERVICED_ZK declaration, which references
only the master host.
Insert the number sign character (#) immediately in front of
the original SERVICED_ZK variable.
Navigate to the end of the file, and cut the line that contains
the SERVICED_ISVCS_ZOOKEEPER_ID variable declaration at that
location.
Locate the original SERVICED_ISVCS_ZOOKEEPER_ID variable
declaration, and then paste the cut line immediately below it.
Navigate to the end of the file, and cut the line that contains
the SERVICED_ISVCS_ZOOKEEPER_QUORUM variable declaration at that
location.
Locate the original SERVICED_ISVCS_ZOOKEEPER_QUORUM variable
declaration, and then paste the cut line immediately below it.
Navigate to the end of the file, and cut the line that contains
the SERVICED_ZK_SESSION_TIMEOUT variable declaration at that
location.
Locate the original SERVICED_ZK_SESSION_TIMEOUT variable
declaration, and then paste the cut line immediately below it.
Navigate to the end of the file, and cut the line that contains
the SERVICED_ISVCS_START variable declaration at that location.
Locate the original SERVICED_ISVCS_START variable declaration,
and then paste the cut line immediately below it.
Use this procedure to configure the delegate host designated as
Delegate-B as a ZooKeeper node.
Log in to the delegate host as root or as a user with superuser
privileges.
Define the IP address variables for each node in the ZooKeeper
ensemble.Replace Master with the IP address or hostname of the
Control Center master host, and replace Delegate-A and Delegate-B
with the IP addresses or hostnames of the delegate hosts to include
in the ensemble:
node1=Master
node2=Delegate-A
node3=Delegate-B
Set the ID of this node in the ZooKeeper ensemble.
Specify the nodes in the ZooKeeper quorum.
ZooKeeper requires a unique quorum definition for each node in its
ensemble. To achieve this, replace the IP address or hostname of
delegate host B with 0.0.0.0.You can copy the following text and
paste it in your console:
Navigate to the end of the file, and cut the line that contains
the SERVICED_ZK variable declaration at that location.
Locate the original SERVICED_ZK variable declaration, and then
paste the cut line immediately below it.
Comment the original SERVICED_ZK declaration, which references
only the master host.
Insert the number sign character (#) immediately in front of
the original SERVICED_ZK variable.
Navigate to the end of the file, and cut the line that contains
the SERVICED_ISVCS_ZOOKEEPER_ID variable declaration at that
location.
Locate the original SERVICED_ISVCS_ZOOKEEPER_ID variable
declaration, and then paste the cut line immediately below it.
Navigate to the end of the file, and cut the line that contains
the SERVICED_ISVCS_ZOOKEEPER_QUORUM variable declaration at that
location.
Locate the original SERVICED_ISVCS_ZOOKEEPER_QUORUM variable
declaration, and then paste the cut line immediately below it.
Navigate to the end of the file, and cut the line that contains
the SERVICED_ZK_SESSION_TIMEOUT variable declaration at that
location.
Locate the original SERVICED_ZK_SESSION_TIMEOUT variable
declaration, and then paste the cut line immediately below it.
Navigate to the end of the file, and cut the line that contains
the SERVICED_ISVCS_START variable declaration at that location.
Locate the original SERVICED_ISVCS_START variable declaration,
and then paste the cut line immediately below it.
Use this procedure to import the Docker image for ZooKeeper on delegate
hosts A and B. This procedure is not necessary on the master host.
Log in to the host as root or as a user with superuser privileges.
Change directory to /root.
cd/root
Extract the ZooKeeper image.
yes|./install-zenoss-isvcs-zookeeper_v*.run
Optional: Delete the archive file, if desired.
rm-i./install-zenoss-isvcs-zookeeper_v*.run
Starting a ZooKeeper ensemble
Use this procedure to start a ZooKeeper ensemble. This procedures uses
the nc utility to query ensemble hosts. If nc is not available, you
can use telnet with interactive ZooKeeper commands.
The window of time for starting a ZooKeeper ensemble is relatively
short. The goal of this procedure is to restart Control Center on each
ensemble node at about the same time, so that each node can participate
in electing the leader.
Log in to the Control Center master host as root or as a user with
superuser privileges.
In a separate window, log in to the second node of the ZooKeeper
ensemble (Delegate-A) as root or as a user with superuser
privileges.
In a different window, log in to the third node of the ZooKeeper
ensemble (Delegate-B) as root or as a user with superuser
privileges.
On all ensemble hosts, stop and start serviced.
systemctlstopserviced&&systemctlstartserviced
On the master host, check the status of the ZooKeeper ensemble.
Attach to the container of the ZooKeeper service.
dockerexec-itserviced-isvcs_zookeeper/bin/bash
Define IP address variables for each node in the ZooKeeper
ensemble.Replace Master with the IP address or hostname of the
Control Center master host, and replace Delegate-A and
Delegate-B with the IP addresses or hostnames of the delegate
hosts in the ensemble:
node1=Master
node2=Delegate-A
node3=Delegate-B
Query the master host and identify its role in the ensemble.
{echostats;sleep1;}|nc$node12181|grepMode
The result includes leader or follower.
Query delegate host A and identify its role in the ensemble.
{echostats;sleep1;}|nc$node22181|grepMode
Query delegate host B and identify its role in the ensemble.
{echostats;sleep1;}|nc$node32181|grepMode
Detach from the container of the ZooKeeper service.
exit
If none of the hosts reports that it is the ensemble leader within a
few minutes of starting serviced, reboot the hosts.
The default configuration of delegate hosts sets the value of the
SERVICED_ZK variable to the master host only. Use this procedure to
update the setting to include all of the hosts in the ZooKeeper
ensemble. Perform this procedure on each host in your Control Center
deployment that is not a ZooKeeper ensemble node.
Log in to the delegate host as root or as a user with superuser
privileges.
Define the IP address variables for each node in the ZooKeeper
ensemble.Replace Master with the IP address or hostname of the
Control Center master host, and replace Delegate-A and Delegate-B
with the IP addresses or hostnames of the delegate hosts to include
in the ensemble:
node1=Master
node2=Delegate-A
node3=Delegate-B
Specify the nodes in the ZooKeeper ensemble.You can copy the
following text and paste it in your console:
Navigate to the end of the file, and cut the line that contains
the SERVICED_ZK variable declaration at that location.
The value of this declaration specifies three endpoints.
Locate the SERVICED_ZK variable near the beginning of the file,
and then delete the line it is on.
The value is just the master host endpoint.
Paste the SERVICED_ZK variable declaration from the end of the
file in the location of the just-deleted declaration.
This procedure secures the /zookeeper and /zookeeper/quota data
nodes as long as the /opt/serviced/var/isvcs/zookeeper
directory is intact (not deleted and recreated).
Perform this procedure on each Control Center host in your deployment,
not just ensemble hosts.
Follow these steps:
Log in to the Control Center host as root or as a user with
superuser privileges.
Authorize the credentials you used for the Zookeeper ACL variables
(step 2).
addauthdigest<USERNAME>:<PASSWORD>
Display the hashed password.
getAcl/docker
If /docker does not return a result, repeat the command with
/net, /pools, /scheduler, or /storage.
The result should look similar to the following example: