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

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. IntelliJ IDEA推荐插件

    JRebel for IntelliJ 一款热部署插件,只要不是修改了项目的配置文件,用它都可以实现热部署.收费的,破解比较麻烦.不过功能确实很强大.算是开发必备神器了.热部署快捷键是control+ ...

  2. Navicat_Premium 连接oracle遇到ORA-28457

    解决方案很简单,我用oracle文件目录下的oci.dll替换了navicat文件目录下的oci.dll,之后很顺畅地就连上了.

  3. webstorm 设置js或者html文件自动缩进为4个空格不生效

    设置 tab 和自动缩进为4个空格不生效,解决办法如下 设置代码缩进 1. 依次打开files —- settings —- Editor —- Code Style —- JavaScript 2. ...

  4. 【剑道】步法(Ashi Sabaki)

    转自 http://www.openkendo.com/class7.html 步法(Ashi Sabaki)可能算是剑道中最重要的部分.,以下大致做一归纳讲解,希望能够帮助到各位新人的练习. “折足 ...

  5. Android应用一般上架流程

    Android App上架所需文件 上架准备  App文件: 1. 安装包 2. 应用商标:图片格式KB. 3. 应用截图(4~6张):图片格式JPG或者PNG.图片大小480*800,且每张大小一致 ...

  6. [hihoCoder] 第四十九周: 欧拉路·一

    题目1 : 欧拉路·一 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho最近在玩一个解密类的游戏,他们需要控制角色在一片原始丛林里面探险,收集道具,并找到最 ...

  7. SQL Server 的动态语句(SQLServer 的String.format用法)(SQLServer的调用SQL占位符的使用)

    直接上代码好了: --建表语句if exists(select 1 from [你的测试数据库名字].sys.tables where name='TDepartment') BEGIN print ...

  8. 使用Delaunay三角剖分解决求多边形面积的问题

    朋友那边最近有个需求,需要框选一个选区,然后根据选区中的点求出面积.并且让我尝试用Delaunay来解决 似乎音译过来应该是德诺类 大致如下: 我在github上找了一个可以用的Delaunay库 h ...

  9. Java设计模式之工厂模式的两种实现方式

    工厂模式(Factory Pattern)是 Java 中最常用的设计模式之一.这种类型的设计模式属于创建型模式,它提供了一种创建对象的最佳方式. 1. 为什么要有工厂模式? "Talk i ...

  10. Java之JDBC①

    JDBC工具准备:Mysql(数据库). MyEclipse(开发工具).Navicat(数据库管理工具) JDBC编程步骤·加载驱动程序:class.forName(driverClass);   ...