Chapter 5. Starting the ZooKeeper ensemble

Use this procedure to start the ZooKeeper ensemble.
  1. Log in to the master host as root, or as a user with superuser privileges.
  2. Determine whether serviced is configured to start when the system starts.
    systemctl is-enabled serviced
    • If the result is enabled, proceed to the next step.
    • If the result is disabled, enter the following command:
      systemctl enable serviced
  3. Identify the hosts in the ZooKeeper ensemble.
    grep -E '^\b*SERVICED_ZK=' /etc/default/serviced
    The result is a list of 3 or 5 hosts, separated by the comma character (,). The master host is always a node in the ZooKeeper ensemble.
  4. In separate windows, log in to each of the delegate hosts that are nodes in the ZooKeeper ensemble as root, or as a user with superuser privileges.
  5. On all ensemble hosts, start serviced.
    The window of time for starting a ZooKeeper ensemble is relatively short. The goal of this step is to start Control Center on each ensemble node at about the same time, so that each node can participate in electing the leader.
    systemctl daemon-reload && systemctl start serviced
  6. On the master host, check the status of the ZooKeeper ensemble.
    1. Attach to the container of the ZooKeeper service.
      docker exec -it serviced-isvcs_zookeeper /bin/bash
    2. Query the master host and identify its role in the ensemble.
      Replace Master with the hostname or IP address of the master host:
      { echo stats; sleep 1; } | nc Master 2181 | grep Mode
      The result includes leader or follower.
    3. Query the other delegate hosts to identify their role in the ensemble.
      Replace Delegate with the hostname or IP address of a delegate host:
      { echo stats; sleep 1; } | nc Delegate 2181 | grep Mode
    4. Detach from the container of the ZooKeeper service.
      exit
    If none of the nodes reports that it is the ensemble leader within a few minutes of starting serviced, reboot the ensemble hosts.