elasticsearch2.2-yarn(hadoop)安装

  序言:

 首先说说es2.2在yarn上跑的好处和不足,在hadoop上跑可以统一使用yarn资源,不用单独给es搞物理机了。

这里要注意es并没有使用hdfs,网上资料说可以使用hdfs来管理es备份文件,本人费很大劲没有找到成功安装方式。

 参考网址:

https://github.com/elastic/elasticsearch-hadoop 源码地址

https://www.elastic.co/guide/en/elasticsearch/hadoop/current/es-yarn.html 官方文档

https://www.elastic.co/downloads/elasticsearch   下载包地址

安装需要:

这里需要一个jar(elasticsearch-yarn-2.2.0.jar)和一个zip(elasticsearch-2.2.0.zip)

jar从私服下载,zip从官网下载就可以了


开始安装:

1.使用hadoop运行jar输出帮助文档

 

$ hadoop jar elasticsearch-yarn-2.2.0.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.

2.按照官网执行 $ hadoop jar elasticsearch-yarn-2.2.0 -download-es

下载了n次 不行啊,看看原来没地址吧 https://download.elastic.co/elasticsearch/elasticsearch/ 
试了试好像下载不了

自己找地址手工下载吧  

https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/2.2.0/elasticsearch-2.2.0.zip

放在 hadoop的app/downloads 中吧,为什么放这里的,因为官方文档说从命令行执行的  .downloads中获取zip

这样就算下载完了。

 下一步安装命令:

hadoop jar elasticsearch-yarn-2.2.0.jar -install-es
 hadoop jar elasticsearch-yarn-2.2.0.jar -install

不错,两个执行都上传成功了
文件放在了 hdfs://cluster1:8020/apps/elasticsearch/ 目录下

启动一下试一试吧:

hadoop jar /app/elasticsearch-hadoop-2.2.0/dist/elasticsearch-yarn-2.2.0.jar -start 

提示 16/02/18 09:37:24 INFO impl.YarnClientImpl: Submitted application application_1455675371242_0002
Launched a 1 node Elasticsearch-YARN cluster [application_1455675371242_0002@http://host218:9026/proxy/application_1455675371242_0002/] at Thu Feb 18 09:37:23 CST 2016
查看一下状态:

hadoop jar elasticsearch-yarn-2.2.0.jar -status

提示如下 

Id                              State       Status     Start Time         Finish Time        Tracking URL
application_1455675371242_0002  FINISHED    FAILED     2/18/16 9:37 AM    2/18/16 9:37 AM    http://host218:9026/proxy/ap


官网提示应该是这样
Id                              State       Status     Start Time         Finish Time        Tracking URL
application_1415921358606_0007  RUNNING     UNDEFINED  11/14/14 19:34 PM  N/A               
这里使用yarn命令查看一下日志发现,是root权限不让启动,这样我们就使用一个参数强制使用root启动吧。

命令如下:

hadoop jar elasticsearch-yarn-2.2.0.jar -start sys.prop.es.insecure.allow.root=true containers=5

解释一下啊,第一个参数是允许root启动(其他参数参考官网),第二个参数是使用多少个datanode节点。
终于启动成功可以正常使用过了。

这里说一下,这个zip可以减压修改配置文件,也可以安装head等插件。

以下是一些优化及其配置供参考:

#node名称为主机名称
node.name: ${HOSTNAME}
使用eth0网卡
network.host: _eth0_
单播发现nodes集合
discovery.zen.ping.unicast.hosts: ["host213", "host217", "host221", "host231","host236","host233","host235"]
cluster.name: ehl_elasticsearch
path.data: /data/elasticsearch/indexdata
path.work: /data/elasticsearch/work
path.logs: /data/elasticsearch/logs
#允许锁定内存
bootstrap.mlockall: true
ES_MIN_MEM: 4g
ES_MAX_MEM: 4g
#不允许动态生成索引配置
index.mapper.dynamic: false
修改linux允许所内存

echo 'ulimit -l unlimited' >> /etc/profile
 . /etc/profile











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值