天天看點

ELK之插件安裝Eelasticsearch插件安裝

Eelasticsearch插件安裝

  • head插件
  • bigdesk插件
  • cerebro插件

head插件

elasticsearch5.0以下版本可以直接在elasticsearch目錄下執行對應的指令安裝head插件: https://github.com/mobz/elasticsearch-head

# /usr/share/elasticsearch/bin/plugin install mobz/elasticsearch-head
open http://localhost:9200/_plugin/head/
           
5.0以上不支援直接安裝,需要獨立服務運作

elasticsearch6.0 head插件的安裝方法:

1.安裝Node.js

官網:https://nodejs.org/en/download/

wget https://nodejs.org/dist/v8/node-v8.tar.gz  #下載下傳安裝包  
#解壓編譯安裝
tar xf node-v8.tar.gz 
cd node-v8
./configure --prefix=/usr/local/node-8.9.1 && make -j 8 && make install
ln -s /usr/local/node-/ /usr/local/node

#配置環境變量
# tail -1 /etc/profile      
export PATH=$PATH:/usr/local/node/bin

# node -v   #檢視版本
v8
# npm -v

           
centos7要求新版nodejs,如果centos6直接yum install npm即可

2.下載下傳安裝head:

# git clone git://github.com/mobz/elasticsearch-head.git
# cd elasticsearch-head
# npm install -g grunt --registry=https://registry.npm.taobao.org  
# npm install  --registry=https://registry.npm.taobao.org
           

在elasticsearch-head目錄下node_modules/grunt下如果沒有grunt二進制程式,需要執行

# cd elasticsearch-head
# npm install grunt --save
           

3.修改配置

修改伺服器監聽位址:

目錄:elasticsearch-head/Gruntfile.js

connect: {
    server: {
        options: {
            port: ,
            hostname: '*',
            base: '.',
            keepalive: true
        }
    }
}
           

增加hostname屬性,設定為*

修改head連接配接位址:

目錄:elasticsearch-head/_site/app.js

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
把localhost修改成你es的伺服器位址,如:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.20.101:9200";
           

解決使用Head插件連結不上叢集問題:增加如下兩行

# tail -2 /usr/local/elk/elasticsearch-6.0.0/config/elasticsearch.yml  
http.cors.enabled: true
http.cors.allow-origin: "*"
           

啟動:

# cd node_modules/grunt/bin/
# ./grunt server
           

1.停止elasticsearch主程序并不會影響到head 9100的通路

2.如果要将head程序放入背景運作,可以使用nohup 加&背景運作或者screen

bigdesk插件

要想最快的了解 ES 各節點的性能細節,推薦使用 bigdesk 插件,其原作者為

lukas-vlcek。但是從 Elasticsearch 1.4 版本開始就不再更新了。國内有使用者 fork出來繼續維護到支援 5.0 版本,GitHub 位址見:https://github.com/hlstudio/bigdesk

bigdesk 通過浏覽器直連 ES 節點,發起 RESTful 請求,并渲染結果成圖。是以其安裝部署極其簡單:

# git clone https://github.com/hlstudio/bigdesk
# cd bigdesk/_site
# python -mSimpleHTTPServer
Serving HTTP on  port  ...
           

cerebro插件

cerebro 這個名字大家可能覺得很陌生,其實它就是過去的 kopf 插件!因為

Elasticsearch 5.0 不再支援 site plugin,是以 kopf 作者放棄了原項目,另起爐竈搞

了 cerebro,以獨立的單頁應用形式,繼續支援新版本下 Elasticsearch 的管理工

作。

#kopf
# /usr/share/elasticsearch/bin/plugin install lmenezes/elasticsearch-kopf
open http://localhost:9200/_plugin/kopf/
           

安裝部署:

realease版本下載下傳位址:https://github.com/lmenezes/cerebro/releases

解壓安裝包到一個自定義目錄(非elasticsearch或kibana的plugin目錄),Run bin/cerebro(or bin/cerebro.bat if on Windows)。界面會讓你輸入es域名,連接配接即可。

然後浏覽器打開 http://localhost:9000即可。

Elasticsearch的監控方案:bigdesk、cerebro、zabbix等
elk