Origin:
zookeeper is a project under Apache. It was first used in Yahoo! and later used by Apache HBase to track distributed data.
Distributed :
refers to running in multiple systems at a certain time or at the same time. Compared with the traditional project structure, it saves time and effort, and has higher reliability, scalability and transparency.
Save time and effort: In the traditional structure, a single system can only be performed sequentially, and distributed can be performed at the same time, just like the difference between multi-threaded and single-threaded, the gap between the throughput of one port and multiple ports .
Reliability: We call multiple zookeeper systems a cluster, and a single zookeeper in a cluster is called a node. When a request is sent to the cluster, the request link will be sent to the cluster, and it will stop until it is received by one of the nodes or rejected at all. (The specific content will be mentioned later)
Scalability: You can add new nodes at any time without restarting the system
Transparency: Combine them to display a single application
zookeeper node:
nodes are divided into persistent nodes (default type), temporary nodes, sequential nodes
persistent nodes:
from the start It always exists and will not be deleted because the client is disconnected. The default is a persistent node.
Temporary node:
is created when the client connects, and the cluster will periodically send heartbeat requests to the client. If the client does not respond within the specified time, the cluster will determine that the client is disconnected, and the temporary node created by the client will be deleted
sequence node:
will be in Add a ten-digit number after the specified file name. Every time the leader with the smallest number will be elected, the leader will be visited during access. If the leader is disconnected and deleted, this step will be repeated again to elect a new leader
The principle of most failures in the cluster:
When most of the nodes in the cluster are in a failure state, the cluster is determined to be in a failure state. The number of nodes in the cluster is generally set to an odd number, because 1 is relative For 2, it is not the majority.
The original link:
https://www.w3cschool.cn/zookeeper/zookeeper_api.html