---
title: etcd and MySQL backup and restoration
sidebar_label: etcd and MySQL
---

A majority of Deephaven configuration is stored in etcd. The etcd cluster may consist of a single node or any odd number of nodes. Assuming a healthy etcd cluster, the nodes should be automatically synchronized.

## etcd backup and restore

etcd can be backed up and restored using etcd's own tools. However, the Deephaven provided [etcdctl.sh](../../sys-admin/troubleshooting/troubleshooting-etcd.md#etcdctl-command-overview) script is preferred.

Backup can be done using the `etcdctl.sh` utility with:

```bash
sudo -u irisadmin ETCDCTL_ENDPOINTS=https://{ip-of-single-etcd-node}:2379 /usr/illumon/latest/bin/etcdctl.sh snapshot save [filename]
```

Restore is covered in the [etcd documentation](https://etcd.io/docs/v3.5/op-guide/runtime-configuration/), under the topic: "Restart cluster from majority failure". For Deephaven, the etcd restore process is as follows:

1. Install the new Deephaven cluster.
2. Connect to the etcd node where restore will be processed.
3. Use `/usr/illumon/latest/bin/etcdctl.sh endpoint status -w table` to get a list of etcd nodes in the cluster.
4. Use `/usr/illumon/latest/bin/etcdctl.sh move-leader` to force the local node to be the leader of the cluster.
5. Use `/usr/illumon/latest/bin/etcdctl.sh member remove` to remove the other nodes from the cluster until only the local node remains.
6. Use `/usr/illumon/latest/bin/etcdctl.sh snapshot restore` to restore the etcd database.
7. Follow the rest of the steps in the linked [etcd.io](https://etcd.io/docs/v3.3/op-guide/runtime-configuration/) article for adding the other nodes back to the cluster.

## MySQL ACL backup and restore

In systems that use `MySQL`/`MariaDB` for ACLs, the `dbacl_iris` database stores Deephaven logins and groups and associated permissions for Deephaven objects. This database can be backed up and restored using `MySQL` native backup and restore tools, though the [Deephaven backup script](./backup-and-restore.md#deephaven-backup-script) is the preferred method.

```bash
# Backup with:
mysqldump --user [user_name] --password=[password] --databases dbacl_iris > [filename]

# Restore with:
mysql --user [user_name] --password=[password] -e "drop database if exists dbacl_iris"
mysql --user [user_name] --password=[password] -e "create database dbacl_iris"
mysql --user [user_name] --password=[password] dbacl_iris < [filename]
```

> [!TIP]
> If the original deployment uses `MySQL`/`MariaDB` for ACLs, a migration may be a good time to convert to the preferred etcd ACL storage. The [Deephaven backup script](./backup-and-restore.md#deephaven-backup-script) ACL export can be imported to etcd on the new deployment after setting a few properties. Contact Deephaven support for guidance on migrating from MySQL/MariaDB ACLs to etcd ACLs.

## Related documentation

- [Backup, Restore, and Migration overview](./backup-and-restore.md)
- [Configuration backup and restore](./configuration-properties-backup.md)
- [File system backup and restore](./configuration-files-backup.md)
- [Table migration](./table-migration.md)
- [WorkspaceData backup and restore](./workspace-data-backup.md)
