Cyberithub

How to Install VictoriaMetrics on Ubuntu 20.04 LTS [Step By Step]

Advertisements

In this article, I will take you through the steps to install VictoriaMetrics on Ubuntu 20.04 LTS. According to Official Documentation, VictoriaMetrics is a cost effective, high performance open series database and scalable monitoring solution. It can be used as a long term storage for Prometheus and can also be used as drop-in replacement for Prometheus in Grafana. All the configuration done in Victoriametrics can be explicitly done through command-line flags hence making it easier for all command line lovers.

Other Important Features

  • It provides high performance and faster response.
  • It provides good horizontal and vertical scalability for both data ingestion and data querying.
  • It is optimized for time series with high churn rate.
  • It is optimized for storage with high-latency IO and low IOPS.
  • It provides global query view which means multiple Prometheus Instances can ingest data into VictoriaMetrics.
  • It provides high data compression.
  • It protects the storage from data corruption on unclean shutdown.
  • It supports metrics relabeling. More on GitHub.
  • Easy and fast backups from instant snapshots to S3 or GCS can be done with vmbackup / vmrestore tools.

How to Install VictoriaMetrics on Ubuntu 20.04 LTS [Step By Step]

How to Install VictoriaMetrics on Ubuntu 20.04 LTS

Also Read: How to Install Graylog on Ubuntu 20.04 LTS [Easy Steps]

Step 1: Prerequisites

a) You should have a running Ubuntu 20.04 LTS Server.

b) You should have sudo or root access to run privileged commands.

c) You should have snap utility available in your System.

 

Step 2: Update Server

First logical step that you can think of doing before installing any new package is checking for any latest available updates by using apt update command. This will search and install all the available stables updates from configured Repositories.

root@localhost:~# apt update
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:5 https://artifacts.elastic.co/packages/oss-7.x/apt stable InRelease
Ign:6 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 InRelease
Hit:7 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 Release
Get:9 https://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Hit:8 https://packages.graylog2.org/repo/debian stable InRelease
Get:10 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [35.7 kB]
Get:12 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [64.5 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:14 https://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,088 B]
Fetched 219 kB in 4s (56.5 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
8 packages can be upgraded. Run 'apt list --upgradable' to see them.

 

Step 3: Check Victoriametrics Info

If you want to check complete information about Victoriametrics snap then you need to use snap info victoriametrics command as shown below. This will give some important information like the snap version currently available through different channels.

root@localhost:~# snap info victoriametrics
name: victoriametrics
summary: VictoriaMetrics is fast, cost-effective and scalable time-series database.
publisher: VictoriaMetrics (f41gh7)
store-url: https://snapcraft.io/victoriametrics
contact: info@victoriametrics.com
license: unset
description: |
* VictoriaMetrics can be used as long-term storage for Prometheus or for vmagent.
See [these docs](#prometheus-setup) for details.
* Supports Prometheus querying API, so it can be used as Prometheus drop-in replacement in
Grafana.
..........................................

 

Step 4: Install VictoriaMetrics

In the next step, you need to install VictoriaMetrics snap using snap install victoriametrics command as shown below.

root@localhost:~# snap install victoriametrics
victoriametrics v1.58.0+git439.c5188581 from VictoriaMetrics (f41gh7) installed

 

Step 5: Verify VictoriaMetrics

You can verify the VictoriaMetrics health by checking its /metrics page using curl http://localhost:8428/metrics query. You should see a list of internal metrics in plain text format as shown below.

root@localhost:~# curl http://localhost:8428/metrics
vm_active_force_merges 0
vm_active_merges{type="indexdb"} 0
vm_active_merges{type="storage/big"} 0
vm_active_merges{type="storage/small"} 0
vm_assisted_merges_total{type="indexdb"} 0
vm_assisted_merges_total{type="storage/small"} 0
vm_blocks{type="indexdb"} 0
vm_blocks{type="storage/big"} 0
vm_blocks{type="storage/small"} 0
vm_cache_collisions_total{type="storage/metricName"} 0
vm_cache_collisions_total{type="storage/tsid"} 0
vm_cache_entries{type="indexdb/dataBlocks"} 0
vm_cache_entries{type="indexdb/indexBlocks"} 0
vm_cache_entries{type="indexdb/tagFilters"} 2
vm_cache_entries{type="promql/parse"} 1
vm_cache_entries{type="promql/regexp"} 1
vm_cache_entries{type="promql/rollupResult"} 0
vm_cache_entries{type="storage/bigIndexBlocks"} 0

 

Step 6: Run Sample Query

You can also run a sample API query to check the usage. If you get a response with success status like below then it confirms API request/response is working as expected.

root@localhost:~# curl http://localhost:8428/api/v1/query -d 'query={job=~".*"}'
{"status":"success","data":{"resultType":"vector","result":[]}}

 

Step 7: Remove VictoriaMetrics

Once you are done with VictoriaMetrics, you can remove the snap by using snap remove victoriametrics command as shown below.

root@localhost:~# snap remove victoriametrics
victoriametrics removed

Leave a Comment