ZooKeeper+ Architecture
Now that we have discussed at a high level the operations that ZooKeeper exposes to applications, we need to understand more of how the servicec actually works. Applications make calls to ZooKeeper through a client library. The client library is responsible for the interaction with ZooKeeper servers.
Look at the following Figure, shows the relationship between clients and servers. Each client imports the client library, and then can communicate with any ZooKeeper node.
ZooKeeper servers run in two modes: standalone (独立模式)and quorum(仲裁模式). Standalone mode is pretty much what the term says: there is a single server, and ZooKeeper state is not replicated. In quorum mode, a group of ZooKeeper servers, which we call a ZooKeeper ensemble(集合), replicates the state, and together they serve client request. From this point on, we use the term “ZooKeeper ensemble” to denote an installation of servers. This installation could contain a single server and operate in standalone mode or contain a group of servers and operate in quorum mode.