zoukankan      html  css  js  c++  java
  • Ubuntu环境部署Kibana实战案例

                Ubuntu环境部署Kibana实战案例

                                     作者:尹正杰

    版权声明:原创作品,谢绝转载!否则将追究法律责任。

      

    一.准备环境

    1>.部署Elasticsearch集群

      Kibana可以单独找一台机器部署,但生产环境中我们一般会和Elasticsearch集群任意一个节点部署在一起,因此我这里基于之前搭建好的es101.yinzhengjie.com进行部署。
    
      博主推荐阅读:
        https://www.cnblogs.com/yinzhengjie2020/p/12953504.html

    2>.下载kibana软件包

      博主推荐阅读:
        https://www.cnblogs.com/yinzhengjie2020/p/12934518.html

    二.部署Kibana实操

    1>.将下载的Kibana软件包上传到es101.yinzhengjie.com节点并安装

    [root@es101.yinzhengjie.com ~]# ls
    kibana-6.8.9-amd64.deb
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# dpkg -i kibana-6.8.9-amd64.deb 
    Selecting previously unselected package kibana.
    (Reading database ... 103047 files and directories currently installed.)
    Preparing to unpack kibana-6.8.9-amd64.deb ...
    Unpacking kibana (6.8.9) ...
    Setting up kibana (6.8.9) ...
    Processing triggers for systemd (237-3ubuntu10.38) ...
    Processing triggers for ureadahead (0.100.0-21) ...
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# dpkg -i kibana-6.8.9-amd64.deb

    2>.修改kibanna的配置文件

    [root@es101.yinzhengjie.com ~]# grep '#server.host: "localhost"' /etc/kibana/kibana.yml 
    #server.host: "localhost"
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# sed -r -i s'@#(server.host: )"localhost"@1172.200.5.101@' /etc/kibana/kibana.yml         #修改Kibana的监听地址
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# grep "^server.host" /etc/kibana/kibana.yml 
    server.host: 172.200.5.101
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# grep "elasticsearch.hosts" /etc/kibana/kibana.yml                            #指定elsticsearsh集群地址,各节点使用逗号进行分割。
    elasticsearch.hosts: ["http://172.200.5.101:9200","http://172.200.5.102:9200","http://172.200.5.103:9200"]
    [root@es101.yinzhengjie.com ~]# 

    3>.启动Kibana服务并设置开机自启动

    [root@es101.yinzhengjie.com ~]# systemctl start kibana.service 
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# systemctl enable kibana.service 
    Synchronizing state of kibana.service with SysV service script with /lib/systemd/systemd-sysv-install.
    Executing: /lib/systemd/systemd-sysv-install enable kibana
    [root@es101.yinzhengjie.com ~]# 
    root@es101.yinzhengjie.com ~]# systemctl status kibana.service 
    ● kibana.service - Kibana
       Loaded: loaded (/etc/systemd/system/kibana.service; enabled; vendor preset: enabled)
       Active: active (running) since Thu 2020-06-04 01:04:38 UTC; 3min 56s ago
     Main PID: 69403 (node)
        Tasks: 11 (limit: 4633)
       CGroup: /system.slice/kibana.service
               └─69403 /usr/share/kibana/bin/../node/bin/node --no-warnings --max-http-header-size=65536 /usr/share/kibana/bin/../src/cli -c /etc/kibana/kibana.yml
    
    Jun 04 01:07:57 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:57Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/api/console/
    Jun 04 01:07:57 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:57Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/api/spaces/s
    Jun 04 01:07:57 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:57Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/api/saved_ob
    Jun 04 01:07:58 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:57Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/bundles/ebdc
    Jun 04 01:07:58 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:58Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/api/security
    Jun 04 01:07:58 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:58Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/api/xpack/v1
    Jun 04 01:07:58 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:58Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/ui/fonts/ope
    Jun 04 01:07:58 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:58Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/plugins/kiba
    Jun 04 01:07:58 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:58Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/bundles/c342
    Jun 04 01:07:58 es101.yinzhengjie.com kibana[69403]: {"type":"response","@timestamp":"2020-06-04T01:07:58Z","tags":[],"pid":69403,"method":"get","statusCode":200,"req":{"url":"/bundles/cc17
    [root@es101.yinzhengjie.com ~]# 
    root@es101.yinzhengjie.com ~]# systemctl status kibana.service

    4>.访问Kibana的WebUI

      浏览器访问:
        http://es101.yinzhengjie.com:5601/

    5>.如下图所示,点击"Add"即可添加数据

    6>.点击Discover即可查看刚刚添加的日志

    7>.查看Dashboard界面

    三.修改Kibana中文支持

    1>.修改配置文件

    [root@es101.yinzhengjie.com ~]# grep "i18n.locale" /etc/kibana/kibana.yml 
    #i18n.locale: "en"
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# sed -r -i s'@#(i18n.locale: )"en"@1"zh-CN"@' /etc/kibana/kibana.yml         #修改中文支持
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# grep "i18n.locale" /etc/kibana/kibana.yml 
    i18n.locale: "zh-CN"
    [root@es101.yinzhengjie.com ~]#

    2>.重启Kibana服务使得配置文件生效

    [root@es101.yinzhengjie.com ~]# systemctl restart kibana.service 
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# systemctl status kibana.service 
    ● kibana.service - Kibana
       Loaded: loaded (/etc/systemd/system/kibana.service; enabled; vendor preset: enabled)
       Active: active (running) since Thu 2020-06-04 01:47:54 UTC; 1min 3s ago
     Main PID: 69537 (node)
        Tasks: 11 (limit: 4633)
       CGroup: /system.slice/kibana.service
               └─69537 /usr/share/kibana/bin/../node/bin/node --no-warnings --max-http-header-size=65536 /usr/share/kibana/bin/../src/cli -c /etc/kibana/kibana.yml
    
    Jun 04 01:48:43 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:43Z","tags":[],"pid":69537,"method":"get","statusCode":304,"req":{"url":"/bundles/comm
    Jun 04 01:48:43 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:43Z","tags":[],"pid":69537,"method":"get","statusCode":304,"req":{"url":"/bundles/kiba
    Jun 04 01:48:43 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:43Z","tags":[],"pid":69537,"method":"get","statusCode":304,"req":{"url":"/translations
    Jun 04 01:48:44 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:44Z","tags":[],"pid":69537,"method":"get","statusCode":200,"req":{"url":"/api/console/
    Jun 04 01:48:44 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:44Z","tags":[],"pid":69537,"method":"get","statusCode":200,"req":{"url":"/api/spaces/s
    Jun 04 01:48:44 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:44Z","tags":[],"pid":69537,"method":"get","statusCode":200,"req":{"url":"/api/saved_ob
    Jun 04 01:48:44 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:44Z","tags":[],"pid":69537,"method":"get","statusCode":304,"req":{"url":"/bundles/ebdc
    Jun 04 01:48:44 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:44Z","tags":[],"pid":69537,"method":"get","statusCode":200,"req":{"url":"/api/security
    Jun 04 01:48:44 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:44Z","tags":[],"pid":69537,"method":"get","statusCode":304,"req":{"url":"/ui/fonts/ope
    Jun 04 01:48:44 es101.yinzhengjie.com kibana[69537]: {"type":"response","@timestamp":"2020-06-04T01:48:44Z","tags":[],"pid":69537,"method":"get","statusCode":304,"req":{"url":"/ui/fonts/ope
    [root@es101.yinzhengjie.com ~]# 
    [root@es101.yinzhengjie.com ~]# systemctl restart kibana.service

    3>.再次查看Kibana的WebUI界面,如下图所示,的确是中文界面啦~

    四.kibana管理Elasticsearch的索引

    1>.如下图所示,点击"索引管理"

    2>.选中要操作的索引

    3>.如下图所示,可以对索引进行删除操作

    4>.如果你确认要删除索引,点击"确认"按钮

    5>.索引删除成功

    五.博主推荐阅读

      Kibana使用快速入门:
        https://www.cnblogs.com/yinzhengjie2020/p/12995545.html
  • 相关阅读:
    Set,List,Map的区别
    阅读笔记15
    阅读笔记14
    阅读笔记13
    阅读笔记12
    阅读笔记11
    阅读笔记10
    架构漫谈读后感
    阅读笔记1
    暑期周记8
  • 原文地址:https://www.cnblogs.com/yinzhengjie2020/p/12990158.html
Copyright © 2011-2022 走看看