>> package:
1 |
yum install holland-mysqldump |
>> Auto install script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#!/bin/bash which yum rc=$? if [ $rc != 0 ] ; then apt-get install -y python-setuptools python-mysqldb else yum install -y MySQL-python fi if [ ! -f holland-1.0.10.tar.gz ] ; then wget http://hollandbackup.org/releases/stable/1.0/holland-1.0.10.tar.gz fi if [ ! -d holland-1.0.10 ] ; then tar zxf holland-1.0.10.tar.gz fi cd holland-1.0.10 python setup.py install cd plugins/holland.lib.common/ python setup.py install cd ../holland.lib.mysql/ python setup.py install cd ../holland.backup.mysqldump/ python setup.py install cd ../../config mkdir -p /etc/holland/providers mkdir -p /etc/holland/backupsets cp holland.conf /etc/holland/ cp providers/mysqldump.conf /etc/holland/providers/ cp backupsets/examples/mysqldump.conf /etc/holland/backupsets/default.conf cd /etc/holland sed -i 's=/var/spool/holland=/var/lib/mysqlbackup=g' holland.conf sed -i 's/backups-to-keep = 1/backups-to-keep = 7/g' backupsets/default.conf sed -i 's/file-per-database.*=.*no/file-per-database = yes/g' backupsets/default.conf sed -i 's/file-per-database.*=.*no/file-per-database = yes/g' providers/mysqldump.conf hour=$(python -c "import random; print random.randint(0, 4)") minute=$(python -c "import random; print random.randint(0, 59)") echo '# Dump mysql DB to files. Time was chosen randomly' > /etc/cron.d/holland echo "$minute $hour * * * root /usr/local/bin/holland -q bk" >> /etc/cron.d/holland mkdir -p /var/lib/mysqlbackup mkdir -p /var/log/holland chmod o-rwx /var/log/holland echo echo echo "Holland should be installed now." echo "Test backup: holland bk" echo "See cron job: cat /etc/cron.d/holland" echo "See backups: find /var/lib/mysqlbackup/" |
>> Where is the DB conf file:
1 |
/etc/holland/backupsets |
>> When it runs
1 |
cat /etc/cron.d/holland |
>> Test command to see if all works without actually run it
1 |
holland bk --dry-run |
>> /etc/holland/backupsets/default.conf
1 2 |
[mysql:client] defaults-extra-file = /root/.my.cnf |