Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Here are also a few pages on using rsync to create incremental backups. The first one has a few words on the tar method also, you might want to read them to have an opinion on whether to use it or rsync.
MySQL supports incremental backups: You must start the server with the --log-bin option to enable binary logging; see Section 5.2.4, “The Binary Log”. The binary log files provide you with the information you need to replicate changes to the database that are made subsequent to the point at which you performed a backup. At the moment you want to make an incremental backup (containing all changes that happened since the last full or incremental backup), you should rotate the binary log by using FLUSH LOGS. This done, you need to copy to the backup location all binary logs which range from the one of the moment of the last full or incremental backup to the last but one. These binary logs are the incremental backup; at restore time, you apply them as explained in Section 6.5, “Point-in-Time (Incremental) Recovery Using the Binary Log”.
I've been using this script via cron for a couple years now. I maintain 3 monthly backups, 4 weekly backups and 7 daily backups within about 150% disk space of a single, full backup. Rsnapshot eliminates the need for incremental backups by using rsync and "hard links" to perform full backups in a fraction of the space. Hard links are used with unchanged files and are amazing when it comes to saving space with backups.
Here's a script I run daily to backup mysql databases without shutting down the mysql server. It can be included in the rsnapshot config file. I replaced the server ip with "xxx.xxx.xxx.xxx" and the root password with "root_pswd" for security.
Code:
#!/bin/bash
###########################################################
# Back up MySQL databases
###########################################################
# Do not backup these databases
IGNORE="information_schema mysql test"
# Get list of all databases
DB_LIST=`mysql -h xxx.xxx.xxx.xxx -proot_pswd -Bse 'show databases'`
for db in $DB_LIST; do
# set skip variable
skip=0
if [ "$IGNORE" != "" ]; then
for i in $IGNORE; do
[ "$db" == "$i" ] && skip=1 || :
done
fi
if [ "$skip" == "0" ]; then
mysqldump -h xxx.xxx.xxx.xxx -proot_pswd $db > $db.sql
fi
done
exit 0
The script which you have provided for backing up mysql database works like charm,but will feel very happy if i get a similar one for postgresql database too.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.