在YARN上运行ElasticSearch

        这么做的目的,主要是为了统一资源管理(cpu和内存)。一体化平台,spark,es ,mr等都在一起跑的时候,做好资源的调度。

在故事开始之前,先去把插件下载了。

插件地址

安装主要参考了官方文档

[root@master nq]# hadoop jar elasticsearch-yarn-2.1.0.BUILD-SNAPSHOT.jar 
No command specified
Usage:
     -download-es  : Downloads Elasticsearch.zip
     -install      : Installs/Provisions Elasticsearch-YARN into HDFS
     -install-es   : Installs/Provisions Elasticsearch into HDFS
     -start        : Starts provisioned Elasticsearch in YARN
     -status       : Reports status of Elasticsearch in YARN
     -stop         : Stops Elasticsearch in YARN
     -help         : Prints this help

Configuration options can be specified _after_ each command; see the documentation for more information.

[root@master nq]#

安装过程比较简单,根据文档顺序来遍就好了,可能会出现的情况就是,HDFS权限问题。

[root@master nq]# hadoop jar elasticsearch-yarn-2.1.0.BUILD-SNAPSHOT.jar -download-es
[root@master nq]# hadoop jar elasticsearch-yarn-2.1.0.BUILD-SNAPSHOT.jar -install-es
[root@master nq]# hadoop jar elasticsearch-yarn-2.1.0.BUILD-SNAPSHOT.jar -install
[root@master nq]# hadoop jar elasticsearch-yarn-2.1.0.BUILD-SNAPSHOT.jar -start containers=2  #我启动了2个,为了副本能分配

完成后,能在HDFS下面看到2个文件

154334_RV3j_99041.png

YARN这边也能看到日志和应用了

155107_TdrG_99041.png

155107_ytwy_99041.png

ES这边访问OK

[root@master nq]# curl localhost:9200
{
  "status" : 200,
  "name" : "Shadowmage",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "1.4.0",
    "build_hash" : "bc94bd81298f81c656893ab1ddddd30a99356066",
    "build_timestamp" : "2014-11-05T14:26:12Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.2"
  },
  "tagline" : "You Know, for Search"
}
[root@master nq]#


好了,大功告成。刚要开心的大笑,就发现了2个严重的问题,然后笑容凝固。

  1. 怎么安装插件?

  2. 数据存哪儿去了? local or hdfs 

看着HDFS上的zip包,我茫然了,首先确定的是插件,肯定是没提供相应的接口了,从图1也能看出来。经过一顿纠结后,想到了2个办法。

  1. 把插件打包进zip包里面。

    1. 安装过程的,第一步,(-download-es)会把es下载到当前dowanloads目录下面,

    2. dowanloads里面把elasticsearch-1.4.0.zip解压,再把head等插件弄进去,压缩

    3. 替换HDFS上的zip包,

    4. stop & start

  2. 使用plugin命令安装。

jps -v|grep elastic

./bin/plugin -install mobz/elasticsearch-head

jps找到ES的运行目录(-Des.path.home),然后就没有然后了。熟悉的head。到这里,其实索引文件是不是存在HDFS里面也清楚了。

163723_Chxe_99041.png


转载于:https://my.oschina.net/naqin/blog/393631

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值