无法将数据从Apache配置单元加载到ElasticSearch -

时间:2016-11-16 06:43:54

标签: hadoop elasticsearch hive yarn elastic-stack

我正在使用CDH5.5,ElasticSearch-2.4.1。 我创建了Hive表并尝试使用以下查询将hive表数据推送到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;

我在Job Tracker网址中收到以下错误 &#34;

 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. "

它会在hive终端中抛出"FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask"

我尝试了论坛中提到的所有步骤,例如在hive-site.xml中包含/usr/lib/hive/bin/elasticsearch-hadoop-2.0.2.jar,将ES-hadoop jar添加到HIVEAUXJARS_PATH,复制纱线罐到/usr/lib/hadoop/elasticsearch-yarn-2.1.0.Beta3.jar也。请建议我如何解决错误。


提前致谢, 斯里纳

2 个答案:

答案 0 :(得分:0)

我处理同样的问题,我发现hive抛出的执行错误是由字符串类型的时间戳字段引起的,无法解析。我想知道字符串类型的时间戳字段是否可以正确映射到es,如果不是,这可能是根本原因。

顺便说一下,您应该转到hadoop MR日志以查找有关错误的更多详细信息。

答案 1 :(得分:0)

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 ...........

不需要位置