rsync对网站进行同步

rsync对网站进行同步

server端配置

安装rsync

#yum -y install xinetd rsync

#chkconfig rsync on

因为rsync 没有配置文件所以我们要新建一个配置文件

# vim /etc/rsyncd.conf

uid = nginxgid =nginx use chroot = no # 不使用chrootmax connections = 4 # 最大连接数为4

pid file = /var/run/rsyncd.pid lock file = /var/run/rsyncd.locklog file = /var/log/rsyncd.log # 日志记录文件

motd file = /etc/rsyncd.motd (欢迎信息)

hosts allow = 192.168.0.0/24

auth users = user1

secrets file = /etc/rsyncd.secrets

[web] 需同步的目录

path = /usr/local/nginx/html

comment = BACKUP CLIENT IS SOLARIS 8 E250 #说明

read only = yes# 只读list = false 不允许列文件

#vim /etc/rsyncd.motd #建立欢迎信息文件

welcome to rsync

#vim /etc/rsyncd.secrets#建立密码文件

user1:123456

#chmod 600 /etc/rsyncd.secrets #设置600权限

启动服务

# service xinetd start

从客户端测试:

客户端也要写密码文件

#vim ~/secret

123456

#chmod 600 /root/secret

#rsync -Rav –delete–password-file =/root/secret user1@192.168.0.182::web /var/www/html/default

问题一:

@ERROR: chroot failed

rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]

原因:

服务器端的目录不存在或无权限。创建目录并修正权限可解决问题。

问题二:

@ERROR: auth failed on module tee

rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]

原因:

服务器端该模块(tee)需要验证用户名密码,香港服务器,但客户端没有提供正确的用户名密码,认证失败。提供正确的用户名密码解决此问题。

问题三:

@ERROR: Unknown module ‘tee_nonexists’

rsync error: error starting client-server protocol (code 5) at main.c(1522) [receiver=3.0.3]

原因:

服务器不存在指定模块。提供正确的模块名或在服务器端修改成你要的模块以解决问题。

问题四:

password file must not be other-accessible

continuing without password file

Password:

原因:

这是因为rsyncd.pwd rsyncd.secrets的权限不对,应该设置为600。如:chmod 600 rsyncd.pwd

问题五:

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 error: error starting client-server protocol (code 5) at main.c(1524) [Receiver=3.0.7]

原因:

/etc/rsyncd.conf配置文件内容有错误。请正确核对配置文件。

问题七:

rsync: chown "" failed: Invalid argument (22)

原因:

权限无法复制。去掉同步权限的参数即可。(这种情况多见于Linux向Windows的时候)

本文出自 “linux集群技术博客” 博客,香港服务器,请务必保留此出处

没有什么可留恋,只有抑制不住的梦想,

rsync对网站进行同步

相关文章:

你感兴趣的文章:

标签云: