安装elasticsearch-head插件
1.安装head插件
1.1.谷歌浏览器安装es-head插件
安装完谷歌head插件后,服务器无需部署head服务也可以链接es集群
https://github.com/liufengji/es-head从这里下载插件
下载后将插件crx后缀修改为zip,然后解压文件
点击谷歌浏览器—更多工具—扩展程序—加载已经解压的程序—选择文件夹即可
2.1.安装head插件
1.安装nodejs环境
[root@elastic soft]# wget https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz
[root@elastic soft]# tar xf node-v10.16.3-linux-x64.tar.xz -C /usr/local/
[root@elastic soft]# vim /etc/profile
export NODE_HOME=/usr/local/node-v10.16.3-linux-x64
export PATH=$NODE_HOME/bin:$PATH
[root@elastic soft]# source /etc/profile
[root@elastic soft]# node -v
v10.16.3
[root@elastic soft]# npm -v
6.9.0
2.安装head
[root@elastic soft]# git clone git://github.com/mobz/elasticsearch-head.git
[root@elastic soft]# cd elasticsearch-head/
[root@elastic elasticsearch-head]# npm install
3.启动head
[root@elastic elasticsearch-head]# npm run start &
> elasticsearch-head@0.0.0 start /root/soft/elasticsearch-head
> grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
4.查看端口
[root@elastic phantomjs]# netstat -lnpt | grep 9100
tcp 0 0 0.0.0.0:9100 0.0.0.0:* LISTEN 41450/grunt
访问head插件
2.2.配置elasticsearch允许head插件远程访问
[root@elastic ~]# vim /etc/elasticsearch/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
[root@elastic ~]# systemctl restart elasticsearch
2.3.登录head插件
填写es服务器点击连接即可
3.安装head插件报错解决
3.1.npm install软件长时间不响应
如果npm install的时候长时间不加载则去浏览器把这个软件下载下来
https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
下载好放到这个目录
/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
3.2.npm install报错解决
报错如下图
[root@elastic elasticsearch-head]# npm audit fix
修复一下,在执行npm install
如果还是修复不成功则使用如下修复方式
1.淘宝镜像源会自动修复,然后下载相关依赖包。
2.使用nrm use taobao,nrm如果没有安装,就使用npm i -g nrm,然后再使用nrm use taobao
3.再使用npm i 安装一遍所有依赖包,这时候没下载的会自动下载,再使用npm install进行初始化即可
[root@elastic elasticsearch-head]# npm i -g nrm [root@elastic elasticsearch-head]# nrm use taobao Registry has been set to: https://registry.npm.taobao.org/ [root@elastic elasticsearch-head]# npm i [root@elastic elasticsearch-head]# npm install npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) up to date in 4.652s