Tutorial: mysql-zrm installation for backup vpopmail database
make sure on /etc/my.cnf the following parameters is there, if not added and restart MySQL
[mysqld]
...
log-bin
server-id = 1
[mysqlhotcopy]
interactive-timeout
download copy of mysql-zrm from http://zmanda.com/download-zrm.php
I am still using old version which you can get the copy on my site
MySQL-zrm-1.1.3-1.noarch.rpm
MySQL-zrm-socket-server-1.1.3-1.noarch.rpm
If you want to use mysqlhotcopy (which is faster and smaller backup) for MySQL-zrm do backup, it requires perl-DBD-MySQL. so if you are want to use mysqlhotcopy, I suggest install perl-DBD-MySQL and solves it required dependencies
# rpm -ivh MySQL-zrm-1.1.3-1.noarch.rpm
# vi /etc/mysql-zrm/mysql-zrm.conf
backup-level=0
backup-mode=logical
retention-policy=10W
replication=0
compress=1
compress-plugin=/usr/bin/gzip
databases=vpopmail
user="backup"
password="backup"
host="localhost"
Create user backup (enter your MySQL's root password)
# mysql -uroot -p -h localhost
Enter password:
mysql> GRANT LOCK TABLES, SELECT, FILE, RELOAD, SUPER, CREATE, DROP,
-> INDEX, SHUTDOWN, INSERT, ALTER, REPLICATION CLIENT
-> ON *.*
-> TO 'backup'@'localhost'
-> IDENTIFIED BY 'backup';
mysql> flush privileges;
testing backup (make sure no error found)
# mysql-zrm-scheduler --now
schedule mysql-zrm to do weekly backup on 01:00
# mysql-zrm-scheduler --add --interval weekly --start 01:00
you can also schedule mysql-zrm to do daily backup but please make sure you have enough diskspace
# mysql-zrm-scheduler --add --interval daily --start 01:00
and verify it
# mysql-zrm-scheduler --query
create bash script to maintain MySQL's binlog file
# vi /root/maintainbinlog.sh
#!/bin/bash
AGE=100 # days
AGE_MINS=$[ $AGE * 60 * 24 ]
OLDLOGS=`find /var/lib/mysql/*-bin.* -cmin +$AGE_MINS | tail -n 1 | gawk -F'/' '{print $5}'`
/usr/bin/mysql -u backup -pbackup mysql -e "PURGE MASTER LOGS TO '$OLDLOGS'"
# chmod +x maintainbinlog.sh
add crontab schedules to maintain MySQL's binlog and mysql-zrm backup file
# crontab -e
0 3 * * * /root/maintainbinlog.sh
0 4 * * * /usr/bin/mysql-zrm --action purge
further info visit ZManda Quick MySQL Backup,
mysql-zrm wiki, and ZManda
make sure on /etc/my.cnf the following parameters is there, if not added and restart MySQL
[mysqld]
...
log-bin
server-id = 1
[mysqlhotcopy]
interactive-timeout
download copy of mysql-zrm from http://zmanda.com/download-zrm.php
I am still using old version which you can get the copy on my site
MySQL-zrm-1.1.3-1.noarch.rpm
MySQL-zrm-socket-server-1.1.3-1.noarch.rpm
If you want to use mysqlhotcopy (which is faster and smaller backup) for MySQL-zrm do backup, it requires perl-DBD-MySQL. so if you are want to use mysqlhotcopy, I suggest install perl-DBD-MySQL and solves it required dependencies
# rpm -ivh MySQL-zrm-1.1.3-1.noarch.rpm
# vi /etc/mysql-zrm/mysql-zrm.conf
backup-level=0
backup-mode=logical
retention-policy=10W
replication=0
compress=1
compress-plugin=/usr/bin/gzip
databases=vpopmail
user="backup"
password="backup"
host="localhost"
Create user backup (enter your MySQL's root password)
# mysql -uroot -p -h localhost
Enter password:
mysql> GRANT LOCK TABLES, SELECT, FILE, RELOAD, SUPER, CREATE, DROP,
-> INDEX, SHUTDOWN, INSERT, ALTER, REPLICATION CLIENT
-> ON *.*
-> TO 'backup'@'localhost'
-> IDENTIFIED BY 'backup';
mysql> flush privileges;
testing backup (make sure no error found)
# mysql-zrm-scheduler --now
schedule mysql-zrm to do weekly backup on 01:00
# mysql-zrm-scheduler --add --interval weekly --start 01:00
you can also schedule mysql-zrm to do daily backup but please make sure you have enough diskspace
# mysql-zrm-scheduler --add --interval daily --start 01:00
and verify it
# mysql-zrm-scheduler --query
create bash script to maintain MySQL's binlog file
# vi /root/maintainbinlog.sh
#!/bin/bash
AGE=100 # days
AGE_MINS=$[ $AGE * 60 * 24 ]
OLDLOGS=`find /var/lib/mysql/*-bin.* -cmin +$AGE_MINS | tail -n 1 | gawk -F'/' '{print $5}'`
/usr/bin/mysql -u backup -pbackup mysql -e "PURGE MASTER LOGS TO '$OLDLOGS'"
# chmod +x maintainbinlog.sh
add crontab schedules to maintain MySQL's binlog and mysql-zrm backup file
# crontab -e
0 3 * * * /root/maintainbinlog.sh
0 4 * * * /usr/bin/mysql-zrm --action purge
further info visit ZManda Quick MySQL Backup,
mysql-zrm wiki, and ZManda

on October 11, 2008, 10:54 pm
that error would came out if that the first time you run the script