爲什麼要使用elasticsearch-head
訪問http://127.0.0.1:9200/看的的web界面並不是很友好,此時我可以使用elasticsearch-head插件來提供友好的web界面。
ElasticSearch-head是一個H5編寫的ElasticSearch集羣操作和管理工具,可以對集羣進行傻瓜式操作。
- 顯示集羣的拓撲,並且能夠執行索引和節點級別操作
- 搜索接口能夠查詢集羣中原始json或表格格式的檢索數據
- 能夠快速訪問並顯示集羣的狀態
- 有一個輸入窗口,允許任意調用RESTful API。這個接口包含幾個選項,可以組合在一起以產生有趣的結果;
- 5.0版本之前可以通過plugin名安裝,5.0之後可以獨立運行。
方法1、安裝elasticsearch-head插件
1.登錄github.com搜索elasticsearch-head然後下載:
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
2.檢查是否安裝了node.js,如果沒有安裝,在官網上現在.pkg文件安裝就可以了
npm -install
3.運行elasticsearch-head
npm run start
(1)啓動日誌:
(2)訪問http://localhost:9100進入web界面:
4.在web界面上看到的集羣未連接,此時要進行跨越請求配置:
cd /Users/shifeifei/Software/elasticsearch-6.2.4/config
vim elasticsearch.yml
文件尾部添加:
http.cors.enabled: true
http.cors.allow-origin: "*"
重啓elastiasearch服務,刷新http://localhost:9100頁面
方法2、安裝Elasticsearch-Head
1.插件安裝方式(推薦)
#在Elasticsearch目錄下
$/bin/plugin -install mobz/elasticsearch-head
如果提示
ERROR: unknown command [-install]. Use [-h] option to list available commands
是因爲好像2.0以上的版本-install 變成了 install了。
elasticsearch/bin/plugin install mobz/elasticsearch-head
2.下載安裝方式
從https://github.com/mobz/elasticsearch-head下載ZIP包。
在 elasticsearch 目錄下創建目錄/plugins/head/_site 並且將剛剛解壓的elasticsearch-head-master目錄下所有內容COPY到當前創建的/plugins/head/_site/目錄下即可。
二、重啓Elasticsearch。訪問。
head 插件是最好安裝的其中一個, elasticsearch head 是集羣管理工具、數據可視化、增刪改查工具, Elasticsearch 語句可視化(下面會講到)
重啓Elasticsearch。訪問。
訪問地址是http://{你的ip地址}:9200/_plugin/head/
http 端口默認是9200 。
https://www.sojson.com/blog/85.html
方法3、搭建ELK(6.4.0)日誌分析系統----Elasticsearch插件篇
地址 : https://blog.csdn.net/kumara_00/article/details/82706955
安裝Elasticsearch插件
下載安裝包:
下載地址:https://github.com/mobz/elasticsearch-head
解壓安裝包
unzip elasticsearch-head-master.zip
安裝nodejs
下載地址:https://nodejs.org/en/download/
解壓安裝包
tar -Jxv -f node-v10.8.0-linux-x64.tar.xz
解壓完成後進入文件夾,使用pwd打印當前目錄地址, vim /etc/profile然後配置環境變量:
運行 source /etc/profile,使/etc/profile文件生效
輸入 node -v 檢查安裝是否成功,安裝成功會顯示node版本
安裝npm
配置全局環境使用node和npm
ln -s /usr/elk/node-v10.8.0-linux-x64/bin/npm /usr/local/bin/npm
ln -s /usr/elk/node-v10.8.0-linux-x64/bin/node /usr/local/bin/node
建立鏈接後將node的bean目錄配置到用戶環境變量中
vi .bash_profile
#配置環境變量
PATH=$PATH:<PATH 1>:<PATH 2>:---:/usr/elk/node-v10.8.0-linux-x64/bin
#執行更改
source .bash_profile
#驗證 隨便找個目錄
node -v
npm -v
運行命令安裝npm
#安裝當前目錄
npm install grunt
#安裝全局目錄
npm install -g grunt-cli
修改Elasticsearch配置文件
修改Gruntfile.js
在elasticsearch-head-master目錄下,使用命令 vim Gruntfile.js 修改其中參數如下:
啓動elasticsearch-head
在elasticsearch-head-master/目錄下,運行啓動命令 grunt server
接着即可通過IP:9100端口訪問頁面
運行報錯:
npm install grunt-contrib-jasmine
運行命令把缺的東西都安裝好。然後可以啓動,但是還有報錯:
解決方案:
npm install [email protected] --ignore-scripts
啓動後進入IP:9100訪問頁面
後臺啓動elasticsearch-head
後臺啓動grunt server命令 nohup grunt server &exit
如果想關閉head插件,使用linux查找進程命令 ps aux|grep head
結束進程 kill 進程號
Elasticsearch6.X中head連接不上es
解決辦法 :
1、在es6.x中連接不到head。
需要在配置文件conf/elasticsearch.yml中添加:
http.cors.enabled: true
http.cors.allow-origin: "*"
修改完,重啓es和head,則可以連接
關閉ES:control+c或
2、使用命令kill殺掉服務器的ES進程即可。
1、查找ES進程
ps -ef | grep elastic
2、殺掉ES進程
kill- 9 2389(進程號)
3、重啓ES
sh elasticsearch -d
2、
參考鏈接 :
head插件安裝 : https://www.sogou.com/link?url=hedJjaC291OV7dVab-QfvHtdr0qpeLU_My-09JFxBhOo1k6h8MknKQ…
https://blog.csdn.net/kumara_00/article/details/82706955
https://segmentfault.com/a/1190000015145850
https://blog.csdn.net/qq_33863843/article/details/78864618?utm_source=distribute.pc_relevant.none-task