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