軟件版本:rsync-3.0.9
服務(wù)器端配置
>需要安裝xinetd服務(wù)
為鹽津等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及鹽津網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都網(wǎng)站建設(shè)、網(wǎng)站制作、鹽津網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!
yum install xinetd -y #rhel |
apt-get install xinetd -y #ubuntu |
>安裝
wget http://rsync.samba.org/ftp/rsync/rsync-3.0.9.tar.gzwget http://rsync.samba.org/ftp/rsync/rsync-patches-3.0.9.tar.gztar zxvf rsync-3.0.9.tar.gztar zxvf rsync-patches-3.0.9.tar.gzcd rsync-3.0.9
./configuremake && make install |
1.創(chuàng)建配置文件
; port=873uid=rootgid=root
max connections=10log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
secrets file=/etc/rsyncd.passwd
; hosts allow=192.168.11.0/27; hosts deny=192.168.11.0/255.255.255.224timeout=600 [backdir]comment= for client backpath=/home/backdir/read only = no
;exclude=test;exclude from=/path/to/file;include from=/path/to/fileauth users=caide.me[share]comment= backup share filepath=/home/share/read only = yesauth users=caide.me |
2.創(chuàng)建密碼文件(/etc/rsyncd.passwd)
echo "caide.me:caide.me.passwd" > /etc/rsyncd.passwdchmod 600 /etc/rsyncd.passwd |
3.創(chuàng)建xinetd監(jiān)聽任務(wù)(/etc/xinetd.d/xinetd_rsync)
vim /etc/xinetd.d/xinetd_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/local/bin/rsync
server_args = --daemon
log_on_failure += USERID} |
–>如有需要,防火墻需開啟tcp協(xié)議873端口<--
客戶端配置
>安裝
wget http://rsync.samba.org/ftp/rsync/rsync-3.0.9.tar.gzwget http://rsync.samba.org/ftp/rsync/rsync-patches-3.0.9.tar.gztar zxvf rsync-3.0.9.tar.gztar zxvf rsync-patches-3.0.9.tar.gzcd rsync-3.0.9
./configuremake && make install |
備份-還原文件shell腳本
#!/bin/sh# 按照IP進(jìn)行備份NICS=`arp -a | awk '{print $7}'`NIC=`echo $NICS |awk '{print $1}'`SERVERIP=`ifconfig $NIC | awk '/inet / {print $2}' | cut -f2 -d ":"`# directory to backupBDIR=/path/to/backdir# excludes file - this contains a wildcard pattern per line of files to excludeEXCLUDES=no_rsync.txt# the name of the backup machineBSERVER=back_server_ipif [ "$SERVERIP" = "$BSERVER" ]thenexitfi# your password on the backup serverUSERNAME=caide.meexport RSYNC_PASSWORD=caide.me.passwd########################################################################MODULE=backdirOPTS="--force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES--delete -avz"export PATH=$PATH:/bin:/usr/bin:/usr/local/bin# now the actual transferrsync $OPTS $BDIR $USERNAME@$BSERVER::$MODULE/$SERVERIP #備份# rsync $OPTS $USERNAME@$BSERVER::$MODULE/$SERVERIP $BDIR #還原
網(wǎng)頁題目:數(shù)據(jù)備份之–rsync
網(wǎng)站地址:
http://weahome.cn/article/jjsghd.html