一.es5以上版本安装head需要安装node和grunt(之前的直接用plugin命令即可安装)。
二.安装nodejs。
从地址https://nodejs.org/en/download/下载相应系统的msi,双击安装。

三.安装grunt。
执行 npm install -g grunt-cli 安装grunt ,安装完成后执行grunt -version查看是否安装成功,会显示安装的版本号。
四:修改elasticsearch的参数。
编辑config/elasticsearch.yml:
# 换个集群的名字,免得跟别人的集群混在一起
cluster.name: xzp
# 换个节点名字
node.name: node-1
# 修改一下ES的监听地址,这样别的机器也可以访问
network.host: 0.0.0.0
# 默认的就好
http.port: 9200
# 增加新的参数,这样head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin: "*"
注意:设置参数的时候:后面要加空格。
修改后重启es。
五.安装head。
1.下载head插件源码https://github.com/mobz/elasticsearch-head。
2.修改Gruntfile.js。(在如下地方添加hostname: '*',)

3.在head源码目录下执行npm install,安装完成后执行grunt server 或者npm run start 运行head插件,如果不成功重新安装grunt。
参考:1.https://blog.csdn.net/shubingzhuoxue/article/details/80998738;
2.https://www.cnblogs.com/hts-technology/p/8477258.html;
网友评论