2014-08-11 23:53:33 +02:00
|
|
|
mysql_utils for Debian or Other OS
|
2014-05-27 11:30:16 +02:00
|
|
|
=======================================
|
2013-06-12 00:10:39 +02:00
|
|
|
|
|
|
|
Backup and Restore data from MySql tables
|
2013-11-23 18:17:53 +01:00
|
|
|
|
2014-04-21 14:44:31 +02:00
|
|
|
Install
|
|
|
|
======
|
|
|
|
|
|
|
|
cd ~
|
|
|
|
git clone https://github.com/Mirocow/mysql_utils.git
|
|
|
|
cd mysql_utils
|
|
|
|
|
2014-05-23 10:35:42 +02:00
|
|
|
Backup all databases
|
2014-04-21 14:44:31 +02:00
|
|
|
======
|
|
|
|
|
|
|
|
cd ~
|
|
|
|
cd mysql_utils
|
|
|
|
bash backup.sh
|
|
|
|
|
2014-05-23 10:33:45 +02:00
|
|
|
Restore for selected date
|
2014-04-21 14:44:31 +02:00
|
|
|
=======
|
|
|
|
|
2014-05-23 10:33:45 +02:00
|
|
|
cd /var/backups/mysql/[some date]
|
2014-04-21 14:44:31 +02:00
|
|
|
bash ~/mysql_utils/restore.sh
|
|
|
|
|
2015-05-12 17:06:02 +02:00
|
|
|
Restore selected DB
|
2014-05-23 10:32:45 +02:00
|
|
|
=======
|
|
|
|
|
|
|
|
cd /var/backups/mysql/[some date]/[some db name]
|
2015-05-12 17:06:02 +02:00
|
|
|
bash ~/mysql_utils/restore_db.sh
|
2014-05-23 10:32:45 +02:00
|
|
|
|
2013-11-23 18:17:53 +01:00
|
|
|
Automation backup with Cron
|
|
|
|
===========================
|
|
|
|
|
2014-04-21 14:16:04 +02:00
|
|
|
nano /etc/default/db_backup
|
|
|
|
|
|
|
|
START=yes
|
|
|
|
|
2014-08-11 23:50:59 +02:00
|
|
|
nano /etc/cron.daily/db_backup
|
2013-11-23 18:17:53 +01:00
|
|
|
|
2014-08-11 23:50:59 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
. /etc/default/db_backup
|
|
|
|
|
|
|
|
if [ "$START" = "yes" ]; then
|
|
|
|
logger "Start databases backup system..."
|
2014-08-11 23:51:51 +02:00
|
|
|
/bin/bash /root/scripts/mysql_utils/backup.sh -e some_exclude_database
|
2014-08-11 23:50:59 +02:00
|
|
|
fi
|
2014-04-21 14:48:26 +02:00
|
|
|
|
|
|
|
Check work
|
|
|
|
==========
|
|
|
|
|
2014-05-23 10:32:45 +02:00
|
|
|
# tail -f /var/log/syslog
|
|
|
|
May 23 12:25:34 db1 logger: BACKUP: ** Dump tecdoc.2013.ALI_COORD
|
|
|
|
May 23 12:25:35 db1 logger: BACKUP: ** set perm on tecdoc.2013/AL
|
|
|
|
May 23 12:25:35 db1 logger: BACKUP: ** bzip2 tecdoc.2013/ALI_COOR
|
|
|
|
May 23 12:25:35 db1 logger: BACKUP: ** Dump tecdoc.2013.ARTICLES
|
|
|
|
May 23 12:25:43 db1 logger: BACKUP: ** set perm on tecdoc.2013/AR
|
|
|
|
May 23 12:25:43 db1 logger: BACKUP: ** bzip2 tecdoc.2013/ARTICLES
|
|
|
|
May 23 12:25:43 db1 logger: BACKUP: ** Dump tecdoc.2013.ARTICLES_
|
|
|
|
May 23 12:25:43 db1 logger: BACKUP: ** set perm on tecdoc.2013/AR
|
|
|
|
May 23 12:25:43 db1 logger: BACKUP: ** bzip2 tecdoc.2013/ARTICLES
|
|
|
|
May 23 12:25:43 db1 logger: BACKUP: ** Dump tecdoc.2013.ARTICLE_C
|
|
|
|
|
2014-05-27 11:30:16 +02:00
|
|
|
Tested on
|
|
|
|
==========
|
|
|
|
|
|
|
|
Debiad
|
|
|
|
FreeBsd
|
|
|
|
Ubuntu
|