In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the meaning of the observer of Zookeeper". In the daily operation, I believe that many people have doubts about the meaning of the observer of Zookeeper. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubt of "what is the meaning of the observer of Zookeeper?" Next, please follow the editor to study!
Before reading this article, it is recommended to read:
Election method 1 based on zookeeper leader
Source Code Analysis of Kafka Source Code Series the role of zookeeper in kafka
An introduction to the observer
Review the role of Zookeeper's runtime.
The observer is designed to dynamically scale the zookeeper cluster without compromising write performance.
Although ZooKeeper also performs very well by allowing clients to connect directly to voting members of the cluster, this architecture makes it difficult to scale to a large number of clients. The problem is that as we add more voting members, write performance will decline. This is because write operations require (usually) at least half of the nodes in the cluster to vote to agree, so the cost of voting increases significantly as more voters join.
A new type of zookeeper node called observer is introduced here, and the introduction of observer helps solve the above problems and greatly increases the dynamic scalability of zookeeper. Observers do not participate in the vote, only listen to the results of the vote. Apart from this simple difference, Observers has exactly the same function as Followers-clients can connect to them and send read and write requests to them. Observer forwards the message to leader like follower, but Observer only listens to the result of the vote and does not participate in the vote. Because of this, we can add any number of Observer without affecting the performance of our cluster.
Observer has other advantages. Because they don't vote, they are not an important part of the ZooKeeper cluster. Therefore, they can fail or disconnect from the cluster without compromising the availability of the ZooKeeper service. The advantage for users is that Observer is better able to connect through less reliable web links than Follower. In fact, Observers can be used to communicate with ZooKeeper servers in another data center. Observers clients can read quickly because all reads are provided locally and writes consume the least amount of network traffic because fewer messages are required without a voting protocol.
How to use the Observer
Using observers in a zookeeper cluster is very simple, and you only need to modify the two configurations in the configuration file.
On all nodes that will be configured as zookeeper watchers, add the following line:
PeerType=observer
This line of configuration tells zookeeper that the server will become an Observers.
Second, on all server nodes, you need to add: observer at the end of the server definition. For example:
Server.1:localhost:2181:3181:observer
This will tell other services that server.1 is an observer and will not vote.
Run the following command to link to the cluster:
Bin/zkCli.sh-server localhost:2181
Here are two use cases for observer. In fact, whether you want to expand the number of clients in a ZooKeeper cluster, or whether you want to isolate critical parts of the cluster from the load that processes client requests, Observers is a good architectural choice.
1, as a data center bridge (datacenterbridge): it takes a lot of money to build the same zookeeper cluster for two data centers, because high changes in network latency between data centers can lead to false positives and cluster partitions in fault detection. However, if the cluster is fully deployed to one data center and another data center uses Observers, the partitioning problem will not occur. Client can still see and publish proposals.
2, as a link to the message bus: some companies have expressed interest in using ZK as a component of a persistent and reliable message bus. The observer will provide a natural integration point for this work: the plug-in mechanism can be used to attach the proposed stream seen by the observer to the publish-subscribe system without loading the core cluster.
At this point, the study of "what is the meaning of the observer of Zookeeper" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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: 281
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.