简体   繁体   English

将数据从HDFS加载到HBASE

[英]Loading data from HDFS to HBASE

I'm using Apache hadoop 1.1.1 and Apache hbase 0.94.3.I wanted to load data from HDFS to HBASE. 我正在使用Apache hadoop 1.1.1和Apache hbase 0.94.3。我想将数据从HDFS加载到HBASE。 I wrote pig script to serve the purpose. 我写了猪脚本来达到目的。 First i created hbase table in habse and next wrote pig script to load the data from HDFS to HBASE. 首先,我在habse中创建了hbase表,然后编写了Pig脚本以将数据从HDFS加载到HBASE。 But it is not loading the data into hbase table. 但是它没有将数据加载到hbase表中。 Dont know where it's going worng. 不知道它要去哪里。 Below is the command used to craete hbase table : 以下是用于创建hbase表的命令:

create table 'mydata','mycf' 创建表“ mydata”,“ mycf”

Below is the pig script to load data from hdfs to hbase: 下面是将数据从hdfs加载到hbase的Pig脚本:

    A = LOAD '/user/hduser/Dataparse/goodrec1.txt' USING PigStorage(',') as (c1:int, c2:chararray,c3:chararray,c4:int,c5:chararray);   
    STORE A INTO 'hbase://mydata'
    USING org.apache.pig.backend.hadoop.hbase.HBaseStorage(
          'mycf:c1,mycf:c2,mycf:c3,mycf:c4,mycf:c5'); 

After excecuting the script it says 执行脚本后,它说

2014-04-29 16:01:06,367 [main] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 100% complete

2014-04-29 16:01:06,376 [main] ERROR org.apache.pig.tools.pigstats.PigStatsUtil - 1 map reduce job(s) failed!
2014-04-29 16:01:06,382 [main] INFO  org.apache.pig.tools.pigstats.SimplePigStats - Script Statistics:

HadoopVersion   PigVersion      UserId  StartedAt       FinishedAt      Features
1.1.1   0.12.0  hduser  2014-04-29 15:58:07     2014-04-29 16:01:06     UNKNOWN

Failed!

Failed Jobs:
JobId   Alias   Feature Message Outputs
job_201403142119_0084   A       MAP_ONLY        Message: Job failed! Error -           JobCleanup Task Failure, Task: task_201403142119_0084_m_000001     hbase://mydata,

Input(s):
Failed to read data from "/user/hduser/Dataparse/goodrec1.txt"

Output(s):
Failed to produce result in "hbase://mydata"

Counters:
Total records written : 0
Total bytes written : 0
Spillable Memory Manager spill count : 0
Total bags proactively spilled: 0
Total records proactively spilled: 0

Job DAG:
job_201403142119_0084


2014-04-29 16:01:06,382 [main] INFO   org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - Failed!

Please help where i'm going wrong ? 请帮我哪里出问题了?

You have specified too many columns in the output to hbase. 您在hbase的输出中指定了太多列。 You have 5 input columns and 5 output columns, but HBaseStorage requires the first column to be the row key so there should only be 4 in the output 您有5个输入列和5个输出列,但是HBaseStorage要求第一列为行键,因此输出中应该只有4个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM