1. 安裝 ElasticSearch
直接下載 zip 包解壓即可,假設解壓到 E:\ESTool\elasticsearch-5.6.3
2. 安裝 nodejs 和 npm
head 插件本身是一個 nodejs 工程,需要安裝 npm,用來安裝依賴的包
3. 安裝 grunt-cli(用於運行 head)
全局安裝 grunt-cli,使用如下命令:
npm install -g grunt-cli (第二步中若配置了npm 的環境變量,則在任意目錄下執行皆可)
4. 安裝head 插件
a. 下載 head 源碼
git clone https://github.com/mobz/elasticsearch-head.git E:\ESTool\elasticsaerch-head
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
-----------------
