PDA

View Full Version : Backup Strategy



blake06
May 7th, 2009, 02:56 PM
Hello,

I am attempting to set up a backup strategy using ZRM to backup a single server.

I want to run the backup locally on the server and then I would like to copy the backups to our Rackspace Cloud Files space using a mounted directory (done with jungledisk).

After reading through all of the info on ZRM about how to set up full backups, incremental backups, etc, here is what I came up with as far as a schedule is concerned:

Run a full snapshot LVM backup each morning at 3:00am.
Run an incremental snapshot LVM backup every hour (so 23 of these before the next full backup)

Set it up to keep backups for a certain # of days (maybe 3-7 days worth).

My idea is to set up an rsync script (send from the zrm backups directory to the jungledisk mounted directory) that I can call in the post-backup after each of the incremental backups, and that should keep my jungledisk drive in sync with the local machine, so that I have a remotely stored copy of all the backups. Does that sound like it will work?

I assume I need to use 'regular' instead of 'quick', is this correct?

Thanks!
blake

blake06
May 8th, 2009, 09:44 AM
I started working on setting up my backups, but I receive the following error when trying to manually run a LVM Snapshot backup:

dailyrun_dev:backup:INFO: PHASE START: Creating snapshot based backup
dailyrun_dev:backup:INFO: innodb on lvm = 0
dailyrun_dev:backup:INFO: getting device details using command /usr/share/mysql-zrm/plugins/lvm-snapshot.pl --action get-vm-device-details --directory /var/lib/mysql/. --sname zrmjuF5Z0DzE2 2>/tmp/jC8FECOMeO
dailyrun_dev:backup:ERROR: Command /usr/share/mysql-zrm/plugins/lvm-snapshot.pl --action get-vm-device-details --directory /var/lib/mysql/. --sname zrmjuF5Z0DzE2 2>/tmp/jC8FECOMeO returned error
dailyrun_dev:backup:WARNING: Error getting device details for /var/lib/mysql/.
dailyrun_dev:backup:WARNING: Output of command: 'Getting Device Details' is {
sudo: must be setuid root
Failed to find database: /var/lib/mysql/.
}
dailyrun_dev:backup:INFO: PHASE END: Creating snapshot based backup

Any ideas what I need to do?

I have this line in my /etc/sudoers files, does it look correct?

## Allow mysql to have the various permissions it needs for mysql-zrm LVM snapshot backups
mysql localhost = NOPASSWD: /bin/mount, NOPASSWD: /bin/umount, NOPASSWD: /bin/df, NOPASSWD: /sbin/lvdisplay, NOPASSWD: /sbin/lvcreate, NOPASSWD: /sbin/lvremove

Thanks,
blake

paddy
May 8th, 2009, 10:04 AM
sudo: must be setuid root
Failed to find database: /var/lib/mysql/.
}



The problem is with sudo permissions. It should be setuid root. In my machine,


$ ls -l /usr/bin/sudo
-rwsr-xr-x 2 root root 91508 2006-10-09 04:37 /usr/bin/sudo


Paddy

blake06
May 8th, 2009, 10:10 AM
Here is the output on my server:

ls -l /usr/bin/sudo
---x--x--x 2 root root 150904 Mar 24 19:55 /usr/bin/sudo*

What/how should I change it to make it work?

Thanks for your help!

paddy
May 8th, 2009, 10:15 AM
Here is the output on my server:

ls -l /usr/bin/sudo
---x--x--x 2 root root 150904 Mar 24 19:55 /usr/bin/sudo*

What/how should I change it to make it work?

Thanks for your help!

Can you please consider uninstalling sudo package and reinstalling it?

This would be better than fixing sudo permissions.

thanks,

blake06
May 8th, 2009, 10:19 AM
Okay, I can have our server techs look at it.

It is a brand new server, though, so I'm not sure if that is going to change anything.

blake06
May 8th, 2009, 06:08 PM
Could you provide a little bit more info about why you think I need to re-install sudo? My server admins are a little hesitant to do so without know why.

Also, I was under the impression that mysql-zrm runs as the mysql user? If so, why does it need to run commands in a sudo environment?

Thanks for your help!

blake06
May 9th, 2009, 05:27 AM
Okay, I've managed to get the sudo permission corrected, but now I have another problem.

I ran the backup, but instead of doing an LVM snapshot backup, it did a logical backup.

Here is the (truncated) output. I attempted to backup 4 databases, all of which contain only InnoDB tables.

backup:INFO: ZRM for MySQL Community Edition - version 2.1
dailyrun_dev:backup:INFO: START OF BACKUP
dailyrun_dev:backup:INFO: PHASE START: Initialization
dailyrun_dev:backup:INFO: ZRM Temporary configuration file = /etc/mysql-zrm/dailyrun_dev/tmpG8Ua9.conf
dailyrun_dev:backup:INFO: {
dailyrun_dev:backup:INFO: verbose=1
dailyrun_dev:backup:INFO: retention-policy=5D
dailyrun_dev:backup:INFO: backup-level=0
dailyrun_dev:backup:INFO: databases=shiftadv_lookup shiftadv_main shiftadv_mesa shiftadv_dummy2
dailyrun_dev:backup:INFO: password=******
dailyrun_dev:backup:INFO: backup-mode=raw
dailyrun_dev:backup:INFO: snapshot-size=500M
dailyrun_dev:backup:INFO: snapshot-plugin=/usr/share/mysql-zrm/plugins/lvm-snapshot.pl
dailyrun_dev:backup:INFO: comment=Daily backup set for DEV account
dailyrun_dev:backup:INFO: backup-type=regular
dailyrun_dev:backup:INFO: user=backup-user
dailyrun_dev:backup:INFO: mysql-binlog-path=/var/lib/mysql
dailyrun_dev:backup:INFO: }
dailyrun_dev:backup:INFO: Getting mysql variables
dailyrun_dev:backup:INFO: mysqladmin --user="backup-user" --password="*****" variables
dailyrun_dev:backup:INFO: datadir is /var/lib/mysql/
dailyrun_dev:backup:INFO: mysql_version is 5.0.67-community-log
dailyrun_dev:backup:INFO: InnoDB data file are ./ibdata1
dailyrun_dev:backup:INFO: InnoDB log dir is /var/lib/mysql/.
dailyrun_dev:backup:INFO: backup set being used is dailyrun_dev
dailyrun_dev:backup:INFO: backup-set=dailyrun_dev
dailyrun_dev:backup:INFO: backup-date=20090509091843
dailyrun_dev:backup:INFO: mysql-server-os=Linux/Unix
dailyrun_dev:backup:INFO: backup-type=regular
dailyrun_dev:backup:INFO: host=localhost
dailyrun_dev:backup:INFO: backup-date-epoch=1241875123
dailyrun_dev:backup:INFO: retention-policy=5D
dailyrun_dev:backup:INFO: mysql-zrm-version=ZRM for MySQL Community Edition - version 2.1
dailyrun_dev:backup:INFO: mysql-version=5.0.67-community-log
dailyrun_dev:backup:INFO: backup-directory=/var/lib/mysql-zrm/dailyrun_dev/20090509091843
dailyrun_dev:backup:INFO: comment=Daily backup set for DEV account
dailyrun_dev:backup:INFO: backup-level=0
dailyrun_dev:backup:INFO: backup-mode=raw
dailyrun_dev:backup:INFO: PHASE END: Initialization
dailyrun_dev:backup:INFO: PHASE START: Running pre backup plugin
dailyrun_dev:backup:INFO: Executing pre-backup-plugin
dailyrun_dev:backup:INFO: PHASE END: Running pre backup plugin
dailyrun_dev:backup:INFO: PHASE START: Flushing logs
dailyrun_dev:backup:INFO: Flushing the logs
dailyrun_dev:backup:INFO: mysqladmin --user="backup-user" --password="*****" flush-logs
dailyrun_dev:backup:INFO: Getting master logname using command mysql --user="backup-user" --password="*****" -e "show master status"
dailyrun_dev:backup:INFO: PHASE END: Flushing logs
dailyrun_dev:backup:INFO: PHASE START: Creating snapshot based backup
dailyrun_dev:backup:INFO: innodb on lvm = 0
dailyrun_dev:backup:INFO: getting device details using command /usr/share/mysql-zrm/plugins/lvm-snapshot.pl --action get-vm-device-details --directory /var/lib/mysql/. --sname zrmDWb0C6OX1g 2>/tmp/NmFJ77pRPp
dailyrun_dev:backup:INFO: PHASE END: Creating snapshot based backup
dailyrun_dev:backup:INFO: PHASE START: Find table type
dailyrun_dev:backup:INFO: Command used for getting engine type mysql --user="backup-user" --password="*****" -e "show table status from \`shiftadv_lookup\`"
dailyrun_dev:backup:INFO: For database shiftadv_lookup
dailyrun_dev:backup:INFO: engine
dailyrun_dev:backup:INFO: InnoDB
...
dailyrun_dev:backup:INFO: InnoDB
dailyrun_dev:backup:INFO: Command used for getting engine type mysql --user="backup-user" --password="*****" -e "show table status from \`shiftadv_main\`"
dailyrun_dev:backup:INFO: For database shiftadv_main
dailyrun_dev:backup:INFO: engine
dailyrun_dev:backup:INFO: InnoDB
...
dailyrun_dev:backup:INFO: InnoDB
dailyrun_dev:backup:INFO: Command used for getting engine type mysql --user="backup-user" --password="*****" -e "show table status from \`shiftadv_mesa\`"
dailyrun_dev:backup:INFO: For database shiftadv_mesa
dailyrun_dev:backup:INFO: engine
dailyrun_dev:backup:INFO: InnoDB
...
dailyrun_dev:backup:INFO: InnoDB
dailyrun_dev:backup:INFO: Command used for getting engine type mysql --user="backup-user" --password="*****" -e "show table status from \`shiftadv_dummy2\`"
dailyrun_dev:backup:INFO: For database shiftadv_dummy2
dailyrun_dev:backup:INFO: engine
dailyrun_dev:backup:INFO: InnoDB
...
dailyrun_dev:backup:INFO: InnoDB
dailyrun_dev:backup:INFO: PHASE END: Find table type
dailyrun_dev:backup:INFO: PHASE START: Creating logical backup
dailyrun_dev:backup:WARNING: The database(s) shiftadv_lookup shiftadv_main shiftadv_mesa shiftadv_dummy2 will be backed up in logical mode since they contain tables that use a transactional engine.
dailyrun_dev:backup:INFO: Command used for logical backup is mysqldump --opt --extended-insert --create-options --default-character-set=utf8 --single-transaction --user="backup-user" --password="*****" --databases shiftadv_lookup shiftadv_main shiftadv_mesa shiftadv_dummy2 > "/var/lib/mysql-zrm/dailyrun_dev/20090509091843/backup.sql"
dailyrun_dev:backup:INFO: logical-databases=shiftadv_lookup shiftadv_main shiftadv_mesa shiftadv_dummy2
dailyrun_dev:backup:INFO: PHASE END: Creating logical backup
dailyrun_dev:backup:INFO: PHASE START: Calculating backup size & checksums
dailyrun_dev:backup:INFO: next-binlog=shiftadmin-db-bin.000016
dailyrun_dev:backup:INFO: backup-size=3.21 MB
dailyrun_dev:backup:INFO: PHASE END: Calculating backup size & checksums
dailyrun_dev:backup:INFO: read-locks-time=00:00:01
dailyrun_dev:backup:INFO: flush-logs-time=00:00:00
dailyrun_dev:backup:INFO: backup-time=00:00:01
dailyrun_dev:backup:INFO: backup-status=Backup succeeded
dailyrun_dev:backup:INFO: Backup succeeded
dailyrun_dev:backup:INFO: PHASE START: Running post backup plugin
dailyrun_dev:backup:INFO: Executing post-backup-plugin
dailyrun_dev:backup:INFO: PHASE END: Running post backup plugin
dailyrun_dev:backup:INFO: PHASE START: Cleanup
dailyrun_dev:backup:INFO: PHASE END: Cleanup
dailyrun_dev:backup:INFO: END OF BACKUP

cgrello
July 14th, 2009, 09:17 AM
Would you mind posting your config file?

- Chris