2. AGENDA
- What is Zookeeper
- Zookeeper Architecture
- Zookeeper Data Model
- Leader Election
- Demo
- FAQ
3. ZooKeeper is a centralized
service for maintaining
configuration information,
naming, providing distributed
synchronization, and providing
group services.
WHO AM I?
4. What problems
can it solve?
● Group membership
● Distributed data structures
● Reliable configuration service
● Distributed workflow
5. 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-
8. 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
9. ➤ 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)
10. 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.