配置rsync 同步數(shù)據(jù) rpm包安裝rsync及配置
[root@Hammer home]# rpm -qa |grep rsync #檢查系統(tǒng)是否安裝了rsync軟件包
rsync-2.6.8-3.1
[root@Hammer CentOS]# rpm -ivh rsync-2.6.8-3.1.i386.rpm # 如果沒(méi)有安裝則手動(dòng)安裝
[root@test rsync-3.0.4]# vim /etc/xinetd.d/rsync
1 配置rsync servervi /etc/xinetd.d/rsync
將disable=yes改為no
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
2 配置rsync自動(dòng)啟動(dòng)
[root@test etc]# chkconfig rsync on
[root@test etc]# chkconfig rsync --list
rsync on
3 配置rsyncd.conf
[root@test etc]# vim rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 4
strict modes = yes
port = 873
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup]
path = /srv
comment = This is test
auth users = scihoo
uid = root
gid = root
secrets file = /home/rsync.ps
read only = no
list = no
4 確保etc/services中rsync端口號(hào)正確
[root@test etc]# vim /etc/services
rsync 873/tcp # rsync
rsync 873/udp # rsync
5 配置rsync密碼(在上邊的配置文件中已經(jīng)寫(xiě)好路徑)/home/rsync.ps(名字隨便寫(xiě),只要和上邊配置文件里的一致即可),格式(一行一個(gè)用戶(hù))
[root@test etc]# vi /home/rsync.ps
scihoo:scihoo
6 配置rsync密碼文件權(quán)限
[root@test home]# chown root.root rsync.ps
[root@test home]# chmod 400 rsync.ps
7 啟動(dòng)配置
[root@test home]# /etc/init.d/xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
8 如果xinetd沒(méi)有的話(huà),需要安裝一下
[root@test home]# yum -y install xinetd
啟動(dòng)rsync server
RSYNC服務(wù)端啟動(dòng)的兩種方法
9、啟動(dòng)rsync服務(wù)端(獨(dú)立啟動(dòng))
[root@test home]# /usr/bin/rsync --daemon
10、啟動(dòng)rsync服務(wù)端 (有xinetd超級(jí)進(jìn)程啟動(dòng))
[root@test home]# /etc/init.d/xinetd reload
11 加入rc.local
在各種操作系統(tǒng)中,rc文件存放位置不盡相同,可以修改使系統(tǒng)啟動(dòng)時(shí)把rsync --daemon加載進(jìn)去。
[root@test home]# vi /etc/rc.local
/usr/local/rsync –daemon #加入一行
12 檢查rsync是否啟動(dòng)
[root@test home]# lsof -i :873
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
xinetd 4396 root 5u IPv4 633387 TCP *:rsync (LISTEN)
客戶(hù)端配置
1 配置三個(gè)過(guò)程就可以了
1.1 設(shè)定密碼文件
1.2 測(cè)試rsync執(zhí)行指令
1.3 將rsync指令放入工作排程(crontab)
[root@aj1 home]# vi /etc/xinetd.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 = yes
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
1.1 配置密碼文件 (注:為了安全,設(shè)定密碼檔案的屬性為:600。rsync.ps的密碼一定要和Rsync Server密碼設(shè)定案里的密碼一樣)
[root@aj1 home]# vi rsync.ps
sciooo
[root@aj1 home]# chown root.root .rsync.ps # 注意必須給權(quán)限
[root@aj1 home]# chmod 600 .rsync.ps # 必須修改權(quán)限
1.2 從服務(wù)器上下載文件
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps scihoo@192.168.0.206::backup /home/
從本地上傳到服務(wù)器上去
[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps /home scihoo@192.168.0.206::backup
http://www.linuxsir.org/main/?q=node/256#5.1
http://os.51cto.com/art/201101/243374.htm
posted on 2011-06-30 15:04
Alpha 閱讀(15691)
評(píng)論(3) 編輯 收藏 所屬分類(lèi):
Linux Nginx