1. I. Overview of ZooKeeper

    1. 1.1 Working mechanism +
    2. 1.2 the characteristics of
    3. 1.3 Data structure
    4. 1.4 Application Scenario

      1. 1.4.1 Unified Naming Service
      2. 1.4.2 Unified configuration management
      3. 1.4.3 Unified cluster management
      4. 1.4.4 Dynamic server offline
      5. 1.4.5 Soft load balancing
  2. Two, ZooKeeper download

    1. 1. Linux download
    2. 2. Download the official website


ZooKeeper is a software project of the Apache Software Foundation that provides an open source distributed configuration service, synchronization service, and name registry for large-scale distributed computing.

A typical distributed data consistency solution based on which distributed applications can implement functions such as data publish/subscribe, load balancing, naming services, distributed coordination/notification, cluster management, Master election, distributed locking, and distributed queuing.

1.1 Working mechanism +

ZooKeeper looks at it from a design pattern perspective: ZooKeeper is a distributed service management framework based on the Observer pattern. It stores and manages the data that everyone cares about, and then accepts the registration of observers. Once the state of the data changes, ZooKeeper notifies those observers who have already registered with ZooKeeper to make corresponding response.

1.2 the characteristics of

  1. Zookeeper: A cluster formed by a leader and several followers.
  2. The ZooKeeper cluster will work as long as more than half of the nodes in the cluster are alive.
  3. Global data consistency: Each server keeps a copy of the same data, and the data is consistent regardless of which server the client connects to.
  4. Update requests are executed in sequence, and update requests from the same client are executed in the order in which they were sent.
  5. Data update atomicity, a data update either succeeds or fails.
  6. Real-time, within a certain time range, the client can read the latest data.

1.3 Data structure

The structure of the ZooKeeper data model is similar to that of a UNIX file system in that it can be viewed as a tree as a whole, with each node referred to as a ZNode. Each Znode can store 1MB of data by default, and each Znode can be uniquely identified by its path.

1.4 Application Scenario

The services provided include: unified naming service, unified configuration management, unified cluster management, dynamic loading and unloading of server nodes, soft load balancing, etc. (Three unified motion is equilibrium)

1.4.1 Unified Naming Service

In a distributed environment, it is often necessary to name the application/service uniformly for easy identification.

For example, IP is not easy to remember, but domain name is easy to remember.

1.4.2 Unified configuration management

1) In a distributed environment, profile synchronization is very common.

  1. It is generally required that all nodes in a cluster have the same configuration information, such as the Kafka cluster.
  2. After the configuration file changes, you want to be able to quickly synchronize to various nodes.

2) Configuration management can be implemented by ZooKeeper.

  1. Configuration information can be written to a ZNode on ZooKeeper.
  2. The individual client servers listen on this ZNode.
  3. ZooKeeper notifies each client server when data in ZNode has been modified.

1.4.3 Unified cluster management

1) In a distributed environment, it is necessary to control the state of each node in real time.

  1. Some adjustments can be made based on the real-time state of the node.

2) ZooKeeper can realize real-time monitoring of node state changes

  1. Node information can be written to a ZNode on ZooKeeper.
  2. Listen to this ZNode for real-time state changes.

1.4.4 Dynamic server offline

The client has real-time insight into the server’s up-and-down changes

1.4.5 Soft load balancing

ZooKeeper keeps track of the number of visits per server and lets the server with the least number of visits handle the latest client requests.

Two, ZooKeeper download

1. Linux download

Wget # http://archive.apache.org/dist/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz

2. Download the official website

Download address: https://zookeeper.apache.org/

Click Download to jump to the download page

Select Download Version

Walk the Sahara in the Rain

Personal website: name: walk in the rain Sahara link: https://liudongdong.top/ Description: only create, is the real enjoyment, only hard work, is full of life.