1. 程式人生 > 其它 >mimir grafana 時序儲存參考試用

mimir grafana 時序儲存參考試用

參考示例demo圖

 

 

執行

git clone https://github.com/grafana/mimir.git
cd mimir
cd docs/sources/tutorials/play-with-grafana-mimir/
docker-compose up

參考配置

  • prometheus 租戶支援
global:
  scrape_interval: 5s
  external_labels:
    cluster: demo
    namespace: demo
 
rule_files:
  - /etc/prometheus/rules.yaml
 
scrape_configs:
  - job_name: demo/mimir
    static_configs:
      - targets: [ 'mimir-1:8080' ]
        labels:
          pod: 'mimir-1'
      - targets: [ 'mimir-2:8080' ]
        labels:
          pod: 'mimir-2'
      - targets: [ 'mimir-3:8080' ]
        labels:
          pod: 'mimir-3'
 
remote_write:
  - url: http://load-balancer:9009/api/v1/push
# Add X-Scope-OrgID header so that Mimir knows what tenant the remote write data should be stored in.
# In this case, our tenant is "demo"
    // 基於header 請求頭
    headers:
      X-Scope-OrgID: demo
  • mimir 配置
    比cortex簡單很多了,配置叢集,配置s3 儲存,配置規則,配置儲存
 
# Do not use this configuration in production.
# It is for demonstration purposes only.
# Run Mimir in single process mode, with all components running in 1 process. 
target: all,alertmanager,overrides-exporter
 
# Configure Mimir to use Minio as its object storage backend. 
blocks_storage:
  backend: s3
  s3:
    endpoint: minio:9000
    bucket_name: mimir-blocks
    access_key_id: mimir
    secret_access_key: supersecret
    insecure: true
  tsdb:
    dir: /data/ingester
 
# Use memberlist, a gossip-based protocol, to enable the 3 Mimir replicas to communicate 
memberlist:
  join_members: [ mimir-1, mimir-2, mimir-3 ]
 
ruler:
  rule_path: /data/ruler
  alertmanager_url: http://127.0.0.1:8080/alertmanager
  ring:
    # Quickly detect unhealthy rulers to speed up the tutorial.
    heartbeat_period: 2s
    heartbeat_timeout: 10s
 
ruler_storage:
  backend: s3
  s3:
    endpoint: minio:9000
    bucket_name: mimir-ruler
    access_key_id: mimir
    secret_access_key: supersecret
    insecure: true
 
alertmanager:
  data_dir: /data/alertmanager
  fallback_config_file: /etc/alertmanager-fallback-config.yaml
  external_url: http://localhost:9009/alertmanager
 
alertmanager_storage:
  backend: s3
  s3:
    endpoint: minio:9000
    bucket_name: mimir-alertmanager
    access_key_id: mimir
    secret_access_key: supersecret
    insecure: true
 
server:
  log_level: warn

效果

prometheus metrics

 

 


write metrics

 

 

說明

通過體驗mimir 是極大的簡化的metrics 的儲存處理,同時提供了多租戶的支援,後續還得深入研究下

參考資料

https://grafana.com/oss/mimir/
https://grafana.com/tutorials/play-with-grafana-mimir/?pg=oss-mimir&plcmt=hero-btn-1
https://grafana.com/blog/2022/03/30/announcing-grafana-mimir/?pg=oss-mimir&plcmt=hero-btn-3