In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to briefly introduce Zookeeper, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.
What is Zookeeper?
To put it simply, Zookeeper is an open source distributed collaborative service system. The design goal of Zookeeper is to encapsulate complex and error-prone distributed collaborative services, abstract an efficient and reliable primitive interface, and provide a series of simple interfaces to invoke other services. Other applications can implement a variety of distributed applications as long as they use the interface provided by Zookeeper. For example: distributed lock, distributed election, master-slave switching and so on. We will explain these cases in detail in the actual combat content.
The history of Zookeeper development
Zoookeeper was first developed by Yahoo to solve the problem of coordination between multiple internal systems, and later opened up and donated it to the Apache organization. Later, Zookeeper was widely used in the open source world. Here, I list a few well-known open source projects that use Zookeeper.
Hadoop: use Zookeeper to provide a highly available mechanism for NameNode.
HBase: use Zookeeper to ensure that there is only one Master node in the entire cluster, save the RegionServer list in the cluster, and save the location of the hbase:meta table.
Kafka: use Zookeeper to manage members in the group, and use Zookeeper to provide an election mechanism for controller nodes.
Dubbo: a registry that uses Zookeeper to implement distributed governance services.
SpringCloud: use Zookeeper to implement a microservice registry.
There are many open source projects that use Zookeeper as distributed collaboration. Due to the large number of projects, we will not list them one by one here. Friends can consult them on their own through the Internet.
Zookeeper application scenario
To put it simply, Zookeeper can be applied to the following scenarios.
Configuration management.
DNS service.
Group member management.
All kinds of distributed locks.
Distributed elections.
Data consistency scenario.
However, it should be noted that Zookeeper is only suitable for storing critical data related to collaboration, but not suitable for storing large amounts of data.
Use of Zookeeper services
In general, when we use Zookeeper, we connect and use Zookeeper through the Zookeeper library, and the Zookeeper client is responsible for interacting with the Zookeeper cluster.
Data Model of Zookeeper
In essence, the data model of Zookeeper is a hierarchical model, as shown below.
This hierarchical model is common in the file system, and this hierarchical model and the Key-Value model are two mainstream data models. The main considerations for Zookeeper using the file system model are as follows.
The tree structure of the file system makes it easy to express the hierarchical relationship between the data.
The tree structure of the file system facilitates the allocation of independent namespaces for different applications.
In Zookeeper, each node in the hierarchy is called znode, which is different from the file system. Each node can hold data, and each node has a version number, which is incremented from 0.
Next, let's look at a concrete example of a Zookeeper node.
For example, there are three subtrees in the above figure, which are applied to app1, app2, and app3 applications respectively. The subtree of app1 implements a simple group membership protocol, that is, each client creates a znode under the / app1 node, and the znode created by each process is stored in turn with the structure of / app1/p_1,/app1/p_2,...,/app1/p_n. As long as the / app1/p_n node exists, the Pn process is running normally.
Node Classification of Zookeeper
In general, Znode nodes can be divided into the following four categories.
A Znode node can be persistent or temporary.
Persistent Znode: even if the Zookeeper cluster goes down or the Zookeeper client goes down after the node is created, the node will not be lost.
If there is a temporary Znode:Zookeeper client outage or the client does not send a message to the Zookeeper cluster within the specified timeout, the node will disappear.
Znode nodes can also be sequential, which means that each node is associated with a unique monotone increasing integer, which is the suffix of the Znode node name, such as: / app1/p_1,/app1/p_2, etc., so Znode has the following two categories:
Persistent sequential Znode: in addition to the persistent Znode features, the name of the Znode is sequential.
Temporary sequential Znode: in addition to the temporary Znode features, the name of the Znode is also sequential.
The above is how to briefly introduce 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.