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导致遇到兼容性问题如下:
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/InsertPic_(12-11-10-10-11).png)
而Elasticsearch for Apache Hadoop2.1.1版本开始做了版本限制,详情如下:
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/Catch(12-11-10-10-11).jpg)
Elasticsearch for Apache Hadoop2.2.0beta1开始对Elasticsearch2.x版本做了兼容
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/Catch5AF2(12-11-10-10-11).jpg)
在使用Elasticsearch for Apache Hadoop2.2.0beta1过程中一直遇到以下问题:
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/Catch51D2(12-11-10-10-11).jpg)
经过修改源码打印日志发现是rest API返回结果变了
Elasticsearch1.7的/_nodes/transport rest API返回结果
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/CatchC594(12-11-10-10-11).jpg)
Elasticsearch2.1的/_nodes/transport rest
API返回结果
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/Catch38CD(12-11-10-10-11).jpg)
现已修改解析http_address部分源代码StringUtils.java:
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导致遇到兼容性问题如下:
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/InsertPic_(12-11-10-10-11).png)
而Elasticsearch for Apache Hadoop2.1.1版本开始做了版本限制,详情如下:
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/Catch(12-11-10-10-11).jpg)
Elasticsearch for Apache Hadoop2.2.0beta1开始对Elasticsearch2.x版本做了兼容
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/Catch5AF2(12-11-10-10-11).jpg)
在使用Elasticsearch for Apache Hadoop2.2.0beta1过程中一直遇到以下问题:
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/Catch51D2(12-11-10-10-11).jpg)
经过修改源码打印日志发现是rest API返回结果变了
Elasticsearch1.7的/_nodes/transport rest API返回结果
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/CatchC594(12-11-10-10-11).jpg)
Elasticsearch2.1的/_nodes/transport rest
API返回结果
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/Catch38CD(12-11-10-10-11).jpg)
现已修改解析http_address部分源代码StringUtils.java:
![](file:///C:/Users/lakla/Documents/My%20Knowledge/temp/5195be04-15c3-4087-804f-957724bec041_128_files/CatchBA70(12-11-10-10-11).jpg)
相关文章推荐
- 【ITOO】--项目系统架构图
- Photoshop 快捷键设置之进化
- Linux下配置Caffe及其Python接口全过程记录(Ubuntu15.10_amd64+CUDA7.5)及训练mnist数据集
- activity界面架构即activity视图层结构
- OpenCV 实践程序17——实现图片标注
- linux umount 时出现device is busy 的处理方法--fuser
- Linux负载均衡环境搭建-2 安装J2EE环境
- Tomcat7 Websocket入门贴
- Linux MakeFile (编写、函数以及指定位置存放)
- NSPopover使用
- apache bench
- 关于Apache 的两种工作模式
- netflix zuul-simple-webapp.war在tomcat下启动
- Linux 文件共享之ftp服务
- hbase的shell小技巧
- Photoshop扣人物图:PS调整边缘高速度高效率扣头发丝 亲测好用!!!
- Linux操作系统实时性
- linux LVM 逻辑卷
- 关于 下拉框 数据 回显 的问题
- 利用zabbix监控某个目录大小