在将生产库的备份拷贝到UAT环境时,为降低对生产环境的影响,需要对SCP工具进行限速。
1 | [oracle@xxDB01 xxxdb]$ scp -r lv0_20150607 10.0.97.33:/data/ivldb |
2 | Address 10.0.97.33 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! |
3 | oracle@10.0.97.33's password: |
4 | 20150607.log 100% 71KB 71.2KB/s 00:00 |
5 | level_0_ivldb_datafile_700_1 10% 787MB 11.2MB/s 10:06 ETAKilled by signal 2. |
上面是未做限速的情况,我看到每秒传送11.2MB,当时以为生产库和UAT数据库之间的网络是百兆网,这不把带宽给跑满了吗,当时吓的汗毛都立起来了,现在想想应该不是百兆网,SCP工具很难把网络跑满,一般会使用百分之四五十的带宽,至于每秒11.2MB应该是交换机做了限制。可是问了几个同事都不能确定到底是多少的带宽,只好对SCP工具进行限速了。
SCP工具可是使用-l参数进行速度限制,单位是字节。
2 | scp - secure copy (remote file copy program) |
5 | scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 [...] |
8 | Limits the used bandwidth, specified in Kbit/s. |
限制每秒传输20000字节,也就约等于每秒传输2M的数据。
1 | [oracle@XXDB01 xxdb]$ scp -rl 20000 lv0_20150607 10.0.97.33:/data/xxxdb |
2 | Address 10.0.97.33 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT! |
3 | oracle@10.0.97.33's password: |
4 | 20150607.log 100% 71KB 71.2KB/s 00:00 |
5 | level_0_ivldb_datafile_700_1 50% 3823MB 2.1MB/s 29:50 |
6 | ETASlevel_0_ivldb_datafile_700_1 100% 7593MB 2.1MB/s 59:49 |
7 | level_0_ivldb_datafile_699_1 100% 8709MB 2.1MB/s 1:08:3 |