1. Basic Concepts
Zookeeper is a distributed, open source distributed application Coordination Service that is an open source implementation of Google's chubby and an important component of Hadoop and HBase. It is a software that provides consistent services for distributed applications, including configuration maintenance, domain name services, distributed synchronization, group services, and so on.
Zookeeper is a high-performance, highly available distributed coordination framework that employs a custom ZAB(Zookeeper Atomic Broadcast) transactional consistency protocol to ensure transactional consistency in high-concurrency distributed system environments. ZK uses a similar Linux operating system file directory structure management node, node data resident memory, to avoid disk I/O impact performance, and provide users with transparent persistence function to ensure data security. ZK is suitable for small data, high performance, high concurrency scenarios.
2. The services provided by ZK
(1) Naming services
The service provider creates a temporary node on ZK, and the node is globally unique. The service consumer can invoke the services provided by the service provider by reading the temporary node nodes on the ZK to obtain the information provided by the service provider. Example: Ali's Dubbo is the use of ZK as a registration center.
(2) Publish subscription service
The Publish subscription model, which is the configuration center, can publish application configurable items to ZK for subscribers to dynamically acquire the configuration, use the same set of configurations for the same cluster, implement the centralized and dynamic management of the configuration, avoid restarting the application service after the configuration is modified.
(3) Load Balancing
In a distributed system, services are provided by multiple servers in a cluster. To make each server more load-balanced, you need a framework for requesting distribution based on service load. And ZK is like this, can be dynamic registration and discovery Services, is the service more transparent.
(4) Distribution coordination/notification
(5) Distributed lock
ZK has strong transactional consistency
Lock service is divided into exclusive and sequential locks
Exclusive Lock: Multiple servers create a node on ZK at the same time, and the successful creator acquires the lock successfully.
(6) Distributed Queue Service
Distributed queues are divided into two types:
FIFO, in accordance with the principle of the use of distributed sequential locks.
Control the number of queue elements, waiting for the number of members in the queue to reach the specified value before you can begin the next processing operation.
Content from: http://newliferen.github.io/2015/07/24/ZooKeeper%E5%85%A5%E9%97%A8/
Zookeeper Getting Started learning