ZooKeeper is an open source distributed coordinator and a typical distributed data consistency solution. It is designed to encapsulate complex and error-prone distributed consistency services to form an efficient and reliable system and provides users with a series of simple and easy-to-use atomic operations.
ZooKeeper main features
zookeeper itself is a distributed program. As long as more than half of the nodes survive, zookeeper can Normal service.
In order to ensure high availability, zookeeper is usually deployed in the form of a cluster, so that as long as most of the machines in the cluster are available, zookeeper itself will be available.
zookeeper saves data in memory, which ensures high throughput and low latency
zookeeper is high-performance, especially in programs that read more than write, because writing will cause Synchronization status between all servers.
zookeeper has the concept of temporary nodes. A temporary node exists as long as the client session that created it remains active. When the session ends, the temporary node is deleted.
The bottom layer of zookeeper only provides two functions. 1. Manage the data submitted by the user program. 2. Provide monitoring services for the data nodes submitted by the user program.
ZooKeeper Features
ZooKeeper is based on the Fast Paxos algorithm. The Paxos algorithm has a livelock problem, that is, when there are multiple proposers staggered submissions, it is possible Mutual exclusion results in no proposer being able to submit successfully. Fast Paxos has made some optimizations and elected a leader. Only the leader can submit the proposer. The specific algorithm can be found in Fast Paxos. Therefore, if you want to understand ZooKeeper, you must first understand Fast Paxos. [2]
ZooKeeper’s basic operating process:
1. Elect Leader.
2. Synchronize data.
3. There are many algorithms in the process of electing Leader, but the election standards to be met are the same.
4. Leader must have the highest execution ID, similar to root permissions.
5. Most of the machines in the cluster respond and accept the selected Leader.
Recommended tutorial: "PHP"
The above is the detailed content of What is ZooKeeper?. For more information, please follow other related articles on the PHP Chinese website!