inotify+rsync遇到了个问题:
一旦当文件发生变化同步后,就隔一段时间(大概一分钟不到)就自动轮询一次文件夹,造成了服务器的负载。。。
- /usr/bin/inotifywait -mrq –timefmt ‘%d/%m/%y %H:%M’ –format ‘%T %w%f%e’ -e modify,delete,create,attrib $src|while read files
- do
- /usr/bin/rsync -avzP –delete –progress ${src} ${user}@${host1}::${dst} –password-file=/etc/web.passwd
- echo "${file} was rsyncd"
- done
复制代码
如果只是启动这个脚本,暂时没有文件变化的时候,就不会隔一段时间轮询一次。。。
这个是什么问题?到底要怎么弄?
难道你是监测到文件变化后去同步完成就好了么?为啥还要隔一段时间轮询一次目录啊
- sent 16,559,294 bytes received 9,062 bytes 241,873.81 bytes/sec
- total size is 654,649,017,020 speedup is 39,512.01
- was rsyncd
- sending incremental file list
- sent 16,559,302 bytes received 9,070 bytes 241,874.04 bytes/sec
- total size is 654,649,017,020 speedup is 39,511.97
- was rsyncd
- sending incremental file list
- sent 16,559,306 bytes received 9,074 bytes 241,874.16 bytes/sec
- total size is 654,649,017,020 speedup is 39,511.95
- was rsyncd
- sending incremental file list
- sent 16,559,298 bytes received 9,066 bytes 241,873.93 bytes/sec
- total size is 654,649,017,020 speedup is 39,511.99
- was rsyncd
- sending incremental file list
- sent 16,559,290 bytes received 9,058 bytes 241,873.69 bytes/sec
- total size is 654,649,017,020 speedup is 39,512.03
- was rsyncd
- sending incremental file list
- sent 16,559,302 bytes received 9,070 bytes 241,874.04 bytes/sec
- total size is 654,649,017,020 speedup is 39,511.97
- was rsyncd
- sending incremental file list
- sent 16,559,218 bytes received 8,986 bytes 238,391.42 bytes/sec
- total size is 654,649,017,020 speedup is 39,512.37
- was rsyncd
- sending incremental file list
复制代码
河北网友:用lsyncd
内蒙古网友:文件数量多的时候,用这个就不靠谱了,非常消耗资源,可以做主动同步
吉林网友:实时性不高的话建议定时任务,或者试试lsyncd
未经允许不得转载:美国VPS_搬瓦工CN2 GIA VPS » inotify+rsync懂得进