inotify+rsync做实时同步

一、配置inotify随机启动

vi  /etc/rc.local
nohup /home/jenkins/inotify/inotify.sh > nohup.out 2>&1 &

二、inotify同步脚本

#!/bin/bash
#param
src=/home/jenkins/conf/
dst_module=/home/jenkins/conf/
user=jenkins
/usr/bin/inotifywait -mrq --timefmt ‘%d/%m/%y %H:%M‘ --format ‘%T %w %f‘ -e modify,delete,create,attrib ${src} | while read file
do
        rsync -vzrtopg --delete --progress ${src} ${user}@52.81.4.8:${dst_module}
        rsync -vzrtopg --delete --progress ${src} ${user}@52.8.74.8:${dst_module}
        rsync -vzrtopg --delete --progress ${src} ${user}@18.8.120.8:${dst_module}
        echo "${file} was rsyncd" >>/var/log/rsyncd.log 2>&1
done

原文地址:https://www.cnblogs.com/songfucai/p/8893691.html

时间: 2024-08-03 18:39:57

inotify+rsync做实时同步的相关文章

CentOS 6.5 inotify+rsync做实时同步-企业实例(1.0)

inotify+rsync实时同步起源及简介 inotify服务机制 inotify实施准备 inotify配置是建立在rsync服务的基础上 inotify,sersync,lsyncd sersync功能更多,可以做各种过滤,但从性能上看,通过测试得出inotify性能更高,每秒钟能同步好几百张图片,inotify 150张就不能实时了 实施前检查rsync daemon是正常 [[email protected] oldboy]# ps -ef |grep daemon root     

inotify+rsync实现实时同步

引言:rsync实现数据备份,inotify监控文件系统提供通知功能,二者结合能够实现服务器之间文件的实时同步. rsync 特性: 可以镜像保存整个目录树和文件系统: 增量同步数据,文件传输效率高: 可以保持原有文件的权限.时间等属性: 加密传输数据,保证了数据的安全性: 支持断点续传: 可以使用rcp.ssh等方式传输文件,也可以通过socket连接传输文件: 支持匿名传输: rsync4种模式: 本地shell 远程shell 查询(列表)模式 服务器模式 本地shell模式: rsync

inotify+rsync实现实时同步部署

1.1.架构规划 1.1.1架构规划准备 服务器系统 角色 IP Centos6.7 x86_64 NFS服务器端(NFS-server-inotify-tools) 192.168.1.14 Centos6.7 x86_64 rsync服务器端(rsync热备服务器) 192.168.1.17 1.1.2架构图 2.1 部署前检查 2.1.1 检查rsync热备服务器daemon是否起来 1 [[email protected] data]# lsof -i:873 2 COMMAND PID

inotify+rsync实现实时同步(附解决crontab中无法执行python脚本的问题)

1.准备环境 # 系统支持的话,下面的目录就会存在 ls /proc/sys/fs/inotify/ rpm -qa inotify-tools yum -y install inotify-tools 2.inotifywait监控目录状态变化 /usr/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e delete,create,close_write /data # 可以把时间去掉 /usr/bin/

inotify+rsync监控实时同步

监控到Centos7-001机器上的网站内容发生变化时,就同步Centos7-001:/var/www/html/目录到Centos7-002上 Centos7-001上所做的操作 安装 rsync # yum install rsync -y 生成密钥对 [[email protected] ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh

20190308 samba服务、inotify和rsync实现实时同步、防火墙

Samba服务[root@centos7 ~]#yum install samba[root@centos7 ~]#systemctl start smb[root@centos7 ~]#ss -ntluNetid State Recv-Q Send-Q Local Address:Port Peer Address:Port tcp LISTEN 0 50 :139 : tcp LISTEN 0 50 :445 端口已开启 : 可以做共享了. 主配置文件:/etc/samba/smb.conf

rsync、inotify实现web实时同步

. rsync.inotify实现web实时同步,布布扣,bubuko.com

sersync基于rsync+inotify实现数据实时同步

一.环境描述 需求:服务器A与服务器B为主备服务模式,需要保持文件一致性,现采用sersync基于rsync+inotify实现数据实时同步 主服务器A:192.168.1.23 从服务器B:192.168.1.243 实时同步/var/atlassian目录到从服务器. 二.实施 1.从服务器192.168.1.243 rsync服务搭建 1.1安装软件包 wget http://rsync.samba.org/ftp/rsync/src/rsync-3.1.1.tar.gz tar xf r

利用rsync+inotify实现数据实时同步脚本文件

将代码放在Server端,实现其它web服务器同步.首先创建rsync.shell,rsync.shell代码如下: #!/bin/bash host1=133.96.7.100 host2=133.96.7.101 host3=133.96.7.102 src=/data/www/ dst1=web1 dst2=web2 dst3=web3 user1=web1 user2=web2 user3=web3 /usr/local/inotify/bin/inotifywait -mrq --ti