Skip to main content

A Python - Kazoo based - shell for ZooKeeper

Project description

zk_shell
========

A Python - [Kazoo](https://github.com/python-zk/kazoo "Kazoo") based - shell for [ZooKeeper](http://zookeeper.apache.org/ "ZooKeeper").

This is a clone of the Java ZooKeeper CLI that ships with Apache ZooKeeper
that I use for similar things. But I prefer to use a Kazoo based one since
Kazoo is what the clients I deal with are using.

It supports the basic ops:

```
bin/shell localhost:2181
(CONNECTED) /> ls
zookeeper
(CONNECTED) /> create foo 'bar'
(CONNECTED) /> get foo
bar
(CONNECTED) /> cd foo
(CONNECTED) /foo> create ish 'barish'
(CONNECTED) /foo> cd ..
(CONNECTED) /> ls foo
ish
(CONNECTED) /> create temp- 'temp' true true
(CONNECTED) /> ls
zookeeper foo temp-0000000001
(CONNECTED) /> rmr foo
(CONNECTED) />
(CONNECTED) /> tree
.
├── zookeeper
│ ├── config
│ ├── quota
```

readline support is enabled (if readline is available).

You can also copy individual files from your local filesystem to a znode
in a ZooKeeper. Recursively copying from your filesystem to ZK is supported,
but not from ZK to your local filesystem (since znodes can have content and
children).

```
(CONNECTED) /> cp /etc/passwd zk://localhost:2181/passwd
(CONNECTED) /> get passwd
(...)
unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
```

Copying from one ZK cluster to another is supported, too:

```
(CONNECTED) /> cp zk://localhost:2181/passwd zk://othercluster:2183/mypasswd
```

You can also copy from znodes to a JSON file:

```
(CONNECTED) /> cp zk://localhost:2181/something json://!tmp!backup.json/ true true
```

Sometimes you want to debug watches in ZooKeeper - i.e.: how often do watches fire
under a given path? You can easily do that with the watch command.

This allows you to continously monitor all the child watches that, recursively,
fire under <path>:

```
(CONNECTED) /> watch start /
(CONNECTED) /> create /foo 'test'
(CONNECTED) /> create /bar/foo 'test'
(CONNECTED) /> rm /bar/foo
(CONNECTED) /> watch stats /

Watches Stats

/foo: 1
/bar: 2
/: 1
(CONNECTED) /> watch stop /
```

You can also search for paths or znodes which match a given text:

```
(CONNECTED) /> find / foo
/foo2
/fooish/wayland
/fooish/xorg
/copy/foo
```
Or if you want a case-insensitive match try ifind:

```
(CONNECTED) /> ifind / foo
/foo2
/FOOish/wayland
/fooish/xorg
/copy/Foo
```

Grepping for content in znodes can also be done via grep:

```
(CONNECTED) /> grep / unbound true
/passwd: unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin
/copy/passwd: unbound:x:992:991:Unbound DNS resolver:/etc/unbound:/sbin/nologin
```

Or use igrep for a case-insensitive version.


You can also use zk-shell in non-interactive mode:

```
$ zk-shell localhost --run-once "create /foo 'bar'"
$ zk-shell localhost --run-once "get /foo"
bar
```

Project details


Release history Release notifications

History Node

1.1.4

History Node

1.1.3

History Node

1.1.2

History Node

1.1.1

History Node

1.1.0

History Node

1.0.08

History Node

1.0.7

History Node

1.0.06

History Node

1.0.05

History Node

1.0.04

History Node

1.0.03

History Node

1.0.02

History Node

1.0.01

History Node

1.0.0

History Node

0.99.05

History Node

0.99.04

History Node

0.99.03

History Node

0.99.02

History Node

0.99.01

History Node

0.99.0

History Node

0.98.1

History Node

0.98.0

History Node

0.97.7

History Node

0.97.5

History Node

0.97.4

History Node

0.97.3

History Node

0.97.2

History Node

0.97.1

History Node

0.97.0

History Node

0.95.4

This version
History Node

0.95.3

History Node

0.95.2

History Node

0.95.1

History Node

0.95.0

History Node

0.94.6

History Node

0.94.5

History Node

0.94.4

History Node

0.94.3

History Node

0.94.2

History Node

0.94.1

History Node

0.94.0

History Node

0.93.3

History Node

0.93.2

History Node

0.93.1

History Node

0.93.0

History Node

0.92.8

History Node

0.92.7

History Node

0.92.6

History Node

0.92.5

History Node

0.92.4

History Node

0.92.3

History Node

0.92.2

History Node

0.92.1

History Node

0.92

History Node

0.9.11

History Node

0.9.10

History Node

0.9.9

History Node

0.9.8

History Node

0.9.7

History Node

0.9.6

History Node

0.9.5

History Node

0.9.4

History Node

0.9.3

History Node

0.9.2

History Node

0.9.1

History Node

0.9

History Node

0.8

History Node

0.7

History Node

0.6

History Node

0.5

History Node

0.4

History Node

0.3

History Node

0.2

History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
zk_shell-0.95.3.tar.gz (28.6 kB) Copy SHA256 hash SHA256 Source None May 29, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page