本次安裝在win7下,linux操作差不多。
Elasticsearch的版本是6.5.1
一、前置條件
1、安裝nodejs,如果已經安裝了,檢查一下版本,最好大於6以上,不然后面會失敗,官網上已經到10了
https://nodejs.org/en/download/
2、安裝grunt
Grunt 是基於 Node.js 的項目構建工具
npm install -g grunt-cli
驗證一下:
二、下載head包
https://github.com/mobz/elasticsearch-head 下載zip包后解壓
三、安裝各種依賴
進入elasticsearch-head-master目錄
使用命令:npm install
這里提示修復22個脆弱性漏洞什么的,還有6個事高危的,可以根據提示修復一下:npm audit fix
四、配置elasticsearch
vi config/elasticsearch.yml
加入:
# ---------------------------------- head plugin ----------------------------------- # head等插件訪問es。設置參數的時候[key: value]中,冒號后面要有空格 http.cors.enabled: true http.cors.allow-origin: "*"
五、修改elasticsearch-head-master配置
修改Gruntfile.js文件里的connect屬性,加入hostname。
如果出現以下問題,說明是js文件格式有問題,比如中文逗號或者沒有逗號。
六、運行head插件
E:\elasticsearch-head-master>grunt server
頁面上鏈接測試一下,head安裝在win7上,elasticseach安裝在虛擬機192.168.31.10上,是一個單節點,測試OK。
################################################################################
一、安裝kibana插件
地址:https://www.elastic.co/downloads/kibana
二、配置
修改config目錄下kibana.yml文件
# The URL of the Elasticsearch instance to use for all your queries.
elasticsearch.url: "http://192.168.31.10:9200"
如果需要非本機訪問kibana,則需要修改下面的配置,假設kibana運行在192.168.31.1上
# To allow connections from remote users, set this parameter to a non-loopback address. #server.host: "localhost" server.host:192.168.31.1