linux rsync同步設定詳細指南

來源:互聯網
上載者:User

linux rsync同步設定詳細指南 配置rsync 同步資料     rpm包安裝rsync及配置 [root@Hammer home]# rpm -qa |grep rsync                 #檢查系統是否安裝了rsync軟體包rsync-2.6.8-3.1[root@Hammer CentOS]# rpm -ivh rsync-2.6.8-3.1.i386.rpm # 如果沒有安裝則手動安裝 [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自動啟動[root@test etc]# chkconfig rsync on[root@test etc]# chkconfig rsync --listrsync           on 3 配置rsyncd.conf [root@test etc]# vim rsyncd.conf  uid = rootgid = rootuse chroot = nomax connections = 4strict modes = yesport = 873pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsyncd.log [backup]path = /srvcomment = This is testauth users = scihoouid = rootgid = rootsecrets file = /home/rsync.psread only = nolist = no 4 確保etc/services中rsync連接埠號碼正確[root@test etc]# vim /etc/servicesrsync           873/tcp                         # rsyncrsync           873/udp                         # rsync 5 配置rsync密碼(在上邊的設定檔中已經寫好路徑)/home/rsync.ps(名字隨便寫,只要和上邊設定檔裡的一致即可),格式(一行一個使用者)[root@test etc]# vi /home/rsync.ps scihoo:scihoo 6 配置rsync密碼檔案許可權[root@test home]# chown root.root rsync.ps [root@test home]# chmod 400 rsync.ps  7 啟動配置[root@test home]# /etc/init.d/xinetd restartStopping xinetd:                                           [  OK  ]Starting xinetd:                                           [  OK  ] 8 如果xinetd沒有的話,需要安裝一下[root@test home]# yum -y install xinetd、  啟動rsync server  RSYNC服務端啟動的兩種方法9、啟動rsync服務端(獨立啟動)[root@test home]# /usr/bin/rsync --daemon 10、啟動rsync服務端 (有xinetd超級進程啟動)[root@test home]# /etc/init.d/xinetd reload 11  加入rc.local在各種作業系統中,rc檔案存放位置不盡相同,可以修改使系統啟動時把rsync --daemon載入進去。[root@test home]# vi /etc/rc.local/usr/local/rsync –daemon           #加入一行 12 檢查rsync是否啟動[root@test home]# lsof -i :873COMMAND  PID USER   FD   TYPE DEVICE SIZE NODE NAMExinetd  4396 root    5u  IPv4 633387       TCP *:rsync (LISTEN) 用戶端配置1 配置三個過程就可以了  1.1 設定密碼檔案  1.2 測試rsync執行指令  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  配置密碼檔案  (註:為了安全,設定密碼檔案的屬性為:600。rsync.ps的密碼一定要和Rsync Server密碼設定案裡的密碼一樣)[root@aj1 home]# vi rsync.ps sciooo [root@aj1 home]# chown root.root .rsync.ps   # 注意必須給許可權[root@aj1 home]# chmod 600 .rsync.ps         # 必須修改許可權 1.2 從伺服器上下載檔案[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps scihoo@192.168.0.206::backup /home/    從本地上傳到伺服器上去[root@aj1 rsync-3.0.4]# rsync -avz --password-file=/home/rsync.ps /home scihoo@192.168.0.206::backup
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.