This document provides syntax examples for common operations using ZooKeeper like creating znodes, getting and setting znode data, creating children, listing children, checking znode status, and removing znodes. The operations covered include creating standard, sequential, and ephemeral znodes, getting and watching znode data, setting znode data, creating child znodes, listing child znodes, getting znode status, and removing znodes. Examples are given for each operation syntax.
1 of 2
Downloaded 13 times
More Related Content
Quick reference for zookeeper commands
1. Create Znodes
=============
Syntax
------
create /path /data
create -s /path /data
create -e /path /data
Ex
--
create /FirstZnode "Myfirstzookeeper-app"
create -s /FirstZnode "second-data"
create -e /SecondZnode "Ephemeral-data"
--------------------------------------------------------------------------------
------------------------------------------------------
Get Data of a znode
===================
Syntax
------
get /path
Ex
--
get /FirstZnode
get /FirstZnode0000000003
--------------------------------------------------------------------------------
------------------------------------------------------
Watch Znode for Changes
=======================
Syntax
------
get /path [watch] 1
Ex
--
get /FirstZnode 1
--------------------------------------------------------------------------------
------------------------------------------------------
Set Data of a znode
===================
Syntax
------
set /path /data
Ex
--
set /SecondZnode "Data-updated"
set /FirstZnode "Mysecondzookeeper-app"
--------------------------------------------------------------------------------
------------------------------------------------------
Create Children of a znode
==========================
Syntax
------
create /parent/path/subnode/path /data
Ex
--
create /FirstZnode/Child1 "firstchildren"
create /FirstZnode/Child2 "secondchildren"
--------------------------------------------------------------------------------
------------------------------------------------------
List children of a znode