[20191202]加快scp拷貝速度.txt
[20191202]加快scp拷貝速度.txt
--//以前寫的http://blog.itpub.net/267265/viewspace-2138649/=>[20170508]加快scp拷貝速度.txt
--//如果結合xargs -P引數可以更快.scp加入 -c arcfour引數.
--//當然首先你給避免輸入口令,機器之間要相互認證.
1.方法一:scp +xargs
# time ls -1 *.dbf | xargs -P 5 -I{} scp -c arcfour {} root@192.168.xx.xx:/tmp
tea01.dbf 100% 6152KB 6.0MB/s 00:00
T01.dbf 100% 40MB 40.0MB/s 00:01
temp01.dbf 100% 150MB 50.0MB/s 00:03
undotbs02.dbf 100% 16MB 16.0MB/s 00:01
undotbs03.dbf 100% 16MB 16.0MB/s 00:01
example01.dbf 100% 346MB 49.5MB/s 00:07
users01.dbf 100% 400MB 80.0MB/s 00:05
system01.dbf 100% 770MB 20.3MB/s 00:38
undotbs01.dbf 100% 1475MB 23.1MB/s 01:04
sysaux01.dbf 100% 2800MB 24.4MB/s 01:55
real 1m55.522s
user 1m13.889s
sys 0m33.552s
--//主要問題是sysaux01.dbf最大,如果排序執行,首先執行最大的檔案看看.
# time ls -S1 *.dbf | xargs -P 5 -I{} scp -c arcfour {} root@192.168.xx.xx:/tmp/xxx
example01.dbf 100% 346MB 19.2MB/s 00:18
users01.dbf 100% 400MB 19.1MB/s 00:21
T01.dbf 100% 40MB 13.3MB/s 00:03
temp01.dbf 100% 150MB 16.7MB/s 00:09
undotbs02.dbf 100% 16MB 8.0MB/s 00:02
undotbs03.dbf 100% 16MB 16.0MB/s 00:00
tea01.dbf 100% 6152KB 3.0MB/s 00:02
system01.dbf 100% 770MB 24.1MB/s 00:32
undotbs01.dbf 100% 1475MB 32.1MB/s 00:46
sysaux01.dbf 100% 2800MB 51.9MB/s 00:54
real 0m54.662s
user 1m4.611s
sys 0m29.232s
--//節約一半時間.開啟10個並行看看.
# time ls -S1 *.dbf | xargs -P 10 -I{} scp -c arcfour {} root@192.168.xx.xx:/tmp/xxx
tea01.dbf 100% 6152KB 6.0MB/s 00:01
undotbs03.dbf 100% 16MB 16.0MB/s 00:01
undotbs02.dbf 100% 16MB 16.0MB/s 00:01
T01.dbf 100% 40MB 20.0MB/s 00:02
temp01.dbf 100% 150MB 21.4MB/s 00:07
users01.dbf 100% 400MB 40.0MB/s 00:10
example01.dbf 100% 346MB 19.2MB/s 00:18
system01.dbf 100% 770MB 26.6MB/s 00:29
undotbs01.dbf 100% 1475MB 35.1MB/s 00:42
sysaux01.dbf 100% 2800MB 51.9MB/s 00:54
real 0m54.456s
user 1m2.177s
sys 0m26.754s
--//基本差不多.
# time ls -S1 book/*.dbf | xargs -P 10 -I{} scp -o CompressionLevel=5 -C -c arcfour256 {} root@192.168.xx.xx:/tmp/xxx
tea01.dbf 100% 6152KB 6.0MB/s 00:01
undotbs02.dbf 100% 16MB 16.0MB/s 00:01
undotbs03.dbf 100% 16MB 16.0MB/s 00:01
T01.dbf 100% 40MB 20.0MB/s 00:02
temp01.dbf 100% 150MB 50.0MB/s 00:03
example01.dbf 100% 346MB 49.5MB/s 00:07
users01.dbf 100% 400MB 22.2MB/s 00:18
system01.dbf 100% 770MB 22.0MB/s 00:35
undotbs01.dbf 100% 1475MB 22.4MB/s 01:06
sysaux01.dbf 100% 2800MB 27.5MB/s 01:42
real 1m42.486s
user 3m46.769s
sys 0m11.963s
*/
--//效果並不明顯,問題在與sysaux01.dbf太大了.
2.方法2: tar+pigz+ssh
--//注意兩邊都要安裝pigz:
# tar cvf - book -I pigz | ssh oracle@192.168.xx.xx tar xvf - -I pigz -C /tmp/xxx
--//有一些tar版本不支援-I引數使用--use-compress-program pigz代替.
# tar cvf - book --use-compress-program pigz | ssh oracle@192.168.xx.xx tar xvf - --use-compress-program pigz -C /tmp/xxx
--//注意一點tar f引數後面的-千萬不要忘記寫!!例子:
# time tar cvf - book/*.dbf --use-compress-program pigz | ssh root@192.168.xx.xx tar xvf - --use-compress-program pigz -C /tmp/xxx
# time tar cf - book/*.dbf --use-compress-program pigz | ssh root@192.168.xx.xx tar xvf - --use-compress-program pigz -C /tmp/xxx
book/example01.dbf
book/sysaux01.dbf
book/system01.dbf
book/T01.dbf
book/tea01.dbf
book/temp01.dbf
book/undotbs01.dbf
book/undotbs02.dbf
book/undotbs03.dbf
book/users01.dbf
<stdin> OK, has trailing junk which was ignored
real 0m31.753s
user 7m53.904s
sys 0m17.523s
*/
--//這種方式非常考驗網路,如果網路或者交換機不給力,整個網路都會有影響.
--//再次提醒tar f引數後面的 - 千萬不要忘記寫!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2666513/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux-scp 遠端拷貝報錯原因Linux
- SCP和Rsync遠端拷貝的幾個技巧
- linux採用scp命令拷貝檔案到本地,拷貝本地檔案到遠端伺服器Linux伺服器
- [20191202]od使用技巧.txt
- 淺拷貝&深拷貝
- python 指標拷貝,淺拷貝和深拷貝Python指標
- 淺拷貝和深拷貝
- 深拷貝和淺拷貝
- 淺拷貝與深拷貝
- [20191202]tmux共享回話.txtUX
- jquery之物件拷貝深拷貝淺拷貝案例講解jQuery物件
- 一文搞懂Java引用拷貝、淺拷貝、深拷貝Java
- C++拷貝建構函式(深拷貝,淺拷貝)C++函式
- JS深拷貝與淺拷貝JS
- iOS深拷貝和淺拷貝iOS
- js 深拷貝和淺拷貝JS
- python深拷貝與淺拷貝Python
- JavaScript淺拷貝和深拷貝JavaScript
- Java深拷貝和淺拷貝Java
- Python淺拷貝與深拷貝Python
- 物件深拷貝和淺拷貝物件
- JavaScript深拷貝和淺拷貝JavaScript
- javascript 淺拷貝VS深拷貝JavaScript
- JavaScript 深度拷貝和淺拷貝JavaScript
- js 淺拷貝和深拷貝JS
- 淺談深拷貝與淺拷貝?深拷貝幾種方法。
- [20180412]手工拷貝檔案到另外主機.txt
- [20180718]拷貝資料檔案從dg庫.txt
- go slice深拷貝和淺拷貝Go
- js之淺拷貝和深拷貝JS
- ECMAScript-淺拷貝和深拷貝
- C++淺拷貝和深拷貝C++
- 深拷貝、淺拷貝與Cloneable介面
- 實現物件淺拷貝、深拷貝物件
- 深度解析深拷貝和淺拷貝
- 正則以及淺拷貝深拷貝
- 談談深拷貝與淺拷貝
- 賦值、淺拷貝與深拷貝賦值