zookeeper-util icon indicating copy to clipboard operation
zookeeper-util copied to clipboard

Zookeeper management helpers for importing, exporting and purging of zk data

The Zookeeper Utilities

p. The zookeeper utilities are meant to help automating some administrative tasks with zookeeper test instances. All operations implicitly exclude the /zookeeper path. Please try not to use with production instances.

  • export (read) data from a running zk instance into a file ** keep the data editable
  • import (write) a full (or partial) export off of another zk instance
  • purge (delete) all data from a running zk instance

There is only one executable (zkutil) that understands the three commands specified above with the following options:

bc. Usage: zkutil <dump|import|purge> -c host:port [options]

h5. dump

bc. zkutil dump -h Usage: zk_dump.rb [options] -c host:port -c, --connectstring host:port the server to connect to -s, --separator sep separator /path[::]data -p, --start_path path path to dump, defaults to '/' -v, --verbose Output more information -h, --help Display this screen

p. Will print a text representation to STDOUT (which you can redirect into a dump file) looking like this:

pre. / /conf /conf/entries /conf/entries/00 /conf/entries/00/host1::192.168.1.211 /conf/entries/00/host2::192.168.1.213 ...

h5. import

Can either import from a file or take alternatively path + data as parameters

bc. zkutil import -h Usage: zk_import.rb [options] -c host:port -p /some/path -n somedata or zk_import.rb -c host:port -f </some/file/name> -c, --connectstring host:port defaults to -s, --separator sep separator /path[::]data -p, --path path path to create or delete -n, --node_data data to add to the node, if creating -d, --delete Output more information -f, --file FILE the import file to read from -v, --verbose Output more information -h, --help Display this screen

h5. purge

Delete all data from the path.

bc. zkutil purge -h Usage: zk_purge.rb [options] -c host:port -c, --connectstring host:port defaults to -p, --path path path to purge, defaults to '/' -v, --verbose Output more information -h, --help Display this screen