Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zookeeper application scenario

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Zookeeper- Unified naming Service

1) in a distributed environment, it is often necessary to name applications / services uniformly to facilitate the identification of different services.

It is similar to the correspondence between domain name and ip.

Information such as the address of a resource or service is obtained by name.

2) organize the service / application name according to the hierarchical structure.

It can write the service name and address information to zookeeper, and the client can get the service list through zookeeper.

two。 Configuration management

1) in a distributed environment, configuration file management and synchronization are often needed.

In a cluster, the configuration information of all nodes is the same.

After we modify the configuration file, we want to be able to quickly synchronize to each node.

2) configuration management can be implemented by zookeeper

Configuration information can be written to a znode on zookeeper

Each node listens to this znode

Once the data in znode is modified, zookeeper will notify each node.

3. Cluster management

1) in a distributed environment, we need to know the status of each node in real time.

Some adjustments can be made according to the real-time status of the node.

2) it can be implemented by zookeeper

Node information can be written to a znode on zookeeper

Monitor this znode to get its real-time status changes

3) typical application

Master status Monitoring and Election in HBase

4. Distributed notification and coordination

1) in a distributed environment, there is often a service that needs to know the status of the subservices it manages.

NameNode needs to know the status of each Datanode

ResourceManager needs to know the status of each NodeManager

2) zookeeper can implement heartbeat detection mechanism and information push, which is equivalent to a publish / subscribe system.

5. Distributed lock

1) zookeeper is strongly consistent.

2) realize the exclusivity of the lock

3) Control the timing of the lock

6. Distributed queue

There are two types of distributed queues:

1) A queue is available only when all the members of the queue are gathered together, otherwise it is always waiting for all the members to arrive. This is a synchronous queue.

A job consists of multiple task, and the job runs only after all tasks are completed.

You can create a job directory for job, and then create a temporary znode for each completed task in that directory

Once the number of temporary nodes reaches the total number of task, it indicates that the job is running.

2) queues perform queuing and dequeuing operations according to fifo, such as implementing producer and consumer models.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report