前言
前不久剛烏鴉嘴說完比較閑,就忙成狗,過了很久都沒有更新,趁周末趕緊之前總結(jié)的經(jīng)驗梳理一下谣拣。上次我們說完ELK三個組件的安裝和配置,但是看著這枯燥無味的命令行啟動的ELK族展,可能會讓大家覺得很抽象森缠,只知道安裝成功了,不知道怎么使用仪缸,不知道該從何下手贵涵;那么我們就可以給ES安裝幾個可視化控件,可以更方便恰画、更直觀的了解ES的結(jié)構(gòu)宾茂,以及之后為ES集群擴展做準備。
ps:由于在mac機子上ELK不好擴展拴还,所以往后的教程均在linux系統(tǒng)上實現(xiàn)跨晴,本文使用的系統(tǒng)為CentOS7。
elasticserch-head 安裝
簡介
關(guān)于ElasticSearch-Head官方介紹比較簡單片林,只有一句話:
ElasticSearch-Head 是一個與Elastic集群(Cluster)相交互的Web前臺端盆。
ES-Head的主要作用
它展現(xiàn)ES集群的拓撲結(jié)構(gòu),并且可以通過它來進行索引(Index)和節(jié)點(Node)級別的操作
它提供一組針對集群的查詢API费封,并將結(jié)果以json和表格形式返回
它提供一些快捷菜單焕妙,用以展現(xiàn)集群的各種狀態(tài)
安裝
一、安裝nodejs
打開終端輸入
curl -sL -o /etc/yum.repos.d/khara-nodejs.repo https://copr.fedoraproject.org/coprs/khara/nodejs/repo/epel-7/khara-nodejs-epel-7.repo
yum install -y nodejs nodejs-npm
二孝偎、安裝grunt
grunt是一個很方便的構(gòu)建工具访敌,可以進行打包壓縮凉敲、測試衣盾、執(zhí)行等等的工作寺旺,5.X里的head插件就是通過grunt啟動的。
npm install grunt-cli #安裝grunt-cli
npm install grunt #安裝grunt
grunt -version #查看版本
三势决、安裝git
yum remove git #移除之前老的git
git --version #查看是否安裝git
yum install git #安裝git
四阻塑、安裝head
新建一個文件夾elasticsearch-head
cd elasticsearch-head
git clone git://github.com/mobz/elasticsearch-head.git
npm install安裝head
可能會遇到的報錯
“查看報錯信息”Error: Cannot find module '/var/lib/elasticsearch/elasticsearch-head/node_modules/phantomjs-prebuilt/install.js'”,未找到” phantomjs-prebuilt/install.js”文件果复;”
使用 npm install phantomjs-prebuilt@2.1.13 --ignore-scripts 解決
修改/elasticsearch-head/_site/app.js
修改/elasticsearch-head/Gruntfile.js
grunt server & 運行head插件
http://locahost:9100/查看服務(wù)
如果“集群健康值: 未連接”
修改elasticsearch目錄下 conf/elasticsearch.yml
elasticsearch/conf目錄下 文件elasticsearch.yml中添加配置如下:
#避免出現(xiàn)跨域問題
http.cors.enabled: true
http.cors.allow-origin: "*"
重啟es 和head即可
ps:這里不著重介紹如何使用插件陈莽,大家可以自行去了解或者看我下一篇集群介紹。
elasticserch-kopf 安裝
簡介
Kopf是一個ElasticSearch的管理工具虽抄,它也提供了對ES集群操作的API走搁。是一個我非常喜歡,非常強大的工具迈窟。
安裝
使用git下載kopf
git clone git://github.com/lmenezes/elasticsearch-kopf.git
下載elasticserch-kopf 完成后會在用戶下創(chuàng)建elasticserch-kopf 文件夾
cd到elasticserch-kopf 目錄下
npm install 安裝kopf npm會自動檢索沒有安裝的插件
可能會遇到的問題
Local Npm module "grunt-contrib-copy" not found.? Is it installed?
Local Npm module "grunt-contrib-uglify" not found.? Is it installed?
Local Npm module "grunt-contrib-jshint" not found.? Is it installed?
Local Npm module "grunt-contrib-less" not found.? Is it installed?
Local Npm module "grunt-contrib-clean" not found.? Is it installed?
Local Npm module "grunt-contrib-watch" not found.? Is it installed?
Local Npm module "grunt-contrib-concurrent" not found.? Is it installed?
Local Npm module "grunt-contrib-nodemon" not found.? Is it installed?
Local Npm module "grunt-contrib-newer" not found.? Is it installed?
Warning: Task "copy:vendor" not found. Use --force to continue.
Aborted due to warnings.
這是因為grunt缺少對應(yīng)的module
通過命令
npm install module-名字 --save-dev?
把所有缺少的module安裝上即可
安裝完成運行
grunt server &
http://locahost:9000/查看服務(wù)
配置kopf 添加elasticserch服務(wù)端口即可私植。
elasticserch-bigdesk 安裝
簡介
Bigdesk為Elastic集群提供動態(tài)的圖表與統(tǒng)計數(shù)據(jù)。主要用于監(jiān)控集群性能车酣、CPU使用情況曲稼、內(nèi)存使用率等,方便更好的配置集群節(jié)點等湖员。
安裝
打開終端下載
git clone https://github.com/hlstudio/bigdesk.git
cd 到bigdesk/_site/目錄下
運行
python -m SimpleHTTPServer
而Linux默認是安裝Python的贫悄,所以只需要執(zhí)行python -m SimpleHTTPServer。
這就行了娘摔,而我們的HTTP服務(wù)在8000號端口上偵聽窄坦。你會得到下面的信息:
Serving HTTP on 0.0.0.0 port 8000 …
然后打開瀏覽器(IE或Firefox),然后輸入下面的URL:
http://localhost:8000
如果你的目錄下有一個叫 index.html 的文件名的文件凳寺,那么這個文件就會成為一個默認頁嫡丙,如果沒有這個文件,那么读第,目錄列表就會顯示出來曙博。
部分參考的文獻