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
-----------------