ElasticSearch配置Head
发布日期:2021-05-07 14:49:32 浏览次数:22 分类:原创文章

本文共 1629 字,大约阅读时间需要 5 分钟。

ElasticSearch配置Head

安装配置node.js

  1. 去官网下载node最新版本:
    百度云:
    链接:https://pan.baidu.com/s/1usLKcn1FpSjKoaTh23eWZg
    提取码:19tn
    在这里插入图片描述
    获得node-v12.13.0-linux-x64.tar.xz文件,上传至linux
  2. 使用命令将xz文件转为tar文件
xz -d node-v12.13.0-linux-x64.tar.xz
  1. 解压tar文件:
tar -xvf node-v12.13.0-linux-x64.tar
  1. 配置环境变量
    拷贝安装路径,我的如下:/opt/local_software/node-v14.6.0-linux-x64
vi /etc/profile

添加如下代码:

export NODE_HOME=/opt/local_software/node-v14.6.0-linux-x64export PATH=$PATH:$NODE_HOME/bin 
  1. 更新环境变量
source /etc/profile
  1. 验证是否安装成功:
node -v

安装npm

如果没有安装,详见博客
验证版本:
在这里插入图片描述

安装es-head

下载路径:我的百度云
链接:https://pan.baidu.com/s/18pjsia7dTe_U4nP3gfC8dA
提取码:io4z

  1. 上传到linux中
  2. 解压文件
unzip elasticsearch-head-master.zip
  1. 进入文件夹,修改配置文件
  2. 修改Gruntfile.js文件
vi Gruntfile.js

增加一行hostname(可以输入/connect然后回车,直接定位到这一行)

connect: {          server: {                  options: {                          port: 9100,                       base: '.',                       hostname: '*',                       keepalive: true               }       }}
  1. 修改app.js文件
vi _site/app.js

修改这一行:后面的ip要为es的ip和端口(可以输入/this.bash然后回车,直接定位到这一行)

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.135.237:9201";
  1. 执行npm命令1(否则第七步大概率报错)
npm install phantomjs-prebuilt@2.1.16 --ignore-scripts
  1. 执行npm命令2
npm install
  1. 修改ES的elasticsearch.yml 文件
 vi config/elasticsearch.yml 

添加以下几行,因为ES默认不支持跨域,因此我们应该配置跨域的配置,才能让ES连接到head插件中

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

运行ES-head

运行ES
运行ES-head

前台启动head:

./node_modules/grunt/bin/grunt server 

出现以下界面
在这里插入图片描述
则可以访问页面:
http://192.168.135.237:9100/
在这里插入图片描述
修改一下文本框里面的ip地址,点击连接即可(我的是5台ES的集群,以下页面正好是5个节点):
在这里插入图片描述

后台启动head:

nohup ./node_modules/grunt/bin/grunt server > es-head-start.log 2>&1 & 
上一篇:ElasticSearch-Logstash6.0.0安装以及mysql数据导入ES
下一篇:ElasticSearch搭建冷热架构的集群(5台)

发表评论

最新留言

很好
[***.229.124.182]2025年04月14日 08时07分08秒