Simple, lightweight, dependable CLI for ZooKeeper
zookeepercli is a non-interactive command line client for ZooKeeper. It provides with:
- Basic CRUD-like operations:
create
,set
,delete
,exists
,get
,ls
(akachildren
). - Extended operations:
lsr
(ls recursive),creater
(create recursively) - Well formatted and controlled output: supporting either
txt
orjson
format - Single, no-dependencies binary file, based on a native Go ZooKeeper library by github.com/samuel/go-zookeeper (LICENSE)
There are pre built binaries for download.
You can find RPM
and deb
packages, as well as pre-compiled, dependency free zookeepercli
executable binary.
In fact, the only file installed by the pre-built RPM
and deb
packages is said executable binary file.
Otherwise the source code is freely available; you will need git
installed as well as go
, and you're on your own.
$ zookeepercli --help
Usage of zookeepercli:
-c="": command (exists|get|ls|lsr|create|creater|set|delete)
-debug=false: debug mode (very verbose)
-force=false: force operation
-format="txt": output format (txt|json)
-servers="": srv1[:port1][,srv2[:port2]...]
-stack=false: add stack trace upon error
-verbose=false: verbose
$ zookeepercli --servers srv-1,srv-2,srv-3 -c create /demo_only some_value
# Default port is 2181. The above is equivalent to:
$ zookeepercli --servers srv-1:2181,srv-2:2181,srv-3:2181 -c create /demo_only some_value
$ zookeepercli --servers srv-1,srv-2,srv-3 --format=txt -c get /demo_only
some_value
# Same as above, JSON format output:
$ zookeepercli --servers srv-1,srv-2,srv-3 --format=json -c get /demo_only
"some_value"
# exists exits with exit code 0 when path exists, 1 when path does not exist
$ zookeepercli --servers srv-1,srv-2,srv-3 -c exists /demo_only
true
$ zookeepercli --servers srv-1,srv-2,srv-3 -c set /demo_only another_value
$ zookeepercli --servers srv-1,srv-2,srv-3 --format=json -c get /demo_only
"another_value"
$ zookeepercli --servers srv-1,srv-2,srv-3 -c delete /demo_only
$ zookeepercli --servers srv-1,srv-2,srv-3 -c get /demo_only
2014-09-15 04:07:16 FATAL zk: node does not exist
$ 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
2014-09-15 08:26:31 FATAL zk: node has children
$ 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
# /demo_only path now does not exist.
# Create recursively a path:
$ 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"
# "-c creater" is same as "-c create --force"
$ 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
The tool was built in order to allow with shell scripting seamless integration with ZooKeeper. There is another, official command line tool for ZooKeeper that the author found inadequate in terms of output format and output control, as well as large footprint. zookeepercli overcomes those limitations and provides with quick, well formatted output as well as enhanced functionality.
Release under the Apache 2.0 license
Authored by Shlomi Noach at Outbrain
zookeepercli's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.