> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Export Data from ZooKeeper

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

While the [ZooKeeper Import/Export API](/api-reference/zookeeper/get-zookeeper-data) 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.

<LwTemplate />

## Usage

The script takes the following command-line arguments:

```sh wrap  theme={"dark"}
-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:*

```sh wrap  theme={"dark"}
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:*

```sh wrap  theme={"dark"}
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:*

```sh wrap  theme={"dark"}
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:*

```sh wrap  theme={"dark"}
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:*

```sh wrap  theme={"dark"}
zkImportExport.sh -zkhost FUSION_HOST:9983 -cmd update -filename znode_lucid_dump.json
```

*Remove a znode from Fusion’s ZooKeeper service:*

```sh wrap  theme={"dark"}
zkImportExport.sh -zkhost FUSION_HOST:9983 -cmd delete -path /lucid/test
```
