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_r
sa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/AdminUser/.ssh/id_rs
a.
Your public key has been saved in /home/AdminUser/.ssh/id_rs
a.pub.
The key fingerprint is:
79:82:88:be:48:13:dc:73:b8
:bd:d6:1f:
7c:c5:54:e
0
[email protected]ream.com
2. scp ~/.ssh/id_rsa.pub AdminUser@server2:~/.ssh/a
uthorized_
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/Wor
k /opt/Work
To See Verbose output.
rsync -avz --progress --stats AdminUser@server2:/opt/Wor
k /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/Wor
k /opt/Work
iii. crontab -l
rsync -az AdminUser@server2:/opt/Wor
k /opt/Work
HTH
Ramakant