windows文件共享我就不截图了,估计大家都会,我就直接在centos6.7上操作了
一、挂载win共享文件夹
mount -t cifs -o username=administrator,password=123.qwe //192.168.1.205/web /web
#如果报错就是没有安装cifs-utils
#yum -y install cifs-utils
df -h
//192.168.1.205/web   60G  8.6G   52G  15% /web
二、安装rsync
yum install rsync xinetd
编辑配置文件,设置开机启动rsync
vi /etc/xinetd.d/rsync
service rsync
{
        disable = no
        flags           = IPv6
        socket_type     = stream
        wait            = no
        user            = root
        server          = /usr/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID
}
三、查看系统是否支持inotify并安装
ll /proc/sys/fs/inotify/
-rw-r--r-- 1 root root 0 3月  23 00:47 max_queued_events
-rw-r--r-- 1 root root 0 3月  23 00:47 max_user_instances
-rw-r--r-- 1 root root 0 3月  23 00:47 max_user_watches
tar zxvf inotify-tools-3.13.tar.gz
cd inotify-tools-3.13
./configure --prefix=/usr/local/inotify
make && make install
四、创建脚本,实时触发rsync进行同步

vi rsync.sh
src=/data
target="/web1 /web /web2"
for i in $target;
do
rsync -avH --delete /data/ $i
done
/usr/local/inotify/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e close_write,delete,create,attrib $src |  while read file
do
for i in $target;
do
rsync -avH --delete /data/ $i
done
done

保存退出啊

五、测试
sh +x rsync.sh
sending incremental file list
./

sent 202 bytes  received 26 bytes  456.00 bytes/sec
total size is 336  speedup is 1.47
sending incremental file list
./
rsync: failed to set times on "/web/.": Permission denied (13)
rsync.sh
1/
10/
2/
3/
4/
5/
6/
7/
8/
9/
lost+found/

sent 614 bytes  received 78 bytes  1384.00 bytes/sec
total size is 336  speedup is 0.49
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]
sending incremental file list
./

sent 202 bytes  received 26 bytes  456.00 bytes/sec
total size is 336  speedup is 1.47

查看/web
ll /web
总用量 1
drwxr-xr-x 0 root root   0 3月  22 16:00 1
drwxr-xr-x 0 root root   0 3月  22 16:00 10
drwxr-xr-x 0 root root   0 3月  22 16:00 2
drwxr-xr-x 0 root root   0 3月  22 16:00 3
drwxr-xr-x 0 root root   0 3月  22 16:00 4
drwxr-xr-x 0 root root   0 3月  22 16:00 5
drwxr-xr-x 0 root root   0 3月  22 16:00 6
drwxr-xr-x 0 root root   0 3月  22 16:00 7
drwxr-xr-x 0 root root   0 3月  22 16:00 8
drwxr-xr-x 0 root root   0 3月  22 16:00 9
drwxr-xr-x 0 root root   0 3月  22 14:08 lost+found
-rwxr-xr-x 0 root root 336 3月  22 20:31 rsync.sh

六、添加开机自动挂载

vi /etc/rc.local

mount -t cifs -o username=administrator,password=123.qwe //192.168.1.205/web /web

sh +x /data/rsync.sh >/var/log/rsync.log 2>&1

rsync+inotify实现文件实时同步:

http://www.cnblogs.com/zclzhao/p/4955592.html

centos6.7rsync端与window2012服务器实时文件同步的更多相关文章

  1. Linux 之 rsync实现服务器的文件同步

    rsync实现服务器的文件同步 参考文献链接: 一.rsync实现负载均衡集群文件同步,搭建线上测试部署环境 二.rsync. 三.rsync常见错误. 四.rsync 安装使用详解. 环境部署: 服 ...

  2. rsync+sersync+inotify实现服务器间文件同步之一

    rsync+sersync+inotify实现服务器间文件同步之一:rsync安装配置 2013年12月14日 ⁄ Linux管理, 服务器集群技术 ⁄ 共 4925字 ⁄ rsync+sersync ...

  3. centos6.5 rsync+inotify实现服务器之间文件实时同步

    1. rsync的优点与不足 与传统的cp.tar备份方式相比,rsync具有安全性高.备份迅速.支持增量备份等优点,通过rsync可以解决对实时性要求不高的数据备份需求,例如定期的备份文件服务器数据 ...

  4. cwRsync window下的跨服务器的文件同步

    cwRsync 是window下的文件同步软件,可以跨服务器运行,第一次运行的时候是全部备份同步,之后的同步采用的是增量同步 这个软件分为服务端和客户端. 服务器是需要同步的文件源, 客户端相当于是备 ...

  5. 云server之间实时文件同步和文件备份的最简单高效的免费方案

     分布于不同云计算中心的多台云server,通常须要进行文件同步.以满足业务的须要. 传统的文件同步方案,部署繁琐.同步实时性差.无法令人惬意. 端端Clouduolc,一款纯p2p方式的文件实时 ...

  6. C#实现服务器间文件同步

    using System.IO; /// <summary> /// 远程登陆服务器 /// </summary> /// <param name="remot ...

  7. 使用inotify+rsync实现服务器间文件同步

      1. rsync 1.1 什么是rsync   rsync是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件.它使用所谓的“Rsync演算法”来使本地和远程两个主机之间的文件达到 ...

  8. Lsyncd - 实时文件同步工具(精译)

    原文: http://axkibe.github.io/lsyncd/ 描述 Lsyncd监视本地目录树事件监视器接口(inotify或fsevents).它聚集并组合事件几秒钟,然后生成一个(或多个 ...

  9. 本地和服务器(ubuntu)文件同步

    秘钥登录远端服务器 rsync -avze 'ssh -i ./id_rsa' root@remoteIp:/xx/remotefile.txt ./localpath (./id_rsa为本地秘钥路 ...

随机推荐

  1. PyCharm+Eclipse共用Anaconda的数据科学环境

    1.安装anaconda2 安装好之后,本地python环境就采用anaconda自带的python2.7的环境. 2.安装py4j 在本地ctrl+r打开控制台后,直接使用pip安装py4j,因为a ...

  2. oracle 日期格式化和数据去重

    1.获取系统日期: select sysdate as date1 from dual: 当前时间减去7分钟的时间 select sysdate,sysdate - interval '7' MINU ...

  3. shuffle

    <?php function genArr($len) { $arr = array(); $len = $len; for ($w=1; $w < $len ; $w++) { $arr ...

  4. 洛谷P2661 信息传递 [NOIP2015] 并查集/乱搞 (待补充!

    感觉我好水啊,,,做个noip往年题目还天天只想做最简单的,,,实在太菜辽 然后最水的题目还不会正解整天想着乱搞,,,  虽然也搞出来辽233333 好滴不扯辽赶紧写完去做紫题QAQ 正解:并查集  ...

  5. kubernetes实战(十六):k8s高可用集群平滑升级 v1.11.x 到v1.12.x

    1.基本概念 升级之后所有的containers会重启,因为hash值会变. 不可跨版本升级. 2.升级Master节点 当前版本 [root@k8s-master01 ~]# kubeadm ver ...

  6. 【Espruino】NO.07 获取电压值

    http://blog.csdn.net/qwert1213131/article/details/27985645 本文属于个人理解,能力有限,纰漏在所难免.还望指正! [小鱼有点电] 前几节的内容 ...

  7. NYOJ-1073 最小值

    http://acm.nyist.net/JudgeOnline/problem.php?pid=1073 # include<stdio.h> # include<stdlib.h ...

  8. <转>MySQL临时表的简单用法

    当工作在非常大的表上时,你可能偶尔需要运行很多查询获得一个大量数据的小的子集,不是对整个表运行这些查询,而是让MySQL每次找出所需的少数记录,将记录选择到一个临时表可能更快些,然后在这些表运行查询. ...

  9. matlab做曲线拟合

    python 做曲线拟合 https://blog.csdn.net/qq_16583687/article/details/72723708 matlab做拟合函数,可以在命令行输入:数据x,数据y ...

  10. Python线程,进程,携程,I/O同步,异步

    只有本人能看懂的-Python线程,进程,携程,I/O同步,异步 举个栗子: 我想get三个url,先用普通的for循环 import requests from multiprocessing im ...