Utility script for import/export ztrees to/from a ZooKeeper Server.
This tool uses Yaml format and is intended to help loading configurations for Spring Cloud Config ZooKeeper.
mvn -Dartifact=net.therore.zookeeperdump:therore-zookeeperdump:LATEST:groovy -q -Ddest=zookeeperdump.groovy dependency:get
To print the help message execute zookeeperdump.groovy without parameters.
usage: zookeeperdump.groovy [-s {ip:port}] [-x | -c] [-u scheme:id] [-a {scheme:id:perm,scheme:id:perm...}] zpath
-a,--acls <arg> set acls used for creation
-c,--create import tree in yaml format from stdin
-s,--server <arg> zookeeper server connection. By default localhost:2181
-u,--auth <arg> set session authentication
-x,--extract extract tree in yaml format to stdout
examples:
> zookeeperdump.groovy -x /config/application > dump.yml
> zookeeperdump.groovy -c /config/application < dump.yml
> zookeeperdump.groovy -x /config/application/scheduler/timeout
> echo 1000 | zookeeperdump.groovy -c /config/application/scheduler/timeout
> zookeeperdump.groovy -u digest:usr:pwd -a digest:usr:uPIxv8DxE/mT5RPGVrsDMJnQoTQ=:rw -c /config/application < dump.yml
> zookeeperdump.groovy -u digest:usr:pwd -a digest:usr:uPIxv8DxE/mT5RPGVrsDMJnQoTQ=:r -c /config/application < dump.yml
> zookeeperdump.groovy -u digest:super:secret -c /config/myapplication < dump.yml
> zookeeperdump.groovy -u digest:super:secret -x /config/myapplication > dump.yml
This is an example of a yaml file to import
---
organizations:
departments:
office[0]:
employee[0]:
email: "tom@mail.com"
name: "Tom"
employee[1]:
name: "James"
employee[2]:
name: "Mark"
area: "marketing"
office[1]:
employee[0]:
name: "Steve"
employee[1]:
name: "Richard"
area: "distribution"
We could import that yaml file using this command
zookeeperdump.groovy -c /config/application < dump.yml
We could use this similar command for exporting.
zookeeperdump.groovy -x /config/application > dump.yml