How to create a backup¶
This guide contains recommended steps and useful commands for creating and managing backups to ensure smooth restores.
Prerequisites¶
Create a backup¶
Once juju status shows Charmed MySQL as active and idle, you can create your first backup with the create-backup command:
juju run mysql/leader create-backup
juju run mysql-k8s/leader create-backup
Juju 2.9 users
Remember that juju run <action name> becomes juju run-action <action name> --wait.
See also: Breaking changes between Juju 2.9 and 3
If you have a cluster of one unit, you can run the create-backup action on the leader (which will also be the primary unit). Otherwise, you must run the create-backup action on a non-primary unit.
To find the primary, see juju status or run get-cluster-status on the leader to find the primary unit.
The create-backup action validates that the unit in charge of the backup is healthy, by:
Checking that the MySQL cluster is in a valid state (
OKorOK_PARTIALfrom the InnoDB cluster status)Checking that the MySQL instance is in a valid state (
ONLINEfrom Replication member states.
In order to override these precautions, use the force flag:
juju run mysql/leader create-backup force=True
juju run mysql-k8s/leader create-backup force=True
List backups¶
You can list your available, failed, and in progress backups by running the list-backups command:
juju run mysql/leader list-backups
juju run mysql-k8s/leader list-backups