一.错误
使用BulkLoad向Hbase导入数据时出现了错误
2014-04-04 15:39:08,521 WARN org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles - Bulk load operation did not find any files to load in directory hdfs://192.168.1.200:9000/user/root/output1. Does it contain files in subdirectories that correspond to column family names?
然后去看MapReduce的临时输出目录,果然没有data文件夹,只有_SUCCESS文件。
二.job.setMapOutputValueClass与job.setOutputValueClass
这一定是Reduce的问题了,去看看HFileOutputFormat.configureIncrementalLoad(job, htable); 到底做了什么。
job.setOutputKeyClass(ImmutableBytesWritable.class); job.setOutputValueClass(KeyValue.class); job.setOutputFormatClass(HFileOutputFormat.class); // Based on the configured map output class, set the correct reducer to properly // sort the incoming values. // TODO it would be nice to pick one or the other of these formats. if (KeyValue.class.equals(job.getMapOutputValueClass())) { job.setReducerClass(KeyValueSortReducer.class); } else if (Put.class.equals(job.getMapOutputValueClass())) { job.setReducerClass(PutSortReducer.class); } else if (Text.class.equals(job.getMapOutputValueClass())) { job.setReducerClass(TextSortReducer.class); } else { LOG.warn("Unknown map output value type:" + job.getMapOutputValueClass()); }
Debug时发现,job.getMapOutputValueClass为KeyValue。再看看job.setMapOutputValueClass和job.setOutputValueClass的区别
getOutputValueClass mapreduce.job.output.value.class setOutputValueClass mapreduce.job.output.value.class setMapOutputValueClass mapreduce.map.output.value.class getMapOutputValueClass mapreduce.map.output.value.class /** * Set the value class for the map output data. This allows the user to * specify the map output value class to be different than the final output * value class. * * @param theClass the map output value class. * @throws IllegalStateException if the job is submitted */ public void setMapOutputValueClass(Class<?> theClass ) throws IllegalStateException { ensureState(JobState.DEFINE); conf.setMapOutputValueClass(theClass); } /** * Get the value class for the map output data. If it is not set, use the * (final) output value class This allows the map output value class to be * different than the final output value class. * * @return the map output value class. */ public Class<?> getMapOutputValueClass() { Class<?> retv = getClass(JobContext.MAP_OUTPUT_VALUE_CLASS, null, Object.class); if (retv == null) { retv = getOutputValueClass(); } return retv; }
也就是
- getMapOutputValueClass的值,在没有setMapOutputValueClass时,将使用setOutputValueClass的值。
- 允许map output value的class(即getMapOutputValueClass)和最终output value的(Reduceo output value的)class(即getOutputValueClass)不同。泛型类PutSortReducer<ImmutableBytesWritable, Put, ImmutableBytesWritable, KeyValue>说明map output value的class为Put,最终的为KeyValue。
- 上述同样适用于KeyClass。
我在程序里job.setOutputValueClass(Put.class),改为job.setMapOutputValueClass(Put.class)即可。
三.HBase删除所有数据
这个问题跟主题没有任何关系,就当做绿叶吧。
昨天突然有一想法,如果不重装Hbase,有没有办法“格式化”HBase。
首先想到的是删掉了Hdfs上hbase目录,再重启HBase,发现RegionServer连接不上Master。应该是-ROOT-表和.META.表已经被删掉了,RegionServer向zookeeper汇报心跳时,zookeeper去-ROOT-表里查找此RegionServer的相关信息,发现信息已经丢失,也就无法将此RegionServer信息通知给Master。删掉zookeeper信息,再次重启成功。
rm -rf /tmp/hbase-root*
<property> <name>hbase.zookeeper.property.dataDir</name> <value>/tmp/hbase-root</value> default <description>Property from ZooKeeper's config zoo.cfg. The directory where the snapshot is stored. </description> </property>
相关推荐
Hadoop学习总结之五:Hadoop的运行痕迹
Hadoop学习总结之四:Map-Reduce的过程解析
Hadoop学习总结之一:HDFS简介
Hadoop学习总结之二:HDFS读写过程解析
NULL 博文链接:https://zy19982004.iteye.com/blog/2088173
hadoop2.7汇总:新增功能最新编译64位安装、源码包、API、eclipse插件下载
NULL 博文链接:https://ouyida3.iteye.com/blog/1144326
支持windows开发hadoop的连接,解决报警Did not find winutils.exe: java.io.FileNotFoundException
大数据安全-kerberos技术-hadoop安装包,hadoop版本:hadoop-3.3.4.tar.gz
报错 org.apache.hadoop.hdfs.BlockMissingException: Could not obtain block 2、百度结果 参考 https://blog.csdn.net/xiaozhaoshigedasb/article/details/88999595 防火墙记得关掉; 查看DataNode是否启动;...
赠送jar包:hadoop-auth-2.6.5.jar 赠送原API文档:hadoop-auth-2.6.5-javadoc.jar 赠送源代码:hadoop-auth-2.6.5-sources.jar 包含翻译后的API文档:hadoop-auth-2.6.5-javadoc-API文档-中文(简体)-英语-对照版...
如果出现如下bug:“Could not locate executable null\bin\winutils.exe in the Hadoop binaries”,则下载该文件,放入hadoop的bin文件夹下,并设置环境变量HADOOP_HOME:F:\hadoop2.7.x即可。
apache日志hadoop大数据分析项目:清洗数据核心功能解说及代码实现
搭建hadoop 环境时遇到启动异常告警问题 “WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform… using builtin-java classes where applicable” 上来不多说,百度收集些相关...
主要是hdfs读写的代码分析。可依据该文档进行深入代码。
macOS下使用hadoop2.8.1时, 执行hadoop fs 命令(如:hadoop fs -ls /tmp/input)会提示: WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where ...
hadoop权威指南代码 (Hadoop: The Definitive Guide code) http://www.hadoopbook.com
Hadoop学习总结,内容包括: 1. HDFS简洁 2. HDFS读写过程解析 3. MapReduce入门 4. MapReduce过程解析 5. Hadoop运行痕迹 6. MapReduce源码分析总结
util.Shell (Shell.java:(694)) - Did not find winutils.exe: {} java.io.FileNotFoundException: Could not locate Hadoop executable: E:\hadoop-3.0.2\bin\winutils.exe -see ...