1. If you are using open source DC/OS, install an Apache Zookeeper cluster with the following command from the DC/OS CLI. If you are using Enterprise DC/OS, you may need to follow additional instructions. See the Install and Customize section for information.

    dcos package install kafka-zookeeper

    Alternatively, you can install Apache Zookeeper from the DC/OS web interface.

  2. The service will now deploy with a default configuration. You can monitor its deployment on the Services tab of the DC/OS web interface.

  3. Connect a client to Apache Zookeeper.

    dcos beta-confluent-kafka-zookeeper endpoints
    dcos beta-confluent-kafka-zookeeper endpoints clientport
        "vips": [""],
        "address": [
        "dns": [
        "vip": ""

You will use the values in the address field for the final step.

Install the ZooKeeper CLI

  1. SSH into one your agent nodes.

    dcos node ssh --master-proxy --mesos-id=<agent-id>
  2. Download the latest ZooKeeper release to the node and uncompress it.

    curl -O
    tar -xzf zookeeper-3.4.11.tar.gz
  3. Run the the script with the proper arguments, including one of the IPs that you found earlier.

    docker run -it zookeeper -server

Your output will look like:

Connecting to
2017-07-24 13:10:41,347 [myid:] - INFO  [main:[email protected]] - Client
Welcome to ZooKeeper!
JLine support is enabled
2017-07-24 13:10:41,737 [myid:] - INFO  [main-SendThread([email protected]] - Session establishment complete on server, sessionid = 0x15d75be6fc70000, negotiated timeout = 30000


WatchedEvent state:SyncConnected type:None path:null

This is the same output we would expect when running ZooKeeper locally on just one node. Now, we have all the native ZooKeeper commands available to us.

Run Commands

To get a list of possible commands, run:


And receive:

ZooKeeper -server host:port cmd args
  stat path [watch]
  set path data [version]
  ls path [watch]
  delquota [-n|-b] path
  ls2 path [watch]
  setAcl path acl
  setquota -n|-b val path
  redo cmdno
  printwatches on|off
  delete path [version]
  sync path
  listquota path
  rmr path
  get path [watch]
  create [-s] [-e] path data acl
  addauth scheme auth
  getAcl path
  connect host:port
[zk: 1]

A simple canary test for a properly configured ZooKeeper cluster is to create a znode, verify its existence, and delete it. Do this by running the following commands:

[zk: 1] create /test my_data

Created /test
[zk: 2] ls /

[zookeeper, test]
[zk: 3] delete /test
[zk: 4] ls /


High Availability

We can also connect to every node in the cluster when running native ZooKeeper commands. If the connection to a single node in the cluster is lost, ZooKeeper will automatically try to connect you to the next available node in the cluster.

To enable this, pass a comma-delimited list of all agent IPs as an argument to the script. With this example, the command would be:

docker run -it zookeeper -server,,

See Also