ElasticSearch版本更新很快,2.x一下子就到了5.x,变化很大,其中head插件安装方式就不同。
2.x的可能这样就可以安装
通过elasticseach自带的plugin命令 elasticsearch/bin/plugin -install mobz/elasticsearch-head
5.x的相对来说比较麻烦,看下面配置:
1、安装插件head
1
2
3
4
5
6
7
8
9
10
11
# 去github上下载head
git clone git:
//github
.com
/mobz/elasticsearch-head
.git
# 由于head基于nodejs所以安装它
yum -y
install
nodejs npm
npm
install
grunt-cli
npm
install
grunt
grunt -version
# 修改配置文件
cd
elasticsearch-
head
vim _site
/app
.js
# 修改 『http://localhost:9200』字段到本机ES端口与IP
2、启动head
1
2
3
cd
elasticsearch-
head
grunt server
# 打开浏览器 http://localhost:9100
3、出现问题
head主控页面是可以显示的,但是显示连接失败
“集群健康值: 未连接”
4、解决方案
修改elasticsearch.yml文件
1
2
3
4
vim $ES_HOME$
/config/elasticsearch
.yml
# 增加如下字段
http.cors.enabled:
true
http.cors.allow-origin:
"*"
重启es和head即可