SlideShare a Scribd company logo
1 of 26
Download to read offline
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

Apache Zookeeper Explained: Tutorial, Use Cases and Zookeeper Java API Examples
Apache Zookeeper Explained: Tutorial, Use Cases and Zookeeper Java API ExamplesApache Zookeeper Explained: Tutorial, Use Cases and Zookeeper Java API Examples
Apache Zookeeper Explained: Tutorial, Use Cases and Zookeeper Java API ExamplesBinu George
 
Securing Hadoop with Apache Ranger
Securing Hadoop with Apache RangerSecuring Hadoop with Apache Ranger
Securing Hadoop with Apache RangerDataWorks Summit
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache CassandraRobert Stupp
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisDvir Volk
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Guido Schmutz
 
Apache Spark overview
Apache Spark overviewApache Spark overview
Apache Spark overviewDataArt
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013mumrah
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache SparkRahul Jain
 
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax EnterpriseTop 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax EnterpriseDataStax
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & FeaturesDataStax Academy
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explainedconfluent
 
Kafka for Real-Time Replication between Edge and Hybrid Cloud
Kafka for Real-Time Replication between Edge and Hybrid CloudKafka for Real-Time Replication between Edge and Hybrid Cloud
Kafka for Real-Time Replication between Edge and Hybrid CloudKai Wähner
 
Presto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EnginePresto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EngineDataWorks Summit
 
ksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database SystemksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database Systemconfluent
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internalsKostas Tzoumas
 
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike SteenbergenMeet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergendistributed matters
 

What's hot (20)

Apache Zookeeper Explained: Tutorial, Use Cases and Zookeeper Java API Examples
Apache Zookeeper Explained: Tutorial, Use Cases and Zookeeper Java API ExamplesApache Zookeeper Explained: Tutorial, Use Cases and Zookeeper Java API Examples
Apache Zookeeper Explained: Tutorial, Use Cases and Zookeeper Java API Examples
 
Securing Hadoop with Apache Ranger
Securing Hadoop with Apache RangerSecuring Hadoop with Apache Ranger
Securing Hadoop with Apache Ranger
 
Introduction to Apache Cassandra
Introduction to Apache CassandraIntroduction to Apache Cassandra
Introduction to Apache Cassandra
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Deep Dive on Amazon Aurora
Deep Dive on Amazon AuroraDeep Dive on Amazon Aurora
Deep Dive on Amazon Aurora
 
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
Spark (Structured) Streaming vs. Kafka Streams - two stream processing platfo...
 
Apache Spark overview
Apache Spark overviewApache Spark overview
Apache Spark overview
 
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
Introduction and Overview of Apache Kafka, TriHUG July 23, 2013
 
Introduction to Apache Spark
Introduction to Apache SparkIntroduction to Apache Spark
Introduction to Apache Spark
 
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax EnterpriseTop 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
 
Apache Spark Architecture
Apache Spark ArchitectureApache Spark Architecture
Apache Spark Architecture
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Kafka for Real-Time Replication between Edge and Hybrid Cloud
Kafka for Real-Time Replication between Edge and Hybrid CloudKafka for Real-Time Replication between Edge and Hybrid Cloud
Kafka for Real-Time Replication between Edge and Hybrid Cloud
 
Presto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything EnginePresto: Optimizing Performance of SQL-on-Anything Engine
Presto: Optimizing Performance of SQL-on-Anything Engine
 
Sqoop
SqoopSqoop
Sqoop
 
ksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database SystemksqlDB: A Stream-Relational Database System
ksqlDB: A Stream-Relational Database System
 
Apache Flink internals
Apache Flink internalsApache Flink internals
Apache Flink internals
 
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike SteenbergenMeet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
Meet Spilo, Zalando’s HIGH-AVAILABLE POSTGRESQL CLUSTER - Feike Steenbergen
 

Similar to Apache Zookeeper

Meetup on Apache Zookeeper
Meetup on Apache ZookeeperMeetup on Apache Zookeeper
Meetup on Apache ZookeeperAnshul Patel
 
Benchmarking Solr Performance at Scale
Benchmarking Solr Performance at ScaleBenchmarking Solr Performance at Scale
Benchmarking Solr Performance at Scalethelabdude
 
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabCloudxLab
 
Cassandra
CassandraCassandra
Cassandraexsuns
 
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 NodeJSLilia Sfaxi
 
Migrating To PostgreSQL
Migrating To PostgreSQLMigrating To PostgreSQL
Migrating To PostgreSQLGrant Fritchey
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disquszeeg
 
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 pillRobert 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 8Rohit Agrawal
 
Oracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningOracle WebLogic Diagnostics & Perfomance tuning
Oracle WebLogic Diagnostics & Perfomance tuningMichel Schildmeijer
 
Introduction to SolrCloud
Introduction to SolrCloudIntroduction to SolrCloud
Introduction to SolrCloudVarun Thacker
 
Deploying and managing Solr at scale
Deploying and managing Solr at scaleDeploying and managing Solr at scale
Deploying and managing Solr at scaleAnshum Gupta
 
Architecting for Microservices Part 2
Architecting for Microservices Part 2Architecting for Microservices Part 2
Architecting for Microservices Part 2Elana 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
 
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLabIntroduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
Introduction to Apache ZooKeeper | Big Data Hadoop Spark Tutorial | CloudxLab
 
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
 
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

Deep Reinforcement Learning
Deep Reinforcement LearningDeep Reinforcement Learning
Deep Reinforcement LearningNguyen Quang
 
Deep Dialog System Review
Deep Dialog System ReviewDeep Dialog System Review
Deep Dialog System ReviewNguyen 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 NetworksNguyen Quang
 
Introduction to cassandra
Introduction to cassandraIntroduction to cassandra
Introduction to cassandraNguyen Quang
 
Web browser architecture
Web browser architectureWeb browser architecture
Web browser architectureNguyen Quang
 
X Query for beginner
X Query for beginnerX Query for beginner
X Query for beginnerNguyen Quang
 
Redistributable introtoscrum
Redistributable introtoscrumRedistributable introtoscrum
Redistributable introtoscrumNguyen Quang
 
Text categorization
Text categorizationText categorization
Text categorizationNguyen 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 miningNguyen 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

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Recently uploaded (20)

Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

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