安装head插件 (es 6.2)
2018-05-21 本文已影响888人
g0
head插件是一个es集群的web前端工具,我们可以es查询,查看es集群状态等
es 6.2.2版本es自带 需要独立安装
- 安装nodejs
下载https://github.com/coreybutler/nvm-windows 安装

建议下载第一个
- nvm install v8.9.4
npm加速 全局安装cnpm 指定来源淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org

- git clone git://github.com/mobz/elasticsearch-head.git
注意head不要解压到es的plugin文件夹下
- cd elasticsearch-head
修改Head主目录下的Gruntfile.js,由于默认文件中是没有hostname属性的,我们需要手动添加:

为什么需要修改配置文件:
head插件连接elasticsearch需要注意的点:
因为head插件是一个独立进程,启动后是一个独立的服务器外加端口,比如我的虚拟机ip地址:http://192.168.0.111:9100/
而elasticsearch启动后也是一个独立的进程,ip地址:http://192.168.0.111:9200/
这样两个独立进程,虽然服务器ip地址相同,但是端口不同,此时会发生跨域的情况。。
于是官方给出这样一段话,我们在对elasticsearch启动的时候追加两个配置文件属性即可防止跨域。
添加
http.cors.enabled: true
http.cors.allow-origin: "*"

- npm install
- npm run start