rsync clarification

snmoorthy1977
snmoorthy1977 used Ask the Experts™
on
I am planning to use rsync with ssh to synchronize two servers.  I had a confusion in which place to use rsync - in source server or destination server.
   Can anyone give me the advantage one over the other.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mihai BarbosTrying to tame bits. They're nasty.

Commented:
You need rsync on both machines. If you are asking where to start rsync as daemon, the normal place would be the source server and configure it read-only. So you can sync the destination from a RO server. The other way round would mean a RW server and a higher error "capability". That if you clearly have to copy only one way.

Author

Commented:
Thanks for your response.  But i am not planning to run rsync as daemon.  One server is my mail server and another server is backup of it.  I got the idea of using rsync to backup mailserver's file in backup server.  I am planning to use just rsync command.  I have the following questions.

1. Which place to use rsync command?

2. What is the bandwidth consumed?

TIA
Mihai BarbosTrying to tame bits. They're nasty.

Commented:
You have to use rsync on both machines, since rsync can work only with another rsync at the other end.
In your case I would run rsync as a daemon in RO mode on the mail server (with the proper access restrictions) and rsync from cron on the backup machine, using different directories for each day, or hoever your backup policy is.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Mihai BarbosTrying to tame bits. They're nasty.

Commented:
2. The bandwith depends on many factors, but rsync is supposed to behave "smart" and transfer only what is needed.

Author

Commented:
can u tell me how to daemonize rsync or some URL regd. it
Trying to tame bits. They're nasty.
Commented:
Oh, it's simple. You will have to write the configuration file for the server (/etc/rsyncd.conf). See the man page for it, (man rsync, rsyncd.conf) but it should look like:
[whatever_you_want_to_sync]
uid = <user you would rsync to act as>
path = <the path to your data>
... othe options, maybe.....

You can have many sections like this.
Start the daemon with
rsync --daemon

That's it.

On the client you run

rsync <options> server::<name of section> <destination path>

Probably the options you want are just -a

You can also start rsync on both machines, without using a daemon, but I think using a daemon will save you some trouble

Don't forget to set the users that can connect and to configure the firewall accordingly :)

Author

Commented:
i tried with a small directory..it is working fine.  But i am not able to preserve the ownership of files. Since i am going to mirror a server, ownership maintaining is important.  Do u have any idea regd. it.
   i tested with RSYNC server and client
Mihai BarbosTrying to tame bits. They're nasty.

Commented:
You should run the client with -a. Oh, and as root on both machines (otherwise probably you won't have access to all the files you need, anyway). So uid = root in the rsyncd.conf on server.
snmoorthy1977:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial