Elasticsearch5.x Head插件安装

在5.0版本中不支持直接安装head插件,需要启动一个服务。

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

1、安装Node.js

官网nodejs,https://nodejs.org/en/download/,可以直接从浏览器下载

wget https://nodejs.org/dist/v6.10.2/node-v8.11.3-linux-x64.tar.xz
     
xz –d node-v8.11.3-linux-x64.tar.xz
tar xvf node-v8.11.3-linux-x64.tar
mv node-v8.11.3-linux-x64 /usr/local/node

vim /etc/profile
export NODE_HOME=/usr/local/node/node-v8.11.3-linux-x64
export PATH=$PATH:$NODE_HOME/bin

source /etc/profile

 
# node –v
v0.10.48

# npm –v
1.3.6

2、下载插件包

 如果找不到git,请先安装:

yum install –y git
git clone https://github.com/mobz/elasticsearch-head.git

也可以直接进入:https://github.com/mobz/elasticsearch-head,下载zip压缩包,再解压

3、安装grunt

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

4、修改配置

修改elasticsearch-head下Gruntfile.js文件,默认监听在127.0.0.1下9200端口:

新增hostname: ‘192.168.2.70’,

修改 _site/app.js

修改http://localhost:9200字段到本机ES端口与IP:

6、修改Elasticsearch配置

修改elasticsearch.yml文件加入以下内容:

# 是否支持跨域 http.cors.enabled: true 

# *表示支持所有域名 http.cors.allow-origin: "*"

7、启动服务

/elasticsearch-head/node_modules/grunt/bin/grunt server (后台运行 + &)

浏览器访问 http://192.168.2.70:9100/

猜你喜欢

转载自blog.csdn.net/xianjie0318/article/details/81221954