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