目錄
- 環境
- 安裝node
- 安裝grunt
- elasticsearch-head
- 運行
- 修改elasticsearch.yml
- 排查問題
環境
安裝elasticsearch-head插件,需要依賴nodeJs環境,故首先我們先搭建nodeJs環境;
此part先將此篇文章需要的各個官網列出來:
node官網:https://nodejs.org/en/download/
node中文網:http://nodejs.cn/download/current/
elasticsearch-head GitHub:https://github.com/mobz/elasticsearch-head
安裝node
- 進入node官網,依據自己的系統選擇需要的安裝包;

等待node.msi下載完成,雙擊,next一路安裝, - 安裝完成,輸入
node -version

安裝grunt
- 全域安裝grunt
grunt構建工具,可以進行打包壓縮、測驗、執行等等的作業,head插件就是通過grunt啟動的,因此需要安裝grunt:
注意:路徑切到nodejs安裝目錄下
此外執行下面的安裝grunt命令之前,先配置阿里鏡像,否則安裝速度特別慢;
配置阿里鏡像命令:npm config set registry https://registry.npm.taobao.org
安裝grunt命令:npm install -g grunt-cli
-g 代表是全域安裝

- 安裝完成后,執行
grunt -version查看是否安裝成功,會顯示安裝的版本號;

elasticsearch-head
-
node安裝完成之后,下面開始安裝head插件,從GitHub上下載壓縮包,解壓縮;

解壓縮檔案如下:

-
修改
F:\elasticsearch-head-master\Gruntfile.js(head解壓縮目錄) 在對應的位置加上hostname: '*'

注意:存在空格 -
進入head插件目錄,輸入命令
npm install

-
命令
npm run start運行head插件

運行
瀏覽器中輸入上面的地址http://localhost:9100,如圖說明head插件已經安裝成功了,

但是細心的小伙伴會發現,此時我們并未注冊任何ES 服務,主要是因為本地ES服務沒有啟動,下面將開始修改ES組態檔,將服務注冊,
修改elasticsearch.yml
- 進入
elasticsearch安裝目錄下的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: 0.0.0.0; -
去掉
cluster.name;node.name;http.port的注釋(也就是去掉#)


排查問題
上次運行ES服務,是沒有問題,但是經過上面改動之后,發現雙擊elasticsearch.bat閃退,無法啟動;
首先會考慮到記憶體問題,但是上次啟動沒有問題;
其次,檢查新加配置格式是否正確,key: value一定要存在空格,否則報錯;
最后,進入日志檔案中看錯誤資訊;

解決鏈接參考:https://blog.csdn.net/xuan_lu/article/details/120115312

- 經過上面一系列操作之后,重啟head插件,重啟ES服務;

我們本地服務已經注冊在上面,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/297790.html
標籤:其他
