VictoriaMetrics is a high-performance, open-source time-series database and monitoring solution that is fully compatible with the Prometheus query API. It offers significantly better data compression, faster ingestion rates, and lower memory consumption compared to Prometheus, making it an attractive choice for large or long-retention deployments. On RHEL 9 you can run VictoriaMetrics as a drop-in replacement for Prometheus or alongside it by configuring Prometheus remote_write to forward all metrics. This tutorial covers installing the VictoriaMetrics single-node binary, creating a systemd service, integrating it with Prometheus and Grafana, and migrating existing data with vmctl.
Prerequisites
- RHEL 9 server with at least 2 GB of RAM and 20 GB of free disk space
- An existing Prometheus installation (optional — for remote_write or migration)
- Grafana installed and running (optional — to connect a new data source)
- A non-root user with
sudoprivileges - Firewall access on port 8428
Step 1 — Download and Install VictoriaMetrics
Download the latest VictoriaMetrics single-node release, extract the binary, and place it on the system path alongside the vmctl migration tool.
cd /tmp
curl -LO https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v1.101.0/victoria-metrics-linux-amd64-v1.101.0.tar.gz
tar xzf victoria-metrics-linux-amd64-v1.101.0.tar.gz
sudo mv victoria-metrics-prod /usr/local/bin/victoria-metrics
# Download vmctl for data migration
curl -LO https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v1.101.0/vmutils-linux-amd64-v1.101.0.tar.gz
tar xzf vmutils-linux-amd64-v1.101.0.tar.gz
sudo mv vmctl-prod /usr/local/bin/vmctl
sudo useradd --no-create-home --shell /bin/false victoriametrics
sudo mkdir -p /var/lib/victoriametrics
sudo chown victoriametrics:victoriametrics /var/lib/victoriametrics
Step 2 — Create the Systemd Service
Create a systemd unit that starts VictoriaMetrics with a six-month retention period, a defined storage path, and the HTTP listen address.
sudo tee /etc/systemd/system/victoriametrics.service > /dev/null <<'EOF'
[Unit]
Description=VictoriaMetrics
Wants=network-online.target
After=network-online.target
[Service]
User=victoriametrics
Group=victoriametrics
Type=simple
ExecStart=/usr/local/bin/victoria-metrics
-storageDataPath=/var/lib/victoriametrics
-retentionPeriod=6
-httpListenAddr=:8428
-selfScrapeInterval=10s
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now victoriametrics
sudo systemctl status victoriametrics
Step 3 — Open the Firewall Port
Allow inbound traffic on the VictoriaMetrics HTTP port so Prometheus, Grafana, and other clients can reach it.
sudo firewall-cmd --permanent --add-port=8428/tcp
sudo firewall-cmd --reload
# Verify VictoriaMetrics is responding
curl -s http://localhost:8428/metrics | head -20
curl -s 'http://localhost:8428/api/v1/query?query=up' | python3 -m json.tool
Step 4 — Configure Prometheus remote_write
If you want to keep Prometheus for scraping and rule evaluation but store metrics in VictoriaMetrics, add a remote_write block to your Prometheus configuration. VictoriaMetrics accepts data on the /api/v1/write endpoint.
# Edit /etc/prometheus/prometheus.yml and add under the top level:
#
# remote_write:
# - url: http://localhost:8428/api/v1/write
# queue_config:
# max_samples_per_send: 10000
# capacity: 20000
# max_shards: 30
#
sudo tee -a /etc/prometheus/prometheus.yml > /dev/null <<'EOF'
remote_write:
- url: http://localhost:8428/api/v1/write
queue_config:
max_samples_per_send: 10000
capacity: 20000
max_shards: 30
EOF
sudo systemctl reload prometheus
# Confirm metrics are arriving in VictoriaMetrics
curl -s 'http://localhost:8428/api/v1/query?query=up' | python3 -m json.tool
Step 5 — Connect Grafana to VictoriaMetrics
VictoriaMetrics exposes a fully Prometheus-compatible HTTP API, so you can add it as a Prometheus data source in Grafana without any additional plugin.
# In the Grafana UI:
# Configuration → Data Sources → Add data source → Prometheus
# Set URL: http://localhost:8428
# Leave all other settings at their defaults and click Save & Test.
# Alternatively, provision the data source via file:
sudo tee /etc/grafana/provisioning/datasources/victoriametrics.yml > /dev/null <<'EOF'
apiVersion: 1
datasources:
- name: VictoriaMetrics
type: prometheus
access: proxy
url: http://localhost:8428
isDefault: true
editable: false
EOF
sudo systemctl restart grafana-server
Step 6 — Migrate Existing Prometheus Data with vmctl
Use vmctl to import historical Prometheus data stored in the local TSDB data directory into VictoriaMetrics so you do not lose metrics history during migration.
# Stop Prometheus first to ensure a consistent snapshot
sudo systemctl stop prometheus
# Run vmctl in prometheus mode pointing at the Prometheus data directory
vmctl prometheus
--prom-snapshot=/var/lib/prometheus
--vm-addr=http://localhost:8428
--vm-concurrency=4
--verbose
# Verify the imported data range
curl -s 'http://localhost:8428/api/v1/query_range?query=up&start=now-30d&end=now&step=1h'
| python3 -m json.tool | head -40
# After confirming data is present, restart or keep Prometheus stopped
# depending on whether you are fully migrating or using remote_write
sudo systemctl start prometheus
Conclusion
VictoriaMetrics is now running on RHEL 9 with a six-month retention window, receiving metrics either through Prometheus remote_write or directly from scrapers, and serving queries to Grafana via its Prometheus-compatible API. Its on-disk compression typically reduces storage usage by four to ten times compared to a raw Prometheus TSDB for the same retention period, and its lower memory footprint makes it practical to run alongside other services on a single node. For large multi-server environments, consider the VictoriaMetrics cluster edition which splits ingestion, storage, and query into separate horizontally scalable components.
Next steps: How to Set Up Alertmanager with PagerDuty and Slack Integration on RHEL 9, How to Configure VictoriaMetrics Cluster for High Availability, and How to Use MetricsQL for Advanced Query Analysis in VictoriaMetrics.