Linux 主机之间即时传送文件,scp命令大家都很熟悉
但当要传送的文件较大,过程中如果网络中断了,就比较悲剧了。这时候可以考虑使用rsync命令替代scp,实现断点续传文件。
试验:rsync使用
环境:2台RHEL 5.7
需求:主机A传送文件夹TestDB到主机B
1
|
rsync -rP --rsh=ssh /home/oracle/TestDB/ oracle@192.168.1.173:/home/oracle/TestDB |
实验rsync断点续传的过程记录:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
[oracle@rac1-server TestDB]$ rsync -rP --rsh=ssh /home/oracle/TestDB/ oracle@192.168.1.173:/home/oracle/TestDB sending incremental file list created directory /home/oracle/TestDB ./ DB1.dbf 4194304 100% 17.88MB/s 0:00:00 (xfer#1, to - check =7/9) DB2.dbf 41959424 100% 13.41MB/s 0:00:02 (xfer#2, to - check =6/9) DB3.dbf 8380416 100% 5.57MB/s 0:00:01 (xfer#3, to - check =5/9) DB4.dbf 41959424 100% 6.64MB/s 0:00:06 (xfer#4, to - check =4/9) DB5.dbf 76021760 100% 12.90MB/s 0:00:05 (xfer#5, to - check =3/9) DB6.dbf 80347136 79% 9.76MB/s 0:00:02 --此处断开了连接 Last login: Tue Jul 1 09:22:34 2014 from 192.168.1.101 [oracle@rac1-server ~]$ rsync -rP --rsh=ssh /home/oracle/TestDB/ oracle@192.168.1.173:/home/oracle/TestDB sending incremental file list DB1.dbf 4194304 100% 102.51MB/s 0:00:00 (xfer#1, to - check =7/9) DB2.dbf 41959424 100% 64.44MB/s 0:00:00 (xfer#2, to - check =6/9) DB3.dbf 8380416 100% 11.38MB/s 0:00:00 (xfer#3, to - check =5/9) DB4.dbf 41959424 100% 37.40MB/s 0:00:01 (xfer#4, to - check =4/9) DB5.dbf 76021760 100% 47.14MB/s 0:00:01 (xfer#5, to - check =3/9) DB6.dbf 100597760 100% 42.85MB/s 0:00:02 (xfer#6, to - check =2/9) DB7.dbf 1005977600 100% 10.95MB/s 0:01:27 (xfer#7, to - check =1/9) DB8.dbf 182517760 100% 9.85MB/s 0:00:17 (xfer#8, to - check =0/9) sent 1188790859 bytes received 248537 bytes 10760537.52 bytes/sec total size is 1461608448 speedup is 1.23 [oracle@rac1-server ~]$ --实现了断点续传 |
引自:https://www.cnblogs.com/jyzhao/p/3809095.html