ElasticSearch学习 - (二)windows下安装ElasticSearch5.X head插件

1、安装node.js

个人在网上搜集的这一篇博客介绍的十分详细,十分的感谢博主,地址为:
https://www.cnblogs.com/zhouyu2017/p/6485265.html

查看node.js版本

node -v

查看npm版本

npm -v

2、安装grunt

使用npm安装grunt

npm install -g grunt -cli

查看grunt版本

grunt -version

3、下载ElasticSearch-head压缩包

下载地址:https://github.com/mobz/elasticsearch-head,下载后解压缩。

4、修改head源码(也可以不修改,直接跳过这一步)

由于head的代码还是2.6版本的,直接执行有很多限制,比如无法跨机器访问。因此需要用户修改两个地方:

目录:head/Gruntfile.js:

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

增加hostname属性,设置为*

修改连接地址:
目录:head/_site/app.js

修改head的连接地址:

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";

把localhost修改成你es的服务器地址

5、修改ElasticSearch的配置

目录config/elasticsearch.yml

在配置文件末尾追加一下内容:

# 增加新的参数,这样head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin: "*"

注意,yml文件设置参数的时候:后面要有空格!

6、npm安装依赖

到elasticsearch-head-master目录下,运行命令:

npm install

如果速度较慢或者安装失败,可以使用国内镜像:
建议使用这种方式,速度更快

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

初次运行安装可能会报警告或错误。可以重新运行一次npm install。

最后,在head源代码目录下启动nodejs:

grunt server

这里写图片描述

Gruntfile.js引起的,缺少以下包
启动有可能报错,执行以下命令

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

7、访问head

这个时候,访问http://localhost:9100就可以访问head插件了

(记得要先启动ElasticSearch,再启动head插件)

这里写图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值