1. zookeeper: highly available Distributed Coordination Service
Distributed difficulty lies in part of failure: In the process of message transmission, it is difficult to determine whether the receiver receives the message or not, so that three handshakes of the TCP protocol are available.
2. ZK instance
ZK can be regarded as a file system. This file system has only the concept of a node. znode can be regarded as a service, including a DB instance, thrift service, it can also be seen as a container for storing other services. All these znodes constitute a tree-type structure, and the basic ZK operations are performed on these nodes, including the create group, delete, add, and List Group members.
About znode: there are two different types, short and permanent, and temporarily maintained in a session where the client creates a group. When the session is disconnected, the znode ends, deleted by ZK, and permanent znode always exists
3. Each znode has an associated ACL. ZK is used to coordinate services rather than store data. The size of all znodes cannot exceed 1 MB, which is atomic for znode access.
You can specify a sequence number when creating a znode. znode with a sequence number can have the same name.
4. observation mechanism
When the znode node changes, you can notify other clients. For example, a client calls the zk's exists to check whether a znode exists in the current tree exists, and set an observation above, after other clients create this znode, they can notify the client. You can set observation (exists, getdata, getchildren) in the read operation and trigger observation (create, setdata, delete)