• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

Rsync Server +Rsync client 配置完全实践笔记

发布: 2007-7-04 12:06 | 作者: admin | 来源:  网友评论 | 查看: 16次 | 进入软件测试论坛讨论

领测软件测试网

环境:

Rsync Server 192.168.0.160
Rsync Client  192.168.0.159
(一)配置Rsync Server
1.安装rsync2.6.5
./configure --prefix=/opt/rsync2.6.5
make
make install
2.配置以服务器模式启动
#vi  /etc/x.netd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it #    allows crc checksumming etc.
service rsync
{
       disable = no
       socket_type     = stream
       wait            = no
       user            = root
       server          = /usr/bin/rsync
       server_args     = --daemon --config=/opt/rsync2.6.5/etc/rsyncd.conf
       log_on_failure  += USERID
}
3.建立服务器端目录结构
etc  man  var
4.配置服务器端配置文件
#vi   /opt/rsync2.6.5/etc/rsyncd.conf

log file = /opt/rsync2.6.5/var/rsyncd.log
pid file = /opt/rsync2.6.5/var/rsyncd.pid
lock file = /opt/rsync2.6.5/var/rsyncd.lock
secrets file = /opt/rsync2.6.5/etc/rsyncd.secrets
motd file = /opt/rsync2.6.5/etc/rsyncd.motd

read only = yes
hosts allow = 192.168.0.159
hosts deny = 192.168.100.0/24
list = yes
uid = root
gid = root
use chroot = no
max connections = 4
syslog facility = local5

[mailstore]
       path = /mss
       comment = whole mailstore area
       auth users = mailstore
[maildb]
       path = /db
       comment = db data
       auth users  = maildb
[maildatabase]
       path = /var/lib/mysql/userdb
       comment = mysql databases
       auth users = maildatabase

# vi /opt/rsync2.6.5/etc/rsyncd.secrets
mailstore:123456
maildb:maildb
maildatabase:maildatabase
5.设置服务器端配置文件的权限

# chmod 600 rsyncd.conf rsyncd.secrets
-rw-------    1 root     root          795 Aug 23 06:21 rsyncd.conf
-rw-------    1 root     root           37 Aug 23 06:23 rsyncd.secrets
(注意:这个安全设置很重要,如果不这样做客户机连接服务器时会提示:

@ERROR: auth failed on module smb_recover_files
rsync: connection unexpectedly closed (102 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(165)
服务器端日志将出现错误提示:

2005/08/23 06:32:01 [8388] secrets file must not be other-accessible (see strict modes option)
2005/08/23 06:32:01 [8388] continuing without secrets file
2005/08/23 06:32:01 [8388] auth failed on module smb_recover_files from documentserver (192.168.0.159)
)
(二)配置Rsync Client
1.安装Rsync2。6。5
./configure --prefix=/opt/rsync2.6.5
make
make install
2.编写自动连接服务器端脚本,该脚本可以同时连接多个Rsync Server服务器,并可以从一个Rsync Server同时连接多个备份点。
# vi     rsync_client.sh
#!/bin/sh
# shenxiaoran/foundir.com 2005.7.20
# This script gets files from server to local directory to backup.
# It's a month rotating incremental backup.
#
[ -f /etc/profile ] && . /etc/profile
PROG=/usr/bin/rsync
MAILSTORE=/data/mss
MAILDB=/data/db
MAILDATABASE=/data/userdb
DATE=`date +%d`
BACK_POINT1=mailstore
BACK_POINT2=maildb
BACK_POINT3=maildatabase
BACK_OLD_DIR1=$MAILSTORE/mss_old/$DATE
BACK_OLD_DIR2=$MAILDB/db_old/$DATE
BACK_OLD_DIR3=$MAILDATABASE/userdb_old/$DATE
LOGFILE=./rsync.log
[ -d $BACK_OLD_DIR ] && rm -fr $BACK_OLD_DIR
OPTS1="--force --ignore-errors -pogt --delete --backup --backup-dir=$BACK_OLD_DIR1 -az"
OPTS2="--force --ignore-errors -pogt --delete --backup --backup-dir=$BACK_OLD_DIR2 -az"
OPTS3="--force --ignore-errors -pogt --delete --backup --backup-dir=$BACK_OLD_DIR3 -az"
echo "##############################################" >>$LOGFILE 2>&1
echo "Begin Time: `date`" >>$LOGFILE 2>&1
SERVER1="[email protected]"
export RSYNC_PASSWORD=123456
$PROG $OPTS1 $SERVER1::$BACK_POINT1 $MAILSTORE  >>$LOGFILE 2>&1
SERVER2="[email protected]"
export RSYNC_PASSWORD=maildb
$PROG $OPTS2 $SERVER2::$BACK_POINT2 $MAILDB  >>$LOGFILE 2>&1
SERVER3="[email protected]"
export RSYNC_PASSWORD=maildatabase
$PROG $OPTS3 $SERVER3::$BACK_POINT3 $MAILDATABASE  >>$LOGFILE 2>&1
echo "End Time: `date`" >>$LOGFILE 2>&1
echo "########################################"  >>$LOGFILE 2>&1

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网