版本升级:
[root@prod-lsynd-server-02 ~]# rpm -qa rsyncrsync-3.0.9-18.el7.x86_64[root@prod-lsynd-server-02 ~]# cd /tmp/[root@prod-lsynd-server-02 tmp]# rz[root@prod-lsynd-server-02 tmp]# rpm -Uvh rsync-3.1.2-10.el7.x86_64.rpmwarning: rsync-3.1.2-10.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEYPreparing... ################################# [100%]Updating / installing...1:rsync-3.1.2-10.el7 ################################# [ 50%]Cleaning up / removing...2:rsync-3.0.9-18.el7 ################################# [100%][root@prod-lsynd-server-02 tmp]#[root@prod-lsynd-server-02 tmp]# rpm -qa rsyncrsync-3.1.2-10.el7.x86_64[root@prod-lsynd-server-02 tmp]#
内核优化
echo "5000000000" >/proc/sys/fs/inotify/max_user_watchesecho "10000000" >/proc/sys/fs/inotify/max_queued_eventsecho "8192" >/proc/sys/fs/inotify/max_user_instances
安装软件:
yum install rsync -y
添加用户和同步密钥
服务端账户+密码 客户端只需密码即可
生产环境推送基础服务区、 基础服务区推送准生产
172.16.4.59 - - 10.180.101.33
172.16.4.65 - ————10.68.100.93—— - 10.180.101.36
172.16.4.69 - - 10.180.101.39
172.16.4.59:/data/tongdun/local/elasticsearch —— > 10.68.100.93:/data/tongdun-33/data
10.68.100.93:/data/tongdun-33/data —— > 10.180.101.33:/data/tongdun/local/elasticsearch
手动测试:
rsync -vlzrtopg —progress —delete /data/tongdun/local/elasticsearch rsync_bakup@10.68.100.93::bakup-33 —password-file=/etc/rsyncd.password
修改配置文件:
[root@prod-lsynd-server-02 ~]# cat /etc/rsyncd.confuid = boccfcgid = boccfcport = 873use chroot = truemax connections = 200timeout = 120pid file = /var/run/rsyncd.pidlock file = /var/run/rsyncd.locklog file = /var/log/rsyncd.log[bakup-33]path = /data/tongdun-33read only = falselist = falsehosts allow = 10.68.100.0/24hosts deny = 0.0.0.0/32auth users = rsync_bakupsecrets file = /etc/rsyncd.password[root@prod-lsynd-server-02 ~]######[root@prod-lsynd-server-02 ~]# cat /etc/rsyncd.password123456[root@prod-lsynd-server-02 ~]#目录监控:
10.68.100.93
[root@prod-lsync-server01 ~]# cat /etc/rsyncd.confuid = boccfcgid = boccfcport = 873use chroot = truemax connections = 200timeout = 120pid file = /var/run/rsyncd.pidlock file = /var/run/rsyncd.locklog file = /var/log/rsyncd.log[bakup-33]path = /data/tongdun-33/dataread only = falselist = falsehosts allow = 10.180.101.0/24hosts deny = 0.0.0.0/32auth users = rsync_bakupsecrets file = /etc/rsyncd.password[bakup-36]path = /data/tongdun-36/dataread only = falselist = falsehosts allow = 10.180.101.0/24hosts deny = 0.0.0.0/32auth users = rsync_bakup-36secrets file = /etc/rsyncd.password[bakup-39]path = /data/tongdun-39/dataread only = falselist = falsehosts allow = 10.180.101.0/24hosts deny = 0.0.0.0/32auth users = rsync_bakup-39secrets file = /etc/rsyncd.password[root@prod-lsync-server01 ~]#######[root@prod-lsync-server01 ~]# cat /etc/rsyncd.password123456rsync_bakup:123456[root@prod-lsync-server01 ~]#目录监控:[root@prod-lsync-server01 ~]# cat /etc/lsyncd.confsettings {logfile = "/var/log/lsyncd/lsyncd.log",statusFile = "/var/log/lsyncd/lsyncd.status",inotifyMode = "CloseWrite",maxProcesses = 8,}sync {default.rsync,source = "/data/tongdun-33",target = "rsync_bakup@10.180.101.33::bakup-33",delete="running",exclude = { ".*", ".tmp" },delay = 5,init = false,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,owner = true,perms = true,password_file = "/etc/rsyncd.password",_extra = {"--bwlimit=200"}}}sync {default.rsync,source = "/data/tongdun-36",target = "rsync_bakup-36@10.180.101.36::bakup-36",delete="running",exclude = { ".*", ".tmp" },delay = 5,init = false,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,owner = true,perms = true,password_file = "/etc/rsyncd.password",_extra = {"--bwlimit=200"}}}sync {default.rsync,source = "/data/tongdun-39",target = "rsync_bakup-39@10.180.101.39::bakup-39",delete="running",exclude = { ".*", ".tmp" },delay = 5,init = false,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,owner = true,perms = true,password_file = "/etc/rsyncd.password",_extra = {"--bwlimit=200"}}}[root@prod-lsync-server01 ~]#
10.180.101.33
[root@td-stage-app13 ~]# cat /etc/rsyncd.confuid = boccfcgid = boccfcport = 873use chroot = truemax connections = 200timeout = 120pid file = /var/run/rsyncd.pidlock file = /var/run/rsyncd.locklog file = /var/log/rsyncd.log[bakup-33]path = /data/tongdun/local/elasticsearchread only = falselist = falsehosts allow = 10.180.101.0/24hosts deny = 0.0.0.0/32auth users = rsync_bakupsecrets file = /etc/rsyncd.password[root@td-stage-app13 ~]#####[root@td-stage-app13 ~]# cat /etc/rsyncd.passwordrsync_bakup:123456[root@td-stage-app13 ~]#
部署 lsrync 调取rsync同步数据
10.68.100.93
[chroot@prod-lsync-server01 ~]$ cat /etc/lsyncd.confsettings {logfile = "/var/log/lsyncd/lsyncd.log",statusFile = "/var/log/lsyncd/lsyncd.status",inotifyMode = "CloseWrite",maxProcesses = 8,}sync {default.rsync,source = "/data/tongdun-33",target = "rsync_bakup@10.180.101.33::bakup-33",delete="running",exclude = { ".*", ".tmp" },delay = 5,init = false,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,owner = true,perms = true,password_file = "/etc/rsyncd.password",_extra = {"--bwlimit=200"}}}sync {default.rsync,source = "/data/tongdun-36",target = "rsync_bakup-36@10.180.101.36::bakup-36",delete="running",exclude = { ".*", ".tmp" },delay = 5,init = false,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,owner = true,perms = true,password_file = "/etc/rsyncd.password",_extra = {"--bwlimit=200"}}}sync {default.rsync,source = "/data/tongdun-39",target = "rsync_bakup-39@10.180.101.39::bakup-39",delete="running",exclude = { ".*", ".tmp" },delay = 5,init = false,rsync = {binary = "/usr/bin/rsync",archive = true,compress = true,verbose = true,owner = true,perms = true,password_file = "/etc/rsyncd.password",_extra = {"--bwlimit=200"}}}[chroot@prod-lsync-server01 ~]$
