本文轉載至:https://www.cnblogs.com/hts-technology/p/8477258.html(針對5.0以上版本)
對於es5.0以下的版本可以參考:https://www.cnblogs.com/ljhdo/p/4887557.html(經過測試,可以順暢安裝配置)
es5以上版本安裝head需要安裝node和grunt(之前的直接用plugin命令即可安裝)
(一)從地址:https://nodejs.org/en/download/ 下載相應系統的msi,雙擊安裝。
(二)安裝完成用cmd進入安裝目錄執行 node -v可查看版本號
(三)執行 npm install -g grunt-cli 安裝grunt ,安裝完成后執行grunt -version查看是否安裝成功,會顯示安裝的版本號
(四)開始安裝head
① 進入安裝目錄下的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的注釋(也就是去掉#)
②雙擊elasticsearch.bat重啟es
③在https://github.com/mobz/elasticsearch-head中下載head插件,選擇下載zip
④解壓到指定文件夾下,G:\elasticsearch-6.6.2\elasticsearch-head-master 進入該文件夾,修改G:\elasticsearch-6.6.2\elasticsearch-head-master\Gruntfile.js 在對應的位置加上hostname:'*'
⑤在G:\elasticsearch-6.6.2\elasticsearch-head-master 下執行npm install 安裝完成后執行grunt server 或者npm run start 運行head插件,如果不成功重新安裝grunt。成功如下
⑥瀏覽器下訪問http://localhost:9100/
成功。
(五)、將es5.0以上版本轉換為windows服務
切換至es安裝的bin目錄下:執行elasticsearch-service install 出現以下情況表示切換成功
也有可以出現異常報錯:
通過C:\ elasticsearch-5.0.0 \ config \ jvm.options或ES_JAVA_OPTS進行配置
原因:在Windows上將Elasticsearch作為服務運行時的問題是,procrun需要設置最小堆,最大堆和線程堆棧大小。
解決方案:我們可以在 jvm.options文件中使用 -Xss1m(或者您想要的空間)。
打開jvm.options在文件。\ CONFIG文件夾並輸入-Xss1m線后