Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Apache ZooKeeper Essentials

You're reading from   Apache ZooKeeper Essentials A fast-paced guide to using Apache ZooKeeper to coordinate services in distributed systems

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784391324
Length 168 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Saurav Haloi Saurav Haloi
Author Profile Icon Saurav Haloi
Saurav Haloi
Arrow right icon
View More author details
Toc

The ZooKeeper operations

ZooKeeper's data model and its API support the following nine basic operations:

Operation

Description

create

Creates a znode in a specified path of the ZooKeeper namespace

delete

Deletes a znode from a specified path of the ZooKeeper namespace

exists

Checks if a znode exists in the path

getChildren

Gets a list of children of a znode

getData

Gets the data associated with a znode

setData

Sets/writes data into the data field of a znode

getACL

Gets the ACL of a znode

setACL

Sets the ACL in a znode

sync

Synchronizes a client's view of a znode with ZooKeeper

Let's look at the ZooKeeper operations mentioned in the preceding table using ZooKeeper Java shell:

  1. Create a znode called root with ThisIsTheRootNode as its data:
    [zk: localhost(CONNECTED) 0] create /root "ThisIsTheRootNode"
    Created /root
    
  2. Get the content of the just created znode root:
    [zk: localhost(CONNECTED) 1] get /root
    "ThisIsTheRootNode"
    ...
You have been reading a chapter from
Apache ZooKeeper Essentials
Published in: Jan 2015
Publisher:
ISBN-13: 9781784391324
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime