How to back up and restore¶
This guide shows how to create backups (snapshots) of a Charmed OpenSearch cluster, restore from a backup, and migrate data to a new cluster.
Prerequisites¶
A cluster with at least three nodes deployed and
activeAccess to S3-compatible, Azure, or Google Cloud Storage (see Configure S3, Configure Azure storage, or Configure Google Cloud Storage)
Storage integration already established with OpenSearch
Caution
Only one object storage integrator can be related at a time. Relating more than one
places OpenSearch in a blocked state until you remove the extra relations.
Save cluster credentials¶
Backups exclude the security configuration, so the source cluster’s users, passwords, and role mappings cannot be restored. Before you run a restore or migrate to a new cluster, save the admin password and the CA certificates of the target cluster:
juju run opensearch/leader get-password
Caution
Excluding the security configuration does not protect the data itself. The snapshot repository still contains all indexed application data in an unencrypted form. Anyone with access to the repository can register it in another compatible OpenSearch cluster and restore that data using their own cluster’s admin credentials. Protect the repository with strict access controls and encryption at rest.
Create a backup¶
Confirm the cluster is active and idle with juju status, then run:
juju run opensearch/leader create-backup
Output example
backup-id: "2026-01-01t10:30:00z"
status: in_progress
The action only initiates the snapshot; it does not wait for it to finish. To confirm completion:
Record the
backup-idreturned by the action.Run
list-backups.Repeat until that
backup-idshows asuccessstatus.
Track the backup by its backup-id, not by position in the list: other snapshots can be created directly through the
OpenSearch API, so the newest entry is not necessarily yours.
Caution
Never restore or migrate a backup that is in_progress or failed. Only a success
backup is complete and safe to use.
List backups¶
To list available, failed, and in-progress backups:
juju run opensearch/leader list-backups
Output example
backup-id | backup-status
-------------------------------------
2026-01-01t10:30:00z | in_progress
2026-01-01t10:00:00z | success
2026-01-01t09:00:00z | failed
Restore a backup¶
To restore a backup that was made from a different cluster (cluster migration), see Migrate to a new cluster below.
To restore from the same cluster, pass the backup-id from list-backups:
juju run opensearch/leader restore backup-id=<backup-id>
After the restore completes, juju status shows the OpenSearch application active and the cluster health API returns
green.
Note
If the restore takes longer than the Juju CLI timeout, it continues in the background.
Monitor progress with juju status.
Migrate to a new cluster¶
To migrate data from one cluster to another, configure the new cluster to use the same storage backend where the old cluster’s backups reside, then restore:
juju run opensearch/leader restore backup-id=<backup-id>
The <backup-id> must reference a backup created by the previous cluster.
Next steps¶
Upgrade, rollback, and recover — upgrade the cluster after restoring.
Manage persistent storage — reuse disks when no viable snapshot exists.