为了重复这个实验,遇到不少坑

https://www.iteblog.com/archives/1889.html

/**
* Created by Administrator on 2017/8/18.
*/
public class IteblogBulkLoadDriver {
public static class IteblogBulkLoadMapper extends Mapper<LongWritable, Text, StringWriter, Put> {
protected void map(LongWritable key, Text value, Context context) throws InterruptedException, IOException {
if(value==null) {
return;
} String line = value.toString(); String[] items = line.split("\\^");
if(items.length<){
items = line.split("\\^");
}
if(items.length<){
System.out.println("================less 3");
return;
}
System.out.println(line);
String rowKey = items[]+items[];
Put put = new Put(Bytes.toBytes(items[])); //ROWKEY
put.addColumn("cf".getBytes(), "url".getBytes(), items[].getBytes());
put.addColumn("cf".getBytes(), "name".getBytes(), items[].getBytes());
context.write(new StringWriter().append(rowKey), put);
}
} public static class HBaseHFileReducer extends
Reducer<StringWriter, Put, ImmutableBytesWritable, Put> {
protected void reduce(StringWriter key, Iterable<Put> values,
Context context) throws IOException, InterruptedException {
String value = "";
ImmutableBytesWritable k = new ImmutableBytesWritable(key.toString().getBytes()); Put val = values.iterator().next();
context.write(k, val);
} } public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
// String SRC_PATH= "hdfs:/slave1:8020/maats5/pay/logdate=20170906";
// String DESC_PATH= "hdfs:/slave1:8020/maats5_test/pay/logdate=20170906";
String SRC_PATH= args[];
String DESC_PATH=args[];
Configuration conf = HBaseConnectionFactory.config;
conf.set("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem");
Job job=Job.getInstance(conf);
job.setJarByClass(IteblogBulkLoadDriver.class);
job.setMapperClass(IteblogBulkLoadMapper.class);
job.setMapOutputKeyClass(StringWriter.class);
job.setMapOutputValueClass(Put.class);
job.setReducerClass(HBaseHFileReducer.class);
job.setOutputFormatClass(HFileOutputFormat2.class);
HTable table = new HTable(conf,"maatstest");
HFileOutputFormat2.configureIncrementalLoad(job,table,table.getRegionLocator());
FileInputFormat.addInputPath(job,new Path(SRC_PATH));
FileOutputFormat.setOutputPath(job,new Path(DESC_PATH)); System.exit(job.waitForCompletion(true)?:);
}
}

When using the bulkloader (LoadIncrementalHFiles, doBulkLoad) you can only add items that are "lexically ordered", ie. you need to make sure that the items you add are sorted by the row-id.

https://stackoverflow.com/questions/25860114/hfile-creation-added-a-key-not-lexically-larger-than-previous-key

http://ganliang13.iteye.com/blog/1884921

Caused by: java.io.IOException: Added a key not lexically larger than previous.的更多相关文章

  1. spark bulkload 报错异常:Caused by: java.io.IOException: Added a key not lexically larger than previous

    ------------恢复内容开始------------ Caused by: java.io.IOException: Added a key not lexically larger than ...

  2. eclipse连接远程Hadoop报错,Caused by: java.io.IOException: 远程主机强迫关闭了一个现有的连接。

    eclipse连接远程Hadoop报错,Caused by: java.io.IOException: 远程主机强迫关闭了一个现有的连接.全部报错信息如下: Exception in thread & ...

  3. hive对于lzo文件处理异常Caused by: java.io.IOException: Compressed length 842086665 exceeds max block size 67108864 (probably corrupt file)

    hive查询lzo数据格式文件的表时,抛 Caused by: java.io.IOException: Compressed length 842086665 exceeds max block s ...

  4. Caused by: java.io.IOException: Filesystem closed的处理

    org.apache.hadoop.hive.ql.metadata.HiveException: Unable to rename output from: hdfs://nameservice/u ...

  5. Caused by: java.io.IOException: 你的主机中的软件中止了一个已建立的连接。

    org.apache.catalina.connector.ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接. at org ...

  6. Caused by: java.io.IOException: 您的主机中的软件中止了一个已建立的连接。

    异常详情 2017-07-16 10:55:26,218 ERROR [500.jsp] - java.io.IOException: 你的主机中的软件中止了一个已建立的连接. org.apache. ...

  7. Caused by : java.io.IOException: Cleartext HTTP traffic to 《“url”》 not permitted

    一.问题原因: 根本原因是从Android9.0开始,出于完全因素考虑,默认不再支持http网络请求,需要使用 https. 二.解决方案: 解决的基本思路是:对指定的网址进行过滤,强制允许指定网址继 ...

  8. Push notification - Caused by java.io.IOException toDerInputStream rejects tag

    苹果推送 : 文件不是P12文件当生成一个P12,需要选择两个,在钥匙串访问的私钥和证书.

  9. Caused by: java.io.IOException: Type mismath in vlaue from map: excepted org.apache.hadoop.io.InaWritable,received SC

    解决办法: 看map和reduce的输入是不是对应,看看map和reduce设置的参数和下面的是否一致

随机推荐

  1. 【Android开发】之Fragment生命周期

    上一篇博客我们讲到了,Fragment的基本使用,相信大家都已经了解怎么去使用了.如果还有不懂得同学可以去看一下,传送门.现在我们来讲解一下Fragment的生命周期. 一.Fragment的事务 再 ...

  2. 为什么你学不会递归?告别递归,谈谈我的一些经验 关于集合中一些常考的知识点总结 .net辗转java系列(一)视野 彻底理解cookie,session,token

    为什么你学不会递归?告别递归,谈谈我的一些经验   可能很多人在大一的时候,就已经接触了递归了,不过,我敢保证很多人初学者刚开始接触递归的时候,是一脸懵逼的,我当初也是,给我的感觉就是,递归太神奇了! ...

  3. jQuery $.ajax 参数说明及调用注意事项

    $.ajax参数设置 备注:data.contentType.dataType属性值很重要!!! async 类型:Boolean 默认值: true.默认设置下,所有请求均为异步请求.如果需要发送同 ...

  4. 怎样让HTML 表格中内容自动换行??

    <table style="word-break:break-all; word-wrap:break-all;">

  5. ElementUI 按需引入坑爹的点记录

    官网说的是这样的: 但实际上,应该是这样修改: { "presets": [ ["env", { "targets": { "br ...

  6. 路径不对 导致FileNotFoundError: [WinError 2] 系统找不到指定的文件, 问题解决办法

    执行python + selenium 代码 from selenium import webdriver driver = webdriver.Chrome("D:\AutoConf\bi ...

  7. pycharm + selenium + python 提示 Unresolved reference 'webdriver' 解决办法

    尝试使用python + selenium + pycharm 做自动化测试, 命令行pip install selenium 安装了selenium.但是使用pycharm 新建一个测试项目后并新建 ...

  8. mysql-8.0.11 比较坑的地方dba门要淡定

    [事件描述] 突然之间大量的连接进入数据库.并放开手干,这个使得mysql使用了大量的内存,触发了linux的oom机制.然后mysql就这样 被linux给干掉了.没错MySQL宕机了,要相信我说的 ...

  9. WPF 程序在 Windows XP 下报错:The image format is unrecognized.

    最近做的一个 WPF 程序,在 Windows 7 或以上版本的系统中,测试都很正常,在 Windows XP 下运行时一开始就报了个错误: {     "ClassName" : ...

  10. [CTCI] 最长合成字符串

    最长合成字符串 题目描述 有一组单词,请编写一个程序,在数组中找出由数组中字符串组成的最长的串A,即A是由其它单词组成的(可重复)最长的单词. 给定一个string数组str,同时给定数组的大小n.请 ...