Zookeeper (b) Introduction

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/u011414629/article/details/100171802

What is Zookeeper

Zookeeper is a distributed coordination service for managing mainframe. In a distributed environment, coordination and management services is a complex process. Zookeeper solve this problem through its simple architecture and API, Zookeeper allows developers to focus on core application logic without having to worry about the distributed nature of applications.

Zookeeper data model

Zookeeper data model look like? It's like among the data tree, much like the file system directory, Zookeeper is a standard binary tree structure

Tree is composed of nodes, the Zookeeper data storage node is also based, this node is called Znode

However, different from the node tree, znode the reference is a reference path, similar to a file path

/ Animal / dog

/ Automotive / BMW

Such a hierarchical structure, so that each node has a unique path Znode, like namespaces, make a clear separation of the different information

Znode which elements contained

data: the data Znode

ACI: Record Znode access to that who or what can access this IP node

state: containing Znode various metadata, such as transaction ID, version number, timestamp, size, etc.

child: a reference to the current node's children

It should be noted that: Zookeeper is a little reading and writing scene design, Znode do not want to store the massive business data, but for a small amount of storage status and configuration information, the maximum amount of data per node can not exceed 1MB

The basic operation of Zookeeper

Creating nodes

create

Delete Node

delete

Determine whether there is a node

exists

Obtaining data of a node

getData

Setting data of a node

setData

Gets all the child nodes of node

getChildren

Among these, exists, getData, getChildren read belongs, the Zookeeper client when requesting a read operation, the watch can select whether to set

 

Guess you like

Origin blog.csdn.net/u011414629/article/details/100171802