rsync+lsync在Linux下配置
更新时间:2023-11-15 05:20:01 阅读量: 教育文库 文档下载
- rsync lsyncd推荐度:
- 相关推荐
1.204安装lsyncd
# wget http://lsyncd.googlecode.com/files/lsyncd-1.26.tar.gz # tar zxvf lsyncd-1.26.tar.gz # cd lsyncd-1.26 # ./configure
# make && make install
2. 本地204需要安装rsync客户端
centos 默认状态下rsync已经安装上了。没有安装可以装rpm包,也可以安装源码包进行,只需要客户端工具。
# wget http://www.samba.org/ftp/rsync/src/rsync-3.0.6.tar.gz # tar zvxf rsync-3.0.6.tar.gz # cd rsync-3.0.6
# ./configure --prefix=/usr/local/rsync # make && make install
# cp /usr/local/rsync/bin/rsync /usr/bin/
3. 本地204 lsyncd启动默认日志文件,可以查看lsyncd启动与工作状态 /var/log/lsyncd
4. 本地手动同步目录并监视磁盘目录情况,运行后作为进程一直在后台运行。 # /usr/local/bin/lsyncd /data/soft/ 192.168.162.203::soft
# /usr/local/bin/lsyncd /data/www/ 192.168.162.203::www
5. 或通过配置文件的方式来启动 # vi /etc/lsyncd.conf
1 /var/lib/mysql/ 192.168.0.203::mysql 2 /www/ 192.168.0.203::www 3 /home/svnroot 192.168.0.203:svn
~ ============ 启动脚本如下 ============ vi /root/lsyncd.sh #!/bin/bash
#lsyncd startup script
lsyncd=\
function_start_lsyncd() {
printf \ while read i do
source=`echo $i | awk '{print $1}'` target=`echo $i | awk '{print $2}'` $lsyncd $source $target done < /etc/lsyncd.conf }
function_stop_lsyncd() {
printf \ killall $lsyncd }
function_restart_lsyncd() {
printf \ function_stop_lsyncd function_start_lsyncd }
if [ \ function_start_lsyncd elif [ \ function_stop_lsyncd elif [ \ function_restart_lsyncd else
printf \fi
7. 203 rsync配置文件示例 不用安装源码的rsync包了 ================== 203 rsyncd配置文件 ================== # vi /etc/rsyncd.conf uid = root gid = root
use chroot = no
max connections = 4
pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log
[mysql]
path = /var/lib/mysql/ comment = mysql ignore errors read only = no write only = no list = no
hosts allow = 192.168.0.204
[www]
path = /www/ comment = www ignore errors read only = no write only = no list = no
hosts allow = 192.168.0.204
[svn]
path = /home/svnroot/ comment = svn ignore errors
read only = nolist = no
hosts allow = 192.168.0.204
运行rsyncd服务
# /usr/bin/rsync --daemon
维护注意事项:1.可以用ps -aux查看启动情况 2.客户端要比rsyncd服务端后启动,否则自动启动不了,这时需要手动启动。
双向同步的时候 145启动rsync的时候会报错[root@localhost ~]# /usr/bin/rsync --daemon failed to create pid file /var/run/rsyncd.pid: File exists
[root@localhost ~]# rm -rf /var/run/rsyncd.pid 删掉这个文件 重启就好用了
网上总结rsync报错信息:
Rsync同步常见问题: 错误一:
@ERROR: auth failed on module xxxxx
rsync: connection unexpectedly closed (90 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(150) 解决:这是因为密码设置错了,无法登入成功,检查一下rsync.pwd,看客服是否匹配。还有服务器端没启动rsync 服务也会出现这种情况。 错误二:
password file must not be other-accessible continuing without password file Password: 解决:这是因为rsyncd.pwd rsyncd.sec的权限不对,应该设置为600。如:chmod 600 rsyncd.pwd 错误三:
@ERROR: chroot failed
rsync: connection unexpectedly closed (75 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(150) 解决:这是因为你在 rsync.conf 中设置的 path 路径不存在,要新建目录才能开启同步。 错误四:
rsync: failed to connect to 218.107.243.2: No route to host (113) rsync error: error in socket IO (code 10) at clientserver.c(104) [receiver=2.6.9]
解决:对方没开机、防火墙阻挡、通过的网络上有防火墙阻挡,都有可能。关闭防火墙,其实就是把tcp udp 的873端口打开。
Reported by oer...@gmail.com, Oct 15, 2010
What steps will reproduce the problem? 1. large homedir ( million files )
2. lsyncd --exclude-from=/home/oernii/.rsync_exclude --no-daemon --verbose /home/oernii/ remote::/BACKUP/
What is the expected output? What do you see instead? sync should run without errors
What version of the product are you using? On what operating system? 1.39
Please provide any additional information below. After running I am getting a LOT of this:
watching /home/oernii/.kde
ERROR: Cannot add watch /home/oernii/.kde (28:No space left on device) 这个错误的解决办法
Comment 1 by d...@dans.im, Oct 15, 2010
\space left on device\probably means you need to increase /proc/sys/fs/inotify/max_user_watches. Eg.: `echo 65536 >/proc/sys/fs/inotify/max_user_watches'.
正在阅读:
rsync+lsync在Linux下配置11-15
年产20万吨饲料项目可行性研究报告12-28
县贫困村第一书记轮换工作方案10-26
如何在政治课教学中培养学生的创新思维能力04-30
2016年专业技术人员继续教育满分答案10-08
关于印发《南京农业大学SRT计划项目管理办法(修订)》的通知03-06
房地产公司资本结构影响分析05-27
上海市长宁区2019初三英语一模试题解析04-26
第三章营养物质在植物体内的运输 - 图文09-16
安全与卫生常识教案08-14
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 配置
- rsync
- lsync
- Linux
- 魏晋玄谈 - 图文
- 04电工作业低压电工作业复审20150526试卷卷1题目和答案4
- 三亚学院封面个人简历模板
- 企业职工在企业文化建设中的作用研究
- 深圳行李寄存物品保管临时短租仓库出租进货口装柜仓储外包电子商务仓储发货物流外包市场调研报告
- 南京市2017届高三9月学情调研考试英语试卷 - 图文
- 线路巡视危险点分析与预防控制措施
- 新视野大学英语视听说教程第二版4Unit10答案
- 民法总论期末考试试题
- 关于印发《教师管理实施细则》的通知
- 精编版文章压力管道爆破事故专项应急预案
- 2018年湘少版英语五年级上册期末复习重点
- 晋商银行
- 第6章 层叠样式表
- 2013-循证医学答案 -
- need详解和练习
- 计算机一级部分题目单选题二
- 外国教育史课程习题(1)
- BJL节能水泵工作原理 -
- 《精神病学》考试题库