您的位置:首页 > 运维架构

elasticsearch2.1 elasticsearch-hadoop安装

2015-12-16 17:20 627 查看
1、下载elasticsearch-hadoop-2.2.0beta1.jar,拷贝到hive的lib目录中,然后以如下方式打开hive命令窗口:

bin/hive -hiveconf hive.aux.jars.path=/root/hive/lib/elasticsearch-hadoop-2.2.0beta1.jar
这个也可以写在hive的配置文件中,
<property>
<name>hive.aux.jars.path</name>
<value>hdfs://ns/path/elasticsearch-hadoop.jar</value>
<description>A comma separated list (with no spaces) of the jar files</description>
</property>

2、创建表

CREATE TABLE es(location STRING, url STRING)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.resource' = 'test/share',
'es.index.auto.create' = 'true','es.nodes'='customercenter1,customercenter2,customercenter3,customercenter4','es.port'='9200');

由于在Elasticsearch for hive搭建时,Elasticsearch使用的是官方最新版本,而Elasticsearch
for hadoop的插件包版本更新不及时,导致在环境搭建的时候出现了问题

Elasticsearch for Apache Hadoop 2.1.0版本及前版本不支持最新的Elasticsearch2.1.0导致遇到兼容性问题如下:


而Elasticsearch for Apache Hadoop2.1.1版本开始做了版本限制,详情如下:



Elasticsearch for Apache Hadoop2.2.0beta1开始对Elasticsearch2.x版本做了兼容



在使用Elasticsearch for Apache Hadoop2.2.0beta1过程中一直遇到以下问题:



经过修改源码打印日志发现是rest API返回结果变了

Elasticsearch1.7的/_nodes/transport rest API返回结果



Elasticsearch2.1的/_nodes/transport rest
API返回结果



现已修改解析http_address部分源代码StringUtils.java:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: