How do you back up Prometheus data before a risky migration?
BeginnerScenarioLong-Term Storage, Scale and Cost
Answer
Situation read → Prometheus data is usually re-creatable, but history may be important.
What I'd do →
- Enable the admin API temporarily (
--web.enable-admin-api). - Create a snapshot:
curl -XPOST http://localhost:9090/api/v1/admin/tsdb/snapshot # data goes to <data-dir>/snapshots/<timestamp>-<id> - Copy the snapshot to object storage (
aws s3 sync). - To restore, start Prometheus with the snapshot directory as
--storage.tsdb.path. - Disable the admin API afterwards.
Why → Snapshots use hard links, so they are instant and consistent.
Interview tip → With Thanos or a remote store, object storage is already the backup.
More on Long-Term Storage, Scale and Cost
Prometheus keeps 15 days of data, but leadership wants 13 months of metrics for capacity planning. What do you build?IntermediateThe Thanos compactor has halted and the bucket keeps growing. What do you do?AdvancedGrafana shows every series twice after you added a second Prometheus replica with Thanos. How do you fix it?IntermediateRemote write to your central store is falling further behind every hour. How do you handle it?AdvancedMimir rejects writes from a team with `err-mimir-max-series-per-user`. What do you do?IntermediateYour observability SaaS bill tripled in a quarter, driven by custom metrics. How do you bring it down?Intermediate