Complete sersync2 installation and configuration instructions (1) basic functions

Source: Internet
Author: User
Tags inotify

For rsync configuration, you can find a lot of information on google. The following are only some necessary configurations and instructions for use, for your reference only. Please modify them according to your actual situation.

You must configure sersync on the synchronization master server, configure rsync on the synchronization target server, and enable the rsync waiting process on the target server. In this way, the files generated on the master server are, sersync synchronizes data to multiple target servers in real time. By default, rsync has been installed in centos. You only need to configure and enable rsync.

Configure rsync for the target synchronization server

Configure the following on multiple target servers:

Copy codeThe Code is as follows: vi/etc/rsyncd. conf

Uid = root
Gid = root
Max connections = 36000
Use chroot = no
Log file =/var/log/rsyncd. log
Pid file =/var/run/rsyncd. pid
Lock file =/var/run/rsyncd. lock

[Tongbu1]
Path =/opt/tongbu1
Comment = xoyo video files
Ignore errors = yes
Read only = no
Hosts allow = 192.168.0.100/24
Hosts deny = *

The Configuration File above indicates that the master server is allowed (assuming the ip address is 192.168.0.100) access, the rsync synchronization module is named [tongbu1], and the synchronized files are placed in the directory/opt/tongbu1 specified by path. If there are multiple slave servers, each server requires a similar rsync configuration. The uid gid above must be replaced with the corresponding user on your server, the idea is that rysnc must have the permission to operate the directory to be synchronized. After configuration, run the following command to enable the rsync daemon:

Rsync -- daemon install and configure sresync on the master server
Download the executable file version of sersync from google code, which contains the configuration file and executable file. Here we use sersync2.5 to describe it. The configuration form of the new version is similar.

1. Enable the sersync daemon on the master server to run sersync in the background and enable real-time synchronization.Copy codeThe Code is as follows:./sersync-d

The process is as follows:Copy codeThe Code is as follows: [root @ localhost GNU-Linux-x86] # ls
Confxml. xml sersync2
[Root @ localhost GNU-Linux-x86] #./sersync2-d
Set the system param
Execute: echo 50000000>/proc/sys/fs/inotify/max_user_watches
Execute: echo 327679>/proc/sys/fs/inotify/max_queued_events
Parse the command param
Daemon thread num: 10
Parse xml config file
Host ip: localhost host port: 8008
Config xml parse success
Please set/etc/rsyncd. conf max connections = 0 Manually
Sersync working thread 12 = 1 (primary thread) + 1 (fail retry thread) + 10 (daemon sub threads)
Please according your cpu, use-n param to adjust the cpu rate
Run the sersync:
Watch path is:/opt/tongbu

This indicates that sersync is enabled. You can create a file in the local monitoring path to check whether the remote synchronization is successful.
2. perform an overall synchronization between the master server directory and the remote target machine directory before enabling real-time monitoring.Copy codeThe Code is as follows:./sersync-r

If you want to synchronize all existing files or directories to the remote device before sersync is run, run sersync with the-r parameter to synchronize the local device with the remote device.
If a filter is set, that is, if the filter is true in an xml file, the-r parameter cannot be used for overall synchronization. The-r parameter is invalid.

3. View startup parameter helpCopy codeThe Code is as follows:./sersync -- help

4. Specify the configuration fileCopy codeThe Code is as follows:./sersync-o XXXX. xml

For sersync, use the default configuration file confxml. xml in the executable file directory. If you want to use another configuration file, you can use the-o parameter to specify other configuration files.

5. Specify the total number of threads in the default Thread PoolCopy codeThe Code is as follows:./sersync-n num

For example. /sersync-n 5 specifies the total number of threads to be 5. If not specified, the default number of thread pools to be started is 10. If the cpu usage is too high, you can use this parameter to reduce it, if the machine configuration is high, you can use-n to overwrite the total number of threads.

6. Do not synchronize, only run the plug-inCopy codeThe Code is as follows:./sersync-m pluginName

For example, the./sersync-m command directly runs the command plug-in instead of synchronizing the remote target server after the file event is monitored.

7. Multiple parameters can be used togetherCopy codeThe Code is as follows:./sersync-n 8-o abc. xml-r-d

Indicates that 8 worker threads in the thread pool are set, abc. xml is specified as the configuration file, and the whole synchronization is performed before real-time monitoring, and the daemon process is run in the background.

8. Generally, after synchronizing the local data to the remote data, the system runs real-time synchronization in the background.Copy codeThe Code is as follows:./sersync-d

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.