您的位置:首页 > 职场人生

Rsync 快速部署说明(密码验证版)

2010-10-08 16:56 387 查看
Rsync 快速部署说明(密码验证版)

version:1.0
date:2010-10-08
by:lijun--moko.cc

A服务器操作
1.下载最新版本rsync
wget http://www.samba.org/ftp/rsync/src/rsync-3.0.7.tar.gz 2.卸载自带rsync
yum remove rsync.i386
若64位系统用
yum remove rsync.x86_64

3.安装rsync
tar zxvf rsync-3.0.7.tar.gz
cd rsync-3.0.7
./configure
make && make install
/usr/local/bin/rsync --version (查看版本)

4.编辑服务配置文件
vi /etc/rsync.conf
输入以下内容

uid = nobody
gid = nobody
use chroot = no
max connections = 30
pid file = /var/run/rsync.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsync.log

[imgbak]
path = /图片路径
ignore errors
read only = true
list = no
auth users = mokoimg
secrets file = /etc/rsyncd.passwd

建立用户密码文件

vim /etc/rsyncd.passwd
mokoimg:123456
修改用户密码文件权限(必须为600)
chmod 600 /etc/rsyncd.passwd

加入防火墙规则
iptables -A INPUT -i eth0 -p tcp -m tcp --dport 873 -j ACCEPT
iptables -A INPUT -i eth1 -p tcp -m tcp --dport 873 -j ACCEPT

启动rsyncd
/usr/local/bin/rsync --daemon --config=/etc/rsync.conf

#######如有需要可将此路径加入path环境变量中 ###########
echo 'PATH=$PATH:/usr/local/bin' >> /etc/profile
echo 'export PATH' >> /etc/profile
source /etc/profile

B服务器操作

1.下载最新版本rsync
wget http://www.samba.org/ftp/rsync/src/rsync-3.0.7.tar.gz 2.卸载自带rsync
yum remove rsync.i386
若64位系统用
yum remove rsync.x86_64

3.安装rsync
tar zxvf rsync-3.0.7.tar.gz
cd rsync-3.0.7
./configure
make && make install
/usr/local/bin/rsync --version (查看版本)
建立密码文件
vim /etc/rsyncd.passwd
输入
123456
修改密码文件权限
chmod 600 /etc/rsyncd.passwd

/usr/local/bin/rsync -vzrtopg --progress --delete --password-file=/etc/rsyncd.passwd mokoimg@192.168.0.217::imgbak /imgbak

耐心等待就OK了

###########格式解释###########
--password-file= 密码文件位置
mokoimg@192.168.0.217::imgbak 用户名@源服务器地址::服务实例名称
/imgbak 同步到本地目录路径

#######如有需要可将此路径加入path环境变量中 ###########
echo 'PATH=$PATH:/usr/local/bin' >> /etc/profile
echo 'export PATH' >> /etc/profile
source /etc/profile
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息