Table of Contents
This section provides guidelines on how to restore MySQL-based backup taken by Backup Ninja. All backups created by Backup Ninja can be restored using two ways:
- Automatic restoration
- Manual restoration
Automatic Restoration
The automatic restoration was not supported on the older version of the bartender agent. We highly recommend users to upgrade the agent first by going to Servers → pick a server → More → Upgrade Agent before attempting the automatic restoration.
To start the restore, choose a backup in a “Completed” state and click on Restore. You will be presented with the following dialog:
Select the backup from the “Select file” dropdown and click on the
Physical backup restoration using xtrabackup
and mariabackup
will bring slight downtime to your database service.
You can monitor the restoration status under the Backups page, where you will see a new section appear located on top of the backup list:
Clicking on the “see log” link will open a pop-up showing off the restore job log messages:
Similar log messages can be seen in the bartender log located at /var/log/bartender.log
on the agent’s server:
$ tail -f /var/log/bartender.log
2021-05-04T12:02:31.511Z info Job "c28jfli1a1196ltihakg": mariabackup based on MariaDB server 10.4.11-MariaDB Linux (x86_64)
2021-05-04T12:02:31.517Z info Job "c28jfli1a1196ltihakg": Restoring to mysql (vendor: mariadb, version: 10.4.11) method mariabackup
2021-05-04T12:02:31.525Z info Job "c28jfli1a1196ltihakg": Processing file /backups/backupninja/backup-10/mariabackup_all_2021-05-04_111500.xbstream
2021-05-04T12:02:31.531Z info Job "c28jfli1a1196ltihakg": Running /usr/bin/mbstream -x -C /tmp/xb-restore-272887538/base
2021-05-04T12:02:52.387Z info Job "c28jfli1a1196ltihakg": Processed file /backups/backupninja/backup-10/mariabackup_all_2021-05-04_111500.xbstream
2021-05-04T12:02:52.393Z info Job "c28jfli1a1196ltihakg": Restoring to mysql (vendor: mariadb, version: 10.4.11) method mariabackup
2021-05-04T12:02:52.399Z info Job "c28jfli1a1196ltihakg": Processing file /backups/backupninja/backup-11/mariabackup_all_2021-05-04_113000.xbstream
2021-05-04T12:02:52.407Z info Job "c28jfli1a1196ltihakg": Running /usr/bin/mbstream -x -C /tmp/xb-restore-272887538/inc1
2021-05-04T12:02:53.385Z info Job "c28jfli1a1196ltihakg": Processed file /backups/backupninja/backup-11/mariabackup_all_2021-05-04_113000.xbstream
2021-05-04T12:02:53.406Z info Job "c28jfli1a1196ltihakg": mysql service is running
2021-05-04T12:02:53.428Z info Job "c28jfli1a1196ltihakg": Will use datadir: /var/lib/mysql/ (owned by mysql:mysql)
2021-05-04T12:02:54.154Z info Job "c28jfli1a1196ltihakg": Incremental 15 minutes: Backup restore started.
2021-05-04T12:02:54.160Z info Job "c28jfli1a1196ltihakg": Restoring to mysql (vendor: mariadb, version: 10.4.11) method mariabackup
2021-05-04T12:02:54.164Z info Job "c28jfli1a1196ltihakg": Processing file /backups/backupninja/backup-12/mariabackup_all_2021-05-04_114500.xbstream
2021-05-04T12:02:54.171Z info Job "c28jfli1a1196ltihakg": Running /usr/bin/mbstream -x -C /tmp/xb-restore-272887538/inc2
2021-05-04T12:02:54.351Z info Job "c28jfli1a1196ltihakg": Processed file /backups/backupninja/backup-12/mariabackup_all_2021-05-04_114500.xbstream
2021-05-04T12:02:54.356Z info Job "c28jfli1a1196ltihakg": Running: mariabackup --prepare --target-dir=/tmp/xb-restore-272887538/base
2021-05-04T12:02:56.284Z info Job "c28jfli1a1196ltihakg":
mariabackup based on MariaDB server 10.4.11-MariaDB Linux (x86_64)
[00] 2021-05-04 12:02:54 cd to /tmp/xb-restore-272887538/base/
[00] 2021-05-04 12:02:54 This target seems to be not prepared yet.
[00] 2021-05-04 12:02:54 mariabackup: using the following InnoDB configuration for recovery:
[00] 2021-05-04 12:02:54 innodb_data_home_dir = .
[00] 2021-05-04 12:02:54 innodb_data_file_path = ibdata1:100M:autoextend
[00] 2021-05-04 12:02:54 innodb_log_group_home_dir = .
[00] 2021-05-04 12:02:54 InnoDB: Using Linux native AIO
...
Manual Restoration
You can also opt for manual restoration by clicking on the Or use manual instructions link. A pop-up will appear providing all the instruction steps necessary for the restoration, as shown in the following screenshot:
You may copy and paste the commands by clicking on the “copy” icon in the command box (white clipboard icon). Execute every command in your server’s terminal via SSH, one command at a time and you should be good.