1. 安装 ElasticSearchnode
直接下载 zip 包解压便可,假设解压到 E:\ESTool\elasticsearch-5.6.3git
2. 安装 nodejs 和 npmgithub
head 插件自己是一个 nodejs 工程,须要安装 npm,用来安装依赖的包npm
3. 安装 grunt-cli(用于运行 head)跨域
全局安装 grunt-cli,使用以下命令:bash
npm install -g grunt-cli (第二步中若配置了npm 的环境变量,则在任意目录下执行皆可)cors
4. 安装head 插件elasticsearch
a. 下载 head 源码grunt
git clone https:
//github
.com
/mobz/elasticsearch-head
.git E:\ESTool\elasticsaerch-head
spa
b. 安装插件
cd E:\ESTool\elasticsaerch-head
npm install
5. 修改 head 配置
打开elasticsearch-head-master/Gruntfile.js,找到下面connect属性,新增hostname: ‘0.0.0.0’:
connect: { server: { options: { hostname: '0.0.0.0', port: 9100, base: '.', keepalive: true } } }
6. 修改 ES 的配置,增长跨域的配置,使得head 插件可以访问到 es
修改elasticsearch.yml文件,增长以下内容:
http.cors.enabled:
true
http.cors.allow-origin:
"*"
7. 启动 es 和 head插件
cd
elasticsearch-
5.6.3
/ && .
/bin/elasticsearch.bat
cd
elasticsearch-
head
/ &&
grunt
server
head 插件监听在 9100 端口
经过 localhost:9100便可访问
-----------------
END
-----------------