ZooKeeper configuration
In a distributed system, it is important to keep things coordinated and in sync with each other. In a cluster, if we have more than one master, so there should be a mechanism to control who should be the leader or decision maker and can make changes or writes to metadata, and who are just readers or have read-only access.
To do this, we need a co-ordination service that can do all of this, for which we will use the ZooKeeper service.
Getting ready
Before going through the recipe in this section, we need at least one node to install ZooKeeper. This could be a dedicated node or it can be co-located with other nodes in the cluster. In production, ZooKeeper is configured to run on minimum three nodes, which makes it highly available and there must always be odd number of nodes in the ZooKeeper quorum.
Mostly, ZooKeeper nodes are co-located with master nodes in the cluster. Never run them on slave nodes as they will be replaced often due to Datanode failures. In this recipe...