elasticsearch2.1 elasticsearch-hadoop安装

来源:互联网 发布:淘宝如何招募分销商 编辑:程序博客网 时间:2024/04/30 22:00
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:


0 0