zk
is a command line client to the Zookeeper
distributed storage service designed to be fast, easy to install,
and Unix-friendly. It's written in Go.
Install with:
$ go get github.com/mmcgrana/zk
And use with e.g.:
$ echo data | zk create /path
$ zk get /path
data
$ echo new-data | zk set /path
$ zk get /path
new-data
$ zk children /
path
namespace
zookeeper
Use zk help
or zk help <command>
to see full usage details:
$ zk help
Usage: zk <command> [arguments] [options]
Commands:
exists show if node exists
stat show node details
get show node data
create create node with initial data
set write node data
delete delete node
children list node children
help show help
Run 'zk help <command>' for details.
Commands exists
, get
, and children
accept --watch
options
to trigger the installation of corresponding watches on the
requested node. For example:
$ bash -c "sleep 10; echo second-value | zk set /key" &
$ zk get /key --watch # pauses for ~10s, then returns
first-value
$ zk get /key # returns immediately
second-value
By default the client targets 127.0.0.1:2181
. To configure one or
more different Zookeepers to target, export ZOOKEPER_SERVERS
in
host:port
format with a ,
between each server. For example:
$ export ZOOKEEPER_SERVERS=23.22.49.116:2181,23.20.114.164:2181,54.197.120.188:2181
$ zk ...
You may be interested in these other Zookeper command line clients:
The zk
project borrows much of its CLI scaffolding and therefore
CLI aesthetic from the hk
project.
Like hk
, zk
is designed to behave like a standard Unix tool and
be composed with other such tools.
Please see CONTRIBUTING.md.
Please see LICENSE.md