Must-know zookeeper gadget-zkui

Must-know zookeeper gadget-zkui

Dean talked big data wave wave
This paper was the first to bring everyone to look at the role of zookeeper in big data, and then to introduce a zk monitoring and management tool.

The role of zookeeper in distributed clusters

1. Data publishing and subscription (configuration center)

The publish and subscribe model, the so-called configuration center, as its name implies, is to say that the publisher publishes data to the zk node, and the subscribers dynamically obtain the data, so as to realize the centralized management and dynamic update of the configuration. For example, global configuration information, the address list of the service framework is very suitable for use.

2. Load balancing

That is, software load balancing. The most typical is the production and consumer load balancing of message middleware.

3. Naming Service

It is common that the publisher writes its own address list to the zookeeper node, and then the subscriber can obtain the address list from the node with a fixed name and link to the publisher for related communication.

4. Distributed notification/coordination

This uses the watcher registration and asynchronous notification mechanism of zookeeper, which can well realize the notification and coordination between different systems in a distributed environment, and realize real-time processing of data changes.

5. Cluster management and Master election

Cluster management, such as online rate, node online and offline notification. Master election can be implemented using temporary sequential nodes.

6. Distributed lock

Distributed locks, this is mainly due to the strong consistency of zookeeper data, using temporary nodes. The lock service is divided into two categories, one is an exclusive lock, and the other is a control sequence.

Exclusive means that all clients acquire the lock, and only one can acquire it in the end. Temporary nodes are used.

Control the timing, all clients that come to acquire the lock will be arranged to get the lock, but there must be an order. In fact, it is implemented by a temporary sequence child node under a certain node.

zkui detailed

Introduction

zkui is a web management interface of zookeeper, which can perform CRUD operations on zookeeper.

github address:

https://github.com/DeemOpen/zkui

Environmental requirements

The official requirement of the compilation environment is jdk7, but the jdk8 is running normally here.

The maven version used by Wavetip is mvn-3.3.3

Installation and deployment

1. Compile and package


mvn clean install

After the execution is over, a jar package will be generated in the target directory

Must-know zookeeper gadget-zkui

2. Configuration


执行 vim config.cfg
添加如下配置

# zkui web页面访问端口
serverPort=9090

# zookeeper集群的IP地址和端口
zkServer=localhost:2181

# 设置登录zkui的用户名和密码,这里是默认值
userSet = {"users": [{ "username":"admin" , "password":"manager","role": "ADMIN" },{ "username":"appconfig" , "password":"appconfig","role": "USER" }]}

3. Start

Starting zkui is also relatively simple and can be executed directly


$ java -jar zkui-2.0-SNAPSHOT-jar-with-dependencies.jar

You can also use nohup & to become a background process


nohup java -jar target/zkui-2.0-SNAPSHOT-jar-with-dependencies.jar &

4. Climbing ui

Visit http://localhost:9090 to see the following interface: Enter the username and password you just set: admin/manager to log in.

Must-know zookeeper gadget-zkui

5. CRUD operations

Must-know zookeeper gadget-zkui

Guess you like

Origin blog.51cto.com/15127544/2665254