zookeeper is an open source distributed coordination framework: data publishing and subscription, load balancing, clustering, master election.
Atomicity: either succeeds at the same time or fails at the same time (distributed transaction)
Single view: No matter which server the client connects to, the model seen is all It’s the same.
Reliability: Once the server submits a transaction and obtains the server-side return of success, the server-side changes caused by this transaction will always be retained
Real-time Performance: Near real-time
zookeeper is not used to store data. It achieves data-based cluster management by monitoring changes in data status.
Conversation status:
NOT_CONNECTED
CONNECTING
CONNECTED
CLOSED
Data Model–>Tree structure
The smallest data unit is ZNODE
zab protocol: the client sends a transaction request to the leader, and the leader sends it to each follower, and After receiving the ack, the leader has committed. When the ack is ready to commit to each follower node, the leader hangs, what should I do?
1) Election of a new leader (the maximum value of zxid)
2) Synchronize to other followers
watcher:
eventyType
None client and server successfully establish a session
NodeCreated node creation
NodeDeleted node deletion
NodeDataChanged data change, data content< /p>
NodeChildrenChanged child node changes: it will be triggered when the child node is deleted and added, the change will not be triggered
watcher feature: one-time trigger
The event is processed It will be removed after one time. If you need permanent monitoring, you need to register repeatedly.
The way zookeeper serialization is used is jute
Acl permission operation
Ensure the security of data stored on zookeeper
schema (Ip/Digest/world/super)
Authorization object (192.168.1.1/11, root:root, world:anyone/super)
Data storage
Memory data and disk data
zookeeper will periodically store data on disk
DataDir stores data snapshots
Storage: the full amount of data at a certain moment
DataLogDir stores transaction logs
< p>