This section will cover some basic tasks and recommendations when setting up ZooKeeper for use with Zuul. A complete tutorial for ZooKeeper is out of scope for this documentation.
The following general configuration setting in
/etc/zookeeper/zoo.cfg is recommended:
This instructs ZooKeeper to purge old snapshots every 6 hours. This will avoid filling the disk.
Zuul requires its connections to ZooKeeper are TLS encrypted. ZooKeeper version 3.5.1 or greater is required for TLS support. ZooKeeper performs hostname validation for all ZooKeeper servers (“quorum members”), therefore each member of the ZooKeeper cluster should have its own certificate. This does not apply to clients which may share a certificate.
ZooKeeper performs certificate validation on all connections (server and client). If you use a private Certificate Authority (CA) (which is generally recommended and discussed below), then these TLS certificates not only serve to encrypt traffic, but also to authenticate and authorize clients to the cluster. Only clients with certificates authorized by a CA explicitly trusted by your ZooKeeper installation will be able to connect.
The instructions below direct you to sign certificates with a CA that you create specifically for Zuul’s ZooKeeper cluster. If you use a CA you share with other users in your organization, any certificate signed by that CA will be able to connect to your ZooKeeper cluster. In this case, you may need to take additional steps such as network isolation to protect your ZooKeeper cluster. These are beyond the scope of this document.
tools/zk-ca.sh script in the Zuul source code repository can
be used to quickly and easily generate self-signed certificates for
all ZooKeeper cluster members and clients.
Make a directory for it to store the certificates and CA data, and run it once for each client:
tools/zk-ca.sh /etc/zookeeper/ca zookeeper1.example.com
tools/zk-ca.sh /etc/zookeeper/ca zookeeper2.example.com
tools/zk-ca.sh /etc/zookeeper/ca zookeeper3.example.com
Add the following to
# Necessary for TLS support
# Client TLS configuration
# Server TLS configuration
Change the name of the certificate filenames as appropriate for the
In order to disable plaintext connections, ensure that the
clientPort option does not appear in
zoo.cfg. Use the new
method of specifying Zookeeper quorum servers, which looks like this:
This format normally includes
;2181 at the end of each line,
signifying that the server should listen on port 2181 for plaintext
client connections (this is equivalent to the
Omit it to disable plaintext connections. The earlier addition of
secureClientPort to the config file instructs ZooKeeper to listen
for encrypted connections on port 2281.
Be sure to specify port 2281 rather than the standard 2181 in the
zookeeper.hosts setting in