windows10下安装ElasticSearch的Head插件

  本地环境:Elasticsearch 6.7.1 

  es5以上版本安装head需要安装node和grunt(之前的直接用plugin命令即可安装)

  (一)从地址:https://nodejs.org/en/download/ 下载相应系统的msi,双击安装

  (二)安装完成用cmd进入安装目录执行 node -v可查看版本号

  (三) 安装淘宝镜像

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

  npm 和 cnpm区别

(1) 两者之间只是 node 中包管理器的不同。

(2) npm是node官方的包管理器。cnpm是个中国版的npm,是淘宝定制的 cnpm (gzip 压缩支持) 命令行工具代替默认的 npm。

(3)如果因为网络原因无法使用npm下载,那cnpm这个就派上用场了。

  执行 cnpm install -g grunt-cli 安装grunt 

  如果报如下错误 :无法加载文件 C:UsershpAppDataRoaming pmcnpm.ps1,因为在此系统上禁止运行脚本

  解决方法:1.以管理员身份运行power shell 2.输入set-ExecutionPolicy RemoteSigned 然后输入A 回车

  (四)安装完成后执行grunt -version查看是否安装成功,会显示安装的版本号

  (五)开始安装head

① 进入安装目录下的config目录,修改elasticsearch.yml文件.在文件的末尾加入以下代码

http.cors.enabled: true 
http.cors.allow-origin: "*"
node.master: true
node.data: true

 然后去掉network.host: 192.168.0.1的注释并改为network.host: 127.0.0.1,去掉node.name;http.port的注释(也就是去掉#)

②双击elasticsearch.bat重启es
③在https://github.com/mobz/elasticsearch-head中下载head插件,选择下载zip

④解压到指定文件夹下,E:programelasticsearch-6.7.1elasticsearch-head-master进入该文件夹,修改E:programelasticsearch-6.7.1elasticsearch-head-masterGruntfile.js 在对应的位置加上hostname:'*'

  注意为英文下的 单引号和逗号

⑤在E:programelasticsearch-6.7.1elasticsearch-head-master 下执行cnpm install 安装完成后执行grunt server 或者cnpm run start 运行head插件,如果不成功重新安装grunt。成功如下

⑥浏览器下访问http://localhost:9100/

安装head插件的最简单的方法:
直接在Chrome中安装插件: http://sina.lt/ftSr

转载:https://www.cnblogs.com/hts-technology/p/8477258.html

原文地址:https://www.cnblogs.com/personblog/p/14353890.html