I have read that copying the data directory will work. But, that is a combination of logs and snapshots. How do folks backup a zookeeper infrastructure ? Export ? Dump ? Custom script ? What are the best practices ?
I have read that copying the data directory will work. But, that is a combination of logs and snapshots. How do folks backup a zookeeper infrastructure ? Export ? Dump ? Custom script ? What are the best practices ?
There's a very nice tool called zk-shell that can do an enormous amount of things with Zookeeper. It has a mirror command that can copy an entire Zookeeper tree recursively to/from Zookeeper or local JSON file.
Source & documentation: https://github.com/rgs1/zk_shell
Installation on Centos 7:
yum install python2-pip
pip install zk_shell
Example to back up a zookeeper tree to a local JSON file /tmp/zookeeper-backup.json:
zk-shell localhost:2181 --run-once 'mirror / json://!tmp!zookeeper-backup.json/'