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

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. 《JAVA与模式》之解释器模式 (转载)

    一.引子 其实没有什么好的例子引入解释器模式,因为它描述了如何构成一个简单的语言解释器,主要应用在使用面向对象语言开发编译器中:在实际应用中,我们可能很少碰到去构造一个语言的文法的情况. 虽然你几乎用 ...

  2. Android NDK r9的配置与使用

    Android NDK 配置: 网上有很多教程,但大部分是旧版本的内容,最新版本的已经改变,为了让大家少走弯路,在这里针对r9的配置进行记录分享. 要玩NDK,你或多或少要用到以下一些东西,所以先做一 ...

  3. MySQL -- 在磁盘爆满后复制的状态

    事件: 由于前一天的晚上加班了.第二天又接着上班.所以精神上有点不在状态:收到客户的反馈说在slave上找不到master刚刚插入的数据: 阶段1: 遇到这事的第一感觉就是这可能是主从延时.或是sla ...

  4. photoshop,钢笔工具锚点类型

    以下是钢笔工具绘制出的三种类型的锚点,分别是:无切线的硬锚点.左右切线平行的锚点.左右切线不平行的锚点. 使用转换点工具点击锚点,可以实现 无切线锚点 和 左右切线平行的锚点 之间的转化: 对 左右切 ...

  5. ELK 的插件安装(head)

    这里我装了一个head插件和kopf的插件 ./plugin install mobz/elasticsearch-head ./plugin install lmenezes/elasticsear ...

  6. Java:多线程,Semaphore同步器

    1. 背景 类java.util.concurrent.Semaphore提供了一个计数信号量.通过Semaphore类,可以控制某个资源可被同时访问的个数,通过 acquire() 获取一个许可,如 ...

  7. MySQL5.7.11免安装版的安装和配置:解决MYSQL 服务无法启动问题

    在http://dev.mysql.com/downloads/mysql 这个官网下载MySQL5.7.11 ZIP Archive版本号: watermark/2/text/aHR0cDovL2J ...

  8. 一些新东西学习 - Texture3D,Texture2DArray

    Texture3D Texture3D需要先在脚本中创建3D材质,然后赋予shader. 需要DX11支持,和材质采样一样,3D维度上可以被repleat和插值 参考文章:http://blog.cs ...

  9. Atitti 过程导向 vs 结果导向 attilax的策略

    Atitit  世界著名零食 1.1. /////milk hand candy , milk soft candy . fruit soft candy1 1.2. ==========cookie ...

  10. Fiddlercore Demo - Fiddler

    public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Loa ...