Exception in thread "main" java.io.IOException: Mkdirs failed to create /user/centos/hbase-staging (exists=false, cwd=file:/home/centos)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:440)
at org.apache.hadoop.fs.ChecksumFileSystem.create(ChecksumFileSystem.java:426)
at org.apache.hadoop.fs.FileSystem.create(FileSystem.java:906)
at org.apache.hadoop.io.SequenceFile$Writer.<init>(SequenceFile.java:1071)
at org.apache.hadoop.io.SequenceFile$RecordCompressWriter.<init>(SequenceFile.java:1371)
at org.apache.hadoop.io.SequenceFile.createWriter(SequenceFile.java:272)
at org.apache.hadoop.io.SequenceFile.createWriter(SequenceFile.java:294)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2.writePartitions(HFileOutputFormat2.java:335)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2.configurePartitioner(HFileOutputFormat2.java:596)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2.configureIncrementalLoad(HFileOutputFormat2.java:440)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2.configureIncrementalLoad(HFileOutputFormat2.java:405)
at org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2.configureIncrementalLoad(HFileOutputFormat2.java:386)
at bulkloadExample.BulkloadData.main(BulkloadData.java:88)

package bulkloadExample;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.HFileOutputFormat2;
import org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles;
import org.apache.hadoop.hbase.mapreduce.PutSortReducer;
import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import java.io.IOException;
import java.net.URI; public class BulkloadData { static final String JOBNAME = "BulkLoad";
static final String TABLENAME = "wqbin:duowan_user_bulkLoad";
static final String PATH_IN = "/datain/duowan_user.txt"; //输入路径
static final String PATH_OUT = "/dataout"; //输入路径HFILE static final String SEPARATOR = "\t"; static final byte[] ColumnFamily = "f".getBytes(); // 列簇
// static final byte[] row_id = "id".getBytes(); // 列名
static final byte[] name = "name".getBytes();
static final byte[] pass = "pass".getBytes();
static final byte[] mail = "mail".getBytes();
static final byte[] nickname = "nickname".getBytes(); public static class Map extends Mapper<LongWritable, Text, ImmutableBytesWritable, Put> {
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String[] strArr = value.toString().split(SEPARATOR);
String row = strArr[0];
Put put = new Put(Bytes.toBytes(row.toString())); // rowkey
put.add(ColumnFamily, name, Bytes.toBytes(strArr[1]));
put.add(ColumnFamily, pass, Bytes.toBytes(strArr[2]));
put.add(ColumnFamily, mail, Bytes.toBytes(strArr[3]));
put.add(ColumnFamily, nickname, Bytes.toBytes(strArr[3])); context.write(new ImmutableBytesWritable(value.getBytes()), put);
}
} public static void main(String[] args) throws Exception { Configuration conf = HBaseConfiguration.create();
Connection conn = ConnectionFactory.createConnection(conf);
// conf.set("hbase.zookeeper.quorum", "xx,xx,xx");
conf.set("fs.defaultFS","file:///");
System.setProperty("HADOOP_USER_NAME", "centos"); Job job = Job.getInstance(conf, JOBNAME);
job.setJarByClass(BulkloadData.class); job.setMapOutputKeyClass(ImmutableBytesWritable.class);
job.setMapOutputValueClass(Put.class);
TableMapReduceUtil.addDependencyJars(job);
job.setMapperClass(Map.class);
//这个 SorterReducer(KeyValueSortReducer或PutSortReducer) 可以不指定,
//因为源码中已经做了判断
job.setReducerClass(PutSortReducer.class);
job.setOutputFormatClass(HFileOutputFormat2.class); FileSystem fs = FileSystem.get(URI.create("/"),conf); Path outPath = new Path(PATH_OUT);
// if (fs.exists(outPath))fs.delete(outPath, true); FileOutputFormat.setOutputPath(job, outPath);
FileInputFormat.setInputPaths(job, new Path(PATH_IN)); // HTable table = new HTable(conf, TABLENAME); HFileOutputFormat2.configureIncrementalLoad(job, conn.getTable(TableName.valueOf(TABLENAME)),
conn.getRegionLocator(TableName.valueOf(TABLENAME)));
System.out.println("load完毕"); if(job.waitForCompletion(true)){
LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf);
// loader.doBulkLoad( table); } System.exit(0);
}
}

"main" java.io.IOException: Mkdirs failed to create /user/centos/hbase-staging (exists=false, cwd=file:/home/centos)的更多相关文章

  1. Exception in thread "main" java.io.IOException: Mkdirs failed to create /var/folders/q0/1wg8sw1x0dg08cmm5m59sy8r0000gn/T/hadoop-unjar6090005653875084137/META-INF/license at org.apache.hadoop.util.Run

    在使用hadoop运行jar时出现. 解决方法 zip -d Test.jar LICENSE zip -d Test.jar META-INF/LICENSE 完美解决.

  2. nutch爬取时Exception in thread “main” java.io.IOException: Job failed!

    用cygwin运行nutch 1.2爬取提示IOException: $ bin/nutch crawl urls -dir crawl -depth 3 -topN 10 crawl started ...

  3. Exception in thread "main" java.io.IOException: Failed to set permissions of path

    在跑BuildForest的时候,编写了下面的程序: package test.breiman; import org.apache.mahout.classifier.df.mapreduce.Bu ...

  4. windows下eclipse远程连接hadoop错误“Exception in thread"main"java.io.IOException: Call to Master.Hadoop/172.20.145.22:9000 failed ”

    在VMware虚拟机下搭建了hadoop集群,ubuntu-12.04,一台master,三台slave.hadoop-0.20.2版本.在 master机器上利用eclipse-3.3连接hadoo ...

  5. github提交失败并报错java.io.IOException: Authentication failed:

    一.概述 我最近在写一个android的项目. 软件:android studio.Android studio VCS integration(插件) Android studio VCS inte ...

  6. 解决方案--java执行cmd命令ProcessBuilder--出错Exception in thread "main" java.io.IOException: Cannot run program "dir d:\": CreateProcess error=2(xjl456852原创)

    当我尝试在java中通过ProcessBuilder运行window的cmd命令时出现错误: public static void main(String [] args) throws IOExce ...

  7. android java.io.IOException: open failed: EBUSY (Device or resource busy)

    今天遇到一个奇怪的问题, 测试在程序的下载界面,下载一个文件第一次下载成功,删除后再下载结果下载报错, 程序:file.createNewFile(); 报错:java.io.IOException: ...

  8. java.io.IOException: open failed: EACCES (Permission denied)问题解决

    1.  问题描述:在Android中,用程序访问Sdcard时,有时出现“java.io.IOException: open failed: EACCES (Permission denied)&qu ...

  9. hadoop错误Ignoring exception during close for org.apache.hadoop.mapred.MapTask$NewOutputCollector@17bda0f2 java.io.IOException Spill failed

    1.错误    Ignoring exception during close for org.apache.hadoop.mapred.MapTask$NewOutputCollector@17bd ...

随机推荐

  1. web题

    @php绕过https://www.cnblogs.com/leixiao-/p/9786496.html @step1:F12 step2:抓包 @任何url  http://118.25.14.4 ...

  2. 论文阅读 | Combating Adversarial Misspellings with Robust Word Recognition

    对抗防御可以从语义消歧这个角度来做,不同的模型,后备模型什么的,我觉得是有道理的,和解决未登录词的方式是类似的,毕竟文本方面的对抗常常是修改为UNK来发生错误的.怎么使用backgroud model ...

  3. Column常用的参数

    #encoding: utf-8 from sqlalchemy import create_engine,Column,Integer,String,DateTime from sqlalchemy ...

  4. 在phpStrom中安装php代码格式化插件Php-cs-fixer

    由于phpStrom原来的插件不再开源,现在转为使用Php-cs-fixer格式化代码.以下为在phpStrom中安装Php-cs-fixer的具体步骤. 安装安装很简单,下载php-cs-fixer ...

  5. C语言|作业12—学期总结

    一. 我学到的内容 二. 我的收获 作业链接 收获 C语言l博客作业01 对这个专业.学科以及markdown语法有了初步了解,打印出了"Hello world!" C语言l博客作 ...

  6. centos7基础安装

    基础: hostname xxvim /etc/hostname systemctl stop firewalld systemctl disable firewalldsetenforce 0gre ...

  7. 利用微信web开发者工具调试企业微信页面

    1.只有企业号的管理员才能调试. 2.勾选企业号的开发者工具(具体位置见下图,这个入口位置总是在变,一般来说,找到”微工作台“就能找到了) 3.下载web开发者工具 https://developer ...

  8. Oracle 即时客户点下载以及简单连接数据库的方法

    1. 下载方法 百度 oracle client 第一个即可 2. 下载地址为: https://www.oracle.com/database/technologies/instant-client ...

  9. Java 条件语句 if else

    一个 if 语句包含一个布尔表达式和一条或多条语句. 语法 if 语句的语法如下: if(布尔表达式) { //如果布尔表达式为true将执行的语句 } 如果布尔表达式的值为 true,则执行 if ...

  10. HTTPS原理(三次握手)

    第一步: 客户端向服务器发送HTTPS请求,服务器将公钥以证书的形式发送到客户端(服务器端存放私钥和公钥). 第二步: 浏览器生成一串随机数,然后用公钥对随机数和hash签名进行加密,加密后发送给服务 ...