安装elasticsearch-head插件

0.环境需要

系统搭载的是centos6.8,已经部署好elasticsearch

(es安装参考本人帖子https://blog.csdn.net/qq_39626154/article/details/81939440

node.js

官网下载地址https://nodejs.org/en/download/

下载源码包放在/opt/下

一、安装配置node

解压源码包node-v8.11.4-linux-x64.tar.xz并移到安装目录/usr/local/node

[root@localhost opt]# xz -d node-v8.11.4-linux-x64.tar.xz 

[root@localhost opt]# tar xf node-v8.11.4-linux-x64.tar

[root@localhost opt]# mv node-v8.11.4-linux-x64 /usr/local/node

修改系统环境变量参数

[root@localhost opt]# vim /etc/profile

文件内容末尾增加:

#set for nodejs
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH

声明系统环境变量

[root@localhost opt]# source /etc/profile

查看node版本

[root@localhost opt]# node -v
v8.11.4

二、下载安装elastichsearch-head插件

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

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

[root@localhost elasticsearch-head]# npm install


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
npm ERR! Exit status 1
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-08-27T08_46_50_939Z-debug.log

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

[root@localhost elasticsearch-head]# npm install phantomjs-prebuilt@2.1.16 --ignore-scripts

三、启动elastichsearch-head

[root@localhost elasticsearch-head]# npm run start 


> elasticsearch-head@0.0.0 start /usr/local/elasticsearch-head
> grunt server

>> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?
(node:3685) ExperimentalWarning: The http2 module is an experimental API.

Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

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

四、连接没响应问题解决

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

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

修改后重启elasticsearch

重新连接可看到连接上了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值