Skip to main content
While the ZooKeeper Import/Export API lets you export information from Fusion’s ZooKeeper service, the Fusion distribution provides a script you can use to import or export ZooKeeper data through the ZKImportExport service. The zkImportExport.sh script is located in the top-level Fusion scripts directory.

Usage

The script takes the following command-line arguments:
-c,--cmd <arg>        Command, one of: 'export', 'import', 'update', 'delete'.

-e,--encode <arg>     Type of encoding for znodes. Valid options:
                      'none', 'utf-8', 'base64', default is 'base64'.
                      Option 'none' will not return any data from the znodes.

-ep,--exclude <arg>   Exclude znode paths, followed by list of paths.
                      Can only be used to exclude nodes one level below the root node.

-eph,--ephemeral      Include ephemeral nodes while exporting znodes, boolean, default false.

-f,--filename <arg>   Name of file containing import/export data.

-h,--help             Display help page.

-ip,--include <arg>   Include znode paths to include, followed by a list of paths.
                      Can only be used to include nodes one level below the root node.

-nr,--non-recursive   Do not perform recursive operations on znodes.

-o,--overwrite        Overwrite data for existing znodes. Valid only with 'update' command.

-p,--path <arg>       Path from ZooKeeper root node, e.g. '/lucid/query-pipelines'.

-r,--recursive        Perform recursive operations on znodes.

-z,--zkhost <arg>     ZooKeeper Connect string, required.
Required arguments are:
  • -c, —cmd : operation to perform.
  • -z, —zkhost : the ZooKeeper Connect string.

Examples

Export all data from a local single-node ZooKeeper service, save data to a file:
zkImportExport.sh -zkhost FUSION_HOST:9983 -cmd export -path / -filename znode_dump.json
Export all Fusion configurations from a local single-node ZooKeeper service, save data to a file:
zkImportExport.sh -zkhost FUSION_HOST:9983 -cmd export -path /lucid -filename znode_lucid_dump.json
Export Fusion user databases, groups, roles, and realms configurations from a local single-node ZooKeeper service, save data to a file:
zkImportExport.sh -zkhost FUSION_HOST:9983 -cmd export -path /lucid-apollo-admin -filename znode_lucid_admin_dump.json
Initial import of saved Fusion configuration into a new ZooKeeper:
zkImportExport.sh -zkhost FUSION_HOST:9983 -cmd import -filename znode_lucid_dump.json
Note that the above command will fail if there is conflict between existing znode structures or contents between the ZooKeeper service and the dump file. Update information for Fusion’s ZooKeeper service:
zkImportExport.sh -zkhost FUSION_HOST:9983 -cmd update -filename znode_lucid_dump.json
Remove a znode from Fusion’s ZooKeeper service:
zkImportExport.sh -zkhost FUSION_HOST:9983 -cmd delete -path /lucid/test
I