
Database support
Copyright © Acronis, Inc., 2000-2005
35
Chapter 7. Database support
Database servers, such as MySQL, prove to be troublesome to backup, partially due to open
files and indexes and partially due to rapid data changes. Therefore many system
administrators prefer to suspend the database at the backup moment (image file creation).
7.1 Database start/stop when creating image under X Window
While backup by GUI in X Window it is recommended that the database be suspended just
before pressing the Proceed button on the last page of the Acronis True Image 8.0 Server
for Linux Create Image Wizard. Once the imaging process starts, you can resume server
operations. It is not necessary to suspend the applications for the duration of the imaging
process.
7.2 Scheduling database start/stop for automatic backup
For automatic backup, using the Linux
cron
service, you can schedule sequential actions -
"stop mysql", do backup and "start mysql". The following is an example. System has
/dev/sda1 as root(/) and /dev/sda2 mounted to /backups directory. All database
(mysql) data are located on root(/).
You may schedule a
cron
job to start/stop the database by the following record in
/var/spool/cron/root file:
14 4 * * * /bin/bash -c "(/etc/init.d/mysqld
stop;/usr/sbin/trueimagecmd --create --partition:1-1 --
filename:/backups/test.tib; /etc/init.d/mysqld start)"
However, this will interrupt database operation to the very end of the image creation
process, which may take quite long time.
7.3 Automatic database start/stop inside tils_freeze_hook script
To fully automate the database start/stop, create a special
/usr/lib/Acronis/tils_freeze_hook script. It will allow you both to decrease
database downtime in
cron jobs
, still keeping database consistency, and automatically
start/stop database in GUI mode.
trueimage or trueimagecmd will call this script using the <device-name> <stop>
options before and <device-name> <start> options after creating file system snapshot.
Having set up this script once, you will not have to run the "mysql stop" or "mysql
start" command neither in
cron
job, nor in GUI mode. tils_freeze_hook will be called
automatically and start/stop MySQL itself.
The following is an example of the
cron
record in /var/spool/cron/root file:
14 4 * * * /bin/bash -c "(/usr/sbin/trueimagecmd --create --
partition:1-1 --filename:/backups/test.tib)"
Kommentare zu diesen Handbüchern