RousselTMLEARNING

Observability

VictoriaMetrics: why and how, from single node to cluster

What VictoriaMetrics brings compared with Prometheus alone, its components (single-node, vmagent, vmalert, vminsert/vmselect/vmstorage cluster) and its strengths: efficiency, compatibility and simplicity.

1. Why VictoriaMetrics? #

A resource-efficient time series database.

The promises #

VictoriaMetrics is a Prometheus-compatible time series database (remote write ingestion, query API, PromQL), designed to use little memory, CPU and disk. It can serve as long-term storage for Prometheus or as a full replacement.

StrengthDetail
EfficiencyVery effective compression (often less than one byte per sample), low memory per active series
SimplicityA single binary with no dependencies in single-node mode, local disk storage
CompatibilityPrometheus remote write, Prometheus API, Graphite, InfluxDB, OpenTSDB, OTLP, DataDog
MetricsQLA superset of PromQL with extra functions
Ecosystemvmagent, vmalert, vmbackup, Kubernetes operator, VictoriaLogs for logs
Good to know: VictoriaMetrics is open source (Apache 2.0). An enterprise version notably adds downsampling, per-series retention filters and security features.

2. The components #

Each with its own role.

Overview #

VictoriaMetrics components
vmagent and vmalert also work with any remote-write-compatible storage.
ComponentPortRole
victoria-metrics (single-node)8428Ingestion, storage and queries in a single process
vmagent8429Collection (scrape), relabeling, disk buffer, remote write to one or more stores
vmalert8880Recording and alerting rules, sending to Alertmanager
vminsert / vmselect / vmstorage8480 / 8481 / 8482Cluster version: separate write, read and storage
vmbackup / vmrestore-Incremental backups to object storage
vmui/vmuiBuilt-in interface for exploration and cardinality analysis

3. Single node or cluster? #

The single node goes a long way.

Choosing #

CriterionSingle nodeCluster
VolumeUp to several million active seriesBeyond that, horizontal scaling
AvailabilityOne instance (two instances in parallel for HA)Data replication
Multi-tenantNoYes (account identifier in the URL)
OperationsVery simpleThree components to size
Good practice: Start with the single node: it covers the vast majority of needs and can be migrated to the cluster (vmctl) if necessary.

4. Getting started #

One command.

Startup #

docker run -d --name vm -p 8428:8428 -v vmdata:/victoria-metrics-data \
  victoriametrics/victoria-metrics:latest \
  -retentionPeriod=1y -storageDataPath=/victoria-metrics-data
curl -s localhost:8428/health
# Interface : http://localhost:8428/vmui
Good to know: Without a unit, -retentionPeriod is expressed in months (-retentionPeriod=12); you can also write 90d, 1y. Grafana connects with a Prometheus data source pointing to http://vm:8428.

Related articles

Ingesting metrics into VictoriaMetrics: scraping, vmagent and remote write

All the ways to feed VictoriaMetrics: remote write from Prometheus, built-in scraping, vmagent and its disk b…

MetricsQL: PromQL with superpowers

The differences between MetricsQL and PromQL: implicit windows, extra functions (range, rollup, label), WITH …

VictoriaMetrics cluster: vminsert, vmselect, vmstorage and multi-tenancy

The VictoriaMetrics cluster architecture: the roles of vminsert, vmselect and vmstorage, data distribution an…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!