README.txt 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ==========================================
  2. zktreeutil - Zookeeper Tree Data Utility
  3. Author: Anirban Roy
  4. Organization: Yahoo Inc.
  5. ==========================================
  6. zktreeutil program is intended to manage and manipulate zk-tree data quickly, effi-
  7. ciently and with ease. The utility operates on free-form ZK-tree and hence can be used
  8. for any cluster managed by Zookeeper. Here are the basic functionalities -
  9. EXPORT: The whole/partial ZK-tree is exported into a XML file. This helps in
  10. capturing a current snapshot of the data for backup/analysis. For a subtree
  11. export, one need to specify the path to the ZK-subtree with proper option.
  12. IMPORT: The ZK-tree can be imported from XML into ZK cluster. This helps in priming
  13. the new ZK cluster with static configuration. The import can be non-intrusive by
  14. making only the additions in the existing data. The import of subtree is also
  15. possible by optionally providing the path to the ZK-subtree.
  16. DIFF: Creates a diff between live ZK data vs data saved in XML file. Diff can ignore
  17. some ZK-tree branches (possibly dynamic data) on reading the optional ignore flag
  18. from XML file. Diffing on a ZK-subtree achieved by providing path to ZK-subtree with
  19. diff command.
  20. UPDATE: Make the incremental changes into the live ZK-tree from saved XML, essentia-
  21. lly after running the diff.
  22. DUMP: Dumps the ZK-tree on the standard output device reading either from live ZK
  23. server or XML file. Like export, ZK-subtree can be dumped with optionally
  24. providing the path to the ZK-subtree, and till a certain depth of the (sub)tree.
  25. The exported ZK data into XML file can be shortened by only keeping the static ZK
  26. nodes which are required to prime a cluster. The dynamic zk nodes (created on-the-
  27. fly) can be ignored by setting a 'ignore' attribute at the root node of the dynamic
  28. subtree (see tests/zk_sample.xml), possibly deleting all inner ZK nodes under that.
  29. Once ignored, the whole subtree is ignored during DIFF, UPDATE and WRITE.
  30. Pre-requisites
  31. --------------
  32. 1. Linux system with 2.6.X kernel.
  33. 2. Zookeeper C client library (locally built at ../../zookeeper-client/zookeeper-client-c/target/c/.libs) >= 3.X.X
  34. 3. Development build libraries (rpm packages):
  35. a. boost-devel >= 1.32.0
  36. b. libxml2-devel >= 2.7.3
  37. c. log4cxx0100-devel >= 0.10.0
  38. Build instructions
  39. ------------------
  40. 1. cd into this directory
  41. 2. autoreconf -if
  42. 3. ./configure
  43. 4. make
  44. 5. 'zktreeutil' binary created under src directory
  45. Limitations
  46. -----------
  47. Current version works with text data only, binary data will be supported in future
  48. versions.
  49. Testing and usage of zktreeutil
  50. --------------------------------
  51. 1. Run Zookeeper server locally on port 2181
  52. 2. export LD_LIBRARY_PATH=../../zookeeper-client/zookeeper-client-c/target/c/.libs
  53. 3. ./src/zktreeutil --help # show help
  54. 4. ./src/zktreeutil --zookeeper=localhost:2181 --import --xmlfile=tests/zk_sample.xml 2>/dev/null # import sample ZK tree
  55. 5. ./src/zktreeutil --zookeeper=localhost:2181 --dump --path=/myapp/version-1.0 2>/dev/null # dump Zk subtree
  56. 5. ./src/zktreeutil --zookeeper=localhost:2181 --dump --depth=3 2>/dev/null # dump Zk tree till certain depth
  57. 6. ./src/zktreeutil --xmlfile=zk_sample.xml -D 2>/dev/null # dump the xml data
  58. 7. Change zk_sample.xml with adding/deleting/chaging some nodes
  59. 8. ./src/zktreeutil -z localhost:2181 -F -x zk_sample.xml -p /myapp/version-1.0/configuration 2>/dev/null # take a diff of changes
  60. 9. ./src/zktreeutil -z localhost:2181 -E 2>/dev/null > zk_sample2.xml # export the mofied ZK tree
  61. 10. ./src/zktreeutil -z localhost:2181 -U -x zk_sample.xml -p /myapp/version-1.0/distributions 2>/dev/null # update with incr. changes
  62. 11. ./src/zktreeutil --zookeeper=localhost:2181 --import --force --xmlfile=zk_sample2.xml 2>/dev/null # re-prime the ZK tree
  63. 12. ./src/zktreeutil --zookeeper=localhost:2188 --dump --ssl=/path/certs/root_ca.pem,/path/certs/node.crt,/path/certs/node.key # connect with ssl params to the secureClientPort