Configure sersync for multi-server file synchronization

Source: Internet
Author: User
Tags inotify rsync
Sersync is mainly used for server synchronization, web images, and other functions. Developed based on boost1.43.0, inotifyapi, and rsynccommand. Currently, inotify-tools + rsync is the most widely used synchronization solution, and Openduckbill, an open-source google Project (dependent on inotify-tool ..
SersyNcIt is mainly used for server synchronization, web images, and other functions. Based on boost1.43.0, inotify api, rSyncCommand. Development. Currently, inotify-too is the most widely used synchronization solution.Ls+ Rsync, another Open-source google ProjectDuCkbill (dependent on inotify-tools), both of which are written in script language. Compared with the above two projects, the advantages of this project are:
  1. SersyncIs written in c ++, andLinuxThe temporary files generated by the file system and repeated file operations are filtered (see appendix for details. This filtering script is not implemented). Therefore, when combined with rsync synchronization, this reduces runtime consumption and network resources. Therefore, it is faster.
  2. Compared with the above two projects, sersync is easy to configure. The bin directory already has a basically statically compiled binary file, which can be used directly with the xml configuration file under the bin directory.
  3. In addition, compared with other open-source scripts, this project uses multiple threads for synchronization. Especially when synchronizing large files, multiple servers can be synchronized in real time.
  4. This project has an error handling mechanism. The failed queue is used to re-Synchronize the failed files. If the failed files still fail, the files that fail to be synchronized are re-synchronized every 10 hours.
  5. This project comesCrontabFunction. You only need to enable the function in the xml configuration file to synchronize the configuration file at intervals according to your requirements. You do not need to configure the crontab function.
  6. The socket and http plug-in extensions in this project meet your needs for secondary development.

The specific configuration is simple: Enable sersync on the synchronization master server, and configure rsync on the synchronization target server.

Synchronization master server configuration: assume that the master server ip address is 10.0.0.1, and the target server ip address is 10.0.0.2 and 10.0.0.3.

# Wget http://sersync.googlecode.com/FileS/sersync2.5_64bit_binary_stable_final.tar.gz

# Tar-zvxf sersync2.5_64bit_binary_stable_final.tar.gz

#CdGNU-Linux-x86

# Ls

Confxml. xml
Sersync2

# Vi confxml. xml



# Hostip and port are reserved fields for the plug-in and have no effect on the synchronization function. Retain the default value.



< ExClude ExprEssion = "(. *). svn">
















# Allow Remote synchronization and local paths
# The ip address that allows remote synchronization; rsync_img is the name of the synchronization project. The following shows that if you want to synchronize multiple paths added here, the test will not take effect. At last, I did this by developing an xml file;
# Other server ip addresses that allow remote Synchronization





DfIle = "/etc/rsync. pas"/>
EdPort start = "false" port = "874" type = "codeph" text = "codeph"/>
< TimeOut start = "false" time = "100"/>


CutE = "60"/>










SuFfix = "" ignoreError = "true"/>













Passwd= "Xxxx"/>




Save the configuration file after editing

 

Configure rsync on the target synchronization server

# Rpm-qa rsync # Check whether rsync is installed
Rsync-2.6.8-3.1

# Vi/etc/rsyncd. conf

UId= Root # The uid must be root or cannot be synchronized.
Gid = nobody
Max connections = 200 # maximum number of connections
Timeout = 600
Use chroot = no
Read only = no # This parameter must be set to "no". Otherwise, data cannot be written during synchronization.

Pid file =/var/run/rsyncd. pid

Host allow = 10.0.0.1 # IP address of the master server that allows Synchronization
Host allow = 192.168.0.1 # allow access to other server addresses


[Rsync_img]
Path =/data/img # local synchronization path
Comment = rsync_img # comment

[Rsync_test] # other synchronization Projects
Path =/data/test
Comment = rsync_test

Save

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.