rsync+inotify实现实时同步、增量备份

主机A:被备份的源主机
主机B:备份的目的主机

  • 在linux内核中,默认的inotify机制提供了三个调控参数
[root@fudanwuxi html]# uname -r
3.10.0-693.el7.x86_64
[root@fudanwuxi html]# ll /proc/sys/fs/inotify/
total 0
-rw-r--r--. 1 root root 0 Aug 25 09:32 max_queued_events  #监控事件队列
-rw-r--r--. 1 root root 0 Aug 25 09:32 max_user_instances  #最多监控实例数
-rw-r--r--. 1 root root 0 Aug 25 09:32 max_user_watches  #每个实例最多监控文件数
[root@fudanwuxi html]# cat /proc/sys/fs/inotify/max_queued_events 
16384
[root@fudanwuxi html]# cat /proc/sys/fs/inotify/max_user_instances 
128
[root@fudanwuxi html]# cat /proc/sys/fs/inotify/max_user_watches 
8192
  • 当要监控的目录、文件数量较多或者变化较频繁时,要加大这三个参数的值
[root@fudanwuxi html]# vim /etc/sysctl.conf                      
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).

fs.inotify.max_queued_events = 32768
fs.inotify.max_user_instances = 1024
fs.inotify.max_user_watches = 305564824
~                                                    
[root@fudanwuxi html]# sysctl -p
fs.inotify.max_queued_events = 32768
fs.inotify.max_user_instances = 1024
fs.inotify.max_user_watches = 305564824
[root@fudanwuxi html]# cat /proc/sys/fs/inotify/max_queued_events  
32768
[root@fudanwuxi html]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值