Rsync Two Way Sync Folders

broken image


How to sync the data between two servers without using SAN replication ? Do you have better than RSYNC tool for this job ? I don't think so, you we will not get better than RSYNC. It uses ‘rsync algorithm' which provides a very fast method for syncing the directories or filesystems. An important feature of rsync is that the mirroring takes place with only one transmission in each direction and which is not available in other similar programs.

  1. Rsync Two Way Sync Folders Software
  2. Rsync Multiple Files
  3. Rsync Two Way Sync Folders Free
  4. Rsync Two Way Sync Folders Free

Remote sync, or rsync, is a way to synchronize files and directories through the command line interface on Unix-based machines. This easy-to-use utility is commonly used for backing up your data. Given the confusion about rsync's operation, it is perhaps worth noting rsync's -update option, which will skip (not sync) files which have a more recent modified time on the receiving side. – Richard Michael Dec 29 '13 at 22:17.

Way
Rsync's default port is 873 and its an opensource software. Rsync is available for Unix,Linux and windows operating systems. You can freely download rsync source code from rsync.samba web portal.
Here we will see how to sync data between two servers using automated script.
Operating system:Red Hat Linux
Source Server IP: 192.168.10.20 (mylinz1)
Source Server Path:/db/oracle/

Destination Server IP:192.168.10.25 (mylinz2)
Destination Server Path:/db/oracle-bck/
Before proceeding to rsync part,you need to configure key-less authentication to ensure each can communicate using that.

1.Verify whether your host will allow to perform RSA key-less authentication.If you didn't get similar output,then you need to comment out the lines in sshd_config.


2.Generate the keygen if you didn't have one already. Here the user is 'root'.


3.Share the 'id_rsc.pub' file across the servers to enable the ssh key-less authentication.


4.Verify your work.

Let's move to RSYNC part.
Rsync two way sync folders download
Rsync's default port is 873 and its an opensource software. Rsync is available for Unix,Linux and windows operating systems. You can freely download rsync source code from rsync.samba web portal.
Here we will see how to sync data between two servers using automated script.
Operating system:Red Hat Linux
Source Server IP: 192.168.10.20 (mylinz1)
Source Server Path:/db/oracle/

Destination Server IP:192.168.10.25 (mylinz2)
Destination Server Path:/db/oracle-bck/
Before proceeding to rsync part,you need to configure key-less authentication to ensure each can communicate using that.

1.Verify whether your host will allow to perform RSA key-less authentication.If you didn't get similar output,then you need to comment out the lines in sshd_config.


2.Generate the keygen if you didn't have one already. Here the user is 'root'.


3.Share the 'id_rsc.pub' file across the servers to enable the ssh key-less authentication.


4.Verify your work.

Let's move to RSYNC part.


Here is the rsync script which will be used for syncing the data between servers mylinz1 & mylinz2.

Here I am running script from mylinz1 to sync the data.


This script creates log as well with newly synchronized files information.

Testing rsync script:

1.Run the script manually.


2.Verify the log file.

3.Create a new file to sync the data to mylinz2 server.

4.Verify the whether the newly created file synced in mylinz2.
That's it. Our rsync script is working fine.

If you want to sync the data between two servers automatically on preferred time interval,you can add the script in to crontab.

Rsync Two Way Sync Folders Software



Add the below line in root's crontab to sync the data for every 5 minutes.

Thank you for reading this article.Please leave a comment if you have any doubt.

Rsync is very powerful tool to take backups, or sync files and directories between two different locations (or servers).

In a typical backup situation, you might want to exclude one or more files (or directories) from the backup. You might also want to exclude a specific file type from rsync. Following are some examples on how to do this:

Twitch rivals league. If you don't want to sync the dir1 (including all it's subdirectories) from the source to the destination folder, use the rsync –exclude option as shown below.

The following example will exclude any directory (or subdirectories) under source/ that matches the pattern 'dir*'

To exclude a specific file, use the relative path of the file in the exclude option as shown below.

To exclude a specific file type that has a specific extension, use the appropriate pattern. For example, to exclude all the files that contains .txt as extension, do the following.

When you want to exclude multiple files and directories, you can always specify multiple rsync exclude options in the command line as shown below.

Rsync Multiple Files

So, the better way is to use rsync –exclude-from option as shown below, where you can list all the files (and directories) you want to exclude in a file.

Rsync Two Way Sync Folders Free

First, create a text file with a list of all the files and directories you don't want to backup. This is the list of files and directories you want to exclude from the rsync.

Rsync Two Way Sync Folders Free

Next, execute the rsync using –exclude-from option with the exclude-list.txt as shown below.





broken image