Rsync is a great tool especially for data migration/mirroring/backups.Rsync's advantage is that it transfers the data in a "smart way", for example if a big sized file transfer was corrupted it will not resend the whole file, instead it breaks the data into chunks and re-transfers only the unfinished data. One of the advantages of rsync is that it knows how to cooperate with ssh, creating a very powerful tool.
Let's see some basic usages of rsync.
1) Transfer remote folder into local one:
jenova:/mysql_db # rsync -avz -e ssh root@remote:/tmp/. /mysql_db/
This will transfer all the contents of /tmp on the remote server to my /mysql_db folder.
2) Transfer local folder into remote one:
jenova:/mysql_db #rsync -avz -e ssh /mysql_db/ root@prana:/tmp/.
Notice the -e flag which tells rsync to use ssh as the network transfer method.