Bacula Restores
Bacula DB Restore
------------------------------------------------------------------------------------------------------------------------------------------
Restore Command
------------------------------------------------------------------------------------------------------------------------------------------
https://kb.ukfast.net/Restore_MySQL_from_Bacula
Bconsole > restore > 3 > select Job IDs > Mark /var/lib/mysql > done > 9 (where) > /root/restore_TICKETNUMBER
Once MySQL has been restored onto client server, we then need to start a 2nd instance of mysql:
-update the restore path to start the process from
Open new ssh windows an connect to MySQL instance:
Check that all databases are included:
Next the required databases/tables need to be dumped out:
-
For all data and databases
-
To dump several but not all databases (substitute databasename1,databasename2 etc)
For a specific database only (substitute databasename)
-
For a specific table only (substitute databasename and tablename)
If running into issues with mysqldump (errors) try with –f before db name to ignore errors
Once the dump is complete, terminate the 2nd instance:
------------------------------------------------------------------------------------------------------------------------------------------ ------
2nd MySQL instance not starting
If the 2nd instance of mysql won't start on the client server, there's 2 steps I usually follow:
-
Delete the restored content on the client server and start the restore again
-
If this still doesn't work, you'll need to start the 2nd MySQL instance using innodb_force_recovery
To do this, add the following line into /etc/my.cnf:
innodb_force_recovery = 1
--innodb-force-recovery=1
Innodb_force_recovery has 6 levels, start with 1 and work through to 6, hopefully one of these will start the mysql instance
Ensure you notify the client that the database had to be restored using the force recovery feature and link to the following doc
https://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
IMPORTANT! Ensure that you remove the innodb_force_recovery entry from /etc/my.cnf once finished
If errors are being shown regarding the existing my.cnf, you can choose to launch the instance with a setting to ignore my.cnf:
--no-defaults
Example:
/usr/sbin/mysqld --no-defaults --socket=/tmp/mysql2.sock --datadir=/home/restore_4450884/mysql --skip-networking --pid-file=/tmp/mysql2.pid --user=mysql --skip-grant-tables