loki2.7.1报错

本人环境:我直接用hostpath存储数据,不建议生产环境这样子,应该使用云存储或者nfs服务器。hostpath:/data/loki

报错:

[root@150m01 ~/kind]# kubectl logs loki-0 -n middle-ware
failed parsing config: /etc/loki/local-config.yaml: yaml: unmarshal errors:
  line 3: field chunks_directory not found in type local.FSConfig
  line 4: field rules_directory not found in type local.FSConfig

源configmap.yaml文件配置:

apiVersion: v1
kind: ConfigMap
metadata:
  name: loki-config
  namespace: middle-ware
data:
  loki-config.yaml: |
    storage_config:
      filesystem:
        compaction_interval: 1h
        working_directory: /data/loki/blocks
        compaction_interval: 1h
        retention_enabled: true
        retention_delete_delay: 2h
        retention_delete_worker_count: 150
    compactor:
      working_directory: /data/loki/blocks
      shared_store: filesystem
      compaction_interval: 1h
      retention_enabled: true
      retention_delete_delay: 2h
      retention_delete_worker_count: 150

原因版本问题,loki的配置文件有变更.

storage_config结构调整-->filesystem和boltdb_shipprt必须成对出现,不能独立存在,且schema_config在2.7.*版本必须定义,本次示例将boltdb-shipper作为索引存储方式,filesystem作为对象存储,目录结构也有所调整,active_index_directory作为loki索引存储路径,cache_location作为boltdb缓存位置,chunks_directory&rules_direstory作为日志块和规则存储路径

修改后配置文件

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: loki-config
  namespace: middle-ware
data:
  local-config.yaml: |
    storage_config:
      boltdb_shipper:
        active_index_directory: /data/loki/index
        cache_location: /data/loki/boltdb-cache
        shared_store: filesystem
      filesystem:
        chunks_directory: /data/loki/chunks
        rules_directory: /data/loki/rules
    compactor:
      working_directory: /data/loki/blocks
      shared_store: filesystem
      compaction_interval: 1h
      retention_enabled: true
      retention_delete_delay: 2h
      retention_delete_worker_count: 150
    schema_config:
      configs:
        - from: 2020-10-24
          store: boltdb-shipper
          object_store: filesystem
          schema: v11
          index:
            prefix: index_
            period: 24h

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值