【Mapreduce】从代码上解决Output directory already exists错误,避免每次调试都要手动删除输出文件夹
来源:互联网 发布:galgame游戏删除数据 编辑:程序博客网 时间:2024/06/11 14:29
感谢分享:http://blog.csdn.net/yongh701/article/details/50601811
Mapreduce调试很蛋疼的,它不会覆盖上一次输出的结果,如果发现输出文件夹已经存在,比如我的调试输出文件夹是hdfs://192.168.230.129:9000/output,它会直接给你报如下错误:
如下图所示:
当然,错误很明了,就是输出文件夹已存在。
不过网上有写很坑爹的教程,表示解决这个错误,要自己手动删除输出文件夹。
这很蛋疼,无论你这次调试成功还是报错与否,都要先刷新HDFS,再删除,再运行程序:
这是何其地蛋疼啊!其实可以在代码上利用hdfs的文件操作,解决这个问题。思想就是在代码运行之前,也就是提交作业之前,判断output文件夹是否存在,如果存在则删除。具体代码如下:
关键就是如下这4行:
教会Mapreduce这SB覆盖上一次运行结果,别只会在这报错!
阅读全文
0 0
- 【Mapreduce】从代码上解决Output directory already exists错误,避免每次调试都要手动删除输出文件夹
- 【Mapreduce】从代码上解决Output directory already exists错误,避免每次调试都要手动删除输出文件夹
- 【Mapreduce】从代码上解决Output directory already exists错误,避免每次调试都要手动删除输出文件夹
- Output directory /opt/user/output already exists
- Output directory hdfs://hadoop:8010/user/root/output already exists
- 如何避免开机每次都要手动reload window manager
- FileAlreadyExistsException: Output directory hdfs://ubuntu:9000/output09 already exists
- 解决:在VS上写Qt文件每次都要手动添加include、lib、bin文件的问题
- mapreduce自动删除输出文件夹
- hadoop之WordCoun输出文件用时间命名,避免每次运行都要修改
- 解决PHP执行乱码、每次都要手动更改Firefox Unicode设置问题
- magento -- 解决magento错误:ERROR: Base table or view already exists: 1050 Table ... already exists
- fatal: destination path ‘文件夹名’ git clone already exists and is not an empty directory解决方法
- 如何解决ORA-27100 shared memory realm already exists错误
- ora-27100:shared memory realm already exists错误的解决
- 解决MySQL 5.6版的Function 'innodb' already exists错误
- 出现Swap file….already exists以下错误如何解决?
- hadoop提示问题:output already exists
- table表格合并跨行中相同元素的列
- 没有找到draw9patch.bat
- android studio中kotlin语言生成API文档工具GenerateDokka
- ElasticSearch基础教程
- Servlet 详解
- 【Mapreduce】从代码上解决Output directory already exists错误,避免每次调试都要手动删除输出文件夹
- JavaWeb
- 数据结构(查找)
- Linux_MongoDB 安装笔记
- 自定义dialog
- 自定义ImageView
- 导航栏变为透明
- 编译原理中四种文法语言的基本概念
- 【连载】研究EasyUI系统—Tree组件(事件)