0x01 緣由
最近,比較蛋疼,産品在公司戰略層面上已經開始遠離,但是外場又有項目。因為現網運作環境elasticsearch的不穩定性,最近嘗試安裝了head、hq、bigdesk、kibana、x-pack去監控線上es運作情況。不管效果咋樣吧,先說下安裝的心路曆程。
0x02 安裝步驟
建議相關安裝步驟從官方幫助文檔中擷取,在網上查閱的安裝辦法千差萬别,容易走上彎路。
1.安裝es
這個過程網上有很多教程,相對較簡單。關鍵是配置項。此次安裝示例為elasticsearc 5.1.1
2.安裝kibana
kibana是一個為 ElasticSearch 提供的資料分析的 Web 接口。可使用它對日志進行高效的搜尋、可視化、分析等各種操作。
2.1下載下傳與es對應的版本
wget https://artifacts.elastic.co/downloads/kibana/kibana-5.1.1-linux-x86_64.tar.gz
sha1sum kibana-5.1.1-linux-x86_64.tar.gz
tar -xzf kibana-5.1.1-linux-x86_64.tar.gz
cd kibana/
2.2相關配置
cd kibana-5.1.1-linux-x86_64/config
vim kibana.yml
配置關鍵點:
2.3驗證是否安裝成功
http://localhost:5601/,可以打開Kibana,此時需要輸入使用者名和密碼登入,預設分别是 elastic 和 changeme。
2.4 需要關聯索引
在下圖箭頭出添加你的索引命名:可以帶通配符*
現在基本kibana就安裝完成了。
3.安裝x-pack
3.1 此處完全參考官方教程:https://www.elastic.co/guide/en/x-pack/current/monitoring-cluster.html
1.Install X-Pack into Kibana.
bin/kibana-plugin install x-pack
2.Configure Kibana
3.Start Kibana by running bin/kibana.
4.Install X-Pack on the Elasticsearch nodes in your production cluster.
bin/elasticsearch-plugin install x-pack
Configure each Elasticsearch node in the cluster you are monitoring to send metrics to your monitoring cluster by configuring an HTTP exporter in the xpack.monitoring.exporters settings in elasticsearch.yml.
xpack.monitoring.exporters:
id1:
type: http
host: ["http://es-mon-1:9200", "http://es-mon2:9200"]
auth.username: remote_monitor
auth.password: changeme
5.Restart Elasticsearch on the nodes in your production cluster.
3.2 申請license
https://license.elastic.co/registration 簡單填寫相關資訊,然後會将相關資訊發到郵箱。
3.3 安裝license
curl -XPUT -u elastic 'http://<host>:<port>/_xpack/license' -H "Content-Type: application/json" -d @license.json
-u elastic 内置的超級使用者,預設密碼是changeme.
<host> Es IP
<port> Http 端口
license.json 申請網站下下載下傳的
0x03 使用
kibana + x-pack後多了一個監控界面,如下圖:
bigdesk使用和HQ使用類似:
0x04 總結
無論是開源程式,還是自己編寫的服務,有一個好的監控工具,是保證産品線上上運作穩定的必備工具。