2014-08-27 143 views
2

我在hive-site.xmlHivesever2無法從elasticsearch-的Hadoop裝載EsStorageHandler類

<property> 
    <name>hive.aux.jars.path</name> 
    <value>/path/to/elasticsearch-hadoop-2.0.1.jar</value> 
</property> 

當我HiveCli數據映射到Elasticsearch這種配置,通過這個代碼正常工作:

CREATE EXTERNAL TABLE artists (...) 
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' 
TBLPROPERTIES('es.resource' = 'radio/artists', 
       'es.index.auto.create' = 'false') 

但當我在Hive Java Client(我開始使用Hiveserver2)中使用它時,它拋出以下異常:

FAILED: Execution Error, return code 1 
    from org.apache.hadoop.hive.ql.exec.DDLTask. 
     org.apache.hadoop.hive.ql.metadata.HiveException: 
    Error in loading storage handler.org.elasticsearch.hadoop.hive.EsStorageHandler 

回答

1

在$ HIVE_HOME/lib文件夾中添加elasticsearch-Hadoop-2.0.1.jar文件。

編輯您的查詢 - 創建由 'org.elasticsearch.hadoop.hive.EsStorageHandler' tblproperties存儲外部表的藝術家(...)行格式SERDE 'org.elasticsearch.hadoop.hive.EsSerDe'(' s.resource'='radio/artists','es.index.auto.create'='false');

希望它可以幫助..

相關問題