设为首页 加入收藏

TOP

hadoop distcp 命令
2018-11-29 08:36:18 】 浏览:435
Tags:hadoop distcp 命令

实例:

hadoop distcp -ip -overwrite -m 80 "hdfs://${cluster_upload}/${biz}/${name}/ds=${date}" "hdfs://${cluster_95}/database/${biz}/${name}/ds=${date}"

hadoop distcp -overwrite -delete -i dir1 dir2


distcp命令是用于集群内部或者集群之间拷贝数据的常用命令。

顾名思义:dist即分布式,分布式拷贝是也。

hadoopdistcp[选项]src_urldest_url

常用选项

-m表示启用多少map

-delete:删除已经存在的目标文件,不会删除源文件。这个删除是通过FS Shell实现的。所以如果垃圾回收机制启动的话,删除的目标文件会进入trash。
-i:忽略失败。这个选项会比默认情况提供关于拷贝的更精确的统计, 同时它还将保留失败拷贝操作的日志,这些日志信息可以用于调试。最后,如果一个map失败了,但并没完成所有分块任务的尝试,这不会导致整个作业的失败。
-overwrite:覆盖目标。如果一个map失败并且没有使用-i选项,不仅仅那些拷贝失败的文件,这个分块任务中的所有文件都会被重新拷贝。 所以这就是为什么要使用-i参数。


新版本可以指定不同集群之间的拷贝,

1.指定不同集群的用户名密码

distcp-m300-su<user,paswd>-du<user,paswd>src_urldest_url

2.本地hadoop客户端需要设置hadoop_site.xml中的各种信息fs.default.name

目前猜测是因为distcp是要启动map任务的所以需要知道namenode,jobtracker等信息。


其他选项:

-p[rbugp] Preserve status
r: replication number
b: block size
u: user
g: group
p: permission
-p alone is equivalent to -prbugp
-i Ignore failures
-log <logdir> Write logs to <logdir>
-m <num_maps> Maximum number of simultaneous copies
-overwrite Overwrite destination
-update Overwrite if src size different from dst size
-f <urilist_uri> Use list at <urilist_uri> as src list
-filelimit <n> Limit the total number of files to be <= n
-sizelimit <n> Limit the total size to be <= n bytes
-delete Delete the files existing in the dst but not in src
-mapredSslConf <f> Filename of SSL configuration for mapper task

关于distcp的详细内容详见官方地址:http://hadoop.apache.org/common/docs/r0.20.0/distcp.html




】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Hadoop (海量数据存储及计算) .. 下一篇hadoop ha 高可用实现原理

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目