Apache Zookeeper 101
By TungQD
AGENDA
- What is Zookeeper
- Zookeeper Architecture
- Zookeeper Data Model
- Leader Election
- Demo
- FAQ
ZooKeeper is a centralized
service for maintaining
configuration information,
naming, providing distributed
synchronization, and providing
group services.
WHO AM I?
What problems
can it solve?
● Group membership
● Distributed data structures
● Reliable configuration service
● Distributed workflow
What is a Distributed System?
“A distributed system consists of multiple
computers that communicate through a computer
network and interact with each other to achieve a
common goal.”
-Wikipedia-
A
R
C
H
I
T
E
C
T
U
R
E
The Zookeeper Data Model
D
A
T
A
M
O
D
E
L
ZNODE
Ephemeral Znodes:
Ephemeral Znodes are
deleted when the creating
client's session ends.
Ephemeral znodes also
cannot have any child
znodes attached to it.
Persistent znodes:
Persistent znodes on the
other hand,can have child
znodes and are only deleted
by any client, even the one
that wasn’t the creator,
subject to the znode’s
access control list.
Sequential znodes:
Sequential znode is given a
10-digit number in a
numerical order at the end of
its name. Let’s say client1
created a sznode1. In the
ZooKeeper server, the
sznode1 will be named like
sznode0000000001
➤ Creating a Znode
create -<options> /<znode-name> <znode-data>
Ex: Persistent (Default): create /znode mydata
Ephemeral: create –e /eznode mydata
Sequential: create –s /sznode mydata
➤ Deleting a Znode
delete /<znode>
rmr /<znode-with-child>
➤ Reading a Znode Data
get /<znode-name>
➤ (Re) Writing a Znode Data
set /<znode-name> <new-data>
Zookeeper Command Line Interface (CLI)
ZNode Watches
● Clients can set watches on znodes:
o NodeChildrenChanged
o NodeCreated
o NodeDataChanged
o NodeDeleted
● Changes to a znode trigger the watch and ZooKeeper sends the client a notification.
● Watches are one time triggers.
● Watches are always ordered.
● Client sees watched event before new znode data.
● Client should handle cases of latency between getting the event and sending a new
request to get a watch.
ZooKeeper - Consistency
Guarantees
➤ Sequential Consistency
➤ Atomicity
➤ Single System Image
➤ Reliability
➤ Timeliness
L
E
A
D
E
R
E
L
E
C
T
I
O
N
Zookeeper
Management
tools
- Netflix Exhibitor
- Zookeeper UI(web)
- Zookeeper GUI (desktop -
Windows)
- ZK-web
- Zoo Navigator
Who uses Zookeepers?
COMPANIES:
1. Yahoo
2. Netflix
3. LinkedIn
4. Rackspace
5. Zynga
And many more….
PROJECTS IN FOSS:
1. Apache Map/Reduce (Yarn)
2. Apache Hbase
3. Apache Solr
4. Neo4j
5. Katta
And many more….
DEMO & FAQ
THANK YOU

Apache zookeeper 101

  • 1.
  • 2.
    AGENDA - What isZookeeper - Zookeeper Architecture - Zookeeper Data Model - Leader Election - Demo - FAQ
  • 3.
    ZooKeeper is acentralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. WHO AM I?
  • 4.
    What problems can itsolve? ● Group membership ● Distributed data structures ● Reliable configuration service ● Distributed workflow
  • 5.
    What is aDistributed System? “A distributed system consists of multiple computers that communicate through a computer network and interact with each other to achieve a common goal.” -Wikipedia-
  • 6.
  • 7.
    The Zookeeper DataModel D A T A M O D E L
  • 8.
    ZNODE Ephemeral Znodes: Ephemeral Znodesare deleted when the creating client's session ends. Ephemeral znodes also cannot have any child znodes attached to it. Persistent znodes: Persistent znodes on the other hand,can have child znodes and are only deleted by any client, even the one that wasn’t the creator, subject to the znode’s access control list. Sequential znodes: Sequential znode is given a 10-digit number in a numerical order at the end of its name. Let’s say client1 created a sznode1. In the ZooKeeper server, the sznode1 will be named like sznode0000000001
  • 9.
    ➤ Creating aZnode create -<options> /<znode-name> <znode-data> Ex: Persistent (Default): create /znode mydata Ephemeral: create –e /eznode mydata Sequential: create –s /sznode mydata ➤ Deleting a Znode delete /<znode> rmr /<znode-with-child> ➤ Reading a Znode Data get /<znode-name> ➤ (Re) Writing a Znode Data set /<znode-name> <new-data> Zookeeper Command Line Interface (CLI)
  • 10.
    ZNode Watches ● Clientscan set watches on znodes: o NodeChildrenChanged o NodeCreated o NodeDataChanged o NodeDeleted ● Changes to a znode trigger the watch and ZooKeeper sends the client a notification. ● Watches are one time triggers. ● Watches are always ordered. ● Client sees watched event before new znode data. ● Client should handle cases of latency between getting the event and sending a new request to get a watch.
  • 11.
    ZooKeeper - Consistency Guarantees ➤Sequential Consistency ➤ Atomicity ➤ Single System Image ➤ Reliability ➤ Timeliness
  • 12.
  • 13.
    Zookeeper Management tools - Netflix Exhibitor -Zookeeper UI(web) - Zookeeper GUI (desktop - Windows) - ZK-web - Zoo Navigator
  • 14.
    Who uses Zookeepers? COMPANIES: 1.Yahoo 2. Netflix 3. LinkedIn 4. Rackspace 5. Zynga And many more…. PROJECTS IN FOSS: 1. Apache Map/Reduce (Yarn) 2. Apache Hbase 3. Apache Solr 4. Neo4j 5. Katta And many more….
  • 15.
  • 16.