Apache ZooKeeper

This lesson introduces Apache ZooKeeper, a coordination software for distributed applications. Watches, data model (znodes) and leader election are addressed including a tutorial for the zkCli.sh client tool .

zookeeperapache zookeepertutorial
1.0x

Apache ZooKeeper

Created 2 years ago

Duration 0:39:25
lesson view count 72
This lesson introduces Apache ZooKeeper, a coordination software for distributed applications. Watches, data model (znodes) and leader election are addressed including a tutorial for the zkCli.sh client tool .
Select the file type you wish to download
Slide Content
  1. Apache ZooKeeper

    Slide 1 - Apache ZooKeeper

    • Open source project by ASF
    • For coordinating distributed applications
    • For High Availability (HA)
    • Data model (znodes)
    • ZAB (Zookeeper Atomic Broadcast)
    • Yahoo Research
    • Version 3.5.0 available
    • ZooKeeper Service
    • Image source: http://zookeeper.apache.org/doc/trunk/zookeeperOver.html
  2. Use Cases of ZooKeeper

    Slide 2 - Use Cases of ZooKeeper

    • Apache HBase
    • Apache Kafka
    • Apache Solr
    • Yahoo! Fetching Service
    • Facebook Messages
  3. Common Problems in Distributed Systems

    Slide 3 - Common Problems in Distributed Systems

    • Failure of Master
    • Failure of Slaves
    • Failure of communication
    • Task n
    • Task 2
    • Task 1
    • Job
    • Standby
    • Master
    • Master
    • Slave 1
    • Slave 2
    • Slave n
  4. Primitives of ZooKeeper

    Slide 4 - Primitives of ZooKeeper

    • Configuration Management (metadata)
    • Dynamic configuration at Pinterest
    • Image source: http://engineering.pinterest.com/post/77933733851/zookeeper-resilience-at-pinterest
  5. ZooKeeper Quorum

    Slide 5 - ZooKeeper Quorum

    • Primitives of ZooKeeper
    • Configuration Management (metadata)
    • Leader Election for Failover
    • E.g. HA for YARN ResourceManager or HBase
    • Master 2
    • Master 3
    • vote
    • vote
    • New Leader
    • Client
    • Master 1
    • (Leader)
  6. Data Models of ZooKeeper

    Slide 6 - Data Models of ZooKeeper

    • Data objects in hierarchical name spaces: znodes
    • Access to a data object like a file systems
    • E.g. /Parent_James/Child_Mike/Grandchild_Jacob
    • /
    • Parent_James
    • Child_Brian
    • Child_Rebecca
    • Child_Mike
    • Grandchild_Jacob
  7. Data Models of ZooKeeper

    Slide 7 - Data Models of ZooKeeper

    • Znodes with flags
    • SEQUENCE|EPHEMERAL flags
    • Sequential node: e.g. guid-n_xxxxxwhere xxxxx is an incremental number
    • ‘-s’ option for command: e.g. create -s [path] [data]
    • Ephemeral node: no children allowed, lives with a session.
    • ‘-e’ option for command: e.g. create –e [path] [data]
    • Leader election
    • Node can be created with e.g. create -e -s guid-n_ [data]
    • Herd effect
    • /ELECTION
    • guid-n_
    • guid-n_
    • guid-n_
  8. ZooKeeper Watches (push notification)

    Slide 8 - ZooKeeper Watches (push notification)

    • a watch event is one-time trigger, sent to the client that set the watch, which occurs when the data for which the watch was set changes. (as quoted by ZooKeeper’s manual)
    • Google’s Chubby lock service has polling
    • Watch getData("/znode1", true)
    • setData(“/znode1”, “new-data”)
    • WatchedEvent state:SyncConnected type:NodeDataChanged path:/znode1
    • /
    • znode1
    • Client 1
    • Client 2
    • Client n
  9. ZooKeeper Client Tool

    Slide 9 - ZooKeeper Client Tool

    • zkCli.sh
  10. Primitives of ZooKeeper

    Slide 10 - Primitives of ZooKeeper

    • Configuration Management (metadata)
    • Leader Election for Failover
    • Failure detection
    • Group Membership
    • Image source: https://www.digitalocean.com/community/tutorials/an-introduction-to-mesosphere