zoukankan      html  css  js  c++  java
  • Grafana+loki+promtail入门级部署分布式日志系统

    概念:

    Grafana:用于图形展示。

        grafana 是一款采用 go 语言编写的开源应用,主要用于大规模指标数据的可视化展现,是网络架构和应用分析中最流行的时序数据展示工具,目前已经支持绝大部分常用的时序数据库。(http://docs.grafana.org/

    Loki:是主服务器,负责存储日志和处理查询。grafana支持的时序数据库中的一种。除此之外还支持SqlServer、mysql等多种关系型数据库。

    Promtail :是代理。负责收集日志并将其发送给loki。

    安装:

    本次演示windows服务器本地安装。

    Grafana

      下载地址:https://grafana.com/grafana/download?platform=windows

      下载后傻瓜式安装即可,安装完毕后访问:http://localhost:3000/即可。

    Loki

      下载地址:https://github.com/grafana/loki/releases

      安装说明:https://grafana.com/docs/loki/latest/installation/local/

      下载release后解压到文件夹,得到一个EXE文件,然后exe文件同目录下添加loki-config.yaml文件,内容如下:

    auth_enabled: false
    
    server:
      http_listen_port: 3100
    
    ingester:
      lifecycler:
        address: 127.0.0.1
        ring:
          kvstore:
            store: inmemory
          replication_factor: 1
        final_sleep: 0s
      chunk_idle_period: 5m
      chunk_retain_period: 30s
      max_transfer_retries: 0
    
    schema_config:
      configs:
        - from: 2020-06-22
          store: boltdb
          object_store: filesystem
          schema: v11
          index:
            prefix: index_
            period: 168h
    
    storage_config:
      boltdb:
        directory: /tmp/loki/index
    
      filesystem:
        directory: /tmp/loki/chunks
    
    limits_config:
      enforce_metric_name: false
      reject_old_samples: true
      reject_old_samples_max_age: 168h
    
    chunk_store_config:
      max_look_back_period: 0s
    
    table_manager:
      retention_deletes_enabled: false
      retention_period: 0s
    View Code

      打开cmd定位到exe目录,执行命令:loki-windows-amd64.exe --config.file=loki-config.yaml,loki服务启动成功。

    Promtail

      下载地址:https://github.com/grafana/loki/releases

      安装说明:https://grafana.com/docs/loki/latest/clients/promtail/installation/

      下载release文件包后解压,得到一个EXE文件,然后exe文件同目录下添加promtail-config.yaml文件,内容参考如下(jobname可以配置多个):

    server:
      http_listen_port: 9080
      grpc_listen_port: 0
    
    positions:
      filename: /tmp/positions.yaml
    
    clients:
      - url: http://localhost:3100/loki/api/v1/push
    
    scrape_configs:
    - job_name: system
      static_configs:
      - targets:
          - localhost
        labels:
          job: viplogs
          __path__: D:1ProjectMicroServiceTestCommoninDebugLogs*.log
    - job_name: system
      static_configs:
      - targets:
          - localhost
        labels:
          job: viplogs
          __path__: D:1ProjectMicroServiceTestCommoninDebugLogs*.log
    View Code

      打开cmd定位到exe目录,执行命令:promtail-windows-amd64.exe --config.file=promtail-config.yaml,loki服务启动成功。

    使用:

    配置数据源和浏览数据,网上很多说明,可以参考这个:https://blog.csdn.net/qq_23598037/article/details/99850396

  • 相关阅读:
    Microjs: 超棒的迷你框架和迷你类库搜罗工具
    本周推荐7款CSS3实现的动态特效
    Bootstrap3.1开发的响应式个人简历模板
    10分钟,利用canvas画一个小的loading界面
    四款超棒的jQuery数字化签名插件
    搜索引擎优化网页设计:最佳实践
    推荐超实用的8款jQuery插件
    9款HTML5实现的超酷特效
    想成为程序猿?28个在线学习网站让你变身齐天大圣!
    推荐7款超棒的单页面网站设计模板。关键是!免费!!
  • 原文地址:https://www.cnblogs.com/chenxizhaolu/p/14434645.html
Copyright © 2011-2022 走看看