SlideShare a Scribd company logo
APACHE ZOOKEEPER
Viet-Dung TRINH (Bill), 03/2016
Saltlux – Vietnam Development Center
Agenda
•  Overview
•  The ZooKeeper Service
•  The ZooKeeper Data Model
•  Recipes
Overview – What is ZooKeeper?
•  An open source, high-performance
coordination service for distributed
application.
•  Exposes common services in simple
interface:
•  Naming
•  Configuration management
•  Locks & synchronization
•  Groups services
•  Build your own on it for specific needs
Overview – Who uses ZooKeeper?
•  Companies:
•  Yahoo!
•  Zynga
•  Rackspace
•  Linkedlin
•  Netflix, and many more…
•  Projects:
•  Apache Map/Reduce (Yarn)
•  Apache HBase
•  Apache Kafka
•  Apache Storm
•  Neo4j, and many more…
Overview – ZooKeeper Use Cases
•  Configuration Management
•  Cluster member nodes bootstrapping configuration from a
centralized source in unattended way
•  Distributed Cluster Management
•  Node join / leave
•  Node statuses in real time
•  Naming service – e.g. DNS
•  Distributed synchronization – locks, barriers, queues
•  Leader election in a distributed system
The ZooKeeper Service (ZKS)
•  ZooKeeper Service is replicated over a set of machines
•  All machines store a copy of the data (in-memory)
•  A leader is elected on service startup
•  Clients only connect to a single ZooKeeper server and maintain a
TCP connection
The ZKS - Sessions
•  Before executing any request, client must establish a
session with service
•  All operations client summits to service are associated to
a session
•  Client initially connects to any server in ensemble, and
only to single server.
•  Session offer order guarantees – requests in session are
executed in FIFO order
The ZKS – Session States and Lifetime
•  Main possible states: CONNECTING, CONNECTED,
CLOSED, NOT_CONNECTED
The ZooKeeper Data Model (ZDM)
•  Hierarchal name space
•  Each node is called as a ZNode
•  Every ZNode has data (given as byte[])
and can optionally have children
•  ZNode paths:
•  Canonical, absolute, slash-separated
•  No relative references
•  Names can have Unicode characters
•  ZNode maintain stat structure
ZDM - Versions
•  Eash Znode has version number, is incremented every
time its data changes
•  setData and delete take version as input, operation
succeeds only if client’s version is equal to server’s one
ZDM – ZNodes – Stat Structure
•  The Stat structure for each znode in ZooKeeper is made
up of the following fields:
•  czxid
•  mzxid
•  pzxid
•  ctime
•  mtime
•  dataVersion
•  cversion
•  aclVersion
•  ephemeralOwner
•  dataLength
•  numChildren
ZDM – Types of ZNode
•  Persistent ZNode
•  Have lifetime in ZooKeeper’s namespace until they’re explicitly
deleted (can be deleted by delete API call)
•  Ephemeral ZNode
•  Is deleted by ZooKeeper service when the creating client’s session
ends
•  Can also be explicitly deleted
•  Are not allowed to have children
•  Sequential Znode
•  Is assigned a sequence number by ZooKeeper as a part of name
during creation
•  Sequence number is integer (4bytes) with format of 10 digits with 0
padding. E.g. /path/to/znode-0000000001
ZDM – Znode Operations
ZDM – Znode – Reads & Writes
•  Read requests are processed locally at the ZooKeeper
server to which client is currently connected
•  Write requests are forwarded to leader and go through
majority consensus before a response is generated
ZDM – Consistency Guarantees
•  Sequential Consistency
•  Atomicity
•  Single System Image
•  Reliability
•  Timeliness (Eventual Consistency)
ZDM - Watches
•  A watch event is one-time trigger, sent to client that set
watch, which occurs when data for which watch was set
changes.
•  Watches allow clients to get notifications when a znode
changes in any way (NodeChildrenChanged,
NodeCreated, NodeDataChanged,NodeDeleted)
•  All of read operations – getData(), getChildren(), exists()
– have option of setting watch
•  ZooKeeper Guarantees about Watches:
•  Watches are ordered, order of watch events corresponds to the
order of the updates
•  A client will see a watch event for znode it is watching before
seeing the new data that corresponds to that znode
ZDM – Watches (cont)
ZDM – Access Control List
•  ZooKeeper uses ACLs to control access to its znodes
•  ACLs are made up of pairs of (scheme:id, permission)
•  Build-in ACL schemes
•  world: has single id, anyone
•  auth: doesn’t use any id, represents any authenticated user
•  digest: use a username:password
•  host: use the client host name as ACL id identity
•  ip: use the client host IP as ACL id identity
•  ACL Permissions:
•  CREATE
•  READ
•  WRITE
•  DELETE
•  ADMIN
•  E.g. (ip:192.168.0.0/16, READ)
Recipe #1: Queue
•  A distributed queue is very common data structure used in
distributed systems.
•  Producer: generate / create new items and put them into
queue
•  Consumer: remove items from queue and process them
•  Addition and removal of items follow ordering of FIFO
Recipe #1: Queue (cont)
•  A ZNode will be designated to hold a queue instance,
queue-znode
•  All queue items are stored as znodes under queue-znode
•  Producers add an item to queue by creating znode under
queue-znode
•  Consumers retrieve items by getting and then deleting a
child from queue-znode
QUEUE-ZNODE : “queue instance”
|-- QUEUE-0000000001 : “item1”
|-- QUEUE-0000000002 : “item2”
|-- QUEUE-0000000003 : “item3”
Recipe #1: Queue (cont)
•  Let /_QUEUE_ represent top-level znode, is called queue-
znode
•  Producer put something into queue by creating a
SEQUENCE_EPHEMERAL znode with name “queue-N”,
N is monotonically increasing number
create (“queue-”, SEQUENCE_EPHEMARAL)
•  Consumer process getChildren() call on queue-znode with
watch event set to true
M = getChildren(/_QUEUE_, true)
•  Client picks up items from list and continues processing
until reaching the end of the list, and then check again
•  The algorithm continues until get_children() returns
empty list
Recipe #2: Group Membership
•  A persistent Znode /membership represent the root of the
group in ZooKeeper tree
•  Any client that joins the cluster creates ephemeral znode
under /membership to locate memberships in tree and set
a watch on /membership
•  When another node joins or leaves the cluster, this node
gets a notification and becomes aware of the change in
group membership
Recipe #2: Group Membership (cont)
•  Let /_MEMBERSHIP_ represent root of group membership
•  Client joining the group create ephemeral nodes under root
•  All members of group will register for watch events on /
_MEMBERSHIP, thereby being aware of other members in
group
L = getChildren(“/_MEMBERSHIP”, true)
•  When new client joins group, all other members are notified
•  Similarly, a client leaves due to failure or otherwise,
ZooKeeper automatically delete node, trigger event
•  Live members know which node joined or left by looking at
the list of children L
References
[1]. Apache ZooKeeper, http://zookeeper.apache.org
[2]. Introduction to Apache ZooKeeper,
http://www.slideshare.net/sauravhaloi
[3]. Saurav Haloi, Apache Zookeeper Essentials, 2015
Questions?
Thank You!

More Related Content

What's hot

Intro to HBase
Intro to HBaseIntro to HBase
Intro to HBase
alexbaranau
 
Need for Time series Database
Need for Time series DatabaseNeed for Time series Database
Need for Time series Database
Pramit Choudhary
 
Intro to HBase Internals & Schema Design (for HBase users)
Intro to HBase Internals & Schema Design (for HBase users)Intro to HBase Internals & Schema Design (for HBase users)
Intro to HBase Internals & Schema Design (for HBase users)
alexbaranau
 
Hadoop & MapReduce
Hadoop & MapReduceHadoop & MapReduce
Hadoop & MapReduce
Newvewm
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기
NHN FORWARD
 
Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper
Omid Vahdaty
 
Minio Cloud Storage
Minio Cloud StorageMinio Cloud Storage
Minio Cloud Storage
Minio
 
Apache Flink Deep Dive
Apache Flink Deep DiveApache Flink Deep Dive
Apache Flink Deep Dive
DataWorks Summit
 
How to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor NettyHow to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor Netty
VMware Tanzu
 
Grafana introduction
Grafana introductionGrafana introduction
Grafana introduction
Rico Chen
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
Mirantis
 
Understanding Presto - Presto meetup @ Tokyo #1
Understanding Presto - Presto meetup @ Tokyo #1Understanding Presto - Presto meetup @ Tokyo #1
Understanding Presto - Presto meetup @ Tokyo #1
Sadayuki Furuhashi
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Arnab Mitra
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
SATOSHI TAGOMORI
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
Taras Matyashovsky
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
Aparna Pillai
 
CockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseCockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL Database
C4Media
 
Monitoring Apache Kafka with Confluent Control Center
Monitoring Apache Kafka with Confluent Control Center   Monitoring Apache Kafka with Confluent Control Center
Monitoring Apache Kafka with Confluent Control Center
confluent
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
confluent
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking VN
 

What's hot (20)

Intro to HBase
Intro to HBaseIntro to HBase
Intro to HBase
 
Need for Time series Database
Need for Time series DatabaseNeed for Time series Database
Need for Time series Database
 
Intro to HBase Internals & Schema Design (for HBase users)
Intro to HBase Internals & Schema Design (for HBase users)Intro to HBase Internals & Schema Design (for HBase users)
Intro to HBase Internals & Schema Design (for HBase users)
 
Hadoop & MapReduce
Hadoop & MapReduceHadoop & MapReduce
Hadoop & MapReduce
 
[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기[2018] MySQL 이중화 진화기
[2018] MySQL 이중화 진화기
 
Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper
 
Minio Cloud Storage
Minio Cloud StorageMinio Cloud Storage
Minio Cloud Storage
 
Apache Flink Deep Dive
Apache Flink Deep DiveApache Flink Deep Dive
Apache Flink Deep Dive
 
How to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor NettyHow to Avoid Common Mistakes When Using Reactor Netty
How to Avoid Common Mistakes When Using Reactor Netty
 
Grafana introduction
Grafana introductionGrafana introduction
Grafana introduction
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
 
Understanding Presto - Presto meetup @ Tokyo #1
Understanding Presto - Presto meetup @ Tokyo #1Understanding Presto - Presto meetup @ Tokyo #1
Understanding Presto - Presto meetup @ Tokyo #1
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
The Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and ContainersThe Patterns of Distributed Logging and Containers
The Patterns of Distributed Logging and Containers
 
From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.From cache to in-memory data grid. Introduction to Hazelcast.
From cache to in-memory data grid. Introduction to Hazelcast.
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
CockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseCockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL Database
 
Monitoring Apache Kafka with Confluent Control Center
Monitoring Apache Kafka with Confluent Control Center   Monitoring Apache Kafka with Confluent Control Center
Monitoring Apache Kafka with Confluent Control Center
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
 

Similar to Apache Zookeeper

Meetup on Apache Zookeeper
Meetup on Apache ZookeeperMeetup on Apache Zookeeper
Meetup on Apache Zookeeper
Anshul Patel
 
Scalable IoT platform
Scalable IoT platformScalable IoT platform
Scalable IoT platform
Swapnil Bawaskar
 
Windows 8 Apps and the Outside World
Windows 8 Apps and the Outside WorldWindows 8 Apps and the Outside World
Benchmarking Solr Performance at Scale
Benchmarking Solr Performance at ScaleBenchmarking Solr Performance at Scale
Benchmarking Solr Performance at Scale
thelabdude
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
Prabhakaran Soundarapandian
 
Cassandra
CassandraCassandra
Cassandra
exsuns
 
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
InfluxData
 
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
DataStax
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJS
Lilia Sfaxi
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...
Jimmy Lai
 
Migrating To PostgreSQL
Migrating To PostgreSQLMigrating To PostgreSQL
Migrating To PostgreSQL
Grant Fritchey
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
zeeg
 
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
DataStax
 
OrigoDB - take the red pill
OrigoDB - take the red pillOrigoDB - take the red pill
OrigoDB - take the red pill
Robert Friberg
 
SQL Server Deep Drive
SQL Server Deep Drive SQL Server Deep Drive
SQL Server Deep Drive
DataArt
 
Advance HBase and Zookeeper - Module 8
Advance HBase and Zookeeper - Module 8Advance HBase and Zookeeper - Module 8
Advance HBase and Zookeeper - Module 8
Rohit Agrawal
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuning
Michel Schildmeijer
 
Introduction to SolrCloud
Introduction to SolrCloudIntroduction to SolrCloud
Introduction to SolrCloud
Varun Thacker
 
Deploying and managing Solr at scale
Deploying and managing Solr at scaleDeploying and managing Solr at scale
Deploying and managing Solr at scale
Anshum Gupta
 
Architecting for Microservices Part 2
Architecting for Microservices Part 2Architecting for Microservices Part 2
Architecting for Microservices Part 2
Elana Krasner
 

Similar to Apache Zookeeper (20)

Meetup on Apache Zookeeper
Meetup on Apache ZookeeperMeetup on Apache Zookeeper
Meetup on Apache Zookeeper
 
Scalable IoT platform
Scalable IoT platformScalable IoT platform
Scalable IoT platform
 
Windows 8 Apps and the Outside World
Windows 8 Apps and the Outside WorldWindows 8 Apps and the Outside World
Windows 8 Apps and the Outside World
 
Benchmarking Solr Performance at Scale
Benchmarking Solr Performance at ScaleBenchmarking Solr Performance at Scale
Benchmarking Solr Performance at Scale
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
 
Cassandra
CassandraCassandra
Cassandra
 
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
 
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
Cassandra Tools and Distributed Administration (Jeffrey Berger, Knewton) | C*...
 
Server-side JS with NodeJS
Server-side JS with NodeJSServer-side JS with NodeJS
Server-side JS with NodeJS
 
Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...Distributed system coordination by zookeeper and introduction to kazoo python...
Distributed system coordination by zookeeper and introduction to kazoo python...
 
Migrating To PostgreSQL
Migrating To PostgreSQLMigrating To PostgreSQL
Migrating To PostgreSQL
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
 
OrigoDB - take the red pill
OrigoDB - take the red pillOrigoDB - take the red pill
OrigoDB - take the red pill
 
SQL Server Deep Drive
SQL Server Deep Drive SQL Server Deep Drive
SQL Server Deep Drive
 
Advance HBase and Zookeeper - Module 8
Advance HBase and Zookeeper - Module 8Advance HBase and Zookeeper - Module 8
Advance HBase and Zookeeper - Module 8
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuning
 
Introduction to SolrCloud
Introduction to SolrCloudIntroduction to SolrCloud
Introduction to SolrCloud
 
Deploying and managing Solr at scale
Deploying and managing Solr at scaleDeploying and managing Solr at scale
Deploying and managing Solr at scale
 
Architecting for Microservices Part 2
Architecting for Microservices Part 2Architecting for Microservices Part 2
Architecting for Microservices Part 2
 

More from Nguyen Quang

Apache Storm
Apache StormApache Storm
Apache Storm
Nguyen Quang
 
Deep Reinforcement Learning
Deep Reinforcement LearningDeep Reinforcement Learning
Deep Reinforcement Learning
Nguyen Quang
 
Deep Dialog System Review
Deep Dialog System ReviewDeep Dialog System Review
Deep Dialog System Review
Nguyen Quang
 
Sequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural NetworksSequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural Networks
Nguyen Quang
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandra
Nguyen Quang
 
Web browser architecture
Web browser architectureWeb browser architecture
Web browser architecture
Nguyen Quang
 
Eclipse orion
Eclipse orionEclipse orion
Eclipse orion
Nguyen Quang
 
X Query for beginner
X Query for beginnerX Query for beginner
X Query for beginner
Nguyen Quang
 
Html 5
Html 5Html 5
Html 5
Nguyen Quang
 
Redistributable introtoscrum
Redistributable introtoscrumRedistributable introtoscrum
Redistributable introtoscrum
Nguyen Quang
 
Text categorization
Text categorizationText categorization
Text categorization
Nguyen Quang
 
A holistic lexicon based approach to opinion mining
A holistic lexicon based approach to opinion miningA holistic lexicon based approach to opinion mining
A holistic lexicon based approach to opinion mining
Nguyen Quang
 
Overview of NoSQL
Overview of NoSQLOverview of NoSQL
Overview of NoSQL
Nguyen Quang
 

More from Nguyen Quang (13)

Apache Storm
Apache StormApache Storm
Apache Storm
 
Deep Reinforcement Learning
Deep Reinforcement LearningDeep Reinforcement Learning
Deep Reinforcement Learning
 
Deep Dialog System Review
Deep Dialog System ReviewDeep Dialog System Review
Deep Dialog System Review
 
Sequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural NetworksSequence to Sequence Learning with Neural Networks
Sequence to Sequence Learning with Neural Networks
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandra
 
Web browser architecture
Web browser architectureWeb browser architecture
Web browser architecture
 
Eclipse orion
Eclipse orionEclipse orion
Eclipse orion
 
X Query for beginner
X Query for beginnerX Query for beginner
X Query for beginner
 
Html 5
Html 5Html 5
Html 5
 
Redistributable introtoscrum
Redistributable introtoscrumRedistributable introtoscrum
Redistributable introtoscrum
 
Text categorization
Text categorizationText categorization
Text categorization
 
A holistic lexicon based approach to opinion mining
A holistic lexicon based approach to opinion miningA holistic lexicon based approach to opinion mining
A holistic lexicon based approach to opinion mining
 
Overview of NoSQL
Overview of NoSQLOverview of NoSQL
Overview of NoSQL
 

Recently uploaded

TheFutureIsDynamic-BoxLang-CFCamp2024.pdf
TheFutureIsDynamic-BoxLang-CFCamp2024.pdfTheFutureIsDynamic-BoxLang-CFCamp2024.pdf
TheFutureIsDynamic-BoxLang-CFCamp2024.pdf
Ortus Solutions, Corp
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
Microsoft-Power-Platform-Adoption-Planning.pptx
Microsoft-Power-Platform-Adoption-Planning.pptxMicrosoft-Power-Platform-Adoption-Planning.pptx
Microsoft-Power-Platform-Adoption-Planning.pptx
jrodriguezq3110
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
kalichargn70th171
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
Streamlining End-to-End Testing Automation
Streamlining End-to-End Testing AutomationStreamlining End-to-End Testing Automation
Streamlining End-to-End Testing Automation
Anand Bagmar
 
42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert
vaishalijagtap12
 
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA ComplianceSecure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
ICS
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
Pedro J. Molina
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.
KrishnaveniMohan1
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Vince Scalabrino
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
What’s New in VictoriaLogs - Q2 2024 Update
What’s New in VictoriaLogs - Q2 2024 UpdateWhat’s New in VictoriaLogs - Q2 2024 Update
What’s New in VictoriaLogs - Q2 2024 Update
VictoriaMetrics
 
Hands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion StepsHands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion Steps
servicesNitor
 
Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
WebConnect Pvt Ltd
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
kalichargn70th171
 

Recently uploaded (20)

TheFutureIsDynamic-BoxLang-CFCamp2024.pdf
TheFutureIsDynamic-BoxLang-CFCamp2024.pdfTheFutureIsDynamic-BoxLang-CFCamp2024.pdf
TheFutureIsDynamic-BoxLang-CFCamp2024.pdf
 
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
Microsoft-Power-Platform-Adoption-Planning.pptx
Microsoft-Power-Platform-Adoption-Planning.pptxMicrosoft-Power-Platform-Adoption-Planning.pptx
Microsoft-Power-Platform-Adoption-Planning.pptx
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
Streamlining End-to-End Testing Automation
Streamlining End-to-End Testing AutomationStreamlining End-to-End Testing Automation
Streamlining End-to-End Testing Automation
 
42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert42 Ways to Generate Real Estate Leads - Sellxpert
42 Ways to Generate Real Estate Leads - Sellxpert
 
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA ComplianceSecure-by-Design Using Hardware and Software Protection for FDA Compliance
Secure-by-Design Using Hardware and Software Protection for FDA Compliance
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.Penify - Let AI do the Documentation, you write the Code.
Penify - Let AI do the Documentation, you write the Code.
 
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery FleetStork Product Overview: An AI-Powered Autonomous Delivery Fleet
Stork Product Overview: An AI-Powered Autonomous Delivery Fleet
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
What’s New in VictoriaLogs - Q2 2024 Update
What’s New in VictoriaLogs - Q2 2024 UpdateWhat’s New in VictoriaLogs - Q2 2024 Update
What’s New in VictoriaLogs - Q2 2024 Update
 
Hands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion StepsHands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion Steps
 
Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
 

Apache Zookeeper

  • 1. APACHE ZOOKEEPER Viet-Dung TRINH (Bill), 03/2016 Saltlux – Vietnam Development Center
  • 2. Agenda •  Overview •  The ZooKeeper Service •  The ZooKeeper Data Model •  Recipes
  • 3. Overview – What is ZooKeeper? •  An open source, high-performance coordination service for distributed application. •  Exposes common services in simple interface: •  Naming •  Configuration management •  Locks & synchronization •  Groups services •  Build your own on it for specific needs
  • 4. Overview – Who uses ZooKeeper? •  Companies: •  Yahoo! •  Zynga •  Rackspace •  Linkedlin •  Netflix, and many more… •  Projects: •  Apache Map/Reduce (Yarn) •  Apache HBase •  Apache Kafka •  Apache Storm •  Neo4j, and many more…
  • 5. Overview – ZooKeeper Use Cases •  Configuration Management •  Cluster member nodes bootstrapping configuration from a centralized source in unattended way •  Distributed Cluster Management •  Node join / leave •  Node statuses in real time •  Naming service – e.g. DNS •  Distributed synchronization – locks, barriers, queues •  Leader election in a distributed system
  • 6. The ZooKeeper Service (ZKS) •  ZooKeeper Service is replicated over a set of machines •  All machines store a copy of the data (in-memory) •  A leader is elected on service startup •  Clients only connect to a single ZooKeeper server and maintain a TCP connection
  • 7. The ZKS - Sessions •  Before executing any request, client must establish a session with service •  All operations client summits to service are associated to a session •  Client initially connects to any server in ensemble, and only to single server. •  Session offer order guarantees – requests in session are executed in FIFO order
  • 8. The ZKS – Session States and Lifetime •  Main possible states: CONNECTING, CONNECTED, CLOSED, NOT_CONNECTED
  • 9. The ZooKeeper Data Model (ZDM) •  Hierarchal name space •  Each node is called as a ZNode •  Every ZNode has data (given as byte[]) and can optionally have children •  ZNode paths: •  Canonical, absolute, slash-separated •  No relative references •  Names can have Unicode characters •  ZNode maintain stat structure
  • 10. ZDM - Versions •  Eash Znode has version number, is incremented every time its data changes •  setData and delete take version as input, operation succeeds only if client’s version is equal to server’s one
  • 11. ZDM – ZNodes – Stat Structure •  The Stat structure for each znode in ZooKeeper is made up of the following fields: •  czxid •  mzxid •  pzxid •  ctime •  mtime •  dataVersion •  cversion •  aclVersion •  ephemeralOwner •  dataLength •  numChildren
  • 12. ZDM – Types of ZNode •  Persistent ZNode •  Have lifetime in ZooKeeper’s namespace until they’re explicitly deleted (can be deleted by delete API call) •  Ephemeral ZNode •  Is deleted by ZooKeeper service when the creating client’s session ends •  Can also be explicitly deleted •  Are not allowed to have children •  Sequential Znode •  Is assigned a sequence number by ZooKeeper as a part of name during creation •  Sequence number is integer (4bytes) with format of 10 digits with 0 padding. E.g. /path/to/znode-0000000001
  • 13. ZDM – Znode Operations
  • 14. ZDM – Znode – Reads & Writes •  Read requests are processed locally at the ZooKeeper server to which client is currently connected •  Write requests are forwarded to leader and go through majority consensus before a response is generated
  • 15. ZDM – Consistency Guarantees •  Sequential Consistency •  Atomicity •  Single System Image •  Reliability •  Timeliness (Eventual Consistency)
  • 16. ZDM - Watches •  A watch event is one-time trigger, sent to client that set watch, which occurs when data for which watch was set changes. •  Watches allow clients to get notifications when a znode changes in any way (NodeChildrenChanged, NodeCreated, NodeDataChanged,NodeDeleted) •  All of read operations – getData(), getChildren(), exists() – have option of setting watch •  ZooKeeper Guarantees about Watches: •  Watches are ordered, order of watch events corresponds to the order of the updates •  A client will see a watch event for znode it is watching before seeing the new data that corresponds to that znode
  • 17. ZDM – Watches (cont)
  • 18. ZDM – Access Control List •  ZooKeeper uses ACLs to control access to its znodes •  ACLs are made up of pairs of (scheme:id, permission) •  Build-in ACL schemes •  world: has single id, anyone •  auth: doesn’t use any id, represents any authenticated user •  digest: use a username:password •  host: use the client host name as ACL id identity •  ip: use the client host IP as ACL id identity •  ACL Permissions: •  CREATE •  READ •  WRITE •  DELETE •  ADMIN •  E.g. (ip:192.168.0.0/16, READ)
  • 19. Recipe #1: Queue •  A distributed queue is very common data structure used in distributed systems. •  Producer: generate / create new items and put them into queue •  Consumer: remove items from queue and process them •  Addition and removal of items follow ordering of FIFO
  • 20. Recipe #1: Queue (cont) •  A ZNode will be designated to hold a queue instance, queue-znode •  All queue items are stored as znodes under queue-znode •  Producers add an item to queue by creating znode under queue-znode •  Consumers retrieve items by getting and then deleting a child from queue-znode QUEUE-ZNODE : “queue instance” |-- QUEUE-0000000001 : “item1” |-- QUEUE-0000000002 : “item2” |-- QUEUE-0000000003 : “item3”
  • 21. Recipe #1: Queue (cont) •  Let /_QUEUE_ represent top-level znode, is called queue- znode •  Producer put something into queue by creating a SEQUENCE_EPHEMERAL znode with name “queue-N”, N is monotonically increasing number create (“queue-”, SEQUENCE_EPHEMARAL) •  Consumer process getChildren() call on queue-znode with watch event set to true M = getChildren(/_QUEUE_, true) •  Client picks up items from list and continues processing until reaching the end of the list, and then check again •  The algorithm continues until get_children() returns empty list
  • 22. Recipe #2: Group Membership •  A persistent Znode /membership represent the root of the group in ZooKeeper tree •  Any client that joins the cluster creates ephemeral znode under /membership to locate memberships in tree and set a watch on /membership •  When another node joins or leaves the cluster, this node gets a notification and becomes aware of the change in group membership
  • 23. Recipe #2: Group Membership (cont) •  Let /_MEMBERSHIP_ represent root of group membership •  Client joining the group create ephemeral nodes under root •  All members of group will register for watch events on / _MEMBERSHIP, thereby being aware of other members in group L = getChildren(“/_MEMBERSHIP”, true) •  When new client joins group, all other members are notified •  Similarly, a client leaves due to failure or otherwise, ZooKeeper automatically delete node, trigger event •  Live members know which node joined or left by looking at the list of children L
  • 24. References [1]. Apache ZooKeeper, http://zookeeper.apache.org [2]. Introduction to Apache ZooKeeper, http://www.slideshare.net/sauravhaloi [3]. Saurav Haloi, Apache Zookeeper Essentials, 2015