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.
I have one doubt, is copying /var/lib/mysql is a good alterntive to mysqldump?.
Because i use rsync to copy /var/lib/mysql for back up without dumping the database. I use rsync to do differential backup up so that it copies /var/lib/mysql to /var/tmp every one minute.
Does this idea worths or will it create any other problems.
I have used BackupPC and rsync in the past to backup (and restore) a live MySQL database. Granted, when I restored, I stopped the process so further "live" changes weren't made while I was trying to restore.
No, I actually did not experience any problems doing the data restore. Basically, to put it simply, someone decided to delete the entire MySQL database (don't ask me how) and I was able to restore the entire database using the files that were backed up from rsync. We did not experience any database or other problems as a result of this if that is what you are asking. I have also restored a database after some wrong data was entered, which also worked fine.
Overall, I personally found that rsync did and does a better job at doing the data backup compared to MySQL dump. However, that is not to say they don't both have their place. I have personally used mysqldump when doing upgrades or changes to the system to add a bit of "redundancy" in there in case rsync didn't work during these times. I also used to use mysqldump monthly but I stopped doing it.
Hopefully this helps clarify things. Please let me know if I can be of further assistance.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
Quote:
Originally Posted by dinakumar12
Hi all,
I have one doubt, is copying /var/lib/mysql is a good alterntive to mysqldump?.
Because i use rsync to copy /var/lib/mysql for back up without dumping the database. I use rsync to do differential backup up so that it copies /var/lib/mysql to /var/tmp every one minute.
Does this idea worths or will it create any other problems.
Basically, you may get away with simply backing up /var/lib/mysql, but you run the risk of having inconsistencies in the database when you recover. It may work many times, and then you may encounter the time when it doesn't. You will end up having to get deeper into MySQL at that point to repair things.
Simply copying files won't work with all storage engines. It will work with MyISAM; but I'd recommend you to use mysqlhotcopy or mysqldump to avoid problems with data inconsistencies.
But kindly provide me how to take differential backups in mysql.I googled for it,and found that mysqld service has to be started --log--bin option.But i edited /etc/my.cnf file but mysqld didn't started.I use mysql 5.0 version.
So can you just provide me any link or tip for takilng differential backups using mysqldump.
And also can you please provide me the command used for differential backup using tar. i googled and found many for incremental backup but not for differential.
Last edited by dinakumar12; 01-27-2011 at 08:15 AM.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
Two points here, since your post is going in two different directions now.
Differential is just a particular type of incremental that some vendors talk about. See the definitions here: http://wiki.zmanda.com/index.php/FAQ...da_use_them%3F . Thus, if you can do incremental with tar, you can do differential. They just aren't going to make a specific case for that and call it by that name.
Back to MySQL. Things like mysqldump do full dumps. If you want incremental, you need the binary log: http://dev.mysql.com/doc/refman/5.1/en/binary-log.html. You don't want to be messing with file system backups (like tar) trying to do incremental on your database files.
If you changed your my.cnf and are having trouble starting mysql, tell us exactly what you changed and what errors you see on startup.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
You are pretty much there.
You don't do incremental dumps. The binary log is the incremental. You use mysqldump to dump everything and the binary log to recover to a particular point in time (incremental).
You can manage all this yourself, or you could implement Zmanda Recovery Manager for MySQL. It's best if you understand doing it yourself first, though.
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197
Rep:
I believe it's described in the documentation links in my previous posts. Typically, I think, you would synchronize full backups and binary logging.
Suppose you have a full backup and binary logging is enabled. Now you are going to do another full backup. Assuming you are going to be keeping your previous full backup. As part of the procedure for stopping database activity (locking tables), you also stop logging. Then copy the binary log to a backup location associated with the previous full backup. Now, when you do the mysqldump, use the --flush-logs option. Then start up the logging again and unlock the tables. This way, you have the full dumps and the binary logs that correspond to the incremental sequences from one full dump to the next as well as a clean start to logging for the new full dump. Of course, you then have a policy for aging those out and tossing them.
I'm not sure exactly how the sequence goes in doing a full and then incremental recovery. If you are bringing it all the way back up, then you should leave the binary log as is at the end. Then start things back up with logging again. But, how to manage a recovery to some particular point in time. Perhaps the binary log gets copied out to the backup location, and then you edit the log to include only the portion you want to use for the recovery. Then proceed as in the case where you recovered the whole binary log. I haven't done that before, so I'm not sure. It sounds logical, but it could get messy if you are partially recovering only one of several databases. The documentation should give the details. In particular, this tutorial might be helpful: http://www.learn-mysql-tutorial.com/BackupRestore.cfm
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.