Enable Shards for TidbMonitor

This document describes how to use shards for TidbMonitor.

Shards

TidbMonitor collects monitoring data for a single TiDB cluster or multiple TiDB clusters. When the amount of monitoring data is large, the computing capacity of one TidbMonitor might hit a bottleneck. In this case, it is recommended to use shards of Prometheus Modulus. This feature performs hashmod on __address__ to divide the monitoring data of multiple targets (Targets) into multiple TidbMonitor Pods.

To use shards for TidbMonitor, you need a data aggregation plan. The Thanos method is recommended.

Enable shards

To enable shards for TidbMonitor, you need to specify the shards field. For example:

apiVersion: pingcap.com/v1alpha1 kind: TidbMonitor metadata: name: monitor spec: replicas: 1 shards: 2 clusters: - name: basic prometheus: baseImage: prom/prometheus version: v2.27.1 initializer: baseImage: pingcap/tidb-monitor-initializer version: v5.2.1 reloader: baseImage: pingcap/tidb-monitor-reloader version: v1.0.1 prometheusReloader: baseImage: quay.io/prometheus-operator/prometheus-config-reloader version: v0.49.0 imagePullPolicy: IfNotPresent

For details on the configuration, refer to shards example.

Was this page helpful?