10/06
25
环境:ubuntu-9.01
生成静态页面的机器作为客户端采用上传的方式,地址为:192.168.18.12
静态页面服务器作为服务器端,地址为:192.168.18.14
同步目录为:/usr/ROOT
rysnc的下载地址为:http://rsync.samba.org/目前最新的版本为:3.0.7
inotify下载地址为:http://inotify-tools.sourceforge.net/最新版本为:3.13
服务器端安装:
tar -zxvf rsync-3.0.7.tar.gz
./configure --prefix=/usr/local/rsync --指定安装目录
make
make install
配置:1、vi /etc/rsyncd.conf
motd file=/etc/rsyncd.conf
read only=no ----因为是上传所以这里一定要可写
list=yes
uid=root
gid=root
hosts allow=192.168.18.12 ---允许连接ip
host deny=19.168.18.100
max connections=2 ----允许最大连接
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsync.lock
模块
[web]
comment=from 192.168.18.12
path=/usr/ROOT
auth users=allen
secrets file=/etc/rsync.pass ----密码文件
2、vi /etc/rsyncd.motd
welcome to use rsync server!
3、vi /etc/rsync.pass
allen:123456
给密码文件赋权:chmod 400 /etc/rsync.pass
4、vi /etc/services
在最后加入:
rsync 873/tcp
rsync 873/udp
5、vi /etc/xinetd.d/rsync
service{
disable=no
socket_type=staream
wait=no
user=root
server=/usr/local/rsync/bin/rsync
server_args=--daemon
log_on_failure+=USERID
}
到这里配置完成,启动:/usr/local/rsync /bin/rsync --daemon
ps -aux | grep rsync 查看是否启动成功!
客户端安装:tar -zxvf rsync-3.0.7.tar.gz
cd rsync-3.0.7
./configure --prefix=/usr/local/rsync --指定安装目录
make
make install
客户端只需安装,无需配置,建个密码文件
vi /etc/rsync-client.pass
123456
赋权:chmod 600 /etc/rsync-client.pass
rsync的上传和下载命令:
cd /usr/local/rsync/bin
下载命令:
./rsync -vzrtopg --progress --delete allen@192.168.18.14::web /usr/ROOT
上传命令:
./rsync -vzrtopg --progress --delete /usr/ROOT allen@192.168.18.14::web
在加上定时执行,就可以定时同步文件了。若需要实时同步则需要用 inotify,安装之前需查看系统内核:uname -a
只能在高于2.6.13版本的系统上安装,以下的需要安装补丁。
inotify安装:inotify-tool-3.13
tar -zxvf inotify-tool-3.13
cd inotify-tool-3.13
./configure
make
make install
建个执行文件:rsync.sh
#!/bin/sh
src=/usr/ROOT
/usr/local/bin/inotifywait -mrq --timefmt '%d%m%y %H:%M' --format '%T%w%f' \
-e modify,delete,move,create,attrib \
${src}\
|while read file
do
rsync -vartopg --progress –delete –password-file=/etc/rsync-client.pass /usr/ROOT/ allen@192.168.18.14::web
echo "success!"
done
这样就能检测到是否有静态页面的生成或修改、删除而进行自动同步,实现实时同步。
--------------------可能出现的错误解惑
1、@ERROR: Unknown module 'web'
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
这是因为服务器端hosts allow 没有允许该主机访问
2、@ERROR: auth failed on module web
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
检查一下用户名是否正确,
服务器端rysnc.pass(用户:密码)<用户必须是系统用户,密码尽量不要为系统用户密码>
客户端rsync-client.pass(密码)<服务器端密码>
注意:auth users=allen 这里不能有空格,上次这个问题把我找惨了。
3、@ERROR: secrets file must not be other-accessible
这是客户端的密码文件需要设置成600权限
chmod 600 rsync-client.pass
生成静态页面的机器作为客户端采用上传的方式,地址为:192.168.18.12
静态页面服务器作为服务器端,地址为:192.168.18.14
同步目录为:/usr/ROOT
rysnc的下载地址为:http://rsync.samba.org/目前最新的版本为:3.0.7
inotify下载地址为:http://inotify-tools.sourceforge.net/最新版本为:3.13
服务器端安装:
tar -zxvf rsync-3.0.7.tar.gz
./configure --prefix=/usr/local/rsync --指定安装目录
make
make install
配置:1、vi /etc/rsyncd.conf
motd file=/etc/rsyncd.conf
read only=no ----因为是上传所以这里一定要可写
list=yes
uid=root
gid=root
hosts allow=192.168.18.12 ---允许连接ip
host deny=19.168.18.100
max connections=2 ----允许最大连接
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsync.lock
模块
[web]
comment=from 192.168.18.12
path=/usr/ROOT
auth users=allen
secrets file=/etc/rsync.pass ----密码文件
2、vi /etc/rsyncd.motd
welcome to use rsync server!
3、vi /etc/rsync.pass
allen:123456
给密码文件赋权:chmod 400 /etc/rsync.pass
4、vi /etc/services
在最后加入:
rsync 873/tcp
rsync 873/udp
5、vi /etc/xinetd.d/rsync
service{
disable=no
socket_type=staream
wait=no
user=root
server=/usr/local/rsync/bin/rsync
server_args=--daemon
log_on_failure+=USERID
}
到这里配置完成,启动:/usr/local/rsync /bin/rsync --daemon
ps -aux | grep rsync 查看是否启动成功!
客户端安装:tar -zxvf rsync-3.0.7.tar.gz
cd rsync-3.0.7
./configure --prefix=/usr/local/rsync --指定安装目录
make
make install
客户端只需安装,无需配置,建个密码文件
vi /etc/rsync-client.pass
123456
赋权:chmod 600 /etc/rsync-client.pass
rsync的上传和下载命令:
cd /usr/local/rsync/bin
下载命令:
./rsync -vzrtopg --progress --delete allen@192.168.18.14::web /usr/ROOT
上传命令:
./rsync -vzrtopg --progress --delete /usr/ROOT allen@192.168.18.14::web
在加上定时执行,就可以定时同步文件了。若需要实时同步则需要用 inotify,安装之前需查看系统内核:uname -a
只能在高于2.6.13版本的系统上安装,以下的需要安装补丁。
inotify安装:inotify-tool-3.13
tar -zxvf inotify-tool-3.13
cd inotify-tool-3.13
./configure
make
make install
建个执行文件:rsync.sh
#!/bin/sh
src=/usr/ROOT
/usr/local/bin/inotifywait -mrq --timefmt '%d%m%y %H:%M' --format '%T%w%f' \
-e modify,delete,move,create,attrib \
${src}\
|while read file
do
rsync -vartopg --progress –delete –password-file=/etc/rsync-client.pass /usr/ROOT/ allen@192.168.18.14::web
echo "success!"
done
这样就能检测到是否有静态页面的生成或修改、删除而进行自动同步,实现实时同步。
--------------------可能出现的错误解惑
1、@ERROR: Unknown module 'web'
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
这是因为服务器端hosts allow 没有允许该主机访问
2、@ERROR: auth failed on module web
rsync error: error starting client-server protocol (code 5) at main.c(1383) [receiver=2.6.9]
检查一下用户名是否正确,
服务器端rysnc.pass(用户:密码)<用户必须是系统用户,密码尽量不要为系统用户密码>
客户端rsync-client.pass(密码)<服务器端密码>
注意:auth users=allen 这里不能有空格,上次这个问题把我找惨了。
3、@ERROR: secrets file must not be other-accessible
这是客户端的密码文件需要设置成600权限
chmod 600 rsync-client.pass
SM
2010/08/18 11:01
现在都用sersync了...
分页: 1/1
1
1
tcrmgr的一些用法
ubuntu下vsftpd配置


