RousselTMLEARNING

Observability

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

The VictoriaMetrics cluster architecture: the roles of vminsert, vmselect and vmstorage, data distribution and replication, multi-tenant URLs, sizing and high availability.

1. Architecture #

Three components, only one stateful.

Roles #

VictoriaMetrics cluster
vmstorage nodes do not talk to each other: the architecture is deliberately simple.
ComponentStateRole
vminsertStatelessReceives writes and distributes series across vmstorage nodes (consistent hashing)
vmstorageStateful (disk)Stores data; does not know about other vmstorage nodes
vmselectStateless (cache)Queries all vmstorage nodes and merges the results
vmstorage -storageDataPath=/data -retentionPeriod=1y
vminsert  -storageNode=vmstorage-1:8400,vmstorage-2:8400,vmstorage-3:8400
vmselect  -storageNode=vmstorage-1:8401,vmstorage-2:8401,vmstorage-3:8401

2. Multi-tenancy #

The tenant is in the URL.

URLs #

UsageURL
Writehttp://vminsert:8480/insert/<accountID>/prometheus/api/v1/write
Read (Grafana data source)http://vmselect:8481/select/<accountID>/prometheus
Tenant and project<accountID>:<projectID>, for example 42:1

Tenants are created implicitly on first write. As with Mimir, authentication is delegated to a gateway (vmauth in the VictoriaMetrics ecosystem) that maps each user to their URL.

# vmauth : routage authentifié vers les tenants
users:
  - username: equipe-web
    password: secret-web
    url_prefix: http://vmselect:8481/select/1/prometheus
  - username: equipe-data
    password: secret-data
    url_prefix: http://vmselect:8481/select/2/prometheus

3. Replication and availability #

Surviving the loss of a node.

Settings #

vminsert -replicationFactor=2 -storageNode=...      # chaque échantillon sur 2 vmstorage
vmselect -replicationFactor=2 -dedup.minScrapeInterval=1ms -storageNode=...
SituationBehavior
One vmstorage unavailable, no replicationWrites are redirected to the others; reads return partial results (flagged)
One vmstorage unavailable, replication 2Complete reads
vminsert or vmselect unavailableNo impact if there are several instances behind a load balancer
Good practice: Replication doubles the disk needed. For many teams, two independent clusters fed by vmagent (two -remoteWrite.url) offer better resilience at a comparable cost.

Related articles

VictoriaMetrics: why and how, from single node to cluster

What VictoriaMetrics brings compared with Prometheus alone, its components (single-node, vmagent, vmalert, vm…

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 …

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!