Rsync+unison双向文件同步

1.配置RSYNC服务器的同步源:
- 基于SSH同步源
- rsync -avz /server/rsyncd/* chen@172.16.23.204:/client/rsyncd
- 基于RSYNC同步源
- /etc/rsyncd.conf
address = 172.16.23.203
port 873
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
read only = false
auth users = chen
secrets file = /etc/rsync_user.db
[share]
comment = soft
path=/server/rsyncd
- /etc/rsyncd_user.db
- 文件的权限必须是600
chen:123456
- rsyncd -avz chen@172.16.23.203::share /client/rsyncd/
- rsyncd -avz rsyncd://chen@172.16.23.203/share /client/rsyncd
上行同步的时候:nobody必须有权限(setfacl -m u:nobody:rwx /client/rsyncd)
- 文件的权限必须是600
- /etc/rsyncd.conf
- 免验证登录
- 基于ssh秘钥对登录
- 密钥对ssh-keygen -t rsa
- 传到对端:ssh-copy-id 172.16.23.204
- 基于RSYNCD系统变量
- RSYNC_PASSWORD=123456
2.inotify+rsyncd
- 服务端建立脚本
#!/bin/bash
a="/usr/local/bin/inotifywait -mrq -e create,delete /server/rsyncd"
b="/usr/bin/rsync -avz /server/rsyncd/* 172.16.23.204:/client/rsyncd"
$a | while read diretory event file
do
$b
done
执行 bash a.sh & 放到后台执行
3.inotify+unison
安装软件:inotify-tools-3.14.tar.gz ocaml-3.10.0.tar.gz unison-2.13.16.tar.gz
- tar zxvf inotify-tools-3.14.tar.gz
- ./configure && make && make install
- tar -zxvf ocaml-3.10.0.tar.gz
- ./configure
- make world opt
- make install
- tar zxvf unison-2.13.16.tar.gz
- cd unison-2.13
- make UISTYLE=text THREADS=true STATIC=true
- cp unison /usr/local/bin
- 建立脚本
#!/bin/bash
a="/usr/local/bin/inotifywait -mrq -e create,delete /server1"
b="/usr/bin/unison -batch /server1 ssh://172.16.23.204//server2"
$a | while read diretory event file
do
$b
done
- tar zxvf inotify-tools-3.14.tar.gz
Rsync+unison双向文件同步的更多相关文章
- unison 双向镜像同步
unison 双向镜像同步 需要 ocaml 依赖工具(3.0.7) 而且需要机器ssh双向互信 ssh 开启互信 # vi in.sh 直接执行 in.sh 就可以了 mkdir ~/.ssh ...
- rsync+sersync实现文件同步
一.目的 A服务器:11.11.11.11 源服务器 B服务器:22.22.22.22 目标服务器,既同步备份的目标 将A服务器的文件同步到B服务器上 二.rsync环境部署 1.关闭selinux, ...
- CentOS7.5搭建Rsync,实现文件同步
Rsync(remote sync)是UNIX及类UNIX平台下一款神奇的数据镜像备份软件,它不像FTP或其他文件传输服务那样需要进行全备份,Rsync可以根据数据的变化进行差异备份,从而减少数据流量 ...
- rsync+inotify实现文件同步更新(配置)
linux下为了数据安全或者网站同步镜像,不得不考虑一些实时备份的问题,这篇linux下通过rsync+inotify 实现数据实时备份配置过程记录下来,防止遗忘配置过程记录下来,防止遗忘!如有建议技 ...
- 文件同步 单向rsync 双向unison 监控inotifywait 免密登录
1.负载均衡中文件同步必不可少,我这边选择rsync来实现文件同步 rsync同步文件机制更适用于单向文件同步,可配合unison实现双向同步功能. 实现同步的两种方法 一:ssh方法 rsync - ...
- rsync+inotify实现文件实时同步
一.相关组件简介 1.rsync 与传统的cp.tar备份方式相比,rsync具有安全性高.备份迅速.支持增量备份等优点,通过rsync可以解决对实时性要求不高的数据备份需求,例如定期的备份文件服务器 ...
- rsync unison+inotify双向实时同步
rsync多线程同步 A:文件服务器 ip:10.10.1.10 B:备份服务器 ip:10.10.1.11 1.在B服务器上安装rsync软件 tar xzvf rsync-3.1.0.tar.gz ...
- Linux下 Unison 实现文件双向同步
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://hx100.blog.51cto.com/44326/612301 一.Uniso ...
- unison+inotify实现文件双向自动同步
nfs适合存小图片和小文件,有一个致命的缺点,就是其中一台web服务挂掉之后,会直接导致web页面无法访问,动态的那种数据, 而且数据量很大的数据不适合nfs Unison是一款跨平台(window, ...
随机推荐
- SpringBoot使用Nacos配置中心
本文介绍SpringBoot如何使用阿里巴巴Nacos做配置中心. 1.Nacos简介 Nacos是阿里巴巴集团开源的一个易于使用的平台,专为动态服务发现,配置和服务管理而设计.它可以帮助您轻松构建云 ...
- BZOJ.5092.[Lydsy1711月赛]分割序列(高维前缀和)
题目链接 \(Description\) \(Solution\) 首先处理\(a_i\)的前缀异或和\(s_i\).那么在对于序列\(a_1,...,a_n\),在\(i\)位置处分开的价值为:\( ...
- [Caffe]Win10+VS2015+CUDA8.0+cudnn5.1环境配置
百度:win10 caffe vs2015 编译caffe.sln工程参见->这里 caffe训练参见->这里 参见->这里 Windows+VS2013爆详细Caffe编译安装教程
- Python assert 断言函数
http://blog.csdn.net/hunyxv/article/details/52737339 使用assert断言是学习python一个非常好的习惯,python assert 断言句语格 ...
- centos7安装nginx-1.13.6 新手入门,图文解析
系统环境 操作系统:64位CentOS Linux release 7.2.1511 (Core) 安装nginx依赖包 [root@localhost ~]# yum install gcc-c++ ...
- flexible.js 移动端自适应方案
一,flexible.js 的使用方式: github地址:https://github.com/amfe/lib-flexible 官方文档地址:https://github.com/amfe/ar ...
- 七、Servlet概述
Servlet概述 生命周期方法:void init(ServletConfig):出生之后(1次):void service(ServletRequest request, ServletRes ...
- Python基础之集合
一.定义: 二.基本操作: 三.运算: 交集&, 并集|, 补集-, 对称补集^, 子集< 超集> 四.集合推导式: 五.固定集合 frozenset 六.基本代码: # 1. ...
- [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project triage: Compilation failure [ERROR] No compiler is provided in this environment.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-c ...
- 5m21d缓冲区溢出学习笔记
mysql链接字符串函数 concat(str1,str2) concat_ws(separator,str1,str2....) group_concat(str1,str2....) mysql的 ...