Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 2.29 KB

README.textile

File metadata and controls

62 lines (47 loc) · 2.29 KB

The Zookeeper Utilities

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:

Usage: zkutil <dump|import|purge> -c host:port [options]
dump
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

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

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

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

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>           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
purge

Delete all data from the path.

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