Skip to content

bameur/therore-zookeeperdump

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

zookeeperdump

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.

Downloading the script

mvn -Dartifact=net.therore.zookeeperdump:therore-zookeeperdump:LATEST:groovy -q -Ddest=zookeeperdump.groovy dependency:get

Help command

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

Import Yaml into ZooKeeper

This is an example of a yaml file to import

dump.yml (example)
---
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"
command

We could import that yaml file using this command

zookeeperdump.groovy -c /config/application < dump.yml

Export Yaml from ZooKeeper

command

We could use this similar command for exporting.

zookeeperdump.groovy -x /config/application > dump.yml

Further ZooKeper Information

ZooKeeper Programmer's Guide

About

Import/Export utility for ZooKeeper

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 100.0%