Loki
grafana/loki-stack:单体模式
grafana/loki-canary:金丝雀;
grafana/loki-distributed:分布式;微服务模式,适合生产较大规模场景
grafana/loki-simple-scalable:简单可扩展,读写分离模式;
组件
- Read: {QueryFrontend, Querier},
- Write: {Ingester, Distributor},
- Backend: {QueryScheduler, Ruler, Compactor, IndexGateway}
loki-distributed中Ingester、distributor、querier 和 query-frontend 组件是始终安装的,其他组件是可选的
1 | helm repo add grafana https://grafana.github.io/helm-charts |
config
config.yaml
config.yaml
config.yaml: |
auth_enabled: false
chunk_store_config:
max_look_back_period: 0s
compactor:
shared_store: filesystem
distributor:
ring:
kvstore:
store: memberlist
frontend:
compress_responses: true
log_queries_longer_than: 5s
tail_proxy_url: http://loki-loki-distributed-querier:3100
frontend_worker:
frontend_address: loki-loki-distributed-query-frontend:9095
ingester:
chunk_block_size: 262144
chunk_encoding: snappy
chunk_idle_period: 1h
chunk_retain_period: 1m
chunk_target_size: 1536000
lifecycler:
ring:
kvstore:
store: memberlist
replication_factor: 1
max_chunk_age: 1h
max_transfer_retries: 0
wal:
dir: /var/loki/wal
limits_config:
enforce_metric_name: false
max_cache_freshness_per_query: 10m
reject_old_samples: true
reject_old_samples_max_age: 168h
split_queries_by_interval: 15m
memberlist:
join_members:
- loki-loki-distributed-memberlist
query_range:
align_queries_with_step: true
cache_results: true
max_retries: 5
results_cache:
cache:
enable_fifocache: true
fifocache:
max_size_items: 1024
validity: 24h
ruler:
alertmanager_url: https://alertmanager.xx
external_url: https://alertmanager.xx
ring:
kvstore:
store: memberlist
rule_path: /tmp/loki/scratch
storage:
local:
directory: /etc/loki/rules
type: local
schema_config:
configs:
- from: "2022-06-21"
index:
period: 24h
prefix: loki_index_
object_store: s3
schema: v12
store: boltdb-shipper
server:
http_listen_port: 3100
storage_config:
aws:
access_key_id: myaccessKey
bucketnames: loki-data
endpoint: minio.logging.svc.cluster.local:9000
insecure: true
s3forcepathstyle: true
secret_access_key: mysecretKey
boltdb_shipper:
active_index_directory: /var/loki/index
cache_location: /var/loki/cache
cache_ttl: 168h
shared_store: s3
filesystem:
directory: /var/loki/chunks
table_manager:
retention_deletes_enabled: false
retention_period: 0s
storage
s3
https://grafana.com/docs/loki/latest/configure/examples/#2-s3-cluster-exampleyaml
1 | common: |
https://github.com/grafana/loki/issues/8634
failed to create memberlist: Failed to get final advertise address: no private IP address found, and explicit IP not provided
读写分离
https://github.com/grafana/loki/tree/main/production/helm/loki
https://github.com/grafana/loki/tree/main/production/helm/loki/templates/read
https://github.com/grafana/loki/tree/main/production/helm/loki/templates/write