Zookeeper - scenarios

Generally speaking, zookeeper usage scenarios below, I give you a few simple, we can say that a few like:

  • Distributed Coordination
  • Distributed Lock
  • Metadata / configuration information management
  • HA HA

Distributed Coordination

  In fact, this is a classic zookeeper usage, simply, like you A system sends a request to the mq, then B system after the news consumption process. A system that knows how to deal with the results of B system? Zookeeper can be achieved by coordination between distributed systems. A system then sends a request can register a listener for the value of a node on the zookeeper, once finished on the B-block processing zookeeper modify the value of that node, A system can be immediately notified, the perfect solution.

zookeeper-distributed-coordination

Distributed Lock

  For chestnuts. Issued consecutive two data modification operations on one, two machines received a request, but only one machine to another machine executing the re-execution. So then you can use the distributed lock zookeeper, a machine receives a lock on a distributed request a zookeeper after the first, is that we can to create a znode, then perform the operation; then another machine also try to create the znode, it was found that they can not be created because someone else is created, you can only wait, ranking a machine to perform over their own re-executed.

zookeeper-distributed-lock-demo

Metadata / configuration information management

  zookeeper can be used as a management configuration information of many systems, such kafka, storm and so many would prefer to use a distributed system zookeeper to do some metadata, configuration management information, including dubbo registry also does not support the zookeeper it?

zookeeper-meta-data-manage

HA HA

  This should be very common, such as hadoop, hdfs, yarn and many large data systems are selected based zookeeper to develop HA high availability mechanisms, is an important process will generally call the shots prepared two main processes hung up immediately perceived by zookeeper switch to the backup process.

 

 

Source: https://github.com/doocs/advanced-java/blob/master/docs/distributed-system/zookeeper-application-scenarios.md

 

Guess you like

Origin www.cnblogs.com/myseries/p/10966291.html