Installation of VictoriaMetrics on Ubuntu 22.04

VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database.

It supports the Prometheus pull model and various push protocols (Graphite, InfluxDB, OpenTSDB) for data ingestion. It is optimized for storage with high-latency IO, low IOPS and time series with high churn rate.

For reading the data and evaluating alerting rules, VictoriaMetrics supports the PromQL, MetricsQL and Graphite query languages. VictoriaMetrics Single is fully autonomous and can be used as a long-term storage for time series.

VictoriaMetrics Single can easily handle 10M+ of active time series on a single instance. It is perfect for small and medium environments.

Update package index files

sudo apt update

Create a download directory

mkdir ~/downloads && cd ~/downloads

Get VictoriaMetrics

wget https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v1.91.3/victoria-metrics-linux-amd64-v1.91.3.tar.gz

Extract package contents

tar xzvf victoria-metrics-linux-amd64-v1.91.3.tar.gz

Move VictoriaMetrics single binary to bin folder

sudo mv victoria-metrics-prod /usr/local/bin/victoriametrics

Create a directory to hold the PID file

sudo mkdir /run/victoriametrics

Create service for VictoriaMetrics

sudo nano /etc/systemd/system/victoriametrics.service
[Unit]
Description=VictoriaMetrics
After=network.target

[Service]
Type=simple
StartLimitBurst=5
StartLimitInterval=0
Restart=on-failure
RestartSec=1
PIDFile=/run/victoriametrics/victoriametrics.pid
ExecStart=/usr/local/bin/victoriametrics -storageDataPath /data -retentionPeriod 360
ExecStop=/bin/kill -s SIGTERM $MAINPID

[Install]
WantedBy=multi-user.target

Set the file limits for the service

sudo mkdir /etc/systemd/system/victoriametrics.service.d
sudo nano /etc/systemd/system/victoriametrics.service.d/ulimit.conf

Enter below contents in the file

[Service]
LimitNOFILE=32000
LimitNPROC=32000

Enable VictoriaMetrics service

sudo systemctl enable victoriametrics

Start VictoriaMetrics service

sudo systemctl start victoriametrics

Check the status of VictoriaMetrics service

 sudo systemctl status victoriametrics.service

Terminal output for reference

$ sudo systemctl status victoriametrics.service 
โ— victoriametrics.service - VictoriaMetrics
     Loaded: loaded (/etc/systemd/system/victoriametrics.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/victoriametrics.service.d
             โ””โ”€ulimit.conf
     Active: active (running) since Thu 2023-08-03 10:01:24 UTC; 11s ago
   Main PID: 116141 (victoriametrics)
      Tasks: 8 (limit: 4575)
     Memory: 6.4M
        CPU: 31ms
     CGroup: /system.slice/victoriametrics.service
             โ””โ”€116141 /usr/local/bin/victoriametrics -storageDataPath /data -retentionPeriod 360

Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.584Z        info        VictoriaMetrics/lib/memory/memory.go:42        limiting caches to 2468732928 bytes, leaving 1645821952 bytes to the OS according to -memory.allowedPercent=60
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.588Z        info        VictoriaMetrics/lib/storage/storage.go:858        nothing to load from "/data/cache/curr_hour_metric_ids"
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.588Z        info        VictoriaMetrics/lib/storage/storage.go:858        nothing to load from "/data/cache/prev_hour_metric_ids"
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.588Z        info        VictoriaMetrics/lib/storage/storage.go:818        nothing to load from "/data/cache/next_day_metric_ids"
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.609Z        info        VictoriaMetrics/app/vmstorage/main.go:122        successfully opened storage "/data" in 0.028 seconds; partsCount: 0; blocksCount: 0; rowsCount: 0; sizeBytes: 0
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.610Z        info        VictoriaMetrics/app/vmselect/promql/rollup_result_cache.go:114        loading rollupResult cache from "/data/cache/rollupResult"...
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.611Z        info        VictoriaMetrics/app/vmselect/promql/rollup_result_cache.go:142        loaded rollupResult cache from "/data/cache/rollupResult" in 0.001 seconds; entriesCount: 0, sizeBytes: 0
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.611Z        info        VictoriaMetrics/app/victoria-metrics/main.go:80        started VictoriaMetrics in 0.030 seconds
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.612Z        info        VictoriaMetrics/lib/httpserver/httpserver.go:96        starting http server at http://127.0.0.1:8428/
Aug 03 10:01:24 abb victoriametrics[116141]: 2023-08-03T10:01:24.612Z        info        VictoriaMetrics/lib/httpserver/httpserver.go:97        pprof handlers are exposed at http://127.0.0.1:8428/debug/pprof/