How to delete a monthly partition from VictoriaMetrics vmstore nodes

1.8k Views Asked by At

We are backfilling old data into our VictoriaMetrics and Grafana setup. But we might have messed up the data on a month. We want to delete a monthly partition from vmstore nodes and start again. Is this possible through the APIs?

2

There are 2 best solutions below

0
On

Yep, you can do this via VictoriaMetrics Delete API /api/v1/admin/tsdb/delete_series. Note, that you can only delete All of the data and restore/backfill ones again.

See examples below:

Single-node VictoriaMetrics

curl -v http://localhost:8428/api/v1/admin/tsdb/delete_series -d 'match[]=your_metric_name_here'

Cluster version of VictoriaMetrics

curl -v http://<vmselect>:8481/delete/0/prometheus/api/v1/admin/tsdb/delete_series -d 'match[]=your_metric_name_here'

VictoriaMetrics documentation has a guide "How to delete or replace metrics in VictoriaMetrics" with more explanation and examples.

0
On

The easiest and the fastest way to remove a month-worth partition of data in VictoriaMetrics is to stop VictoriaMetrics (or a vmstorage in cluster version), then delete the YYYY_MM directory for the needed month under the <-storageDataPath>/data/{small,big} directories and then start VictoriaMetrics again. See more details about storage in VictoriaMetrics in these docs.