ElasticSearch学习(三)安装Head插件

本文介绍了如何在ElasticSearch 5.0及更高版本中安装和配置ElasticSearch-head,包括安装git、nodejs,通过git获取ElasticSearch-head源码,安装依赖,修改配置文件以适应ElasticSearch,并设置允许跨域访问,最后详细阐述了启动步骤。
摘要由CSDN通过智能技术生成

提前关闭防火墙

Head是elasticsearch的集群管理工具,可以用于数据的浏览查询

1、ElasticSearch-head是一款开源软件,被托管在github上面,所以如果我们要使用它,必须先安装git,通过git获取ElasticSearch-head

安装git:

linux安装git

2、运行ElasticSearch-head会用到grunt,而grunt需要npm包管理器,所以nodejs是必须要安装的

Linux安装nodejs和npm

3、elasticsearch5.0之后,elasticsearch-head不作为插件放在其plugins目录下,使用git拷贝elasticsearch-head到本地

[root@hadoop01 ~]# cd /usr/local
[root@hadoop01 local]# git clone git://github.com/mobz/elasticsearch-head.git

4、安装elasticsearch-head依赖包

[root@hadoop01 local]# npm install -g grunt-cli
[root@hadoop01 ~]#cd /usr/local/elasticsearch-head
[root@hadoop01 elasticsearch-head]# cnpm install

5、修改Gruntfile.js

[root@hadoop01 ~]# cd /usr/local/elasticsearch-head
[root@hadoop01 elasticsearch-head]#  vi Gruntfile.js
在connect  server  options下面添加:hostname : * ,允许所有Ip访问

6、修改elasticsearch-head默认链接地址

cd /usr/local/elasticsearch-head/_site/
vi app.js
将this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";中localhost的修改为本服务器的Ip地址

7、配置elasticsearch允许跨域访问

打开elasticsearch的配置文件elasticsearch.yml,在文件末尾追加下面两行代码即可:
http.cors.enables: true
http.cors.allow-origin: "*"

8、先启动elasticsearch,再启动elasticsearch-head

 

/usr/local/elasticsearch-head/node_modules/grunt/bin
[root@hadoop01 bin]# ./grunt server

9、浏览器输入网址访问

http://192.168.123.101:9100/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值