Back Up and Restore MySQL Snapshots

Use the existing MySQL snapshot on your source Virtual Appliance to back up and restore on the destination Virtual Appliance.

Back Up a MySQL Snapshot

Back up the MySQL data on your source Virtual Appliance by creating a MySQL database snapshot.
  1. Log in to your source Virtual Appliance and create a MySQL snapshot.
    1. Create a new MySQL snapshot.
      Note: Use this command to create a new snapshot or if the source Virtual Appliance has no snapshots.
      appdcli run mysql_backup create-snapshot repo3
      Sample Output:
      create-snapshot started. Status='backup-20251017052203'

      The backup job takes some time to complete.

    2. View the backup file using the following command:
      kubectl get mysqlbackup -n mysql
      Sample Output:
      NAME                    CLUSTER      STATUS    OUTPUT                  AGE
      backup-20251017052203   appd-mysql   Running   backup-20251017052203   39s

      A default folder is created at /mnt/nfs_share on the NFS server.

  2. Log in to the NFS server and view the backup files.
    /mnt/nfs_share# ls -ltr

    Sample Output:

    drwx------ 5   27 sudo 4096 Oct  8 16:10 mysql-mysql-backup-pvc-pvc-545f88bb-62b4-4bc1-820c-eda07a3db15e
    
    To view the contents in the backup file, run this command:
    ls -ltr <Backup-of-MySQL-Folder-VA>
    Sample Output:
    total 84
    drwxr-x---. 2 27 27 61440 Oct 10 11:05 backup-20251017052203

Restore a MySQL Snapshot

When you restore a MySQL snapshot, all MySQL data on the destination Virtual Appliance is erased and replaced with data from the source Virtual Appliance. Restore the MySQL snapshot on the destination Virtual Appliance:
  1. Log in to your destination Virtual Appliance and create a MySQL snapshot.
    1. Create a new MySQL snapshot.
      appdcli run mysql_backup create-snapshot repo3
      Sample Output:
      create-snapshot started. Status='backup-20251017052203'

      The backup job takes some time to complete.

    2. View the backup file using the following command:
      kubectl get mysqlbackup -n mysql

      A default folder is created at /mnt/nfs_share on the NFS server.

  2. Log in to NFS server to copy the backup file.
    1. View the backup files.
      /mnt/nfs_share# ls -ltr
    2. Copy the source Virtual Appliance backup file contents to destination Virtual Appliance.
      cp -r <Backup-of-MySQL-Folder-Source-VA>/* <Backup-of-MySQL-Folder-Destination-VA>
  3. Log in to your destination Virtual Appliance server and clear the user-defined schema.
    kubectl exec -it appd-mysqlsh-0 -n mysql bash
          cd /mysqlsh
          bash drop-user-schemas.sh 
          exit
  4. Restore the MySQL snapshot.
    appdcli run mysql_backup restore-snapshot repo3 <snapshot-name>
    Example:
    appdcli run mysql_backup restore-snapshot repo3 backup-20251017052203
  5. Verify the progress of MySQL restoration using the following command:
    NAME                                 READY   STATUS      RESTARTS   AGE
    appd-mysql-0                         2/2     Running     0          5d12h
    appd-mysql-1                         2/2     Running     0          5d12h
    appd-mysql-2                         2/2     Running     0          5d12h
    appd-mysql-router-7b956f54c8-2xgpg   1/1     Running     0          5d12h
    appd-mysql-router-7b956f54c8-2zqdq   1/1     Running     0          5d12h
    appd-mysql-router-7b956f54c8-46wjh   1/1     Running     0          5d12h
    appd-mysqlsh-0                       1/1     Running     0          5d12h
    appd-mysqlsh-1                       1/1     Running     0          5d12h
    appd-mysqlsh-2                       1/1     Running     0          5d12h
    backup-20251017052203-2q8jn          0/1     Completed   0          7m24s
    restore-20251017052907-sncvm         1/1     Running     0          20s
    restore-dump-nh52z                   0/1     Completed   0          5d12h
Note: After restoring MySQL on the destination Virtual Appliance, the Controller UI will display the data from that Virtual Appliance. Log in to the Controller UI to verify that it displays the correct data. To redirect traffic to the destination Virtual Appliance from the source Virtual Appliance, perform the cutover steps.