ZooKeeper Observersยถ

Observers: Scaling ZooKeeper Without Hurting Write Performanceยถ

  • Observers are non-voting members of an ensemble which only hear the results of votes, not the agreement protocol that leads up to them.
  • Therefore they can fail, or be disconnected from the cluster, without harming the availability of the ZooKeeper service.

How to use Observersยถ

Firstly, in the config file of every node that is to be an Observer, you must place this line:


Secondly, in every server config file, you must add :observer to the server definition line of each Observer. For example:


This tells every other server that server.1 is an Observer, and that they should not expect it to vote.

$ bin/zkCli.sh -server localhost:2181

Example use casesยถ

  • As a datacenter bridge
  • As a link to a message bus


โ”œโ”€โ”€ conf/
โ”‚    โ”œโ”€โ”€ java.env
โ”‚    โ”œโ”€โ”€ zoo-2181.cfg
โ”‚    โ”œโ”€โ”€ zoo-2182.cfg
โ”‚    โ”œโ”€โ”€ zoo-2183.cfg
โ”‚    โ””โ”€โ”€ zoo-2188.cfg
โ”œโ”€โ”€ data-2181/
โ”‚    โ””โ”€โ”€ myid
โ”œโ”€โ”€ data-2182/
โ”‚    โ””โ”€โ”€ myid
โ”œโ”€โ”€ data-2183/
โ”‚    โ””โ”€โ”€ myid
โ”œโ”€โ”€ data-2188/
โ”‚    โ””โ”€โ”€ myid
โ”œโ”€โ”€ logs-2181
โ”œโ”€โ”€ logs-2182
โ”œโ”€โ”€ logs-2183
โ””โ”€โ”€ logs-2188
cd /usr/local/zookeeper-3.4.10-observer
bin/zkServer.sh start conf/zoo-2181.cfg
bin/zkServer.sh start conf/zoo-2182.cfg
bin/zkServer.sh start conf/zoo-2183.cfg
bin/zkServer.sh start conf/zoo-2188.cfg
bin/zkServer.sh status conf/zoo-2181.cfg
bin/zkServer.sh status conf/zoo-2182.cfg
bin/zkServer.sh status conf/zoo-2183.cfg
bin/zkServer.sh status conf/zoo-2188.cfg
bin/zkCli.sh -server localhost:2188