安装Elasticsearch head
Elasticsearch head 是图形化界面管理ES的nodejs的web程序
安装步骤
- 下载插件
https://github.com/mobz/elasticsearch-head
elasticsearch-head-master.zip
- nodejs官网下载安装包
node-v6.9.2-linux-x64.tar.xz
- 将elasticsearch-head-master.zip和node-v6.9.2-linux-x64.tar.xz都导入到linux的/opt/software目录
- 安装nodejs
[atguigu@hadoop102 software]$ tar -zxvf node-v6.9.2-linux-x64.tar.gz -C /opt/module/
- 配置nodejs环境变量
[root@hadoop102 software]# vi /etc/profile
export NODE_HOME=/opt/module/node-v6.9.2-linux-x64
export PATH=$PATH:$NODE_HOME/bin
[root@hadoop102 software]# source /etc/profile
- 查看node和npm版本
[root@hadoop102 software]# node -v
v6.9.2
[root@hadoop102 software]# npm -v
3.10.9
- 解压head插件到/opt/module目录下
[atguigu@hadoop102 software]$ unzip elasticsearch-head-master.zip -d /opt/module/
- 查看当前head插件目录下有无node_modules/grunt目录,没有则执行命令创建
[atguigu@hadoop102 elasticsearch-head-master]$ npm install grunt --save
- 安装head插件
[atguigu@hadoop102 elasticsearch-head-master]$ npm install -g cnpm --registry=https://registry.npm.taobao.org
- 安装grunt
[atguigu@hadoop102 elasticsearch-head-master]$ npm install -g grunt-cli
- 编辑Gruntfile.js
[atguigu@hadoop102 elasticsearch-head-master]$ vim Gruntfile.js
文件93行添加hostname:'0.0.0.0'
options: {
hostname:'0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
- 检查head根目录下是否存在base文件夹
没有:将 _site下的base文件夹及其内容复制到head根目录下
[atguigu@hadoop102 elasticsearch-head-master]$ mkdir base
[atguigu@hadoop102 _site]$ cp base/* ../base/
- 启动grunt server
[atguigu@hadoop102 elasticsearch-head-master]$ grunt server -d
Running "connect:server" (connect) task
[D] Task source: /opt/module/elasticsearch-head-master/node_modules/grunt-contrib-connect/tasks/connect.js
Waiting forever...
Started connect web server on http://localhost:9100
- 浏览器访问head插件
- 启动集群插件后发现集群未连接
在/opt/module/elasticsearch-5.2.2/config路径下修改配置文件elasticsearch.yml,在文件末尾增加
[atguigu@hadoop102 config]$ pwd
/opt/module/elasticsearch-5.2.2/config
[atguigu@hadoop102 config]$ vi elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
再重新启动elasticsearch
如何后台启动插件
后台运行
nohup grunt server &
关闭
好像停不了,网上说的ps -ef|grep head 找不到进程
可能遇到的问题
如果提示grunt的模块没有安装:
Local Npm module “grunt-contrib-clean” not found. Is it installed?
Local Npm module “grunt-contrib-concat” not found. Is it installed?
Local Npm module “grunt-contrib-watch” not found. Is it installed?
Local Npm module “grunt-contrib-connect” not found. Is it installed?
Local Npm module “grunt-contrib-copy” not found. Is it installed?
Local Npm module “grunt-contrib-jasmine” not found. Is it installed?
Warning: Task “connect:server” not found. Use –force to continue.
执行以下命令:
npm install grunt-contrib-clean -registry=https://registry.npm.taobao.org
npm install grunt-contrib-concat -registry=https://registry.npm.taobao.org
npm install grunt-contrib-watch -registry=https://registry.npm.taobao.org
npm install grunt-contrib-connect -registry=https://registry.npm.taobao.org
npm install grunt-contrib-copy -registry=https://registry.npm.taobao.org
npm install grunt-contrib-jasmine -registry=https://registry.npm.taobao.org
最后一个模块可能安装不成功,但是不影响使用
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/135340.html