LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2012, 01:51 AM   #1
mmhs
Member
 
Registered: Oct 2010
Posts: 99

Rep: Reputation: 1
Post sync mirror


hi guys i have a question about syncing two severs mirror

i have a live server and an offline server which works as replicate i have a problem with syncing data between two servers mirror

i want to sync data between these server mirror and if i delete one file on my live server it automatically be deleted on offline server

with rsync command we have two stages first we should backup all of data and then delete the difference with another rsync schedule is there any other ways ??
 
Old 03-08-2012, 04:25 AM   #2
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Rep: Reputation: 15
I've not worked with servers, but I take a backup regularly of files from two workstations (my wife and I work from home) and I use the rsync command for this. You don't have to do the backup twice. I just do "rsync -r --delete" etc etc. This will take an incremental backup and delete files that were there previously and are not there now. In fact, even if you move files around into different folders, this command will ensure that the backup has the new format.
Don't know if I've answered your question.
 
Old 03-08-2012, 08:49 AM   #3
mmhs
Member
 
Registered: Oct 2010
Posts: 99

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Inkit View Post
I've not worked with servers, but I take a backup regularly of files from two workstations (my wife and I work from home) and I use the rsync command for this. You don't have to do the backup twice. I just do "rsync -r --delete" etc etc. This will take an incremental backup and delete files that were there previously and are not there now. In fact, even if you move files around into different folders, this command will ensure that the backup has the new format.
Don't know if I've answered your question.
thx man for you answer but i need mirror backup not incremental both paths should have exactly same data even you delete one file or directory in the main server this file should be deleted automatically in the other server
 
Old 03-09-2012, 02:34 AM   #4
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Rep: Reputation: 15
An incremental backup means that only what is changed will be backed up. Anything that is not changed will remain untouched. This is very important when the total size of the backup is large, because the backup is accomplished faster. For example if you have a total of 1000 files, each of around 500 kb in size. You may want to backup everything every single time, but you may have only changed 10 files between the previous backup and now.
An incremental backup means that the timestamp of the files are compared and only those that have seen any changes are backed up. So instead of all 1000 files being backed up, only the 10 that have changed will be.
All the other remaining files will remain the same. The first time alone, all the files are copied as is, because there is no backup file to compare the timestamp to. From the second time onwards you will get only an incremental backup which will cut down on your backup times drastically. This is because you are backing up into the same folder each time instead of creating a separate folder each time. If you are creating a separate folder each time, you may as well use the scp command for all the good rsync will do.
In my case I have nearly 5000 photos that I have in my photos folder. I also have a backup on another drive, and every time I upload new photos, I take a backup. Now copying 5000 photos usually takes me nearly 30 min, but when I use the rsync command, since only the new photos are copied, I can do this in less than 5.
In your case, I would assume that when you use the rsync command from your live server to your backup one, as long as you are pointing to the same backup folder each time, only those files that have changed on the live server will be changed in the backup one too. Everything else will remain the same.
This means that if you have a total of 1000 files to be backed up, and have deleted 10, added 5 and changed 50, then only these 65 files will be changed in the backup folder. ANY change is applied, so even if you move a file from one subfolder into another, this will be applied to the backup folder. I am assuming that this will give you the MIRROR backup you are looking for.
The process is of course not automatic and you will have to run the rsync command each time. I am however sure that if you are able to create a cron tab, you can automate the process. I am unfortunately not very familiar with doing that, so cannot help there.
I'm not saying that this is the best way, but I'm giving an explanation just in case I've not been clear the last time.

Last edited by Inkit; 03-09-2012 at 02:35 AM.
 
Old 03-09-2012, 05:36 AM   #5
mmhs
Member
 
Registered: Oct 2010
Posts: 99

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Inkit View Post
An incremental backup means that only what is changed will be backed up. Anything that is not changed will remain untouched. This is very important when the total size of the backup is large, because the backup is accomplished faster. For example if you have a total of 1000 files, each of around 500 kb in size. You may want to backup everything every single time, but you may have only changed 10 files between the previous backup and now.
An incremental backup means that the timestamp of the files are compared and only those that have seen any changes are backed up. So instead of all 1000 files being backed up, only the 10 that have changed will be.
All the other remaining files will remain the same. The first time alone, all the files are copied as is, because there is no backup file to compare the timestamp to. From the second time onwards you will get only an incremental backup which will cut down on your backup times drastically. This is because you are backing up into the same folder each time instead of creating a separate folder each time. If you are creating a separate folder each time, you may as well use the scp command for all the good rsync will do.
In my case I have nearly 5000 photos that I have in my photos folder. I also have a backup on another drive, and every time I upload new photos, I take a backup. Now copying 5000 photos usually takes me nearly 30 min, but when I use the rsync command, since only the new photos are copied, I can do this in less than 5.
In your case, I would assume that when you use the rsync command from your live server to your backup one, as long as you are pointing to the same backup folder each time, only those files that have changed on the live server will be changed in the backup one too. Everything else will remain the same.
This means that if you have a total of 1000 files to be backed up, and have deleted 10, added 5 and changed 50, then only these 65 files will be changed in the backup folder. ANY change is applied, so even if you move a file from one subfolder into another, this will be applied to the backup folder. I am assuming that this will give you the MIRROR backup you are looking for.
The process is of course not automatic and you will have to run the rsync command each time. I am however sure that if you are able to create a cron tab, you can automate the process. I am unfortunately not very familiar with doing that, so cannot help there.
I'm not saying that this is the best way, but I'm giving an explanation just in case I've not been clear the last time.
thx man but your solution is not mirror backup given that when you move a file from a subfolder into another in the backup server that file will be remained in the main subfolder and a copy will be created in the other subfolder however in the main server or live server you have this file only in a subfolder
 
Old 03-10-2012, 02:10 AM   #6
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Rep: Reputation: 15
Quote:
thx man but your solution is not mirror backup given that when you move a file from a subfolder into another in the backup server that file will be remained in the main subfolder and a copy will be created in the other subfolder however in the main server or live server you have this file only in a subfolder
I guess you haven't read my initial post correctly. What you say happens if you just do "rsync -r", but I believe I had mentioned "rsync -r --delete". This will delete the so called "copy" that you talk about. It will in fact delete everything in the backup that is not there in the live server you are taking a backup from. There are a number of other variables you can use and the man pages of rsync will help you there.
I'm sorry, it seems (even to me, and I'm a little more dense than other people) that I'm shoving this down your throat while you're not that interested. I'll therefore stop with this and leave you to others who may have a better solution for you.

Last edited by Inkit; 03-10-2012 at 02:16 AM.
 
1 members found this post helpful.
Old 03-10-2012, 02:30 PM   #7
mmhs
Member
 
Registered: Oct 2010
Posts: 99

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Inkit View Post
I guess you haven't read my initial post correctly. What you say happens if you just do "rsync -r", but I believe I had mentioned "rsync -r --delete". This will delete the so called "copy" that you talk about. It will in fact delete everything in the backup that is not there in the live server you are taking a backup from. There are a number of other variables you can use and the man pages of rsync will help you there.
I'm sorry, it seems (even to me, and I'm a little more dense than other people) that I'm shoving this down your throat while you're not that interested. I'll therefore stop with this and leave you to others who may have a better solution for you.
thx man for your help i will test that however i test --delete-after and that worked fine

thx for your good explanation
 
Old 03-10-2012, 03:09 PM   #8
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
I am always using rsync with the -au --delete options. That makes a mirror of whatever I backup.

jlinkels
 
Old 03-11-2012, 03:21 AM   #9
Inkit
Member
 
Registered: Feb 2011
Location: India
Distribution: Mint 10
Posts: 142

Rep: Reputation: 15
Hey no problem man. Most of the time it's me who's asking for help here, so I'm just happy that I could "pay it forward" so to speak.
 
Old 03-11-2012, 07:44 AM   #10
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 103Reputation: 103
Lightbulb

http://www.linuxquestions.org/linux/...etween_servers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mirror mirror on the wall taylorkh Red Hat 2 07-09-2011 11:46 AM
Proper way to Sync Debian Mirror but preserve Sarge bizmarke Linux - Server 2 08-23-2010 06:38 PM
[SOLVED] Problems with Debootstrap and apt-mirror-based Debian mirror lil_drummaboy Debian 3 06-22-2010 07:12 PM
apt-mirror doesn't create appropriate mirror ??? abd_bela Debian 1 09-30-2009 05:23 PM
LXer: How To Create A Local Debian/Ubuntu Mirror With apt-mirror LXer Syndicated Linux News 0 01-04-2007 06:33 PM


All times are GMT -5. The time now is 03:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration