ubuntu文件传输,分布式系统搭建
来源:互联网 发布:互动百科排名优化 编辑:程序博客网 时间:2024/06/05 22:28
每一项功能探索都是以需求为先的:
项目需求: 多机连用,批量将pdf进行提取文本和文本转换
方案:1. 文件共享式:一台主机(Master)共享文件,使用nfs;其他slaver读取共享文件夹中的内容;
2. 分布式:文件分发传输到每一台主机,每台机器都在本地执行脚本
总体来说,方案1,2的逻辑都大同小异,具体实施的过程中,共享式的文件系统不稳定(原因暂不明确)
方案2主要需要解决问题:1>文件传输;2>远程脚本执行;3>系统调度和平衡负载
这一篇主要讲文件传输:
工具 SCP
scp是有Security的文件copy,基于ssh登录
scp allows files to be copied to, from, or between different hosts. It
uses ssh for data transfer and provides the same authentication and
same level of security as ssh.
- 文件
1.1远程到本地
$ scp your_username@remotehost.edu:foobar.txt /some/local/directory
1.2本地到远程<单文件,多文件>
$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory $ scp foo.txt bar.txt your_username@remotehost.edu:~
1.3远程到远程
$ scp your_username@rh1.edu:/some/remote/directory/foobar.txt \your_username@rh2.edu:/some/remote/directory/
- 文件夹
2.1本地到远程<其他参考文件操作>
$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar
3.其他用法
3.1用其他端口
$ scp -P 2264 foobar.txt your_username@remotehost.edu:/some/remote/directory
3.2读取多个文件
$ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} . $ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .
3.3换加密方式提速
$ scp -c blowfish some_file your_username@remotehost.edu:~
3.4压缩<注:网速慢时用,因为压缩耗费CPU资源>
$ scp -c blowfish -C local_file your_username@remotehost.edu:~
项目中遇到的问题:
使用语言:python
scp多个数据时(十万级pdf文件),最初传输挺快,后期(十万以后)巨慢,百度了半天没找到原因,自己追终了一下代码流程,原来是自己傻逼了。
楼主的代码,传输多个文件
$ scp your_username@remotehost.edu:/some/remote/file1 your_username@remotehost.edu:/some/remote/file2 ...your_username@remotehost.edu:/some/remote/filen ./
读者你能猜到出了什么问题吗?没错:
这样的代码,每传输一次都需要ssh登陆一次,后期ssh登陆的验证极其慢:
所以可以:
1>优化ssh的登陆时间;
2>使用前面提供的传输多文件的方式{pdf1,pdf2},这样就只有在最开始需要ssh一次
$ scp your_username@remotehost.edu:/some/remote/directory/\{file1,file2,...,filen\} ./
- ubuntu文件传输,分布式系统搭建
- ubuntu执行远程脚本,分布式系统搭建
- tftp文件传输系统的搭建
- Ubuntu 系统局域网内文件传输
- [原]诞生!fileTMS分布式文件传输系统
- 4Ubuntu下交叉环境搭建(设置Samba与Windows系统进行文件传输)
- hadoop伪分布式集群搭建与安装(ubuntu系统)
- 分布式文件传输
- hbase分布式系统搭建
- ubuntu系统的ftp文件传输工具
- Ubuntu 与windows 系统之间文件传输
- ubuntu 搭建伪分布式hadoop
- Ubuntu Hadoop伪分布式搭建
- Ubuntu Hadoop 完全分布式搭建
- 分布式集群Web系统搭建
- Ubuntu系统安装+Hadoop伪分布式环境搭建+eclipse环境配置
- ubuntu系统搭建
- 关于搭建ubuntu系统
- Android Studio 使用7-Eclipse项目转移到AS项目中
- JMX -- JDMK实现HTML页面触发后台方法
- python和java中Des加密初试
- linux安装ftp
- C语言_函数_例子
- ubuntu文件传输,分布式系统搭建
- 利用UITextField自定义搜索栏,实现中文输入过程中字母的搜索功能
- iOS有三种多线程编程的技术
- Mac电脑下把自己的项目上传到Github
- 老友记——回味CSDN那些年的旧时光ME
- 【经典算法】:最长公共子序列(LCS问题,用遍历实现)
- 搜索技术地址
- C++primer plus第六版课后编程练习答案7.9
- git 错误操作回滚