Introduction
Apache ZooKeeper is a distributed key-value store that provides centralized coordination, synchronization, naming, and group services for distributed systems. ZooKeeper was developed as an independent system that can be integrated with other large distributed systems so that developers can focus on distributed application development and not on coordination services. Mesos depends on ZooKeeper for leader election so configuring Mesos with ZooKeeper is critical to running a highly available Mesos cluster. We will guide you through installing ZooKeeper and then configuring it with Mesos.
In the following recipes, we will give examples for configuring both a single development Mesos instance with ZooKeeper and for a highly available, multi-master Mesos cluster with ZooKeeper. ZooKeeper is not required to run a single instance of Mesos. However, you may need to deploy a single instance of ZooKeeper with a single Mesos instance to support development of frameworks that depend on ZooKeeper. For production, you will need a minimum of three, and always an odd number, of ZooKeeper/Mesos master nodes to deploy a highly available cluster. The number of agents can be odd or even and the actual number of agents that you need will depend on the resources you require for your application. If you deploy Mesos with ZooKeeper, you will also need to choose the quorum value for your cluster. The general rule of thumb for assigning the quorum value is (N+1)/2=quorum with N being the number of ZooKeeper/Mesos master nodes. For a single development instance, N=1 so our quorum value is (1+1)/2=1. For a cluster with three ZooKeeper/Mesos masters, our quorum value is (3+1)/2=2, and so on.