使用pig从hdfs到hbase的数据传输

col17t5w  于 2021-06-25  发布在  Pig
关注(0)|答案(1)|浏览(475)

当我试图将数据从hdfs复制到hbase时,输入文件中有两个以上的列(或字段)。我犯了个错误。详细示例:
hdfs中的文件:/home/1.txt

1   2   3   4
5   6   7   8

具有两列族的hbase表:创建“table1”、“p”、“s”
清管器命令:

A= load '/home/1.txt' using PigStorage('\t') as (one:chararray,two:chararray,three:chararray,four:chararray);

STORE A INTO 'hbase://table1' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('P:one,P:two,S:three,S:four');

错误日志:


*********

013-09-20 15:42:25,314 [main] ERROR org.apache.pig.tools.pigstats.PigStats - ERROR: Index: 1, Size: 1
2013-09-20 15:42:25,315 [main] ERROR org.apache.pig.tools.pigstats.PigStatsUtil - 1 map reduce job(s) failed!
2013-09-20 15:42:25,315 [main] INFO  org.apache.pig.tools.pigstats.PigStats - Script Statistics:

HadoopVersion   PigVersion      UserId  StartedAt       FinishedAt      Features
0.20.2-cdh3u6   0.8.1-cdh3u6    hdfs    2013-09-20 15:41:45     2013-09-20 15:42:25     UNKNOWN

Failed!

Failed Jobs:
JobId   Alias   Feature Message Outputs
job_201309051922_0192   A       MAP_ONLY        Message: Job failed! Error - NA hbase://hh2,

Input(s):
Failed to read data from "/home/1.txt"

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

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_201309051922_0192

2013-09-20 15:42:25,315 [main] INFO  org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - Failed!
2013-09-20 15:42:25,352 [main] ERROR org.apache.pig.tools.grunt.GruntParser - ERROR 2999: Unexpected internal error. Index: 1, Size: 1

*********

但是,当我尝试只复制两个字段时,效果很好。以下代码:

A= load '/home/1.txt' using PigStorage('\t') as (one:chararray,two:chararray);

STORE A INTO 'hbase://table1' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('P:one,P:two,S:three,S:four');

[s@namenode ~]$ hadoop version
Hadoop 0.20.2-cdh3u6
Hbase version : Version 0.90.6-cdh3u6
Pig version:  Apache Pig version 0.8.1-cdh3u6 (rexported)
rpppsulh

rpppsulh1#

a=使用pigstorage(',')作为(id:int)加载'/home/1.txt',name:chararray, city:chararray);

相关问题