简体   繁体   English

使用Hue时使用Pig将数据存储到Hbase错误

[英]Using Pig to store data to Hbase error when using Hue

My CDH version is 5.1.2, my Hbase version is 0.98.1, my Hue version is 3.6.0. 我的CDH版本是5.1.2,我的Hbase版本是0.98.1,我的色相版本是3.6.0。 I executed this pig script to load data from Hbase in Hue 我执行了这个Pig脚本以从Hue中的Hbase加载数据

c = LOAD 'hbase://analyze_block_v1' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('d:*', '-loadKey true');
dump c;

I got this error: 我收到此错误:

ERROR org.apache.pig.tools.grunt.Grunt  - ERROR 2998: Unhandled internal error. org/apache/hadoop/hbase/mapreduce/TableInputFormat.

Follow a guide on google, i uploaded all hbase*.jars from folder hbase library to user/oozie/share/lib/lib_20140822104613/pig , and add the following statement to the top of script: 遵循google上的指南,我将所有hbase*.jars从文件夹hbase库上传到user/oozie/share/lib/lib_20140822104613/pig oozie user/oozie/share/lib/lib_20140822104613/pig ,并在脚本顶部添加以下语句:

set hbase.zookeeper.quorum 'localhost' 

I still got the same error. 我仍然遇到相同的错误。

Continue google, I found the guide at GetHue and the guide from Cloudera website 继续使用Google,我在GetHue找到了该指南,并从Cloudera网站找到了该指南

Those guide told me that i must add these statement to top of pig script : 那些指南告诉我,我必须在猪脚本的顶部添加以下语句:

register /usr/lib/zookeeper/zookeeper-<ZooKeeper_version>-cdh<CDH_version>.jar

register /usr/lib/hbase/hbase-<HBase_version>-cdh<CDH_version>-security.jar

set hbase.zookeeper.quorum 'localhost'

The problem is i can't find hbase-0.98.1-cdh5.1.2-security.jar in my Hbase folder and library. 问题是我在我的Hbase文件夹和库中找不到hbase-0.98.1-cdh5.1.2-security.jar I also downloaded and checked from this link http://www.cloudera.com/content/cloudera/en/downloads/cdh/cdh-5-1-2.html . 我还从此链接http://www.cloudera.com/content/cloudera/en/downloads/cdh/cdh-5-1-2.html下载并进行了检查。 And there is no hbase-0.98.1-cdh5.1.2-security.jar in the hbase folder. 在hbase文件夹中没有hbase-0.98.1-cdh5.1.2-security.jar I tried download older version hbase-0.94.6-cdh4.5.0 and i can see the file hbase-0.94.6-cdh4.5.0-security.jar in the folder. 我尝试下载较旧的版本hbase-0.94.6-cdh4.5.0,并且在该文件夹中可以看到文件hbase-0.94.6-cdh4.5.0-security.jar

It seems they don't add the security.jar file in the newer version. 似乎他们没有在较新的版本中添加security.jar文件。 I guess because missing this file, the first guide i found can't help 我想是因为缺少此文件,所以我发现的第一本指南无济于事

What should i do to fix the error ? 我应该怎么做才能纠正错误?


Thank to Romain's support that i can make it work. 感谢Romain的支持,我可以使它正常工作。 This is the detail how to do: 这是详细的操作方法:

First need to upload these file from Hbase library folder to hdfs. 首先需要将这些文件从Hbase库文件夹上传到hdfs。 In my case I uploaded them to /user/oozie/share/lib/lib_20140822104613/pig 就我而言,我将它们上传到/ user / oozie / share / lib / lib_20140822104613 / pig

zookeeper.jar zookeeper.jar

hbase-server-0.98.1-cdh5.1.2.jar HBase的服务器-0.98.1-cdh5.1.2.jar

If you use Hue Pig Editor: 如果您使用Hue Pig Editor:

Put the jars as a resource in the 'Properties' --> 'Resources' of the script, then just put these statement to top of the script: 将罐子作为资源放在脚本的“属性”->“资源”中,然后将这些语句放在脚本顶部:

REGISTER ./hbase-server-0.98.1-cdh5.1.2.jar; 注册./hbase-server-0.98.1-cdh5.1.2.jar;

REGISTER ./zookeper.jar'; 注册./zookeper.jar';

Run the script and it will work. 运行脚本,它将起作用。 In my case i even don't need to register the jar file, it still work. 就我而言,我什至不需要注册jar文件,它仍然可以工作。 I think just put the jar file in 'properties--> resource' is enough 我认为只要将jar文件放在“属性->资源”中就足够了

If you excute the pig script through Hue work flow: 如果您通过Hue工作流程来简化猪脚本,请执行以下操作:

Add File Path to the jar files, then submit the workflow, it will work. 将文件路径添加到jar文件,然后提交工作流,它将起作用。 It dont need the register and set statement either. 它也不需要register和set语句。

The doc is indeed not up to date but could you just try to include a jar that contains the missing class? 该文档确实不是最新的,但是您可以尝试添加一个包含缺少类的jar吗?

eg 例如

find /usr/lib/hbase/ -name '*.jar' -exec grep -Hls TableInputFormat {} \;
/usr/lib/hbase/hbase-server-tests.jar
/usr/lib/hbase/hbase-server-0.98.6-cdh5.4.0-SNAPSHOT.jar
/usr/lib/hbase/hbase-server-0.98.6-cdh5.4.0-SNAPSHOT-tests.jar
/usr/lib/hbase/hbase-server.jar
/usr/lib/hbase/lib/hbase-server-0.98.6-cdh5.4.0-SNAPSHOT.jar
/usr/lib/hbase/lib/hbase-server-0.98.6-cdh5.4.0-SNAPSHOT-tests.jar

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

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