Elasticsearch6.0 安装elasticsearch-head插件

es-head主要有三个方面的操作:

  1. 显示集群的拓扑,并且能够执行索引和节点级别操作
  2. 搜索接口能够查询集群中原始json或表格格式的检索数据
  3. 能够快速访问并显示集群的状态
  4. 有一个输入窗口,允许任意调用RESTful API。这个接口包含几个选项,可以组合在一起以产生有趣的结果; 
    1. 请求方法(get、put、post、delete),查询json数据,节点和路径
    2. 支持JSON验证器
    3. 支持重复请求计时器
    4. 支持使用javascript表达式变换结果
    5. 收集结果的能力随着时间的推移(使用定时器),或比较的结果
    6. 能力图表转换后的结果在一个简单的条形图(包括时间序列)

官方的文档: 
https://github.com/mobz/elasticsearch-head

1、Elasticsearch6.0安装插件,这个和低版本安装不一样.需要先安装nodejs

1)、下载npm包
官网下载npm安装包,https://nodejs.org/en/
[root@es-jypay-1 elasticsearch-head]# wget  https://nodejs.org/dist/v8.9.1/node-v8.9.1-linux-x64.tar.xz

2)、解压,创建链接
[root@es-jypay-1 elasticsearch-head]#tar xf node-v8.9.1-linux-x64.tar.xz
[root@es-jypay-1 elasticsearch-head]#mv node-v8.9.1-linux-x64 /usr/local
[root@es-jypay-1 elasticsearch-head]#ln -s /usr/local/node-v8.9.1-linux-x64/bin/node /usr/local/bin/node
[root@es-jypay-1 elasticsearch-head]#ln -s /usr/local/node-v8.9.1-linux-x64/bin/npm /usr/local/bin/npm

2、安装elasticsearch-head

[root@es-jypay-1 ]#cd /usr/local
[root@es-jypay-1 ]# git clone git://github.com/mobz/elasticsearch-head.git
[root@es-jypay-1 ]# cd elasticsearch-head
[root@es-jypay-1 elasticsearch-head]# npm install
[root@es-jypay-1 elasticsearch-head]# npm install grunt --save-dev
[root@es-jypay-1 elasticsearch-head]# rm -f /usr/local/bin/grunt
[root@es-jypay-1 elasticsearch-head]# ln -s /usr/local/elasticsearch-head/node_modules/grunt/bin/grunt /usr/local/bin/grunt

出现如下错误,需要安装缺少的包:

[root@es-jypay-1 elasticsearch-head]# /usr/share/elasticsearch/plugins/elasticsearch-head/node_modules/grunt/bin/grunt server
>> Local Npm module "grunt-contrib-clean" not found. Is it installed?
>> Local Npm module "grunt-contrib-concat" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?
Warning: Task "connect:server" not found. Use --force to continue.

安装方法如下:

[root@es-jypay-1 elasticsearch-head]# npm install grunt-contrib-clean -registry=https://registry.npm.taobao.org 
[root@es-jypay-1 elasticsearch-head]# npm install grunt-contrib-concat -registry=https://registry.npm.taobao.org 
[root@es-jypay-1 elasticsearch-head]# npm install grunt-contrib-watch -registry=https://registry.npm.taobao.org 
[root@es-jypay-1 elasticsearch-head]# npm install grunt-contrib-connect -registry=https://registry.npm.taobao.org 
[root@es-jypay-1 elasticsearch-head]# npm install grunt-contrib-copy -registry=https://registry.npm.taobao.org 
[root@es-jypay-1 elasticsearch-head]# npm install grunt-contrib-jasmine -registry=https://registry.npm.taobao.org

启动head插件:
[root@es-jypay-1 elasticsearch-head]# grunt --gruntfile=/usr/share/elasticsearch/plugins/elasticsearch-head/Gruntfile.js server  --force &
 elasticsearch/plugins/elasticsearch-head/Gruntfile.js server --force
 (node:3719) ExperimentalWarning: The http2 module is an experimental API.
 Running "connect:server" (connect) task
 Waiting forever...
 Started connect web server on http://localhost:9100

3、安装完成后,在网页浏览

原文地址:https://www.cnblogs.com/kumarhua/p/7918978.html