zookeeper how to achieve Distributed Lock

Lead zookeeper

Overview:

zookeeper is a distributed coordination services,

What is the distributed coordination services? Distributed coordination services in order to achieve a distributed lock;

What is a distributed lock? I hope this is the time for orderly access to resources among multiple processes to share the same resources.

 

Distributed Lock:

  Three core elements:

    shackles

    Unlock

    Lock out

  Three questions:

    To ensure atomicity operation, the yoke and the lock operation to be performed once timeout

    Lock to prevent accidental deletion

    On the basis of accidentally deleted lock on Cadogan a daemon thread for continued life lock

Zookeeper distributed lock it?

  Temporary order of nodes

    Znode four states

      Persistent node

      Persistent but orderly node node

      Temporary node

      But ordered the temporary node node

 

 

Compare Zookeeper distributed lock and Redis

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/cgy-home/p/11837140.html