Head插件安装
head插件可以用来快速查看elasticsearch中的数据概况以及非全量的数据,也支持控件化查询和rest请求。
一、在es服务器上安装nodejs环境
- 1、在官网上下载nodejs的包,并上传到服务器中
# 解压文件
[root@localhost nodejs]# tar -xf ./node-v16.9.0-linux-x64.tar.xz
- 2、配置nodejs环境变量
# 编辑/etc/profile文件
[root@localhost bin]# vim /etc/profile
# 添加如下内容
export NODE_HOME=/home/software/nodejs/node-v16.9.0-linux-x64
export PATH=$PATH:$NODE_HOME/bin
# 使配置生效
[root@localhost bin]# source /etc/profile
二、安装head插件
- 1、执行npm install -g grunt-cli命令
# 安装grunt-cli
[root@localhost bin]# npm install -g grunt-cli
# 查看grunt安装是否成功
[root@localhost bin]# grunt -version
- 2、安装unzip解压软件
[root@localhost software]# yum -y install unzip
- 3、上传head的zip包,并解压
[root@localhost elasticsearch]# unzip elasticsearch-head-master.zip
- 4、修改es的配置文件,开启head插件的访问配置
# 编辑es配置文件
[root@localhost config]# vim ./elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
- 5、如果是多节点es,还需要修改head的配置文件
# 修改head的配置文件
[root@localhost elasticsearch-head-master]# vim Gruntfile.js
- 6、在head项目目录下,执行命令npm install,安装package.json中的依赖
[root@localhost elasticsearch-head-master]# npm install
# 因为npm下载过慢,所以我这边用的淘宝的cnpm命令
[root@localhost elasticsearch-head-master]# cnpm install
- 7、启动head插件
[root@localhost elasticsearch-head-master]# grunt server
- 8、启动es节点
[es@localhost bin]$ ./elasticsearch
- 9、使用head连接es