zookeeper- service registration and discovery

1. zookeeper when the docker as c / s architecture services

2. Data model - Binary Tree, accessible via the path

3. When the tree consisting of the node, the data storage also ZooKeeper based node, which is called by znode point, however, unlike the tree by point, reference is znode the reference path, similar to the file path / order / invoice; such a hierarchy, so that each node has a unique path Znode, like the namespace as to make clear isolation of the different information;

4. Znode element which comprises

4.1 data: data stored Znode;

4.2 ACL: access Znode record, that is who or what ip have access to this node;

4.3 stat: Znode containing various metadata such as transaction id, version number, timestamp, size, and the like;

4.4 child: a reference to the current node's children

It should be noted that, Zookeeper is a little more than read the writing scene design, Znode is not used to store massive business data, but are used to store a small amount of configuration and status information for each node can not exceed 1MB.

The basic operation of 5. Zookeeper

5.1 create, delete, setData write operation (transaction), exists, getData, getChildren read, Zookeeper client when requesting a read operation can choose whether to set Watch.

6. Zookeeper event notification

6.1 Observer pattern Wach, registration trigger on a specific time Znode be understood that when the Znode changed, that is called, when create, delete, setData, method, and the corresponding event registration will start on Znode, request Watch clients will receive asynchronous notifications.

 

 

 

 

Guess you like

Origin www.cnblogs.com/cgy-home/p/11836053.html