Hadoop中FileSystem的append方法
今天在使用Hadoop 1.1.2版本进行FileSystem的append操作时报以下异常:
org.apache.hadoop.ipc.RemoteException: java.io.IOException: Append is not supported. Please see the dfs.support.append configuration parameter.
Google了一下,发现Hadoop 1.x版本不支持FileSystem的append操作,官方Hadoop 1.1.2 Release Notes如下:
- HADOOP-8230. Major improvement reported by eli2 and fixed by eli
Enable sync by default and disable appendAppend is not supported in Hadoop 1.x. Please upgrade to 2.x if you need append. If you enabled dfs.support.append for HBase, you're OK, as durable sync (why HBase required dfs.support.append) is now enabled by default. If you really need the previous functionality, to turn on the append functionality set the flag "dfs.support.broken.append" to true.
上面的解释明显的提到如果需要使用append操作,需要升级到hadoop 2.x版本。并且需要在Conf的hdfs.site.xml文件中加入如下配置:
<property>
<name>dfs.support.append</name>
<value>true</value>
</property>
Hadoop的API中也提供了设置项来支持内容追加,代码如下:
Configuration conf = new Configuration();
conf.setBoolean("dfs.support.append", true);
不过,在已有的文件中追加内容是一件需要斟酌的操作,原因如下:
【Raghava的邮件回复:】
In short, appends in HDFS are extremely experimental and dangerous. Most
would advise you to leave this disabled. Your best option for "append"
like behavior is to rewrite the file with new content being added at the
end. Append support was briefly introduced and then removed as a number
of issues came up. I believe the open (parent) JIRA issue tracking this is:
http://issues.apache.org/jira/browse/HDFS-265
如果想深究其原因,可以参考网址:http://issues.apache.org/jira/browse/HDFS-265
Hadoop中FileSystem的append方法的更多相关文章
- Java中StringBuffer类append方法的使用
public static void testAppend() { StringBuffer sb = new StringBuffer("This is a StringBuffer!&q ...
- JAVA中Stringbuffer的append( )方法
Stringbuffer是动态字符串数组,append( )是往动态字符串数组添加,跟“xxxx”+“yyyy”相当‘+’号. 跟String不同的是Stringbuffer是放一起的,String1 ...
- java append方法
JAVA 中 Stringbuffer 有append()方法 Stringbuffer其实是动态字符串数组 append()是往动态字符串数组添加,跟“xxxx”+“yyyy”相当那个‘+’号 ...
- Hadoop中客户端和服务器端的方法调用过程
1.Java动态代理实例 Java 动态代理一个简单的demo:(用以对比Hadoop中的动态代理) Hello接口: public interface Hello { void sayHello(S ...
- Mongo中append方法使用
在MongoDB的官网已经很详细的介绍了各种客户端的使用,其中也包括java的,在此,仅对几个比较疑惑的地方做个标注: (1).如何向db中添加collection? 如果在api文档中找不到答案,那 ...
- hadoop 中对Vlong 和 Vint的压缩方法
hadoop 中对java的基本类型进行了writeable的封装,并且所有这些writeable都是继承自WritableComparable的,都是可比较的:并且,它们都有对应的get() 和 s ...
- Hadoop中两表JOIN的处理方法(转)
1. 概述 在传统数据库(如:MYSQL)中,JOIN操作是非常常见且非常耗时的.而在HADOOP中进行JOIN操作,同样常见且耗时,由于Hadoop的独特设计思想,当进行JOIN操作时,有一些特殊的 ...
- Hadoop中两表JOIN的处理方法
Dong的这篇博客我觉得把原理写的很详细,同时介绍了一些优化办法,利用二次排序或者布隆过滤器,但在之前实践中我并没有在join中用二者来优化,因为我不是作join优化的,而是做单纯的倾斜处理,做joi ...
- 比较jquery中的after(),append(),appendTo()方法
html页面: <p id="myp1">我的兴趣爱好是:</p> <button id="b1">after函数</ ...
随机推荐
- Android:Context的作用
Context字面意思上下文,Activity中我们直接用this代替,而到了一个button的onClick(View view)等方法时,我们用this时就会报错,改用ActivityName.t ...
- CentOS安装VSFTP及配置用户
第一步,安装vsftp # 1.以管理员(root)身份执行以下命令 yum install vsftpd # 2.设置开机启动vsftpd ftp服务 chkconfig vsftpd on # 3 ...
- C++:向函数传递对象(对象、对象指针、对象引用)
3.5.1 使用对象作为函数参数,其方法与传递基本类型的变量相同 //例3.21 使用对象作为函数参数 #include<iostream> using namespace std; ...
- TCP和UDP协议的应用/参数查看
TCP发送的包有序号,对方收到包后要给一个反馈,如果超过一定时间还没收到反馈就自动执行超时重发,因此TCP最大的优点是可靠.一般网页(http).邮件(SMTP).远程连接(Telnet).文件(FT ...
- 量化Hacker News 中50天的数据 Quantifying Hacker News with 50 days of data
Quantifying Hacker News I thought it would be fun to analyze the activity on one of my favorite sour ...
- opencv 图像阴影检测
参数说明: IplImage *workImg-当前全局变量,表示正在显示的图片. downleft, upright- 检测出的阴影部分矩形框的两个对角顶点. /****************** ...
- Java的String、StringBuffer和StringBuilder的区别
1.String 2.Stringbuffer 3.StringBuilder 4.三者之间的区别 5.使用策略 1.String public final class String implemen ...
- ios跳转
目标应用程序:打开info.plist,添加一项URL types展开URL types,再展开Item1,将Item1下的URL identifier修改为URL Scheme展开URL Schem ...
- BZOJ 2440 完全平方数(莫比乌斯-容斥原理)
题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2440 题意:给定K.求不是完全平方数(这里1不算完全平方数)的倍数的数字组成的数字集合S ...
- IntelliJ IDEA For Mac 快捷键——常用版
一.搜索 搜索文件 command+shift+n 打开方法实现类 command+option+b 全文搜索 ctrl+shift+f (1)类和方法 查看类的继承结构 ctrl+h 查看方法的 ...