Deploying Thanos for Unified Prometheus Monitoring and Long‑Term Storage
This guide explains the background, key features, architecture, and step‑by‑step deployment of Thanos—including Sidecar, Store, Query, Compact, Bucket, Rule, and Check components—to provide a unified, high‑availability Prometheus monitoring view with unlimited historical data storage using object storage.
The article begins by describing the scaling challenges of multiple Prometheus clusters in a company environment, such as slow queries, OOM errors, and insufficient storage for long‑term monitoring data during large events like Double‑Eleven.
To address these issues, the author introduces Thanos, a solution that offers a global view across clusters, unlimited data retention via object storage, down‑sampling for faster queries, high availability, and rule‑based alerting.
Thanos architecture consists of several components that share a single binary but behave differently based on startup flags:
Sidecar : Deploy alongside each Prometheus instance to upload metrics to object storage and enable efficient querying.
Bucket : Provides tools to inspect object storage blocks and a web UI; supports S3, GCS, Azure, Swift, etc.
Store : Implements the Store API, acting as a gateway to object storage and exposing block metadata.
Querier : Offers a PromQL‑compatible API, aggregates data from Store and Sidecar, and is stateless for horizontal scaling.
Compact : Compresses blocks in object storage and performs down‑sampling (e.g., 5m for data older than 30 days).
Rule/Ruler : Evaluates alerting rules against query data; the article notes that rule deployment is optional.
Check : Validates rule files similarly to promtool check rules .
Configuration steps include:
Modify prometheus.yml to add external_labels for cluster identification.
Start Prometheus with appropriate storage and retention flags.
Launch the Sidecar with paths to the Prometheus data directory, the Prometheus URL, and the bucket configuration file.
Create a bucket_config.yaml defining the S3 bucket, endpoint, credentials, and HTTP settings.
Start Store, Query, Compact, and Bucket web components using the provided command lines, specifying data directories, addresses, and the bucket config.
After deployment, the Thanos Query UI is accessible at http:// server_ip :19193/graph , offering a Prometheus‑like interface with full historical data. The Bucket web UI ( http:// server_ip :19194/ ) allows inspection of stored blocks.
Finally, the guide suggests integrating Thanos Query with Grafana for a unified monitoring dashboard and provides links to the official Thanos website and GitHub repository for further reference.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.