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
加入防火牆規則
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
4.開始同步
/usr/local/bin/rsync -vzrtopg --progress --delete 192.168.0.217::imgbak /imgbak
耐心等待就OK了
###########格式解釋###########
192.168.0.217::imgbak 源服務器地址::服務實例名稱
/imgbak 同步到本地目錄路徑
#######如有需要可將此路徑加入path環境變量中 ###########
echo 'PATH=$PATH:/usr/local/bin' >> /etc/profile
echo 'export PATH' >> /etc/profile
source /etc/profile