Centos 6.3 安裝配置使用 Rsync同步

來源:互聯網
上載者:User

Rsync的優點如下:

1、可以鏡像儲存整個分類樹和檔案系統。

2、可以很容易的做到保持原來檔案的許可權、時間、軟連結等。

3、無須特使許可權即可安裝。

4、擁有最佳化的流程,檔案傳輸效率高。

5、可以使用Rsh、SSH等方式來傳輸檔案,當然也可以直接通過Socket串連。

6、支援匿名傳輸。

         另外,與SCP相比,傳輸速度不是一個層次級的。我們在區域網路時經常用Rsync和SCP傳輸大量Mysql資料,發現Rsync至少比Scp快20倍以上,所以大家如果需要在Linux/Unix伺服器之間互傳海量資料,Rsync是非常好的選擇。

我的安裝環境是Centos 6.2系統,Rsync服務端IP(192.168.1.220)用戶端IP(192.168.1.210)

 

1、安裝Rsync服務端

[root@chenyi1 Packages]# yum install rsync
1 [root@chenyi1 Packages]# yum install rsync
注意:這裡需要關閉iptables和SELINUX(在這裡 你可以不用關閉iptables,因為本文有用到iptables)

[root@chenyi1 Packages]# service iptables stop

[root@chenyi1 Packages]# chkconfig iptables off

[root@chenyi1 Packages]# setenforce 0


2、建立Rsync的設定檔

[root@chenyi1 Packages]# vi /etc/rsyncd.conf      #該檔案預設不存在,名字格式可隨你自己建立

[root@chenyi1 Packages]# cat /etc/rsyncd.conf
1 [root@chenyi1 Packages]# cat /etc/rsyncd.conf
uid = nobody #指的是進行備份的使用者,nobody為任何使用者

max connections = 200 #表示最大串連數

pid file = /var/run/rsyncd.pid  #告訴進程寫到/var/run/rsyncd.pid檔案中

lock file = /var/run/rsyncd.lock        #指lock檔案所的存放位置

motd file = /etc/rsyncd.motd    #指的是用戶端串連Rsync伺服器後顯示的提示。

log file = /var/log/rsyncd.log  #指的是記錄檔的存放位置。

 

[backup]        #這裡是預設組名 跟Samba的配置文法一樣,是對外公布的名字

path = /home/itchenyi      #參與同步的目錄

ignore errors   #可以忽略一些無關緊要的I/O錯誤

read only = no  #允許讀和寫

list = no       #不允許列清單

hosts allow = 192.168.1.0/255.255.255.0 #跟Samba的文法一樣,表示只允許192.168.1.0/24>的網段進行同步,拒絕其他。

auth users = itchenyi,chenyi

secrets file = /etc/rsyncd.password     #使用者密碼的存放檔案

下面我們需要手動再建立rsyncd.password,rsyncd.motd兩個檔案以及/home/itchenyi同步目錄

[root@chenyi1 Packages]# touch /etc/rsyncd.password
[root@chenyi1 Packages]# chmod 600 /etc/rsyncd.password
[root@chenyi1 Packages]# echo 'www.111cn.net' >

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.