设为首页 收藏本站
查看: 602|回复: 0

[经验分享] linux下目录传输多种方法及测试(debian)

[复制链接]

尚未签到

发表于 2018-5-14 13:45:18 | 显示全部楼层 |阅读模式
我的博客已迁移到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

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-460092-1-1.html 上篇帖子: Debian修改IP、DNS 下篇帖子: 编译安装python2.7及相关模块(debian5.0.1)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表