插件安装

1、下载插件(默认你已经安装git):

git clone https://github.com/mobz/elasticsearch-head.git

2、检查是否安装node

node -v

如果没有安装:先安装python:

#sudo apt-get install python-software-properties
# apt install nodejs-legacy

手动下载执行脚本文件:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

安装nodejs

sudo apt-get install nodejs

输入命令安装elasticsearch所需的依赖包:

npm install

依赖安装完后,需要修改一个文件才能连上head插件

vim config/elasticsearch.yml

在后面添加以下内容:

http.cors.enabled: true
http.cors.allow-origin: "*"

输入命令启动head插件

npm run start

扩展

安装npm

[root@node1 ~]#  npm install -g cnpm --registry=https://registry.npm.taobao.org


使用npm安装grunt

root@node1 ~]# npm install -g grunt


下载依赖
进入elasticsearch-head-master目录,执行下面命令

[es@node1 elasticsearch-head-master]$ npm install

注意 : 过程很漫长

如果上面命令安装较慢或失败,可以尝试国内镜像安装

#npm install -g cnpm --registry=https://registry.npm.taobao.org$ cnpm install



停止ElasticSearch
如果ElasticSearch已经启动,需要先停止

[es@node1 ~]$ jps
3261 Elasticsearch
3375 Jps
[es@node1 ~]$ kill 3261

(1)配置 ElasticSearch,使得HTTP对外提供服务

[es@node1 elasticsearch-6.1.1]$ vi config/elasticsearch.yml

添加如下内容

# 增加新的参数,这样head插件可以访问es。设置参数的时候:后面要有空格
http.cors.enabled: true
http.cors.allow-origin: "*"

(2)修改Head插件配置文件

$ vi Gruntfile.js

找到connect:server,添加hostname一项,如下

connect: {server: {options: {hostname: '0.0.0.0',port: 9100,base: '.',keepalive: true}}}

启动
(1)启动elasticsearch
首先确认elasticsearch已经启动

[es@node1 elasticsearch-6.1.1]$ bin/elasticsearch -d
[es@node1 elasticsearch-6.1.1]$ jps
3451 Jps
3436 Elasticsearch
[es@node1 elasticsearch-6.1.1]$

(2)启动head
通过命令grunt server启动head

[es@node1 elasticsearch-head-master]$ grunt server
需要在head的目录下运行
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://node1:9100

或者通过命令npm run start也可以启动head

[es@node1 elasticsearch-head-master]$ npm run start
> elasticsearch-head@0.0.0 start /home/es/elasticsearch-head-master
> grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://node1:9100

(3)访问9100端口
http://10.105.45.32:9100/

如果出现“未连接”,请修改localhost为node1,然后单击“连接”按钮

** 简单应用**
(1)创建索引

[root@node1 ~]# curl -XPUT node1:9200/test
{"acknowledged":true,"shards_acknowledged":true,"index":"test"}[root@node1 ~]#

**(2)查看head变化 **

常见问题

1、npm run start报错,端口被占用
卧槽,又他妈报错,心态有点崩啊。好吧,9100端口被占用,查找进程,杀死。再一看,卧槽?又复活了?杀不死?好吧,我换端口。

vim Gruntfile.js

找到port,修改为一个没有被占用的端口就ok啦。然后就可以访问head了,显示集群健康

2、npm run start安装报错
1、npm WARN Local package.json exists, but node_modules missing, did you mean to install?
翻译 :npm WARN本地package.json存在,但缺少node_modules,您是要安装吗?
2、This is probably not a problem with npm. There is likely additional logging output above.
翻译 : npm可能不是问题。 上面可能还有其他日志记录输出。

root@jnydjky:/optlim/elasticsearch-6.2.3/elasticsearch-head# npm run start> elasticsearch-head@0.0.0 start /optlim/elasticsearch-6.2.3/elasticsearch-head
> grunt serversh: 1: grunt: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! elasticsearch-head@0.0.0 start: `grunt server`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the elasticsearch-head@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-04-26T07_52_29_766Z-debug.log


翻译

报错原因安装错的head组件 ,正常地址:https://github.com/mobz/elasticsearch-head/archive/master.zip
解决办法 :
查看elasticsearch日志

root@jnydjky:/var/log# cd elasticsearch/
root@jnydjky:/var/log/elasticsearch# ls
/var/log/elasticsearch# cat elasticsearch.log



没有发现报错;

3、报错信息 :
1 package is looking for funding
run npm fund for details

found 44 vulnerabilities (20 low, 2 moderate, 22 high)
run npm audit fix to fix them, or npm audit for details
root@jnydjky:/optlim/elasticsearch-6.2.3/elasticsearch-head# npm install grunt

root@jnydjky:/optlim/elasticsearch-6.2.3/elasticsearch-head# npm fund
elasticsearch-head@0.0.0
├─┬ resolve@1.17.0
│ └── url: https://github.com/sponsors/ljharb
├─┬ is-finite@1.1.0
│ └── url: https://github.com/sponsors/sindresorhus
└─┬ glob@7.1.6└── url: https://github.com/sponsors/isaacs

# npm install -g grunt-cli --registry=https://registry.npm.taobao.org --no-proxy[root@node1 ~]# npm install -g grunt-cli --registry=https://registry.npm.taobao.org --no-proxy
/usr/bin/grunt -> /usr/lib/node_modules/grunt-cli/bin/grunt
/usr/lib
└─┬ grunt-cli@1.2.0 ├─┬ findup-sync@0.3.0 │ └─┬ glob@5.0.15 │   ├─┬ inflight@1.0.6 │   │ └── wrappy@1.0.2 │   ├── inherits@2.0.3 │   ├─┬ minimatch@3.0.4 │   │ └─┬ brace-expansion@1.1.8 │   │   ├── balanced-match@1.0.0 │   │   └── concat-map@0.0.1 │   ├── once@1.4.0 │   └── path-is-absolute@1.0.1 ├── grunt-known-options@1.1.0 ├─┬ nopt@3.0.6 │ └── abbrev@1.1.1 └── resolve@1.1.7


版本确认

[es@node1 ~]$ node -v
v6.12.0
[es@node1 ~]$ npm -v
3.10.10
[es@node1 ~]$ grunt -version
grunt-cli v1.2.0

grunt为何有两个版本,因为之前装了,隔间了两个月,grunt版本有出新的版本了。apt自动安装最新的版本。

参考链接 :

安装ElasticSearch 6.1.1 head插件 : https://blog.csdn.net/zoubf/article/details/79007908

ubuntu安装elasticsearch和head插件(所有可能出现的问题解决)超详细 : https://blog.csdn.net/qq_40663357/article/details/88910133

安装ElasticSearch 6.1.1 head插件 : https://blog.csdn.net/zoubf/article/details/79007908

ubuntu安装ElasticSearch-head插件相关推荐

  1. Centos7.3安装elasticsearch head插件

    elasticsearch head插件是一个入门级的elasticsearch前端插件:我们来安装下: 第一步:安装nodejs head插件是nodejs实现的,所以必须先安装Nodejs 参考: ...

  2. linux系统中插件安装失败,Ubuntu 安装Rhythmbox多媒体插件时出现错误

    Ubuntu 12.04下想要看mp4文件,系统提示需要安装Rhythmbox多媒体插件,安装时出现错误,错误代码如下: 下列软件包未满足的依赖关系: gstreamer0.10-ffmpeg: De ...

  3. Ubuntu 安装elasticsearch集群

    环境准备 准备三台服务器搭建集群环境 node1 192.168.177.171 node2 192.168.177.172 node3 192.168.177.173 其中node1为master节 ...

  4. Ubuntu安装Elasticsearch集群及Kibana

    1, 下载ES及Kibana https://www.elastic.co/cn/downloads/elasticsearch https://www.elastic.co/cn/downloads ...

  5. Ubuntu安装Flash Player插件

    如果按照Firefox的提示安装Flash插件,总是不成功.因此需要手工安装,步骤如下: 1. 下载Flash Player:http://get.adobe.com/cn/flashplayer/ ...

  6. 谷歌浏览器安装elasticsearch head 插件

    使用步骤 翻墙后用谷歌浏览器打开下面的地址,根据提示安装即可. https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiej ...

  7. Ubuntu安装Flash视频插件

    http://www.linuxidc.com/Linux/2014-05/101095.htm 转载于:https://www.cnblogs.com/acbingo/p/4501987.html

  8. ubuntu 安装浏览器flash插件

    将下载后的文件解压 ,解压后的文件 放到  /usr/lib/mozilla/plugins 要用root用户 cp libflashplayer.so  /usr/lib/mozilla/plugi ...

  9. ubuntu安装flash player插件问题

    尝试下载的时候发现第一个那个用URL下载不行的,只有选择压缩包. 下载来了解压后打开后就是这样: 然后还有两个步骤: ①:把libflashplayer.so复制的你浏览器的plugins目录里面,比 ...

最新文章

  1. 力扣(LeetCode)刷题,简单+中等题(第33期)
  2. 企业管理软件能带来什么
  3. No module named ‘XX‘
  4. 各种平台下Perl模块的安装方法
  5. 数据库:MySQL 团队开发规范,太详细了,建议收藏!
  6. linux系统级别及特殊字符的意义
  7. js根据已知数组长度创建一个一样长度的数组并初始化值为0
  8. linux后台运行命令和杀除命令
  9. Manual Create Database OMF
  10. OpenCV-图像处理(27、模板匹配(Template Match))
  11. 微信小程序实现微信登录详解(JAVA后台)
  12. 网站在线工具查询链接收录与优化文章收录情况
  13. c语言小熊时钟报告,C语言——小熊时钟.doc
  14. 手机动态:摩托罗拉edge s pro搭载骁龙870处理器
  15. OpenCV显示MNIST中的手写图片
  16. 35个极好的高质量PSD源文件网站三
  17. 一看就会QuickWAP入门(转)
  18. html判断app是否安装类似淘宝,H5浏览器如何检查手机中是否安装某个APP并打开
  19. 结构化编程(SP,structured programming)
  20. 给计算机专业大学生的忠告

热门文章

  1. c语言中文本作图,C语言绘图问题
  2. ironpython3发布时间_IronPython0.9.3发布了 —— 介绍一下Decorator
  3. sklearn 决策树例子_Sklearn库例子——决策树分类
  4. 错误: 找不到符号_Excel函数常见特殊符号、字符解读
  5. java nio空轮循_Java nio 空轮询bug到底是什么
  6. Coding the Matrix Week 1 The Vector Space作业
  7. 8种处理VMware报错的高效方法
  8. 量江湖获数千万元B轮融资,提出人工智能ASM投放解决方案
  9. 《深入解析IPv6(第3版)》——11.4 流量转换
  10. 内网监控利器——Nagios