To restore your MariaDB database server on a different VM, share the backup folder using the SCP command.
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.
Install Policy Agent in the new directory and configure it.
For more information, see Installing the Policy Agent on Linux.
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.
Link and install the entrust_key_management.so plugin.
For more information, see Configuring the MariaDB Server.
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.
Use the
--movebackor--copybackcommands to restore the database as follows:Note: The
--movebackoption physically moves the backup files to the new directory, so the original backup files are lost. The--copybackoption keeps the original backup files.Stop the MariaDB service using the following command:
systemctl stop mariadbEnsure that the directory where you plan to restore the backup is empty.
Run the Mariabackup with your preferred option. For example:
$ mariabackup --copy-back \
--target-dir=/var/mariadb/backup/
If necessary, update the file permissions using the
chown -R mysql:mysql /var/lib/mysql/command.Start the MariaDB service using the
systemctl start mariadbcommand.