专栏首页菲宇安装elasticsearch-head插件

安装elasticsearch-head插件

环境

centos7
elastichsearch-6.2.3
node v8.11.1

安装elasticsearch

安装elasticsearch请查看:https://blog.csdn.net/mjlfto/article/details/79769152

安装node

安装elasticsearch-head插件需要nodejs的支持,所以此处讲解一下安装nodejs步骤

1.到nodejs官网现在最新nodejs,官网下载地址:https://nodejs.org/en/download/

2. 解压压缩包

3.在/etc/profile中配置好path环境变量

4.执行node -v验证安装

[root@localhost elasticsearch-head]# node -v
v8.11.1
[root@localhost elasticsearch-head]# 

下载elastichsearch-head插件

1.地址:https://github.com/mobz/elasticsearch-head 2.安装git :yum install git 3.clone elasticsearch-head: git clone https://github.com/mobz/elasticsearch-head.git

安装elastichsearch-head插件

到elasticsearch-head目录下, 执行npm install 命令, 执行该命名可能会出现以下错误:

[root@localhost elasticsearch-head]# npm install 

> phantomjs-prebuilt@2.1.16 install /home/a123/elasticsearch-6.2.3/plugins/elasticsearch-head/node_modules/phantomjs-prebuilt
> node install.js

sh: node: command not found
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-03-31T11_39_28_566Z-debug.log

此时忽略phantomjs-prebuilt@2.1.16,执行命令如下

[root@localhost elasticsearch-head]# npm install phantomjs-prebuilt@2.1.16 --ignore-scripts
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ phantomjs-prebuilt@2.1.16
added 66 packages and removed 4 packages in 18.237s
[root@localhost elasticsearch-head]# ls

启动elastichsearch-head

npm run start
验证elasticsearch-head,在浏览器中输入主机地址和端口

重启elastichsearch

1.当重启elasticsearch可能会出现以下错误, 这个是因为不能将elasticsearch-head放到plugins文件夹下

[a123@localhost bin]$ ./elasticsearch
Picked up _JAVA_OPTIONS: -Xms64m -Xmx64m -Xmn32m
Picked up _JAVA_OPTIONS: -Xms64m -Xmx64m -Xmn32m
Picked up _JAVA_OPTIONS: -Xms64m -Xmx64m -Xmn32m
[2018-03-31T20:25:19,776][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: property [elasticsearch.version] is missing for plugin [head]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.3.jar:6.2.3]
    at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.3.jar:6.2.3]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.3.jar:6.2.3]
Caused by: java.lang.IllegalArgumentException: property [elasticsearch.version] is missing for plugin [head]
    at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:226) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:184) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.bootstrap.Spawner.spawnNativePluginControllers(Spawner.java:75) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:167) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.3.jar:6.2.3]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.3.jar:6.2.3]
    ... 6 more

2.当重启服务器之后发现依旧如上图, 还是无法正常连接到elasticsearch服务,这是因为elasticsearch服务与elasticsearch-head之间可能存在跨越,修改elasticsearch配置即可,在elastichsearch.yml中添加如下命名即可:

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

重新连接如下:

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • Django项目之Elasticsearch搜索引擎

    sudo docker image pull delron/elasticsearch-ik:2.4.6-1.0

    菲宇
  • 搭建ELK日志分析系统

    ELK Stack 是Elasticsearch、Logstash、Kiban三个开源软件的组合。在实时数据检索和分析场合,三者通常是配合共用,而且又都先后归于...

    菲宇
  • CentOS7上安装Elasticsearch+Logstash+Kibana日志管理系统

    集中日志记录在尝试识别服务器或应用程序的问题时非常有用,因为它允许您在单个位置搜索所有日志。它也很有用,因为它允许您通过在特定时间范围内关联其日志来识别跨多个服...

    菲宇
  • [喵咪BELK实战(2)] elasticsearch+kibana搭建

    [喵咪BELK实战(2)] elasticsearch+kibana搭建 ? 前言 上一节我们介绍了日志系统和BELK之后就要到激动人心的安装环境了,实践出真知...

    喵了个咪233
  • elk安装和使用

    启动成功后在控制台随便输入文字,此时会同步到elasticsearch中(前提是在运行中),elasticsearch中会添加elasticsearch-201...

    GreizLiao
  • Elasticsearch 教程(1)安装【CentOS版】

    我们首先要配置java环境,这个需要Java8或者更新的包。一般执行以下命令时可以看看Java版本是否符合:

    魔王卷子
  • Elasticsearch(一)——环境配置

    elasticsearch 的官方中文网址:https://www.elastic.co/cn/products/elasticsearch.点击downloa...

    羊羽shine
  • Elasticsearch在后台启动 转

    (adsbygoogle = window.adsbygoogle || []).push({});

    双面人
  • ELK 基础安装配置

    老七Linux
  • Java开发环境系列:全文搜索引擎elasticsearch的安装(windows、linux)

    Elastic Search要求使用较高版本JDK,本文使用D:\DevTools\jdk1.8.0_131,并配置环境变量

    架构师小跟班

扫码关注云+社区

领取腾讯云代金券

玩转腾讯云 有奖征文活动