linux之rsync遠端資料同步備份

來源:互聯網
上載者:User

標籤:完整備份   格式   主機   ret   usr   password   art   inetd   執行   

        

              

                

                      rsync服務是一種高效的遠端資料備份的工具,該服務的port號為873,

                          是Liunx下的一種非獨立服務。由xinetd超級服務管理,取代監聽873port。

                       長處:  

                                  1。rsync能夠利用ssh和ssl遠端控制進行串連遠程主機進行備份。依賴sshd服務

                                  2,能夠實現增量備份,在第一次建立串連時進行完整備份,以後僅僅同步變化的資料

                                  3。能夠使用自己的socket來進行同步。能夠在服務端設定password限制訪問。

 

                          缺點:不能進行即時同步,須要安裝lsyncd工具來輔助進行即時同步。

                    

                    配置步驟:

                             1,在client和server端各自安裝rsync軟體。

yum install rsync* -y

                                     2 ,  在服務端編寫設定檔rsyncd.conf  此檔案不存在,手動建立 vim /etc/rsyncd.conf

                                     3 ,  在服務端建立password檔案 vi  /var/rsync.pass  chmod 600 /var/rsync 必須賦600許可權。

                                                內容為user:password 格式。

                                    4。 在服務端的rsyncd.conf設定檔設定同步資料夾和許可權。

                                    5。 client 查看server同步資料夾  rsync  --list-only rsync://172.16.0.1

                                    6,    client 同步server檔案夾    rsync -av --delete  rsync://172.16.0.1:/share

                                    7,    client同步訪問有訪問許可權的server

                                      rsync -av --delete --password-file=/var/myscret.pass rsync://[email protected]/share /backup

                                    8。client建立password存放檔案myscrete.pass,內容為server訪問password,這樣直接訪問,適合指令碼。

                                       --delete選項的含義表示:鏡像同步server檔案夾,包含刪除的檔案同步,否則僅僅同步添加的檔案



                            二:配置lrsyncd工具進行即時同步。

                                           1,下載lrsyncd.tar.gz包。安裝。cp /usr/local/share/doc/lsyncd/lrsync.lua  /usr/loca/etc

                                               編輯該設定檔。

                                          2, 執行lsyncd /usr/local/etc/lrsync.lua Ok

                                                  





                                

         

linux之rsync遠端資料同步備份

聯繫我們

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