Kibana簡介
Kibana 是一個免費且開放的用戶界面,能夠讓您對 Elasticsearch 數據進行可視化,並讓您在 Elastic Stack 中進行導航。您可以進行各種操作,從跟蹤查詢負載,到理解請求如何流經您的整個應用,都能輕松完成。
- Kibana是ElasticSearch的一個工具,用來分析ES中的數據並以各種圖形界面顯示出來
- 可以作為ElasticSearch的一個客戶端,在Kibana中可以很輕松的調用ES的RESTful接口
下載地址
https://elasticsearch.cn/download/
https://artifacts.elastic.co/downloads/kibana/kibana-7.6.0-linux-x86_64.tar.gz
系統版本:CentOS Linux release 7.3.1611 (Core)
安裝
下載壓縮包並解壓之后,需要關注兩個文件夾,一個是config文件夾,里面的kibana.yml是配置文件;一個是bin文件夾,里面有kibana啟動的bat腳本
上傳kibana-7.6.0-linux-x86_64.tar.gz文件到 /opt目錄下,並解壓
tar -zxvf kibana-7.6.0-linux-x86_64.tar.gz
在目錄/usr/local下創建目錄:kibana-7.6.0
mkdir kibana-7.6.0
復制解壓后的文件到/usr/local/kibana-7.6.0目錄下
cp -R /opt/kibana-7.6.0-linux-x86_64/* /usr/local/kibana-7.6.0/
設置 kibana-7.6.0目錄權限給elasticsearch用戶
chown -R elasticsearch:elasticsearch kibana-7.6.0/
設置配置文件
修改/usr/local/kibana-7.6.0/config/kibana.yml
設置ElasticSearch的訪問地址:
elasticsearch.hosts: ["http://192.168.8.190:9200"]
設置Kibana的訪問地址,如果不設置則只能本機訪問。
server.host: "192.168.8.190"
# Kibana is served by a back end server. This setting specifies the port to use. #server.port: 5601 # Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values. # The default is 'localhost', which usually means remote machines will not be able to connect. # To allow connections from remote users, set this parameter to a non-loopback address. server.host: "192.168.8.190" # Enables you to specify a path to mount Kibana at if you are running behind a proxy. # Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath # from requests it receives, and to prevent a deprecation warning at startup. # This setting cannot end in a slash. #server.basePath: "" # Specifies whether Kibana should rewrite requests that are prefixed with # `server.basePath` or require that they are rewritten by your reverse proxy. # This setting was effectively always `false` before Kibana 6.3 and will # default to `true` starting in Kibana 7.0. #server.rewriteBasePath: false # The maximum payload size in bytes for incoming server requests. #server.maxPayloadBytes: 1048576 # Kibana is served by a back end server. This setting specifies the port to use. #server.port: 5601 # Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values. # The default is 'localhost', which usually means remote machines will not be able to connect. # To allow connections from remote users, set this parameter to a non-loopback address. server.host: "192.168.8.190" # Enables you to specify a path to mount Kibana at if you are running behind a proxy. # Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath # from requests it receives, and to prevent a deprecation warning at startup. # This setting cannot end in a slash. #server.basePath: ""
啟動
如果用root用戶啟動會報錯:
Kibana should not be run as root. Use --allow-root to continue.
切換elasticsearch用戶,並進入目錄:/usr/local/kibana-7.6.0/bin 啟動服務
./kibana
當看到以下提示信息,說明啟動成功
log [07:05:19.737] [info][status][plugin:snapshot_restore@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.747] [info][status][plugin:input_control_vis@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.751] [info][status][plugin:kibana_react@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.759] [info][status][plugin:management@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.761] [info][status][plugin:navigation@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.766] [info][status][plugin:region_map@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.779] [info][status][plugin:telemetry@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.854] [info][status][plugin:timelion@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.857] [info][status][plugin:ui_metric@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.860] [info][status][plugin:markdown_vis@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.863] [info][status][plugin:metric_vis@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.867] [info][status][plugin:table_vis@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.869] [info][status][plugin:tagcloud@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.872] [info][status][plugin:vega@7.6.0] Status changed from uninitialized to green - Ready log [07:05:19.876] [warning][browser-driver][reporting] Enabling the Chromium sandbox provides an additional layer of protection. log [07:05:20.504] [warning][reporting] Generating a random key for xpack.reporting.encryptionKey. To prevent pending reports from failing on restart, please set xpack.reporting.encryptionKey in kibana.yml log [07:05:20.511] [info][status][plugin:reporting@7.6.0] Status changed from uninitialized to green - Ready log [07:05:20.564] [info][listening] Server running at http://192.168.8.190:5601 log [07:05:20.835] [info][server][Kibana][http] http server running at http://192.168.8.190:5601
訪問
http://192.168.8.190:5601/app/kibana#/home
設置開機啟動
建立服務文件
vi /lib/systemd/system/kibana.service
[Unit] Description=Kibana [Service] LimitNOFILE=100000 LimitNPROC=100000 ExecStart=/usr/local/kibana-7.6.0/bin/kibana User=elasticsearch Group=elasticsearch [Install] WantedBy=multi-user.target
設置開機自啟動
重新加載systemd的守護線程:systemctl daemon-reload
systemctl enable kibana
其他
啟動elasticsearch.service:
systemctl start kibana.service
查看kibana.serivce狀態:
systemctl status kibana.service
ps aux|grep kibana
如果出現錯誤可以使用如下命令查看日志:journalctl -u kibana.service