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

I. the working mechanism of zookeeper

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The working Mechanism of zookeeper

Zookeeper is a distributed service architecture and a sub-project of apache hadoop. It is mainly used to solve the following data management problems encountered in distributed applications, such as cluster management, unified naming service, distributed configuration management, distributed message queue, distributed locking, distributed notification coordination, etc.

Zookeeper has no specific function. His role in big data is to coordinate big data's framework and provide coordination services.

How Zookeeper works:

From a design point of view, Zookeeper is a distributed server management framework based on the observer pattern. It is responsible for storing and managing data, and then accepts the registration of observers. Once the state of the data changes, zookeeper will be responsible for notifying the observers who have registered on zookeeper and respond accordingly.

All in all, zookeeper only needs to do two things.

First thing: save data

The second thing: notice

Understanding: it is necessary for the head teacher to communicate with the lecturer and make an appointment for the course, but because the lecturer cannot come, it is necessary for the head teacher to coordinate and inform the students that the role of the head teacher is the role of zookeeper.

Practical application: Server1 server2 server3 Client1 client2 client3 three server, is a cluster, when there is no zookeeper, the three client will directly connect to the three server, there is nothing in the middle, just a direct connection, but when the serverA is dead, client1 will not know, client1 will still connect to serverA, but serverA will not pay attention to client1 at all, if we add zookeeper cluster The structure is as follows: Server1 server2 server3 | 1. (the server registers the information at startup and saves its own information to zookeeper) zookeeper cluster (similar to middleware) | 2. (client gets the current list of online servers from zookeeper and registers to listen) Client1 client2 client3 We said above, zookeeper does two things, one thing is to store data, one thing is notification, three server The information of the services and ports provided by the server will be saved into zookeeper. Client reads data from zookeeper to see which server can normally connect * * 1, the server registers information at startup, and saves its own information to zookeeper. 2. Client gets the current list of online servers from zookeeper, and registers to monitor 3. Server2 is down, 4. Zookeeper will actively notify the hosts registered on zk, that is, the three client. Tell them that server2 is dead, and this is the second thing zk has done. 5. After zk has notified, the three client will register and listen to zookeeper again, which is a process for zookeeper to provide services. * *

Zookeeper= file system + notification mechanism zookeeper is through these two to achieve the coordination function, (the file system is to store data)

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

Servers

Wechat

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

12
Report