无法将数据从apache hive加载到elasticsearch-

yh2wf1be  于 2021-05-29  发布在  Hadoop
关注(0)|答案(2)|浏览(386)

我使用的是cdh5.5,elasticsearch-2.4.1。我已经创建了配置单元表,并尝试使用下面的查询将配置单元表数据推送到elasticsearch。

CREATE EXTERNAL TABLE test1_es(
  id string,
  timestamp string, 
  dept string)<br>
ROW FORMAT SERDE 'org.elasticsearch.hadoop.hive.EsSerDe'  
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'  
LOCATION
  'hdfs://quickstart.cloudera:8020/user/cloudera/elasticsearch/test1_es'
TBLPROPERTIES (  'es.nodes'='localhost', 
'es.resource'='sample/test1',
'es.mapping.names' = 'timestamp:@timestamp',
'es.port' = '9200', 
'es.input.json' = 'false', 
'es.write.operation' = 'index', 
'es.index.auto.create' = 'yes'
);<br>
INSERT INTO TABLE default.test1_es select id,timestamp,dept from test1_hive;

我在求职者的url中发现以下错误“

Failed while trying to construct the redirect url to the log server. Log Server url may not be configured. <br>
java.lang.Exception: Unknown container. Container either has not started or has already completed or doesn't belong to this node at all. "

它会抛出 "FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask" 在Hive终端。
我尝试了论坛中提到的所有步骤,比如hive-site.xml中的/usr/lib/hive/bin/elasticsearch-hadoop-2.0.2.jar,将es-hadoop-jar添加到hiveauxjars\u路径,还将yarn-jar复制到/usr/lib/hadoop/elasticsearch-yarn-2.1.0.beta3.jar。请告诉我如何纠正这个错误。
提前谢谢你,斯雷纳思

vtwuwzda

vtwuwzda1#

我正在处理同样的问题,我发现hive抛出的执行错误是由无法解析的字符串类型的timestamp字段引起的。我想知道字符串类型的时间戳字段是否可以正确地Map到es,如果不能,这可能是根本原因。
顺便说一句,您应该转到hadoop mr日志以查找有关错误的更多详细信息。

fcipmucu

fcipmucu2#

REATE EXTERNAL TABLE test1_es(
  id string,
  timestamp string, 
  dept string)<br>
ROW FORMAT SERDE 'org.elasticsearch.hadoop.hive.EsSerDe'  
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'  
TBLPROPERTIES ...........

不需要定位

相关问题