Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sersync real-time synchronization

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

1.1.1 Features of sersync

Support for profile management

Real daemon socket

Can retransmit failed files regularly (scheduled task function)

Third-party HTTP interface (such as updating cdn cache)

Default multithreaded synchronization

Sersync profile installation sersync (1)

[root@nfs01 local] # rz-E # # window installation package uploads to Linux

Rz waiting to receive.

[root@nfs01 local] # ls

28-sersync.tar.gz bin etc games include lib lib64 libexec sbin share src

[root@nfs01 local] # tar xf 28-sersync.tar.gz

[root@nfs01 local] # ls

28-sersync.tar.gz etc include lib64 sbin share

Bin games lib libexec sersync src

Note: the software package can be downloaded from the Internet, then uploaded to Linux and decompressed to / usr/local/.

1.1.2.2 modify sersync configuration file (2)

[root@nfs01 conf] # vim/usr/local/sersync/conf/confxml.xml

# filtering function of the software, excluding specified files and not synchronizing

# end of filtering function

# # sersync software monitors the specified event information: indicates the event that triggers the monitoring management.

# # end of sersync Software Monitoring specified event Information

# start with the configuration information of the main parameters of sersync (this section can be modified)

# specify the local directory information to be monitored as / data

Rsync server and module information

# configuration information of main parameters of sersync

# end of the configuration information section of the main parameters of sersync

# # defining default log information of failure

[root@nfs01 conf] #

Help information for sersync:

[root@nfs01 bin] # / usr/local/sersync/bin/sersync-help

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

_ _ _

Parameter-d: enable daemon mode

Parameter-r: before monitoring, push the monitoring directory and the remote host with the rsync command

C parameter-n: specifies the number of daemon threads turned on. The default is 10.

Parameter-o: specifies the configuration file, which uses the confxml.xml file by default

Parameter-m: enable other modules separately, and use-m refreshCDN to enable refresh CDN module

Parameter-m: enable other modules separately, and use-m socket to open the socket module

Parameter-m: enable other modules separately, and use-mhttp to open the http module

If the-m parameter is not added, the synchronization program will be executed by default

_

[root@nfs01 bin] #

1.1.2.3 commands for configuring sersync (3)

[root@nfs01 bin] # which sersync # # after configuring the configuration file, the system does not have the command sersync

/ usr/bin/which: no sersync in (/ usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

1. Append environment variables

[root@nfs01 bin] # echo "export PATH=$PATH:/usr/local/sersync/bin" > > / etc/profile

[root@nfs01 bin] # tail-n 2/etc/profile

Unset-f pathmunge

Export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/sersync/bin

[root@nfs01 bin] # which sersync

/ usr/bin/which: no sersync in (/ usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

2. Effective environment variable configuration file

[root@nfs01 bin] # source / etc/profile

[root@nfs01 bin] # which sersync

/ usr/local/sersync/bin/sersync

[root@nfs01 bin] #

1.1.2.4 start the sersync command (4)

Configure sersync on the NFS client to start the command.

[root@nfs01 data] # sersync-dro / usr/local/sersync/conf/confxml.xml

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

Option:-d run as a daemon

Option:-r rsync all the local files to the remote servers before the sersyncwork

Option:-o config xml name: / usr/local/sersync/conf/confxml.xml

Daemon thread num: 10

Parse xml config file

Host ip: localhost host port: 8008

Daemon start,sersync run behind the console

Use rsync password-file:

User is rsync_backup

Passwordfile is / etc/rsync.password

Config xml parse success

Please set / etc/rsyncd.conf maxconnections=0 Manually

Sersync working thread 12 = 1 (primary thread) + 1 (fail retry thread) + 10 (daemon sub threads)

Max threads numbers is: 22 = 12 (Thread pool nums) + 10 (Sub threads)

Please according your cpu, use-n param to adjust the cpurate

Chmod: cannot access` / application/logs/rsync_fail_log.sh': No such file or directory

-

Rsync the directory recursivly to theremote servers once

Working please wait...

Execute command: cd / data & & rsync-avz-R-delete. /-- timeout=100rsync_backup@172.16.1.41::nfsbackup-- password-file=/etc/rsync.password > / dev/null 2 > & 1

Run the sersync:

Watch path is: / data

[root@nfs01 data] #

View the changes in the / backup file on the server

[root@backup nfsbackup] # rm-fr *

[root@backup nfsbackup] # ls

[root@backup nfsbackup] # ls

3 4 hehe maomao oldboy

[root@backup nfsbackup] #

Parameters of sersync

-r enable a full synchronization for the first time and keep it consistent

-o specify the file for confxml.xml

-n specifies the total number of threads in the default thread pool. If you do not specify that the default thread pool is 10 minutes CPU overused, you can adjust it with this parameter.

The-d parameter is launched in the background

-m is out of sync and only runs plug-ins

1.2 Summary of real-time synchronization of highly concurrent data:

Inotify (sersync) + rsync, which is file level.

Drbd file system level, based on block block synchronization, but standby node data is not available.

Synchronization function of third-party software: mysql,oracle,mongodb

Program double write, write directly to two servers

Using business logic to solve (separation of reading and writing)

NFS cluster (145 scenario consolidation) (dual write primary storage, standby storage inotify/sersync+rsync), does not solve the latency problem.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report