In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to implement the Master-Worker collaboration mechanism in zookeeper. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Case study:
1. Using ZooKeeper to realize the cooperative management of a group member.
2. Create a node of Master and use Master to monitor group member Workers
3. Workers also needs to monitor Master. When Master goes down, a Worker can become Master.
Experimental background
1. ZooKeeper cluster, using the environment built in the previous article.
2. Start 3 clients, connect to the ZooKeeper cluster, and simulate Master and Worker.
Steps
1. The first client creates a temporary node master with its own port number to indicate that it is Master
Create-e / master 'master:2222'
2. Create a non-temporary node directory workers, which is used to store worker nodes. It must be a non-temporary node, and temporary nodes cannot have children.
3. The master node should monitor the workers node.
4. The second client, which also attempts to create a master, will fail.
5. The second client, create Worker node W1, become Worker, and listen for Master
6. The third client, which similarly creates w2, also listens to Master
7. There are already 2 worker nodes in the workers directory.
8. When the Master goes down (here the quit command is used to simulate the downtime), the worker can be notified, and one of them can delete its own worker node to create a master node and become a master.
Note: the above master listens to all worker nodes in the workers directory, please use the command
Ls2 / workers-w
During the stat test, it was found that master could not be notified when the nodes in the workers directory changed.
This is the end of this article on "how to implement Master-Worker collaboration mechanism in zookeeper". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.