1. Architecture #
Three components, only one stateful.
Roles #
| Component | State | Role |
|---|---|---|
| vminsert | Stateless | Receives writes and distributes series across vmstorage nodes (consistent hashing) |
| vmstorage | Stateful (disk) | Stores data; does not know about other vmstorage nodes |
| vmselect | Stateless (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:84012. Multi-tenancy #
The tenant is in the URL.
URLs #
| Usage | URL |
|---|---|
| Write | http://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/prometheus3. 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=...| Situation | Behavior |
|---|---|
| One vmstorage unavailable, no replication | Writes are redirected to the others; reads return partial results (flagged) |
| One vmstorage unavailable, replication 2 | Complete reads |
| vminsert or vmselect unavailable | No 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.