To restore your MariaDB database server on a different VM, share the backup folder using the SCP command.

  1. After the backup is complete, share the folder to the new backup location: 

    scp /var/mariadb/backup user@destination_host:/var/mariadb/backup

    Where user@destination_host is the new location for the backup.

  2. Install Policy Agent in the new directory and configure it.

    For more information, see Installing the Policy Agent on Linux.

  3. Using the same Key Set that you created for the original MariaDB database server, create the database connector, generate the access token, and ensure that the access token information is in the mdb.conf file.

  4. Link and install the entrust_key_management.so plugin.

    For more information, see Configuring the MariaDB Server.

  5. Prepare the backup for restoration by running the following command: 

    $ mariabackup --prepare \

    --use-memory=124M --target-dir=/var/mariadb/backup/

    Note: The --use-memory command defines the buffer pool size that is used during the preparation stage. If you see errors while preparing a backup, try increasing the buffer pool size.

  6. Use the --moveback or --copyback commands to restore the database as follows: 

    Note: The --moveback option physically moves the backup files to the new directory, so the original backup files are lost. The --copyback option keeps the original backup files.

    1. Stop the MariaDB service using the following command:  systemctl stop mariadb

    2. Ensure that the directory where you plan to restore the backup is empty.

    3. Run the Mariabackup with your preferred option. For example:

      $ mariabackup --copy-back \

      --target-dir=/var/mariadb/backup/

    4. If necessary, update the file permissions using the chown -R mysql:mysql /var/lib/mysql/ command.

    5. Start the MariaDB service using the systemctl start mariadb command.