rsyncd.motd #这个可以不用新建 motd file = /etc/rsyncd.motd #欢迎文件 /usr/local/rsync/bin/rsync --daemon /etc/rsyncd.conf rsync -vzrtopg --progress --delete --password-file=/etc/rsyncd.client */10 * * * * rsync -vzrtopg --progress --delete --password-file=/etc/rsyncd.client user@192.168.128.130::web /root/date (svn co https://192.168.1.100/game/trunk/Release/web /var/svn/web) rsync -vzrtopgl --exclude \.svn --exclude WEB-INF/classes/jdbc.properties --exclude Thumbs.db --progress --password-file=/etc/rsyncd.pwd /var/svn/web/* user@192.168.1.102::web 错误一:
read only = no #可以在这里配置no,但是在同步项目中配置yes,这里的这个是全局配置项
list = yes
uid = root
gid = root
hosts allow = 192.168.128.133 192.168.0.0/16
hosts deny =192.168.128.0/24
max connections = 2
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
@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端口打开。
rsync工具的配置及使用
原创
©著作权归作者所有:来自51CTO博客作者radarruan的原创作品,请联系作者获取转载授权,否则将追究法律责任
对于一些文件的同步尤其是需要过滤一些文件的同步,rsync是非常好的工具,用rsync可以很好的实现代码发布。一般的服务器都是安装好rsync服务,以下步骤是在rsync已经安装好rpm包的情况下配置
一、在/etc下新建三个文件
rsyncd.conf
rsyncd.secrets
二、配置rsyncd.conf文件
secrets file = /etc/rsyncd.secrets #这个项可以在同步项配置,如果全部都是一样的话,只需要在这里配置就可以了,不需要在每个同步项目中都进行配置
[web]
comment = rsync the web
secrets file =/etc/rsyncd.secrets#密码文件,如果在全局配置好了,这里就不需要配置了
auth users = user #rsync用户(与linux里的用户无关)
path = /var/www
read only = no
三、配置rsyncd.motd
Welcome to use the rsync services!
四、配置rsyncd.secrets
user:passwd
五、修改权限
chmod 600 /etc/rsyncd.*
六、运行rsync
(rsync --daemon)
七、客户端相关配置
a、要确认客户端已经安装了rsync
b、新建密码文件
vi /etc/rsyncd.secrets
test#文件内容,客户端只需密码无须用户
c、修改权限
chmod 600 /etc/rsyncd.client
否则会报如下错误
password file must not be other-accessible
continuing without password file
d、同步命令
user@192.168.128.130::web /root/date
8、实现定时同步
9、rsync命令使用的一些参数介绍及注意点
以上是一个从发布服务器将代码同步发布到服务器上的一个rsync命令
--exclude \.svn 因为svn下面会有一些.svn文件,这些是不需要的,需要排除
--exclude Thumbs.db 这个也是不需要的
--exclude WEB-INF/classes/jdbc.properties 这个是配置文件,需要过滤掉
10、rsync的一些常见错误
上一篇:grep的使用
下一篇:haproxy的安装与配置
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
数据同步--rsync
使用rsync进行两台或多台主机直接的数据同步
rsync数据同步 -
02@rsync服务的配置及使用
一、备份1、什么是备份备份就是把重要的数据复制一份到其他位置保留起来2、
运维 linux 服务器 rsync scp