debian linux下载路径,linux下目录传输多种方法及测试(debian)

linux下目录传输多种方法及测试(debian)

我的博客已迁移到xdoujiang.com请去那边和我交流

基础环境说明及安装

1、服务器

serverA=192.168.1.124(debian7.8)

serverB=192.168.1.122(debian6.0.10)

2、需要将serverB下的目录testtransfer(4.5G)下全部远程复制到serverA下

3、需要用到软件

1)apt-cache search pigz

pigz - Parallel Implementation of GZip(多线程压缩)

2)apt-cache search pv |grep "^pv"

pv - Shell pipeline element to meter data passing through

3)apt-cache search netcat

netcat - TCP/IP swiss army knife -- transitional package

4)apt-get -y install pigz

5)apt-get -y install pv

6)apt-get -y install netcat

7)apt-get -y install wget

8)apt-get -y install rsync

9)apt-get -y install vsftpd

10)apt-get -y install lftp

11)apt-get -y install python

一、ssh+tar+gzip(pigz)

1、使用ssh+tar+gzip方式(ssh协议)在(serverB)上

time tar czf - testtransfer/|ssh -q jimmy@192.168.1.124 "tar zxf - -C /tmp"

real    13m20.771s

user    4m43.186s

sys     1m55.239s

2、使用ssh+tar+pigz方式(ssh协议)在(serverB)上

time tar cf - testtransfer/|pigz|ssh -q jimmy@192.168.1.124 "pigz -d|tar xf - -C /tmp"

real    12m7.335s

user    4m12.200s

sys     1m46.455s

参数说明

-d, --decompress     Decompress the compressed input

二、nc+tar+gzip(pigz)

1、使用nc+tar+gzip方式(tcp协议)

nc -lp 55555|tar -zxf - -C /tmp(serverA)

time tar -zcf - testtransfer/|pv|nc -w 1 192.168.1.124 55555(serverB)

real    11m31.341s

user    4m25.589s

sys     1m35.162s

2、使用nc+tar+pigz方式(tcp协议)

nc -lp 55555|pigz -d|tar xf - -C /tmp(serverA)

time tar -cf - testtransfer/|pigz|pv|nc -w 1 192.168.1.124 55555(serverB)

real    10m42.789s

user    4m9.968s

sys     1m6.860s

参数说明

-w secs   timeout for connects and final net reads

三、python或web服务器

1、python web服务在(serverB)上

nohup python -m SimpleHTTPServer 50000 &

2、在(serverA)上使用wget去下载

wget -r -q 192.168.1.122:50000

real    4m35.531s

user    0m0.360s

sys     0m33.218s

参数说明

-m module-name Searches sys.path for the named module and runs the

corresponding .py file as a script.

四、rsync(rsync协议)

1、服务端配置(serverB)

1)配置rsyncd.conf

cat rsyncd.conf

[aaa]

path = /opt/testtransfer

use chroot = yes

read only = yes

uid = jimmy

gid = jimmy

auth users = www-data

secrets file = /etc/rsyncd.secrets

2)配置验证密码

cat /etc/rsyncd.secrets

www-data:123456

3)权限

chmod 600 /etc/rsyncd.secrets

2、客户端配置(serverA)

1)配置密码

cat /etc/rsyncd.secrets

123456

2)开始传输

time rsync -az --password-file=/etc/rsyncd.secrets www-data@192.168.1.122::aaa /opt/111

real    9m46.331s

user    0m5.600s

sys     1m0.448s

参数说明

-a, --archive  This  is equivalent to -rlptgoD.

-z, --compress With  this  option, rsync compresses the file data as it is

sent to the destination machine, which reduces the amount of data being

transmitted -- something that is useful over a slow connection.

五、ftp(ftp协议)

1、服务端配置(serverB)

1)配置vsftpd.conf

cat /etc/vsftpd.conf

listen=YES

local_enable=YES

pam_service_name=vsftpd

2、客户端配置(serverA)

time lftp jimmy:redhat@192.168.1.122 -e "mirror /opt/testtransfer;quit"

real    7m29.727s

user    0m1.252s

sys     0m46.495s

PS:serverB上的jimmy用户建立过的,密码是redhat

©著作权归作者所有:来自51CTO博客作者xdoujiang的原创作品,如需转载,请注明出处,否则将追究法律责任

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值