Skip to content

# zookeepercli: lightweight, powerful, controlled command line client for ZooKeeper

Development Linux command line go Open Source ZooKeeper September 17, 2014

I’m happy to announce the availability of zookeepercli: a lightweight, simple, fast and controlled command line client for ZooKeeper.

zookeepercli allows for:

- Basic CRUD-like operations: `create`, `set`, `delete`, `exists`, `get`, `ls` (aka `children`).
- Extended operations: `lsr` (ls recursive), `creater` (create recursively)
- Well formatted and controlled output: supporting either `txt` or `json` format
- Single, no-dependencies binary file, based on a native Go ZooKeeper library by github.com/samuel/go-zookeeper (LICENSE)

I was dissatisfied with existing command line access to ZooKeeper. Uncontrolled and noisy output as well as large footprint were among the reasons. zookeepercli overcomes the above and provides with often required powers.

Usage samples:

>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c create /demo_only "path placeholder"
>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c create /demo_only/key1 "value1"
>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c create /demo_only/key2 "value2"
>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c create /demo_only/key3 "value3"

>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c ls /demo_only
>     key3
>     key2
>     key1

>     # Same as above, JSON format output:
>     $ zookeepercli --servers srv-1,srv-2,srv-3 --format=json -c ls /demo_only
>     ["key3","key2","key1"]

>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c delete /demo_only/key1
>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c delete /demo_only/key2
>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c delete /demo_only/key3
>     $ zookeepercli --servers srv-1,srv-2,srv-3 -c delete /demo_only

>     # Create a path recursively (auto-generate parent directories if not exist):
>     $ zookeepercli --servers=srv-1,srv-2,srv-3 -c creater "/demo_only/child/key1" "val1"
>     $ zookeepercli --servers=srv-1,srv-2,srv-3 -c creater "/demo_only/child/key2" "val2"

>     $ zookeepercli --servers=srv-1,srv-2,srv-3 -c get "/demo_only/child/key1"
>     val1

>     # This path was auto generated due to recursive create:
>     $ zookeepercli --servers=srv-1,srv-2,srv-3 -c get "/demo_only"
>     zookeepercli auto-generated

>     # ls recursively a path and all sub children:
>     $ zookeepercli --servers=srv-1,srv-2,srv-3 -c lsr "/demo_only"
>     child
>     child/key1
>     child/key2

zookeepercli is released as open source by Outbrain under the Apache 2.0 license.

Quick links:

- Project page
- Pre-built binaries for download
- License

- Twitter
- LinkedIn
- WhatsApp
- Email
- Facebook
- Print

###
9
Leave a Reply

6 Comment threads
3 Thread replies
0 Followers
Most reacted comment
Hottest comment thread
3 Comment authors
Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe
Notify of
Guest
CEPE.sql

Good. We use this one at home.
https://github.com/rs/zkfarmer

Author
shlomi

Nice! Thanks for the tip — will take a look

Guest
CEPE.sql

Do you use zookeeper to manager master/slave DBs?

Author
shlomi

No. Our zookeeper setup has almost nothing to do with mysql, actually. At least not directly. I’m personally using it as a distributed, cross DC, highly available key-value store, where I keep note of available mysql snapshots and of general mysql health.

Guest
CEPE.sql

Ok, nice.
No problem with intensive writes? (if occurs)

Author
shlomi

No intensive writes. This is not OLTP. I write at most once per 3-4 seconds, worst case, and I really don’t care about a few seconds latency (actually I don’t care about a minute latency, and for some data even for 30 minutes latency)

Guest
CEPE.sql

Ok, thanks for details Shlomi.

Guest
Priya

Thanks for this library. I am looking to update znode data using this library. I am getting error “FATAL zk: version conflict”. My Zookeeper version: 3.3.3. Please advice.

Author
shlomi

@Priya,

I’m going to have to relay you to the underlying library, https://godoc.org/github.com/samuel/go-zookeeper/zk, where I can find the ErrBadVersion constant declared.

Sorry I can’t help more than that. For what it’s worth, Im using ZooKeeper 3.3.5

wpDiscuz
Send to Email Address Your Name Your Email Address Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.