In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you how to analyze the consistency of Zookeeper, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Zookeeper is a high-performance and scalable service. Zookeeper reads and writes very fast, and the reading speed is faster than the writing speed. In addition, ZooKeeper can still serve old data during read operations. These are all due to the consistency guarantee provided by ZooKeepe, which has the following characteristics:
The consistency provided by Zookeeper is weak consistency. First of all, data replication has the following rules: zookeeper ensures that every change to the znode tree is replicated to more than half of the machines in the collection. Then it is possible that the data of the node is not up-to-date and is accessed by the client. And there will be a point in time that is inconsistent in the cluster.
That is, Zookeeper only guarantees final consistency, but real-time consistency can be guaranteed by the client calling itself, by calling the sync () method.]
Sequential consistency
The order in which clients are updated is consistent with the order in which they are sent.
Atomicity
The update operation either succeeds or fails, and there is no third outcome.
Single system mirroring
No matter which server the client connects to, the client will see the same ZooKeeper view.
[if the data is inconsistent, how can you be sure to see the same view? Insert / delete / modify will affect the data structure]
Reliability.
Once an update operation is applied, its value will not change until the client updates it again. This guarantee will produce the following two results:
1. If the client successfully obtains the correct return code, then the update has been successful. If the return code cannot be obtained (due to a communication error, timeout, and so on), the client will not know whether the update operation takes effect.
2. When recovering from a failure, any successful update operation that can be seen by the client will not be rolled back.
Real-time performance
For a specific period of time, the system seen by the client needs to be guaranteed to be real-time (in more than ten seconds). During this period of time, any changes to the system will be seen or detected by the client.
Pseudo-real-time, too misleading, to put it bluntly, is that the data can be Sync to each node in more than ten seconds to ensure final consistency. When I first saw this real-time performance, I wondered how Oracle RAC took the old nose to ensure real-time and consistency, and how easily Zookeeper did it. It turned out to be a fake, and it was so misunderstood. ]
Given these consistency guarantees, it will be very easy to design and implement more advanced functions of ZooKeeper, such as leader election, queuing, and revocable locks.
[
The CAP principle of distributed system is used to analyze Zookeeper.
1) C: Zookeeper ensures the final consistency and can be Sync to each node in more than ten seconds.
2) A: Zookeeper ensures availability, data is always available and there is no lock. And more than half of the nodes have the latest and real-time data. If you want to make sure that the data is up to date, you need to call Sync () manually.
3) P: there are two points that need to be analyzed.
Having too many nodes can lead to a very large write data latency because multiple nodes are required to synchronize.
The Leader election with more nodes is very time-consuming and will magnify the problems of the network. This problem can be alleviated by introducing observer nodes.
]
The above is how to analyze the consistency of Zookeeper. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.
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.