Caused by: java.io.IOException: Added a key not lexically larger than previous.

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

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<3){
                items = line.split("\\^");
            }
            if(items.length<3){
                System.out.println("================less 3");
                return;
            }
            System.out.println(line);
            String rowKey = items[0]+items[1];
            Put put = new Put(Bytes.toBytes(items[0]));   //ROWKEY
            put.addColumn("cf".getBytes(), "url".getBytes(), items[1].getBytes());
            put.addColumn("cf".getBytes(), "name".getBytes(), items[2].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[0];
            String DESC_PATH=args[1];
            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)?0:1);
        }
    }

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

时间: 2024-08-01 10:46:42

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

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

eclipse连接远程Hadoop报错,Caused by: java.io.IOException: 远程主机强迫关闭了一个现有的连接.全部报错信息如下: Exception in thread "main" java.io.IOException: Call to hadoopmaster/192.168.1.180:9000 failed on local exception: java.io.IOException: 远程主机强迫关闭了一个现有的连接. at org.apach

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

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

解决Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory

最近公司一台线上服务器的hbase的regionserver挂掉之后起不起来报错OOM. 这台机器同时装有cassandra,于是停掉cassandra释放内存,重启regionserver失败,同时cassandra再尝试启动也报错Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory ps -ef发现有很多类似/bin/bash /opt/cloudera-manager/cm

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 size 67108864 (probably corrupt file) 这类异常,如图: 这是由于lzo文件数过多,hive执行时默认是不会自动先合并lzo等压缩文件再计算,需要设置hive对应的参数,告诉它在执行计算之前,先合并较多的压缩文件 在执行hive的sql之前需要加上 set hive

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

org.apache.catalina.connector.ClientAbortException: java.io.IOException: 你的主机中的软件中止了一个已建立的连接. at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:321) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:284) at o

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

解决办法: 看map和reduce的输入是不是对应,看看map和reduce设置的参数和下面的是否一致 原文地址:https://www.cnblogs.com/msq2000/p/11794846.html

Jenkins启动报 Caused by: java.io.IOException: 结构需要清理

我的Jenkins是安装在linux上的  今天启动突然启动不成了  报了如下错误 找到jenkins安装的目录 我的在/var/lib/jenkins下 目录下有一个workspace 把底下的文件删除就可以启动了  不过启动后 需要重新构建 要好长时间 建议安装插件workspace cleanup plugin   在项目构建后会自动清除工作空间中的文件 原文地址:https://www.cnblogs.com/fyg666/p/12122046.html

java.io.IOException: Type mismatch in key from map:解决方法

执行MR程序的时候发生异常:java.lang.Exception: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.Text, received org.apache.hadoop.io.LongWritable 日志如下: 2016-05-09 21:33:28,871 INFO [org.apache.hadoop.conf.Configuration.deprecation

tomcat 启动 证书异常java.io.IOException: Alias name [cas] does not identify a key entry

在搭建CAS server的过程中,Tomcat开启https,配置秘钥证书,证书是通过keytool生成的 <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true"