ES之Head插件安装

可视化的插件可以提高我们的工作效率,ES常用的视图插件有head、Kibana,后者是官方提供的web视图。

安装Head插件

由于head插件本质上还是一个nodejs的工程,因此需要安装node,使用npm来安装依赖的包。

  • 安装Node.js

下载解压

wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz
xz –d node-v6.10.2-linux-x64.tar.xz
tar xvf node-v6.10.2-linux-x64.tar
mv node-v6.10.2-linux-x64 /usr/local/node
 配置NODE_HOME并生效

vim /etc/profile
export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin

source /etc/profile使配置生效

  • 下载head插件

如果未安装git ,则先安装git工具
yum install –y git
git clone https://github.com/mobz/elasticsearch-head.git

  • 安装grunt

cd elasticsearch-head
npm install -g grunt --registry=https://registry.npm.taobao.org

  • 安装插件

npm install


以上安装完成后要做三处修改

1./usr/local/elasticsearch-head/_site/app.js 修改http://localhost:9200字段到本机ES端口与IP,大概在4000行,可以使用:4300定位一下,如下图

2.修改/usr/local/elasticsearch-head/Gruntfile.js host地址,如下图

3.最后重要的是要配置一下elasticsearch.yml,在最后加上两行

http.cors.enabled: true

http.cors.allow-origin: "*"

目的是解决跨域的问题。

启动head插件 记得切换用户 要与elastic一个用户 /elasticsearch-head/node_modules/grunt/bin/grunt server &

看到如下图就说明安装成功

 

显示green 说明服务器是健康的。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章