欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Linux遠程備份工具Rsync怎么用

小編給大家分享一下Linux遠程備份工具Rsync怎么用,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

成都創(chuàng)新互聯(lián)從2013年創(chuàng)立,先為義烏等服務建站,義烏等地企業(yè),進行企業(yè)商務咨詢服務。為義烏企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務解決您的所有建站問題。

:下面所有例子中 – - 之間實際上是沒有空格的,使用時請刪除空格。

Rsync是一個遠程數(shù)據(jù)同步工具,可通過LAN 或互聯(lián)網(wǎng)快速同步多臺主機間的文件。Rsync 本來是用以取代 rcp的一個工具,它當前由 rsync.samba.org 維護。Rsync 使用所謂的”Rsync演算法”來使本地和遠程兩個主機之間的文件達到同步,這個算法只傳送兩個文件的不同部分,而不是每次都整份傳送,因此速度相當快。

Rsync 的特色:

  1. 快速:***次同步時 rsync 會復制全部內(nèi)容,但在下一次只傳輸修改過的文件。

  2. 安全:rsync 允許通過 ssh 協(xié)議來加密傳輸數(shù)據(jù)。

  3. 更少的帶寬:rsync 在傳輸數(shù)據(jù)的過程中可以實行壓縮及解壓縮操作,因此可以使用更少的帶寬。

  4. 特權:安裝和執(zhí)行 rsync 無需特別的權限

基本語法:

rsync options source destination

源和目標都可以是本地或遠程,在進行遠程傳輸?shù)臅r候,需要指定登錄名、遠程服務器及文件位置

樣例:

1 在本地機器上對兩個目錄進行同步

$ rsync -zvr /var/opt/installation/inventory/ /root/temp
building file list … done
sva.xml
svB.xml
.
sent 26385 bytes received 1098 bytes 54966.00 bytes/sec
total size is 44867 speedup is 1.63
$

參數(shù):

  1. -z 開啟壓縮

  2. -v 詳情輸出

  3. -r 表示遞歸

2 利用 rsync -a 讓同步時保留時間標記

rsync 選項 -a 稱為歸檔模式,執(zhí)行以下操作

  1. 遞歸模式

  2. 保留符號鏈接

  3. 保留權限

  4. 保留時間標記

  5. 保留用戶名及組名

$ rsync -azv /var/opt/installation/inventory/ /root/temp/
building file list … done
./
sva.xml
svB.xml
.
sent 26499 bytes received 1104 bytes 55206.00 bytes/sec
total size is 44867 speedup is 1.63
$

3 僅同步一個文件

$ rsync -v /var/lib/rpm/Pubkeys /root/temp/
Pubkeys

sent 42 bytes received 12380 bytes 3549.14 bytes/sec
total size is 12288 speedup is 0.99

4 從本地同步文件到遠程服務器

$ rsync -avz /root/temp/ thegeekstuff@192.168.200.10:/home/thegeekstuff/temp/Password:
building file list … done
./
rpm/
rpm/Basenames
rpm/Conflictname

sent 15810261 bytes received 412 bytes 2432411.23 bytes/sec
total size is 45305958 speedup is 2.87

就像你所看到的,需要在遠程目錄前加上 ssh 登錄方式,格式為 username@machinename:path

5 同步遠程文件到本地

和上面差不多,做個相反的操作

$ rsync -avz thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
Password:
receiving file list … done
rpm/
rpm/Basenames
.
sent 406 bytes received 15810230 bytes 2432405.54 bytes/sec
total size is 45305958 speedup is 2.87

6 同步時指定遠程 shell

用 -e 參數(shù)可以指定遠程 ssh ,比如用 rsync -e ssh 來指定為 ssh

$ rsync -avz -e ssh thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
Password:
receiving file list … done
rpm/
rpm/Basenames

sent 406 bytes received 15810230 bytes 2432405.54 bytes/sec
total size is 45305958 speedup is 2.87

7 不要覆蓋被修改過的目的文件

使用 rsync -u 選項可以排除被修改過的目的文件

$ ls -l /root/temp/Basenames
total 39088
-rwxr-xr-x 1 root root 4096 Sep 2 11:35 Basenames

$ rsync -avzu thegeekstuff@192.168.200.10:/var/lib/rpm /root/temp
Password:
receiving file list … done
rpm/

sent 122 bytes received 505 bytes 114.00 bytes/sec
total size is 45305958 speedup is 72258.31

$ ls -lrt
total 39088
-rwxr-xr-x 1 root root 4096 Sep 2 11:35 Basenames

8 僅僅同步目錄權(不同步文件)

使用 -d 參數(shù)

$ rsync -v -d thegeekstuff@192.168.200.10:/var/lib/ .
Password:
receiving file list … done
logrotate.status
CAM/
YaST2/
acpi/

sent 240 bytes received 1830 bytes 318.46 bytes/sec
total size is 956 speedup is 0.46

9 查看每個文件的傳輸進程

使用 – -progress 參數(shù)

$ rsync -avz – -progress thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
Password:
receiving file list …
19 files to consider
./
Basenames
5357568 100% 14.98MB/s 0:00:00 (xfer#1, to-check=17/19)
Conflictname
12288 100% 35.09kB/s 0:00:00 (xfer#2, to-check=16/19)
.
.
.
sent 406 bytes received 15810211 bytes 2108082.27 bytes/sec
total size is 45305958 speedup is 2.87

10 刪除在目的文件夾中創(chuàng)建的文件

用 – -delete 參數(shù)

# Source and target are in sync. Now creating new file at the target.
$ > new-file.txt

$ rsync -avz – -delete thegeekstuff@192.168.200.10:/var/lib/rpm/ .
Password:
receiving file list … done
deleting new-file.txt
./

sent 26 bytes received 390 bytes 48.94 bytes/sec
total size is 45305958 speedup is 108908.55

11 不要在目的文件夾中創(chuàng)建新文件

有時能只想同步目的地中存在的文件,而排除源文件中新建的文件,可以使用 – -exiting 參數(shù)

$ rsync -avz –existing root@192.168.1.2:/var/lib/rpm/ .root@192.168.1.2′s password:
receiving file list … done
./

sent 26 bytes received 419 bytes 46.84 bytes/sec
total size is 88551424 speedup is 198991.96

12 查看源和目的文件之間的改變情況

用 -i 參數(shù)

$ rsync -avzi thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
Password:
receiving file list … done
>f.st…. Basenames
.f….og. Dirnames

sent 48 bytes received 2182544 bytes 291012.27 bytes/sec
total size is 45305958 speedup is 20.76

輸出結(jié)果中在每個文件最前面會多顯示 9 個字母,分別表示為

> 已經(jīng)傳輸
f 表示這是一個文件
d 表示這是一個目錄
s 表示尺寸被更改
t 時間標記有變化
o 用戶被更改
g 用戶組被更改

13 在傳輸時啟用包含和排除模式

$ rsync -avz – -include ‘P*’ – -exclude ‘*’ thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
Password:
receiving file list … done
./
Packages
Providename
Provideversion
Pubkeys

sent 129 bytes received 10286798 bytes 2285983.78 bytes/sec
total size is 32768000 speedup is 3.19

14 不要傳輸大文件

使用 – - max-size 參數(shù)

$ rsync -avz – -max-size=’100K’ thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp/
Password:
receiving file list … done
./
Conflictname
Group
Installtid
Name
Sha1header
Sigmd5
Triggername

sent 252 bytes received 123081 bytes 18974.31 bytes/sec
total size is 45305958 speedup is 367.35

15 傳輸所有文件

不管有沒有改變,再次把所有文件都傳輸一遍,用 -W 參數(shù)

# rsync -avzW thegeekstuff@192.168.200.10:/var/lib/rpm/ /root/temp
Password:
receiving file list … done
./
Basenames
Conflictname
Dirnames
Filemd5s
Group
Installtid
Name

sent 406 bytes received 15810211 bytes 2874657.64 bytes/sec
total size is 45305958 speedup is 2.87

以上是“Linux遠程備份工具Rsync怎么用”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

分享題目:Linux遠程備份工具Rsync怎么用
標題來源:http://www.aaarwkj.com/article0/igepio.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設、網(wǎng)站維護、云服務器、建站公司、做網(wǎng)站、搜索引擎優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化
日本韩国一级黄色免费| 欧美日韩一区二区午夜福利| 国产农村妇女一区二区三区 | 久久精品国产亚洲av波多| 亚洲精品不卡一区二区| 免费女同一区二区三区| 国产黄片一区二区在线| 日本少妇熟女一区二区| 国产怡红院在线视频观看| 亚洲国际天堂av在线| 青青草原这里只有精品| 很黄很刺激的视频中文字幕| 日本高清视频免费一区| 精品视频一区二区三区在线观看| 91午夜精品在线观看| 亚洲乱码一区二区免费版| 精品福利视频一区二区| 日操夜操天天操夜夜操| 国产第一页第二页在线| 国产精品中文字幕第一页| 亚洲精品国产精品乱码不| 欧美夫妻成人性生活视频| 国产老熟女一区二区三区| 一不卡二不卡三不卡日本影院| av真人青青小草一区二区欧美| 日本国产美女精品一区二区 | 国产偷国产偷亚洲综合av| 久久人妻少妇嫩草av蜜桃综合 | 亚洲av第一区国产精品| 一区二区三区蜜桃av| 亚欧乱色熟女一区二区三区| 日本中文字幕一区在线观看| 粉嫩av北条麻妃电影| 日本一区二区 视频| 四虎精品在线免费视频| 亚洲精品国产精品成人 | 91久久国产综合精品| 亚洲女同中文字幕在线| 欧美日韩亚洲激情一区| 国产一区二区精品久久久女同| 亚欧熟女乱色一二三区日韩|