VictoriaMetrics/docs/Quick-Start.md
Artem Navoiev 38bb2372a4
docs: quick use official names for victoriametrics components (#6626)
### Describe Your Changes

Replace VM- with VictoriaMetrics in QuickStart
Keep the previous anchors for backward compatibility

### Checklist

The following checks are **mandatory**:

- [ x] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).

---------

Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
(cherry picked from commit 5b43675af6)
2024-07-11 12:40:23 +02:00

17 KiB
Raw Blame History

sort weight title menu aliases
22 22 Quick start
docs
parent weight
victoriametrics 22
/Quick-Start.html

Quick start

How to install

VictoriaMetrics is distributed in two forms:

  • Single-server-VictoriaMetrics - all-in-one binary, which is very easy to use and maintain. Single-server-VictoriaMetrics perfectly scales vertically and easily handles millions of metrics/s;
  • VictoriaMetrics Cluster - set of components for building horizontally scalable clusters.

Single-server-VictoriaMetrics VictoriaMetrics is available as:

Just download VictoriaMetrics and follow these instructions. Then read Prometheus setup and Grafana setup docs.

VictoriaMetrics is developed at a fast pace, so it is recommended periodically checking the CHANGELOG and performing regular upgrades.

Starting VictoriaMetrics Single Node via Docker

The following commands download the latest available Docker image of VictoriaMetrics and start it at port 8428, while storing the ingested data at victoria-metrics-data subdirectory under the current directory:

docker pull victoriametrics/victoria-metrics:latest
docker run -it --rm -v `pwd`/victoria-metrics-data:/victoria-metrics-data -p 8428:8428 victoriametrics/victoria-metrics:latest

Open http://localhost:8428 in web browser and read these docs.

There is also VictoriaMetrics cluster

  • horizontally scalable installation, which scales to multiple nodes.

Starting VictoriaMetrics Cluster via Docker

The following commands clone the latest available VictoriaMetrics repository and start the docker container via 'make docker-cluster-up'. Further customization is possible by editing the docker-compose-cluster.yml file.

git clone https://github.com/VictoriaMetrics/VictoriaMetrics && cd VictoriaMetrics
make docker-cluster-up

See more details here.

Starting VictoriaMetrics Single Node from a Binary

  1. Download the correct binary for your OS and architecture from GitHub. For Enterprise binaries see this link.

  2. Extract the archive to /usr/local/bin by running:

sudo tar -xvf <victoriametrics-archive> -C /usr/local/bin

Replace <victoriametrics-archive> with the path to the archive you downloaded in step 1.

  1. Create a VictoriaMetrics user on the system:
sudo useradd -s /usr/sbin/nologin victoriametrics
  1. Create a folder for storing VictoriaMetrics data:
mkdir -p /var/lib/victoria-metrics && chown -R victoriametrics:victoriametrics /var/lib/victoria-metrics
  1. Create a Linux Service by running the following:
cat <<END >/etc/systemd/system/victoriametrics.service
[Unit]
Description=VictoriaMetrics service
After=network.target

[Service]
Type=simple
User=victoriametrics
Group=victoriametrics
ExecStart=/usr/local/bin/victoria-metrics-prod -storageDataPath=/var/lib/victoria-metrics -retentionPeriod=90d -selfScrapeInterval=10s
SyslogIdentifier=victoriametrics
Restart=always

PrivateTmp=yes
ProtectHome=yes
NoNewPrivileges=yes

ProtectSystem=full

[Install]
WantedBy=multi-user.target
END

Extra command-line flags can be added to ExecStart line.

If you want to deploy VictoriaMetrics Single Node as a Windows Service review the running as a Windows service docs.

Please note, victoriametrics service is listening on :8428 for HTTP connections (see -httpListenAddr flag).

  1. Start and enable the service by running the following command:
sudo systemctl daemon-reload && sudo systemctl enable --now victoriametrics.service
  1. Check that service started successfully:
sudo systemctl status victoriametrics.service
  1. After VictoriaMetrics is in Running state, verify vmui is working by going to http://<ip_or_hostname>:8428/vmui.

Starting VictoriaMetrics Cluster from Binaries

VictoriaMetrics cluster consists of 3 components. It is recommended to run these components in the same private network (for security reasons), but on the separate physical nodes for the best performance.

On all nodes you will need to do the following:

  1. Download the correct binary for your OS and architecture with -cluster suffix from GitHub. For Enterprise binaries see this link.

  2. Extract the archive to /usr/local/bin by running:

sudo tar -xvf <victoriametrics-archive> -C /usr/local/bin

Replace <victoriametrics-archive> with the path to the archive you downloaded in step 1

  1. Create a user account for VictoriaMetrics:
sudo useradd -s /usr/sbin/nologin victoriametrics

See recommendations for installing each type of cluster component below.

Installing vmstorage
  1. Create a folder for storing vmstorage data:

mkdir -p /var/lib/vmstorage && chown -R victoriametrics:victoriametrics /var/lib/vmstorage

  1. Create a Linux Service for vmstorage service by running the following command:
cat <<END >/etc/systemd/system/vmstorage.service
[Unit]
Description=VictoriaMetrics vmstorage service
After=network.target

[Service]
Type=simple
User=victoriametrics
Group=victoriametrics
Restart=always
ExecStart=/usr/local/bin/vmstorage-prod -retentionPeriod=90d -storageDataPath=/var/lib/vmstorage

PrivateTmp=yes
NoNewPrivileges=yes
ProtectSystem=full

[Install]
WantedBy=multi-user.target
END

Extra command-line flags for vmstorage can be added to ExecStart line.

Please note, vmstorage service is listening on :8400 for vminsert connections (see -vminsertAddr flag), on :8401 for vmselect connections (see --vmselectAddr flag) and on :8482 for HTTP connections (see -httpListenAddr flag).

  1. Start and Enable vmstorage:
sudo systemctl daemon-reload && systemctl enable --now vmstorage
  1. Check that service started successfully:
sudo systemctl status vmstorage
  1. After vmstorage is in Running state, confirm the service is healthy by visiting http://<ip_or_hostname>:8482/-/healthy link. It should say "VictoriaMetrics is Healthy".
Installing vminsert
  1. Create a Linux Service for vminsert by running the following command:
cat << END >/etc/systemd/system/vminsert.service
[Unit]
Description=VictoriaMetrics vminsert service
After=network.target

[Service]
Type=simple
User=victoriametrics
Group=victoriametrics
Restart=always
ExecStart=/usr/local/bin/vminsert-prod -storageNode=<list of vmstorages>

PrivateTmp=yes
NoNewPrivileges=yes
ProtectSystem=full

[Install]
WantedBy=multi-user.target
END

Replace <list of vmstorages> with addresses of previously configured vmstorage services. To specify multiple addresses you can repeat the flag multiple times, or separate addresses with commas in one flag. See more details in -storageNode flag description here.

Please note, vminsert service is listening on :8480 for HTTP connections (see -httpListenAddr flag).

  1. Start and Enable vminsert:
sudo systemctl daemon-reload && sudo systemctl enable --now vminsert.service
  1. Check that service started successfully:
sudo systemctl status vminsert.service
  1. After vminsert is in Running state, confirm the service is healthy by visiting http://<ip_or_hostname>:8480/-/healthy link. It should say "VictoriaMetrics is Healthy"
Installing vmselect
  1. Create a folder to store temporary cache:
sudo mkdir -p /var/lib/vmselect-cache && sudo chown -R victoriametrics:victoriametrics /var/lib/vmselect-cache
  1. Add a Linux Service for vmselect by running
cat << END >/etc/systemd/system/vmselect.service
[Unit]
Description=VictoriaMetrics vmselect service
After=network.target

[Service]
Type=simple
User=victoriametrics
Group=victoriametrics
Restart=always
ExecStart=/usr/local/bin/vmselect-prod -storageNode=<list of vmstorages> -cacheDataPath=/var/lib/vmselect-cache

PrivateTmp=yes
NoNewPrivileges=yes

ProtectSystem=full

[Install]
WantedBy=multi-user.target
END

Replace <list of vmstorages> with addresses of previously configured vmstorage services. To specify multiple addresses you can repeat the flag multiple times, or separate addresses with commas in one flag. See more details in -storageNode flag description here.

Please note, vmselect service is listening on :8481 for HTTP connections (see -httpListenAddr flag).

  1. Start and Enable vmselect:
sudo systemctl daemon-reload && sudo systemctl enable --now vmselect.service
  1. Make sure the vmselect service is running:
sudo systemctl status vmselect.service
  1. After vmselect is in Running state, confirm the service is healthy by visiting http://<ip_or_hostname>:8481/select/0/vmui link. It should open vmui page.

Write data

There are two main models in monitoring for data collection: push and pull. Both are used in modern monitoring and both are supported by VictoriaMetrics.

See more details on writing data here.

Query data

VictoriaMetrics provides an HTTP API for serving read queries. The API is used in various integrations such as Grafana. The same API is also used by VMUI - graphical User Interface for querying and visualizing metrics.

MetricsQL - is the query language for executing read queries in VictoriaMetrics. MetricsQL is a PromQL -like query language with a powerful set of functions and features for working specifically with time series data.

See more details on querying data here

Alerting

It is not possible to physically trace all changes on graphs all the time, that is why alerting exists. In vmalert it is possible to create a set of conditions based on PromQL and MetricsQL queries that will send a notification when such conditions are met.

Data migration

Migrating data from other TSDBs to VictoriaMetrics is as simple as importing data via any of supported formats.

The migration might get easier when using vmctl - VictoriaMetrics command line tool. It supports the following databases for migration to VictoriaMetrics:

Productionization

When going to production with VictoriaMetrics we recommend following the recommendations.

Monitoring

Each VictoriaMetrics component emits its own metrics with various details regarding performance and health state. Docs for the components also contain a Monitoring section with an explanation of what and how should be monitored. For example, Single-server-VictoriaMetrics Monitoring.

VictoriaMetric team prepared a list of Grafana dashboards for the main components. Each dashboard contains a lot of useful information and tips. It is recommended to have these dashboards installed and up to date.

Using the recommended alerting rules versions would also help to identify and notify about issues with the system.

The rule of thumb is to have a separate installation of VictoriaMetrics or any other monitoring system to monitor the production installation of VictoriaMetrics. This would make monitoring independent and will help identify problems with the main monitoring installation.

See more details in the article VictoriaMetrics Monitoring.

Capacity planning

See capacity planning sections in docs for Single-server-VictoriaMetrics and VictoriaMetrics Cluster.

Capacity planning isn't possible without monitoring, so consider configuring it first. Understanding resource usage and performance of VictoriaMetrics also requires knowing the tech terms active series, churn rate, cardinality, slow inserts. All of them are present in Grafana dashboards.

Data safety

It is recommended to read Replication and data safety, Why replication doesnt save from disaster? and backups.

Configuring limits

To avoid excessive resource usage or performance degradation limits must be in place:

Security recommendations