VictoriaMetrics
Fast and cost-effective time-series database and monitoring solution.
Overview
VictoriaMetrics is a high-performance, cost-effective time-series database designed as a drop-in replacement for Prometheus with significantly better resource efficiency and query performance. Originally developed by VictoriaMetrics team in 2019, it offers full Prometheus compatibility while consuming up to 10x less RAM and providing faster query execution through its optimized storage engine and MetricsQL query language that extends PromQL capabilities.
This deployment combines VictoriaMetrics as the core time-series database with Grafana as the visualization frontend. The VictoriaMetrics container runs as a single-node instance configured with 90-day data retention and exposes the Prometheus-compatible API on port 8428, while Grafana connects to it as a Prometheus data source for creating dashboards and visualizations. The two services communicate over a dedicated Docker network with persistent storage for both metrics data and Grafana configurations.
This stack is ideal for organizations seeking a more efficient alternative to traditional Prometheus setups, particularly those dealing with high-cardinality metrics or resource-constrained environments. The combination provides enterprise-grade monitoring capabilities with lower operational overhead, making it perfect for startups scaling their monitoring infrastructure, enterprises looking to reduce monitoring costs, or developers who need powerful time-series analytics without the complexity of managing multiple Prometheus instances and federation.
Key Features
- Prometheus-compatible ingestion and querying API for seamless migration from existing Prometheus setups
- MetricsQL query language with extended functions beyond standard PromQL for advanced analytics
- Ultra-efficient storage engine consuming up to 10x less RAM than Prometheus with faster query performance
- 90-day configurable data retention with efficient compression and deduplication
- Native support for high-cardinality metrics without performance degradation
- Grafana integration with pre-configured Prometheus data source connection
- Single-node deployment suitable for millions of active time series
- Built-in HTTP API for both Prometheus remote_write protocol and direct metric ingestion
Common Use Cases
- 1Infrastructure monitoring replacement for resource-constrained Prometheus deployments
- 2High-cardinality application metrics storage for microservices architectures
- 3Cost-effective monitoring solution for cloud environments with usage-based pricing
- 4Long-term metrics retention and historical analysis for capacity planning
- 5IoT and sensor data collection with high ingestion rates and efficient storage
- 6Multi-tenant monitoring environments requiring efficient resource utilization
- 7Development and testing environments needing production-like monitoring capabilities
Prerequisites
- Docker and Docker Compose installed with at least 1GB available RAM for VictoriaMetrics
- Understanding of Prometheus metrics format and PromQL query language basics
- GRAFANA_PASSWORD environment variable set for Grafana admin authentication
- Available ports 3000 (Grafana) and 8428 (VictoriaMetrics) on the host system
- Basic knowledge of time-series concepts and monitoring dashboard creation
- Sufficient disk space for metrics retention (estimate based on ingestion rate and 90-day retention)
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 victoriametrics: 3 image: victoriametrics/victoria-metrics:latest4 container_name: victoriametrics5 restart: unless-stopped6 command: 7 - --storageDataPath=/data8 - --httpListenAddr=:84289 - --retentionPeriod=90d10 volumes: 11 - vm_data:/data12 ports: 13 - "8428:8428"14 networks: 15 - vm-network1617 grafana: 18 image: grafana/grafana:latest19 container_name: grafana20 restart: unless-stopped21 environment: 22 GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}23 volumes: 24 - grafana_data:/var/lib/grafana25 ports: 26 - "3000:3000"27 depends_on: 28 - victoriametrics29 networks: 30 - vm-network3132volumes: 33 vm_data: 34 grafana_data: 3536networks: 37 vm-network: 38 driver: bridge.env Template
.env
1GRAFANA_PASSWORD=adminUsage Notes
- 1Docs: https://docs.victoriametrics.com/
- 2Prometheus-compatible API at http://localhost:8428
- 3Use as Prometheus remote_write target or standalone
- 410x less RAM, faster queries than Prometheus
- 5MetricsQL extends PromQL with additional functions
- 6Grafana datasource: add as Prometheus type, URL http://victoriametrics:8428
Individual Services(2 services)
Copy individual services to mix and match with your existing compose files.
victoriametrics
victoriametrics:
image: victoriametrics/victoria-metrics:latest
container_name: victoriametrics
restart: unless-stopped
command:
- "--storageDataPath=/data"
- "--httpListenAddr=:8428"
- "--retentionPeriod=90d"
volumes:
- vm_data:/data
ports:
- "8428:8428"
networks:
- vm-network
grafana
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: unless-stopped
environment:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}
volumes:
- grafana_data:/var/lib/grafana
ports:
- "3000:3000"
depends_on:
- victoriametrics
networks:
- vm-network
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 victoriametrics:5 image: victoriametrics/victoria-metrics:latest6 container_name: victoriametrics7 restart: unless-stopped8 command:9 - --storageDataPath=/data10 - --httpListenAddr=:842811 - --retentionPeriod=90d12 volumes:13 - vm_data:/data14 ports:15 - "8428:8428"16 networks:17 - vm-network1819 grafana:20 image: grafana/grafana:latest21 container_name: grafana22 restart: unless-stopped23 environment:24 GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}25 volumes:26 - grafana_data:/var/lib/grafana27 ports:28 - "3000:3000"29 depends_on:30 - victoriametrics31 networks:32 - vm-network3334volumes:35 vm_data:36 grafana_data:3738networks:39 vm-network:40 driver: bridge41EOF4243# 2. Create the .env file44cat > .env << 'EOF'45GRAFANA_PASSWORD=admin46EOF4748# 3. Start the services49docker compose up -d5051# 4. View logs52docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/victoria-metrics/run | bashTroubleshooting
- VictoriaMetrics container exits with storage permission errors: Ensure Docker has write access to the vm_data volume mount point
- Grafana shows 'Bad Gateway' when connecting to VictoriaMetrics: Verify both containers are on vm-network and VictoriaMetrics is healthy on port 8428
- High memory usage despite VictoriaMetrics efficiency claims: Check for extremely high-cardinality metrics or inefficient MetricsQL queries causing memory spikes
- Grafana datasource configuration fails: Use 'http://victoriametrics:8428' as URL and select 'Prometheus' as datasource type, not VictoriaMetrics
- Missing metrics data in Grafana dashboards: Verify metrics are being ingested via VictoriaMetrics API at http://localhost:8428/api/v1/query
- VictoriaMetrics API returns 'out of disk space' errors: Monitor available storage and adjust retention period using --retentionPeriod parameter
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
victoriametricsgrafana
Tags
#victoriametrics#time-series#prometheus-compatible#metrics
Category
Monitoring & ObservabilityAd Space
Shortcuts: C CopyF FavoriteD Download