viva
  • 主页
  • 开发
    • IDE环境
      • Vim
      • VSCode
        • code-server
        • theia
    • Golang手册
    • Ansible
    • SaltStack
      • salt-api
    • Python
      • Q&A
      • Hello,world!
      • 类型
        • 数字
        • 字符串
        • 列表
        • 元组
        • 集合
        • 字典
      • 语法
        • 流程控制
        • 循环
      • 工具
        • pip
        • pyenv
        • selenium
      • 示例
    • Shell
    • Vue
      • ant-design
      • vue-material
    • Java
  • 随笔
    • WSL2
    • Git
    • Markdown
      • mermaid
    • Linux
      • 时钟同步
      • 账号
      • 文件
      • SSH
      • systemd
      • TLS加密
        • Openssl
      • 存储
        • rsync
        • NFS
      • 路由
      • 日志采集
        • Journalctl
        • Fluentd
          • 根据字段匹配对日志进行结构化
        • Logstash
    • 虚拟化
      • Hyper-V
      • PXE
    • 命令行工具
      • zsh
    • Nexus3
    • 堡垒机
      • JumpServer
    • 测试工具
      • ioping
      • apache bench
      • dd
      • postman
    • 开源项目管理
      • Github
    • 软件包管理
    • 网络镜像源
    • 网关
      • Nginx
  • 存储
    • Ceph
      • 安装
      • 故障处理
    • Etcd
    • Mysql
  • 网络
    • Overlay网络
    • IPVS
    • 网络工具
      • tshark
      • tcpdump
    • 防火墙
      • nftables
      • firewalld
      • iptables
    • 域名解析
      • dig
      • nslookup
      • dnsmasq
    • 代理
      • Clash
      • Redsocks
      • Redsocks2
      • COW
      • Proxfier
  • 云原生
    • 容器
      • Docker
        • Dockerfile
        • docker-compose
      • Podman
      • 原理
        • Chroot
        • Namespace
        • Cgroup
    • 镜像仓库
      • Harbor
    • Kubernetes
      • 部署
        • Kind
        • Minikube
        • kubespray
      • CNI
        • Flannel
        • OVS
        • Calico
      • Operator
        • OperatorSDK
      • StorageClass
      • Q&A
    • Openshift
      • 集群部署
      • 快速使用
    • Prometheus
      • prometheus-operator
      • kube-prometheus
      • Thanos
        • 组件
          • Bucket
          • Check
          • Compact
          • Querier
          • Receiver
          • Ruler
          • Sidecar
          • Store
        • 参考资料
      • Cortex
        • 组件
          • Alertmanager
          • Config
          • Distributor
          • Ingester
          • Querier
          • Query Frontend
          • Ruler
        • 参考资料
      • Thanos与Cortex方案对比
      • 参考资料
      • Q&A
    • Skywalking
    • Rook
    • Helm
    • Istio
    • 应用部署
      • Nexus
      • RabbitMQ
    • 参考资料
  • DevOps
    • 开源DevOps平台
    • CICD
      • Jenkins
    • 参考资料
  • 机器学习
    • Kubeflow
      • 示例
由 GitBook 提供支持
在本页
  • 下采样
  • 可选参数
  1. 云原生
  2. Prometheus
  3. Thanos
  4. 组件

Compact

Compact用于定时对远端对象存储中的历史数据块进行下采样,提升在做大时间跨度查询时的速度。由于Compact的设计是非并发安全的,因此只能单例部署。

下采样

下采样有三个主要的配置参数:

  • --retention.resolution-raw(单位:d,默认0d)

  • --retention.resolution-5m(单位:d,默认0d)

  • --retention.resolution-1h(单位:d,默认0d)

当开启raw之后,原有的历史数据会以该项所配置的时间长度保留于远端对象存储中,超过该时间的数据会被清理。

5m开启后会为每个存储时长大于40小时的块中开辟新的存储区域,将历史数据以5分钟为精度进行下采样,以该项所配置的时间长度存储于远端对象存储中。

1h开启后会为每个存储时长大于10天的块中开辟新的存储区域,将历史数据以1小时为间隔进行下采样,以该项所配置的时间长度存储于远端对象存储中。

下采样的实现方式是以外部标签为分组,以数据块为单位,以采样精度为取值区间在原有的数据块中取指标值保存到新建的下采样数据块中。

这三种采样的数据都是独立存储,相当于存了三份数据,因此并不能起到压缩存储空间的作用。默认情况下值为0d表示永久保留下采样数据。如果需要关闭下采样,也可以在启动时附加--debug.disable-downsampling参数。

可选参数

usage: thanos compact [<flags>]

continuously compacts blocks in an object store bucket

Flags:
  -h, --help                   Show context-sensitive help (also try --help-long
                               and --help-man).
      --version                Show application version.
      --log.level=info         Log filtering level.
      --log.format=logfmt      Log format to use. Possible options: logfmt or
                               json.
      --tracing.config-file=<file-path>
                               Path to YAML file with tracing configuration. See
                               format details:
                               https://thanos.io/tracing.md/#configuration
      --tracing.config=<content>
                               Alternative to 'tracing.config-file' flag (lower
                               priority). Content of YAML file with tracing
                               configuration. See format details:
                               https://thanos.io/tracing.md/#configuration
      --http-address="0.0.0.0:10902"
                               Listen host:port for HTTP endpoints.
      --http-grace-period=2m   Time to wait after an interrupt received for HTTP
                               Server.
      --data-dir="./data"      Data directory in which to cache blocks and
                               process compactions.
      --objstore.config-file=<file-path>
                               Path to YAML file that contains object store
                               configuration. See format details:
                               https://thanos.io/storage.md/#configuration
      --objstore.config=<content>
                               Alternative to 'objstore.config-file' flag (lower
                               priority). Content of YAML file that contains
                               object store configuration. See format details:
                               https://thanos.io/storage.md/#configuration
      --consistency-delay=30m  Minimum age of fresh (non-compacted) blocks
                               before they are being processed. Malformed blocks
                               older than the maximum of consistency-delay and
                               48h0m0s will be removed.
      --retention.resolution-raw=0d
                               How long to retain raw samples in bucket. Setting
                               this to 0d will retain samples of this resolution
                               forever
      --retention.resolution-5m=0d
                               How long to retain samples of resolution 1 (5
                               minutes) in bucket. Setting this to 0d will
                               retain samples of this resolution forever
      --retention.resolution-1h=0d
                               How long to retain samples of resolution 2 (1
                               hour) in bucket. Setting this to 0d will retain
                               samples of this resolution forever
  -w, --wait                   Do not exit after all compactions have been
                               processed and wait for new work.
      --downsampling.disable   Disables downsampling. This is not recommended as
                               querying long time ranges without non-downsampled
                               data is not efficient and useful e.g it is not
                               possible to render all samples for a human eye
                               anyway
      --block-sync-concurrency=20
                               Number of goroutines to use when syncing block
                               metadata from object storage.
      --compact.concurrency=1  Number of goroutines to use when compacting
                               groups.
      --selector.relabel-config-file=<file-path>
                               Path to YAML file that contains relabeling
                               configuration that allows selecting blocks. It
                               follows native Prometheus relabel-config syntax.
                               See format details:
                               https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
      --selector.relabel-config=<content>
                               Alternative to 'selector.relabel-config-file'
                               flag (lower priority). Content of YAML file that
                               contains relabeling configuration that allows
                               selecting blocks. It follows native Prometheus
                               relabel-config syntax. See format details:
                               https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config

上一页Check下一页Querier

最后更新于5年前