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

简介:
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
我的博客已迁移到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









本文转自 xdoujiang 51CTO博客,原文链接:http://blog.51cto.com/7938217/1656687,如需转载请自行联系原作者
目录
相关文章
|
8月前
|
存储 Linux
Linux 目录名称
Linux系统目录结构简介:根目录(/)下包含各类功能目录,如/bin存放用户命令,/etc存储配置文件,/home为用户主目录,/var记录日志等可变数据,/usr存放用户工具,/tmp用于临时文件。各目录分工明确,保障系统有序运行。(238字)
340 5
|
10月前
|
Ubuntu 物联网 Linux
从零安装一个Linux操作系统几种方法,以Ubuntu18.04为例
一切就绪后,我们就可以安装操作系统了。当系统通过优盘引导起来之后,我们就可以看到跟虚拟机中一样的安装向导了。之后,大家按照虚拟机中的顺序安装即可。 好了,今天主要介绍了Ubuntu Server版操作系统的安装过程,关于如何使用该操作系统,及操作系统更深层的原理,还请关注本号及相关圈子。
|
JavaScript Linux 内存技术
Debian 11系统下Node.js版本更新方法详解
本指南详细介绍在Linux系统中安装和管理Node.js的步骤。首先检查现有环境,包括查看当前版本和清除旧版本;接着通过NodeSource仓库安装最新版Node.js并验证安装结果。推荐使用nvm(Node Version Manager)进行多版本管理,便于切换和设置默认版本。同时,提供常见问题解决方法,如权限错误处理和全局模块迁移方案,以及版本回滚操作,确保用户能够灵活应对不同需求。
1464 0
|
JavaScript Linux 内存技术
Debian 11系统下Node.js版本更新方法
Debian 11更新Node.js主要就是这三种方式,无论你是初涉其中的新手还是找寻挑战的专家,总有一种方式能满足你的需求。现在,你已经是这个
1478 80
|
10月前
|
缓存 监控 Linux
Linux系统清理缓存(buff/cache)的有效方法。
总结而言,在大多数情形下你不必担心Linux中buffer与cache占用过多内存在影响到其他程序运行;因为当程序请求更多内存在没有足够可用资源时,Linux会自行调整其占有量。只有当你明确知道当前环境与需求并希望立即回收这部分资源给即将运行重负载任务之前才考虑上述方法去主动干预。
2504 10
|
10月前
|
XML 缓存 Linux
在Linux环境下解决Visual Studio Code字体显示异常和字体替换方法。
解决Linux下VS Code字体显示异常,需要对Linux字体渲染机制有所理解,并对VS Code的配置选项进行合理设置。替换字体时则要通过系统字体配置或VS Code设置来完成。通过上述方法,可以有效地解决字体显示问题,从而提升代码编辑的视觉体验。
1534 21
|
Ubuntu Linux Shell
Linux环境下VSCode快速安装终极指南:debian/ubuntu/linux平台通用
以上就是在Linux环境下安装VSCode的终极指南,抛开繁复的专业词汇,以平易近人的文字、形象生动的比喻让你轻松学会这一过程。别忘了,你的小伙伴VSCode已经在应用菜单里等你了!
3302 23
|
10月前
|
Ubuntu 安全 数据挖掘
揭开Linux系统神秘面纱,选择Centos、Debian、Ubuntu?
CentOS、Debian 和 Ubuntu 三种 Linux 操作系统各具优势和适用场景。CentOS 更适合用于服务器应用,Debian 更适合稳定需求的系统环境,而 Ubuntu 更适合用于桌面操作系统和开发环境等。CentOS 和 Debian 相对保守,重视稳定性和安全性;Ubuntu 侧重更新和更好的可用性,重视用户体验。此外, Ubuntu 在市场上的占有率最高。因此,选择适合自己需求的操作系统非常重要,可以帮助用户提高效率和使用体验。
|
10月前
|
Ubuntu 搜索推荐 安全
Linux发行版大观:Ubuntu、Fedora与Debian的选择与定制
;而如果您重视稳定性、自定义能力和开源理念,Debian无疑是最佳伙伴。无论选择哪个发行版,都不妨尝试对其进行一定程度的定制,以打造最适合自己的操作系统环境。