Prometheus keeps two weeks of data on a local disk and then throws it away, which is fine until someone asks how last quarter compared to this one. VictoriaMetrics single-node is the shortest honest answer: one static binary, one data directory, one HTTP port, and a /api/v1/write endpoint that speaks the Prometheus remote_write protocol without translation. Point your existing Prometheus servers at it, keep their local retention short, and every sample they scrape also lands somewhere that holds a year. This guide covers installing it as a systemd unit, sizing -retentionPeriod and the disk from your real ingestion rate, the remote_write settings worth changing and the ones worth leaving alone, and how to prove the data arrived before you point a dashboard at it.
What you’ll accomplish
- A
victoria-metrics-prodprocess under systemd as an unprivileged user, with its data on a dedicated filesystem. - A retention and disk figure derived from your measured samples-per-second, not copied from a blog post.
- Prometheus streaming every scraped sample to that host over remote_write, with local retention trimmed accordingly.
- A Grafana datasource querying VictoriaMetrics with PromQL, and vmui available for ad-hoc exploration.
- Verification commands on both sides, so a silent write failure surfaces in minutes rather than the next time someone opens a year-over-year panel.
Prerequisites
- A Linux host with systemd. Any current Debian, Ubuntu, RHEL-family or SUSE release works — VictoriaMetrics ships a static binary with no runtime dependencies, so the distribution matters less than the filesystem underneath it.
- One or more Prometheus servers, 2.30 or newer. Remote_write has been stable for years, but the
queue_configdefaults changed noticeably around Prometheus 2.44, so read your own version’s documentation before assuming a number. - A separate block device or LVM volume for
-storageDataPath. Sharing the root filesystem works right up to the day it does not. - Root or sudo on the storage host, plus the ability to reload Prometheus.
- An honest caveat about versions: VictoriaMetrics publishes both a fast-moving line and LTS lines. Flags are stable across them, but new flags do appear. Run the binary with
-helpon the version you actually downloaded rather than trusting any list, including this one.
How it works
Prometheus does not scrape twice. It scrapes once into its local TSDB, and the write-ahead log that protects those writes doubles as the source for remote_write. A separate set of goroutines — the shards — tail the WAL, batch samples, compress each batch with snappy, and POST it as a protobuf body. Nothing about scraping, rule evaluation, or local queries changes when you turn remote_write on; the only new cost is CPU for compression and the memory the queue holds.
On the receiving side, VictoriaMetrics single-node is one process doing everything the cluster version splits across vminsert, vmstorage, and vmselect. It accepts writes on the same port it serves queries on, writes samples into small parts on disk, and merges those parts into larger ones in the background. Retention is enforced by dropping whole parts once every sample inside them is older than -retentionPeriod — which is why deletion is cheap, and why granularity is coarser than the flag suggests.
The query surface is deliberately Prometheus-shaped. /api/v1/query, /api/v1/query_range, /api/v1/labels, and /api/v1/series all behave the way a Prometheus datasource expects, so Grafana needs no plugin. The query language is MetricsQL, a superset of PromQL — existing expressions keep working. That compatibility is the whole reason this migration is short.
The part that catches people is that this is storage, not monitoring. VictoriaMetrics single-node evaluates no alerting rules and no recording rules. Your Prometheus servers keep doing that against their local TSDB, or you run vmalert separately against the VictoriaMetrics endpoint.
Step-by-step
-
Create the user, directories, and volume. The process needs to own its data directory and nothing else.
sudo useradd --system --no-create-home --shell /usr/sbin/nologin victoriametrics sudo mkdir -p /var/lib/victoria-metrics sudo chown victoriametrics:victoriametrics /var/lib/victoria-metrics sudo chmod 700 /var/lib/victoria-metricsExpected: no output from any of the four commands. Confirm the mount is the one you meant with
df -h /var/lib/victoria-metrics— theMounted oncolumn should show your dedicated volume, not/. -
Install the binary. Set the version explicitly so the unit and the download agree.
VM_VERSION=v1.148.0 curl -fsSL -o /tmp/vm.tar.gz \ "https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/${VM_VERSION}/victoria-metrics-linux-amd64-${VM_VERSION}.tar.gz" sudo tar -xzf /tmp/vm.tar.gz -C /usr/local/bin victoria-metrics-prod /usr/local/bin/victoria-metrics-prod -versionExpected: a line like
victoria-metrics-20260720-101143-tags-v1.148.0-0-g.... IftarreportsNot found in archive, you downloaded the cluster tarball — the single-node archive is the one withoutclusterin its name. -
Write the systemd unit. Every flag here is one you should be able to defend, so keep the list short.
[Unit] Description=VictoriaMetrics single-node After=network-online.target Wants=network-online.target [Service] Type=simple User=victoriametrics Group=victoriametrics ExecStart=/usr/local/bin/victoria-metrics-prod \ -storageDataPath=/var/lib/victoria-metrics \ -retentionPeriod=1y \ -httpListenAddr=:8428 \ -memory.allowedPercent=60 \ -storage.minFreeDiskSpaceBytes=20GB \ -selfScrapeInterval=15s \ -loggerFormat=json Restart=on-failure RestartSec=5 TimeoutStopSec=300 LimitNOFILE=1048576 [Install] WantedBy=multi-user.target-retentionPeriodaccepts30d,12(bare numbers mean months),1y, or100yfor effectively forever.-storage.minFreeDiskSpaceBytesis the one people wish they had set: when free space falls below it, VictoriaMetrics goes read-only and keeps serving queries instead of fighting a full disk.-selfScrapeIntervalmakes the process scrape its own/metrics, which is how you get its internal series without another exporter.TimeoutStopSecmatters because shutdown flushes in-memory parts, and killing that halfway costs you the recent buffer. -
Start it and read the first log lines.
sudo systemctl daemon-reload sudo systemctl enable --now victoriametrics sudo journalctl -u victoriametrics -n 20 --no-pagerExpected: JSON log lines ending with something close to
"msg":"started VictoriaMetrics in 0.123 seconds; see https://docs.victoriametrics.com/"and a listener line for:8428. Then confirm the port is bound:curl -fsS http://127.0.0.1:8428/healthExpected:
OK. Anything else means the process is up but not ready, and the journal will say why. -
Size retention and disk from a measurement, not a feeling. Ask each Prometheus server how many samples per second it actually ingests.
curl -fsS 'http://localhost:9090/api/v1/query' \ --data-urlencode 'query=sum(rate(prometheus_tsdb_head_samples_appended_total[10m]))'Expected: a JSON result whose
valueis your samples per second — say48000. VictoriaMetrics compresses typical infrastructure metrics to roughly one byte per sample, so the planning arithmetic issamples_per_second x 86400 x retention_days x 1 byte. At 48k samples per second that is about 4.1 GB per day, so a year is near 1.5 TB. Add the index, provision about 1.5 times the calculated figure, and set-retentionPeriodto a value you can actually store. Churn is the variable that breaks estimates: a deployment that changes a pod label every hour creates new series all day, and series count, not sample count, is what makes an index large. -
Point Prometheus at the endpoint. Start with the smallest configuration that can work, and add tuning only after the metrics ask for it.
global: scrape_interval: 15s external_labels: cluster: prod-east replica: "0" remote_write: - url: http://vm01.internal:8428/api/v1/write name: victoriametrics remote_timeout: 30sThe
external_labelsare not optional in practice. Every Prometheus writing into the same VictoriaMetrics needs a label that distinguishes its series, or two servers scraping identically named targets will interleave into one series and produce a graph nobody can explain. Reload and check the config was accepted:promtool check config /etc/prometheus/prometheus.yml curl -fsS -X POST http://localhost:9090/-/reloadExpected:
SUCCESSfrom promtool, and an empty body plus HTTP 200 from the reload. The reload endpoint requires Prometheus to have been started with--web.enable-lifecycle; without it, usesudo systemctl reload prometheus. -
Tune
queue_configonly when the queue tells you to. The defaults are sized for a healthy receiver on a normal network. Before changing anything, look at the lag.curl -fsS 'http://localhost:9090/api/v1/query' --data-urlencode \ 'query=prometheus_remote_storage_highest_timestamp_in_seconds - ignoring(remote_name, url) prometheus_remote_storage_queue_highest_sent_timestamp_seconds'Expected: a value in the low single digits of seconds. A steady number under about 10 is normal; a number that grows monotonically means the sender is losing ground. Only in that case add a
queue_configblock, and change one field at a time:remote_write: - url: http://vm01.internal:8428/api/v1/write name: victoriametrics remote_timeout: 30s queue_config: max_shards: 100 min_shards: 4 max_samples_per_send: 2000 capacity: 10000 batch_send_deadline: 5smax_shardsis the ceiling on parallel senders and the field that matters when the sender is the bottleneck.min_shardsabove 1 avoids a slow ramp after every restart.capacityis the per-shard in-memory buffer: raising it buys time during a receiver hiccup at the cost of Prometheus memory, roughlycapacity x max_shardssamples held in RAM in the worst case, which is exactly how a tuning session turns into an OOM kill. -
Trim local Prometheus retention — carefully. The point of remote storage is that the scraper no longer needs to hold months.
sudo systemctl show prometheus -p ExecStart | tr ' ' '\n' | grep retentionExpected: your current
--storage.tsdb.retention.timevalue. Two days is a reasonable target: enough to debug locally and to absorb a multi-hour outage of the storage host. Do not drop below a day, and do not change this until the next section confirms data is actually landing on the other end. -
Add the Grafana datasource. Use the Prometheus datasource type; no plugin is required.
curl -fsS -u admin:admin -H 'Content-Type: application/json' \ -d '{"name":"VictoriaMetrics","type":"prometheus","url":"http://vm01.internal:8428","access":"proxy","isDefault":false}' \ http://grafana.internal:3000/api/datasourcesExpected: a JSON body containing
"message":"Datasource added"and the new id. Adding it through the UI is equally fine — the field that matters is the URL, which is the base address with no path suffix, because Grafana appends/api/v1/queryitself.
Validate it works
Prove the write path end to end rather than trusting a green dashboard. First, that samples are arriving:
curl -fsS http://vm01.internal:8428/metrics | grep '^vm_rows_inserted_total'
Expected: a counter with a promremotewrite label and a value that climbs between two runs a few seconds apart. If it exists but never moves, Prometheus is not reaching this host.
Then, that a specific series is queryable from the storage side:
curl -fsS 'http://vm01.internal:8428/api/v1/query' --data-urlencode 'query=up' | head -c 400
Expected: {"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","cluster":"prod-east",.... Seeing your external_labels proves the samples came from the Prometheus you configured and not from -selfScrapeInterval.
Check how the storage is filling and how much room is left:
curl -fsS http://vm01.internal:8428/metrics | grep -E '^(vm_data_size_bytes|vm_free_disk_space_bytes)'
Expected: vm_data_size_bytes split by part type, and a free-space figure comfortably above the -storage.minFreeDiskSpaceBytes you set. Track the growth of the first number for a week and compare it against your step 5 estimate; that is the moment to adjust retention, while it is still cheap.
Finally, open http://vm01.internal:8428/vmui in a browser and run a range query over a period longer than your Prometheus local retention. If it returns data, the whole point of the exercise is satisfied. The cardinality explorer in the same interface answers the follow-up question of which metric is responsible for your series count.
Troubleshooting
- Prometheus logs
server returned HTTP status 400 Bad Requeston every send. Read the VictoriaMetrics journal, which carries the real reason. The two common ones are a request body larger than-maxInsertRequestSize(default 32 MB — lowermax_samples_per_sendor raise the flag) and a series exceeding-maxLabelsPerTimeseries. Neither is fixed by retrying, so the queue spins until you change something. - Lag grows for hours, then recovers all at once. That is the WAL replay working as designed after the receiver was unreachable. If the recovery itself saturates the storage host, raise
min_backoffso the catch-up is gentler rather than raisingmax_shards, which makes the stampede worse. - VictoriaMetrics stops accepting writes and the log says it switched to read-only mode. Free space dropped below
-storage.minFreeDiskSpaceBytes. Queries keep working, which is intended. Extend the volume, or lower-retentionPeriodand restart — retention applies on the next background merge, so space comes back over minutes, not instantly. - Two Prometheus servers in an HA pair produce doubled or jagged graphs. Both are writing the same series with slightly different timestamps. Drop the distinguishing label on the way out with a
write_relabel_configsentry so the two servers produce byte-identical series, then start VictoriaMetrics with-dedup.minScrapeIntervalset to your scrape interval. Deduplication only collapses samples that belong to an identical series, so the relabel step comes first. - vmui shows the data but a Grafana panel is empty for the last minute. VictoriaMetrics holds back the newest samples by
-search.latencyOffset(30s by default) so in-flight writes do not produce partial results. Widen the panel’s window rather than setting the offset to zero, which trades a cosmetic problem for an accuracy one.
When this is the wrong approach
Single-node means single node. There is no replication and no failover — if that host dies, queries stop and the samples buffered in Prometheus WALs start ticking toward expiry. That is an acceptable trade for an archive with a tested backup (vmbackup, or the /snapshot/create endpoint gated behind -snapshotAuthKey), and an unacceptable one if the storage backs on-call decisions at 3 a.m. When availability of the historical data is itself a requirement, the VictoriaMetrics cluster version splits insert, storage, and select into replaceable parts and replicates across storage nodes.
It is also the wrong shape when your constraint is economic rather than operational. Single-node stores everything on block storage you pay for continuously; Thanos and Grafana Mimir push old blocks to object storage where a year of data costs a fraction of the same year on SSD. Our comparison of Thanos and VictoriaMetrics works through where each one stops being the obvious choice, including the multi-tenant case that single-node does not address at all.
And if the honest requirement is thirty days rather than a year, raising --storage.tsdb.retention.time on the Prometheus you already run is a smaller change than any of this. Reach for remote storage when the retention you need has outgrown the disk you can attach, not before. The references worth keeping open are the VictoriaMetrics documentation and the Prometheus configuration reference, whose remote_write section is the authority on which queue_config defaults your version ships.
If alerts fire into an empty room after hours, that’s exactly what 24/7 Monitoring & Response closes — book a monitoring and response review.