Question : rsync help

Hello,

I have a server with a directory and many subdirectories below it ...

ServerA:/Work/

All files below the /Work directory are owned by UserA

I want to rsync (periodically) the entire directory to ServerB:/Work/ . However I am not sure of the best commands to use (it's about 8G of data), or the syntax. The other problem is the owner of /Work on ServerB is different - UserB , so I am not sure how to handle the permissions.

Any Ideas

Thanks

Alistair

Answer : rsync help

Hi,

Please follow below steps to use rsync smoothly and correctly.

Steps to use rsync command:

Rsync between server1 and server2 with AdminUser as common login user.
Steps to do server1
1. ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/AdminUser/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/AdminUser/.ssh/id_rsa.
Your public key has been saved in /home/AdminUser/.ssh/id_rsa.pub.
The key fingerprint is:
79:82:88:be:48:13:dc:73:b8:bd:d6:1f:7c:c5:54:e0 [email protected]ream.com


2.  scp ~/.ssh/id_rsa.pub AdminUser@server2:~/.ssh/authorized_keys2 (Public key needs to be copied)
AdminUser@server2's password:
id_rsa.pub                                                                                                                 100%  419     0.4KB/s   00:00    

3.  ssh server2 (Should log you in without asking for password)
Last login: Mon Feb 15 23:34:03 2010 from 192.168.108.157

4.  To resync
To do it Silently

rsync -az AdminUser@server2:/opt/Work     /opt/Work

To See Verbose output.
rsync -avz  --progress --stats AdminUser@server2:/opt/Work /opt/Work

Notes:
-avz
a for archive mode (preserve all the attributes of each file and directory  ownership, permissions, etc).
v for verbose mode (report a list of files processed by rsync) and z for data compression to speed transfers up.

5. CronJob to set for 5minutes replication
      i. crontab -e
      ii. */5 * * * * rsync -az AdminUser@server2:/opt/Work     /opt/Work
      iii. crontab -l
      rsync -az AdminUser@server2:/opt/Work     /opt/Work



HTH
Ramakant
Random Solutions  
 
programming4us programming4us