Back Up and Restore Using MinIO S3-Compatible Storage
Use MinIO S3-compatible storage to back up and restore Virtual Appliance data.
You can back up Virtual Appliance data to MinIO S3-compatible storage. Complete the following tasks in order:
Set Up MinIO S3-Compatible Storage
Set up a MinIO server for S3-compatible Virtual Appliance backup storage.
Before you back up Virtual Appliance data using MinIO, set up the MinIO server.
9000 port is available for the MinIO server.
Configure MinIO Certificates on the Virtual Appliance
Configure MinIO CA certificates and Elasticsearch truststore settings for secure snapshot storage.
The Virtual Appliance requires the MinIO CA certificate to establish a secure connection to the MinIO server for snapshot storage.
Copy the MinIO public.crt file to the applicable location on the Virtual Appliance cluster:
- PostgreSQL
-
CODE
/var/appd/config/postgres-s3-ca.crt - MySQL
-
CODE
/var/appd/config/mysql-s3-ca.crt
Because Elasticsearch requires Java KeyStore (JKS) format, convert the public.crt file to a JKS file:
- Run the following command to generate the JKS file from the
public.crtfile:CODEkeytool -importcert -keystore es-s3-ca.jks -storepass changeit -file public.crt -alias minio - Copy the
es-s3-ca.jksfile to the following location:CODE/var/appd/config - Configure the truststore password in the
secrets.yamlfile. For example, usechangeit. See Edit thesecrets.yaml.encryptedfile.Note:- Use the MinIO Console to generate access and secret keys.
- Set
trustStorePasswordto the password that you specified for thees-s3-ca.jksfile. - To synchronize changes in
secrets.yaml, run theappdcli synccommand.
Add the following S3 settings:
CODE# S3 secrets backup: elasticsearch: s3: access_key: WTFaWld3c1NHWWNOSzBWeDlXaHI= secret_key: TWtJY0NweVdIcEhJV0pxdzdIWkRnVld3dzAxODRqbjhnS1pnZHozag== trustStorePassword: changeit
Configure the MinIO Endpoint in the globals.yaml.gotmpl File
Configure MinIO repositories and datastore backup settings in the globals.yaml.gotmpl file.
Back Up Virtual Appliance Data
Back up Virtual Appliance datastore snapshots to an S3 Compatible Storage.
Snapshots capture the state of a datastore and can be used to restore data. You can store multiple snapshots in one repository. The following commands store snapshots in the configured S3-compatible repositories.
Create a snapshot for each datastore:
- Elasticsearch
-
CODE
appdcli backup elasticsearch create-snapshot <repo-name> <snapshot-name>ExampleCODEappdcli backup elasticsearch create-snapshot virtual-appliance-repo-minio es-snapshot - PostgreSQL
-
CODE
appdcli backup postgres create-snapshot <repo-name> <snapshot-name>ExampleCODEappdcli backup postgres create-snapshot repo2 pg-snapshot - MySQL
-
Back up the MySQL
dumpInstance:CODEappdcli run mysql_backup create-snapshot <snapshot-name>Back up the MySQLxtrabackup:-
Create a full MySQL backup to start a chain.CODE
# Trigger a full backup appdcli backup mysql full [--pod appd-mysql-0] -
Create any required incremental MySQL backups.
Use the same MySQL pod for the full backup and every incremental backup in its chain. The default pod isappd-mysql-0.CODEappdcli backup mysql incr [--pod <pod>]
-
Restore Snapshots from the MinIO server
Restore Virtual Appliance datastore snapshots.
Use the snapshots that you have stored in MinIO server to restore the datastores.
helm delete controller -n cisco-controller
- List the snapshots in the repository:
- Elasticsearch
-
CODE
appdcli backup elasticsearch list-snapshots <repo-name>CODEappdcli backup elasticsearch restore-snapshot <repository> <snapshot> [<index> ...]ExampleCODEappdcli backup elasticsearch list-snapshots virtual-appliance-repo-mino - PostgreSQL
-
CODE
appdcli backup postgres list-snapshot <repo-name>ExampleCODEappdcli backup postgres list-snapshot repo2 - MySQL
-
List the MySQL
dumpInstance.CODEappdcli backup mysql listList the MySQL
xtrabackup.CODE# List XtraBackup CRs appdcli backup mysql list # List all backup chains with size and incremental appdcli backup mysql list-chains
- Restore the datastore by one of the snapshots:
- Elasticsearch
-
CODE
appdcli backup elasticsearch restore-snapshot <repo-name> <snapshot-name>ExampleCODEappdcli backup elasticsearch restore-snapshot virtual-appliance-repo-mino es_snapshot - PostgreSQL
-
CODE
appdcli backup postgres restore-snapshot <repo-name>ExampleCODEappdcli backup postgres restore-snapshot repo2 pg_snapshot - MySQL
-
Restore the MySQL
dumpInstance.CODEappdcli backup mysql restore-snapshot <repo-name>Restore the MySQLxtrabackup:CODEappdcli backup mysql list-chains # Latest chain and all incremental backups appdcli backup mysql restore # Selected chain and all incremental backups appdcli backup mysql restore --from-chain <timestamp> # Selected chain through an incremental backup, inclusively appdcli backup mysql restore --from-chain <timestamp> --from-incr <timestamp> # Full backup only appdcli backup mysql restore --from-chain <timestamp> --from-incr fullNote: You must manually restore the MySQL cluster.
-
After a MySQL data restore, recover the InnoDB Cluster and verify its status.
Example:CODEappdcli mysql restore appdcli mysql status --strict -
Verify that the restored datastore is healthy and that the expected application data is available.
After the restore is successful, the selected datastore data is restored and validated. If the Controller is down, run the following command:
appdcli sync appd <profile>
Delete Snapshots from MinIO S3-Compatible Storage
Delete Virtual Appliance datastore snapshots that you no longer need from MinIO storage.
Delete snapshots that you no longer need from MinIO S3-compatible storage.
- Elasticsearch
-
CODE
appdcli backup elasticsearch delete-snapshot <repo-name> <snapshot-name>ExampleCODEappdcli backup elasticsearch delete-snapshot virtual-appliance-repo-mino es_snapshot - PostgreSQL
-
CODE
appdcli backup postgres delete-snapshot <repo-name>ExampleCODEappdcli backup postgres delete-snapshot repo2 pg_snapshot - MySQL
-
Delete the MySQL
dumpInstance.CODEappdcli backup mysql delete-snapshot <repo-name>Delete the MySQLxtrabackup:CODEappdcli backup mysql list-chains appdcli backup mysql delete-chain <timestamp>Use
--forceonly when you intentionally delete the latest chain.