How do you backup MySQL with TSM

kim_mitchell

ADSM.ORG Member
Joined
Jan 3, 2004
Messages
27
Reaction score
0
Points
0
TSM currently doesnt have a backup agent for MYSQL atleast that Im aware of. I need to back up a MYSQL db and it was suggested to me that I stop the MYSQL service on the Windows 2000 server then backup the DB then restart the service when the backup is complete. Does anyone have any sugggestion on how to backup MYSQL databases.



Thanks



KIM
 
Hi,



well we first create a dump of all databases, gzip them and then backup/archive them with TSM.

Here's my script:



/usr/bin/mysqldump -u#### -p#### --all-databases -a > /misc/backups/MySQL/$(date +%Y%m%d).sql



tar cf - /misc/backups/MySQL/$(date +%Y%m%d).sql | gzip -c > /misc/backups/MySQL/$(date +%Y%m%d).tar.gz



Then dsmc archive ..... and so on



Bye Bruno
 
There's a better option than doing a full shutdown.



With our warehouse, we do the following in our cronjobs:



mysqlhotcopy --allowold --flushlog -u <username> --password=<password> <dbname> /var/backups/mysql/



then dsmc the rest.



If you aren't happy with having the password in the script, create a user who only has permissions from localhost to the databases you need backed up (SELECT,REFERENCES,LOCK TABLES,INDEX,TMP TABLES - I think) and set no password. Run the script as that user with sudo or as a cronjob for the user.



This only works for MyISAM table types. If you're using InnoDB, you'll need the commercial InnoDB hotbackup utility..



I just saw that someone posted a similar suggestion that does a dump and then tars the whole thing up. I actually like to keep each database separate so I can restore only what I want.
 
/usr/bin/mysqldump -u#### -p#### --all-databases -a > /misc/backups/MySQL/$(date +%Y%m%d).sql

tar cf - /misc/backups/MySQL/$(date +%Y%m%d).sql | gzip -c > /misc/backups/MySQL/$(date +%Y%m%d).tar.gz

Bye Bruno

Hello there. Imagine, the first step had started before midnight and finished after midnight :) The second part would not have anything to tar/gzip :)

I'd suggest setting timestamp variable once and use it later on:

Code:
TIMESTAMP=`date +%Y%m%d`
/usr/bin/mysqldump -u#### -p#### --all-databases -a > /misc/backups/MySQL/$TIMESTAMP.sql

tar cf - /misc/backups/MySQL/$TIMESTAMP.sql | gzip -c > /misc/backups/MySQL/$TIMESTAMP.tar.gz

Regards,
Marcin.
 
We are trying to use adsmpipe on SUSE 10. We have it loaded but we are not sure of the correct syntax. Any hints?

Thanks
 
it looks that TSM cant work with MySQL ...
 
You can restore to any point in time with "Data Protector for MySQL using IBM Tivoli Storage Manager".
It uses the mysql bin-logs to rollforward to the given point in time.
 
Back
Top