简体   繁体   English

用Pig将二进制文件存储到hbase

[英]store binary file to hbase with pig

I have some binary file with ".spc" pattern, and I would like to store these files into HBase with pig mapper job. 我有一些带有“ .spc”模式的二进制文件,并且我想通过Pig Mapper作业将这些文件存储到HBase中。 The rowkey is file name. 行键是文件名。

Here are commands I used: 这是我使用的命令:

A = LOAD 'hdfs-directory/sampleID-uvvis.spc' USING BinStorage();

B = FOREACH A GENERATE $0 AS rowkey;

C = GROUP B BY rowkey; 

STORE C INTO 'hbase://test3' USING BinStorage('colfamily:uvis');

And I got the error like below: 我得到如下错误:

[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2116:
<line 12, column 0> Output Location Validation Failed for: 'hbase://test3 
More info to follow:
java.io.IOException: No FileSystem for scheme: hbase

I also checked the file after load: 加载后我还检查了文件:

Dump A
Input(s):
Successfully read 0 records (3353 bytes) from: "hdfs-directory-uvvis.spc"

Output(s):
Successfully stored 0 records in: "hdfs-directory/tmp/temp-
707332811/tmp1004712115"

Can someone help me with this issue? 有人可以帮我解决这个问题吗? How to load and store the binary file into HBase? 如何将二进制文件加载并存储到HBase中?

I am new to HBase and pig job, any idea will be appreciate. 我是HBase和Pig工作的新手,任何想法都将不胜感激。

You should be using org.apache.pig.backend.hadoop.hbase.HBaseStorage class for storage. 您应该使用org.apache.pig.backend.hadoop.hbase.HBaseStorage类进行存储。 Take a look at this example 看这个例子

https://pig.apache.org/docs/r0.14.0/api/org/apache/pig/backend/hadoop/hbase/HBaseStorage.html https://pig.apache.org/docs/r0.14.0/api/org/apache/pig/backend/hadoop/hbase/HBaseStorage.html

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

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