两种方式部署elasticsearch-head插件(四)

携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第9天,点击查看活动详情

安装elasticsearch-head插件

1.安装head插件

1.1.谷歌浏览器安装es-head插件

安装完谷歌head插件后,服务器无需部署head服务也可以链接es集群

github.com/liufengji/e…

下载后将插件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 &
> [email protected] 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的时候长时间不加载则去浏览器把这个软件下载下来

github.com/Medium/phan…

在这里插入图片描述

下载好放到这个目录

/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 [email protected] license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

up to date in 4.652s

复制代码

猜你喜欢

转载自juejin.im/post/7129335920356130824
今日推荐