Portal Home > Knowledgebase > Articles Database > rsync
rsync
Posted by mylikes786, 11-11-2014, 06:30 PM |
I have 2 server.
I update my server 1 regular. Now I want copy all files from server 1 to server 2 (only new files or updated files)
Can you do this using rsync?
If yes can any one tell me command of rsync to do this? So if i run rsync command the new files will start copy.
Thanks in advance
|
Posted by ZANetworks, 11-11-2014, 06:56 PM |
I haven't done much with rsync but bittorrent sync seems to work wonders. It's very simple and straightforward, might want to give it a try if you don't get a solid answer for your rsync question.
|
Posted by NetworkPanda, 11-11-2014, 07:02 PM |
To sync new of updated files from your-server-A.com to the same path on your-server-B.com, run on server your-server-B.com:
It will ask you for the root password and then the synchronization will begin.
Replace your-server-A.com and your-server-B.com with the real public hostnames or IP addresses of your servers.
|
Posted by madaboutlinux, 11-12-2014, 04:02 AM |
The rsync command is correct, however, if you would like this rsync to take place automatically, create a ssh key on server B
The key will be created under the /root/.ssh/ directory and you should copy the contents of file id_dsa.pub to Server A in file /root/.ssh/authorized_keys. If the file authorized_keys is not present on Server A, you should create it
Once done, set a cronjob for say every 5 minutes for the above command and things will be synced from Server A to Server B automatically. The existing files will be ignored.. only new and updated files will be synced.
If you are looking to sync more than one folder from different locations, place all the rsync commands in a file and execute the file in the cronjob.
The file /root/copy-serverA-to-serverB contains all your rsync commands.
|
Add to Favourites Print this Article
Also Read