2021-04-22 13:44:07 +02:00
---
2021-05-26 11:32:16 +02:00
sort: 10
2023-05-25 21:26:36 +02:00
weight: 10
menu:
docs:
parent: 'victoriametrics'
weight: 10
title: vmbackupmanager
aliases:
- /vmbackupmanager.html
2021-04-22 13:44:07 +02:00
---
## vmbackupmanager
2022-10-24 17:00:25 +02:00
***vmbackupmanager is a part of [enterprise package ](https://docs.victoriametrics.com/enterprise.html ). It is available for download and evaluation at [releases page ](https://github.com/VictoriaMetrics/VictoriaMetrics/releases )***
2021-04-22 13:44:07 +02:00
2022-10-08 09:30:25 +02:00
The VictoriaMetrics backup manager automates regular backup procedures. It supports the following backup intervals: **hourly** , **daily** , **weekly** and **monthly** .
Multiple backup intervals may be configured simultaneously. I.e. the backup manager creates hourly backups every hour, while it creates daily backups every day, etc.
Backup manager must have read access to the storage data, so best practice is to install it on the same machine (or as a sidecar) where the storage node is installed.
The backup service makes a backup every hour and puts it to the latest folder and then copies data to the folders
which represent the backup intervals (hourly, daily, weekly and monthly)
2021-04-22 13:44:07 +02:00
The required flags for running the service are as follows:
2022-10-08 09:30:25 +02:00
* -eula - should be true and means that you have the legal right to run a backup manager. That can either be a signed contract or an email
with confirmation to run the service in a trial period.
* -storageDataPath - path to VictoriaMetrics or vmstorage data path to make backup from.
2022-03-22 12:40:55 +01:00
* -snapshot.createURL - VictoriaMetrics creates snapshot URL which will automatically be created during backup. Example: < http: // victoriametrics:8428 / snapshot / create >
2022-10-08 09:30:25 +02:00
* -dst - backup destination at [the supported storage types ](https://docs.victoriametrics.com/vmbackup.html#supported-storage-types ).
* -credsFilePath - path to file with GCS or S3 credentials. Credentials are loaded from default locations if not set.
See [https://cloud.google.com/iam/docs/creating-managing-service-account-keys ](https://cloud.google.com/iam/docs/creating-managing-service-account-keys )
and [https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html ](https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html ).
2021-04-22 13:44:07 +02:00
Backup schedule is controlled by the following flags:
* -disableHourly - disable hourly run. Default false
* -disableDaily - disable daily run. Default false
* -disableWeekly - disable weekly run. Default false
* -disableMonthly - disable monthly run. Default false
By default, all flags are turned on and Backup Manager backups data every hour for every interval (hourly, daily, weekly and monthly).
The backup manager creates the following directory hierarchy at ** -dst**:
* /latest/ - contains the latest backup
* /hourly/ - contains hourly backups. Each backup is named as *YYYY-MM-DD:HH*
* /daily/ - contains daily backups. Each backup is named as *YYYY-MM-DD*
* /weekly/ - contains weekly backups. Each backup is named as *YYYY-WW*
* /monthly/ - contains monthly backups. Each backup is named as *YYYY-MM*
To get the full list of supported flags please run the following command:
```console
./vmbackupmanager --help
```
2022-10-08 09:30:25 +02:00
The service creates a **full** backup each run. This means that the system can be restored fully
from any particular backup using [vmrestore ](https://docs.victoriametrics.com/vmrestore.html ).
Backup manager uploads only the data that has been changed or created since the most recent backup (incremental backup).
This reduces the consumed network traffic and the time needed for performing the backup.
See [this article ](https://medium.com/@valyala/speeding-up-backups-for-big-time-series-databases-533c1a927883 ) for details.
2021-04-22 13:44:07 +02:00
2023-05-10 09:50:41 +02:00
*Please take into account that the first backup upload could take a significant amount of time as it needs to upload all the data.*
2021-04-22 13:44:07 +02:00
There are two flags which could help with performance tuning:
* -maxBytesPerSecond - the maximum upload speed. There is no limit if it is set to 0
* -concurrency - The number of concurrent workers. Higher concurrency may improve upload speed (default 10)
2021-06-17 16:18:47 +02:00
## Example of Usage
2021-04-22 13:44:07 +02:00
2022-10-08 09:30:25 +02:00
GCS and cluster version. You need to have a credentials file in json format with following structure:
2021-04-22 13:44:07 +02:00
credentials.json
```json
{
"type": "service_account",
"project_id": "< project > ",
"private_key_id": "",
"private_key": "-----BEGIN PRIVATE KEY-----\-----END PRIVATE KEY-----\n",
2023-01-04 06:50:28 +01:00
"client_email": "test@< project > .iam.gserviceaccount.com",
2021-04-22 13:44:07 +02:00
"client_id": "",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/test%40< project > .iam.gserviceaccount.com"
}
```
Backup manager launched with the following configuration:
```console
export NODE_IP=192.168.0.10
export VMSTORAGE_ENDPOINT=http://127.0.0.1:8428
2022-09-26 16:35:45 +02:00
./vmbackupmanager -dst=gs://vmstorage-data/$NODE_IP -credsFilePath=credentials.json -storageDataPath=/vmstorage-data -snapshot.createURL=$VMSTORAGE_ENDPOINT/snapshot/create -eula
2021-04-22 13:44:07 +02:00
```
Expected logs in vmbackupmanager:
```console
info lib/backup/actions/backup.go:131 server-side copied 81 out of 81 parts from GCS{bucket: "vmstorage-data", dir: "192.168.0.10//latest/"} to GCS{bucket: "vmstorage-data", dir: "192.168.0.10//weekly/2020-34/"} in 2.549833008s
2022-09-26 16:35:45 +02:00
info lib/backup/actions/backup.go:169 backed up 853315 bytes in 2.882 seconds; deleted 0 bytes; server-side copied 853315 bytes; uploaded 0 bytes
2021-04-22 13:44:07 +02:00
```
Expected logs in vmstorage:
```console
info VictoriaMetrics/lib/storage/table.go:146 creating table snapshot of "/vmstorage-data/data"...
info VictoriaMetrics/lib/storage/storage.go:311 deleting snapshot "/vmstorage-data/snapshots/20200818201959-162C760149895DDA"...
info VictoriaMetrics/lib/storage/storage.go:319 deleted snapshot "/vmstorage-data/snapshots/20200818201959-162C760149895DDA" in 0.169 seconds
```
The result on the GCS bucket
2022-03-22 12:40:55 +01:00
* The root folder
2022-09-26 16:35:45 +02:00
2023-05-29 16:09:19 +02:00
< img alt = "root folder" src = "vmbackupmanager_root_folder.png" >
2021-04-22 13:44:07 +02:00
2022-03-22 12:40:55 +01:00
* The latest folder
2021-04-22 13:44:07 +02:00
2023-05-29 16:09:19 +02:00
< img alt = "latest folder" src = "vmbackupmanager_root_folder.png" >
2021-04-22 13:44:07 +02:00
## Backup Retention Policy
Backup retention policy is controlled by:
* -keepLastHourly - keep the last N hourly backups. Disabled by default
* -keepLastDaily - keep the last N daily backups. Disabled by default
* -keepLastWeekly - keep the last N weekly backups. Disabled by default
* -keepLastMonthly - keep the last N monthly backups. Disabled by default
*Note*: 0 value in every keepLast flag results into deletion ALL backups for particular type (hourly, daily, weekly and monthly)
Let’ s assume we have a backup manager collecting daily backups for the past 10 days.
2023-05-29 16:09:19 +02:00
< img alt = "retention policy daily before retention cycle" src = "vmbackupmanager_rp_daily_1.png" >
2021-04-22 13:44:07 +02:00
We enable backup retention policy for backup manager by using following configuration:
```console
export NODE_IP=192.168.0.10
export VMSTORAGE_ENDPOINT=http://127.0.0.1:8428
2021-09-29 11:10:26 +02:00
./vmbackupmanager -dst=gs://vmstorage-data/$NODE_IP -credsFilePath=credentials.json -storageDataPath=/vmstorage-data -snapshot.createURL=$VMSTORAGE_ENDPOINT/snapshot/create
2021-04-22 13:44:07 +02:00
-keepLastDaily=3 -eula
```
Expected logs in backup manager on start:
```console
info lib/logger/flag.go:20 flag "keepLastDaily" = "3"
```
Expected logs in backup manager during retention cycle:
```console
info app/vmbackupmanager/retention.go:106 daily backups to delete [daily/2021-02-13 daily/2021-02-12 daily/2021-02-11 daily/2021-02-10 daily/2021-02-09 daily/2021-02-08 daily/2021-02-07]
```
The result on the GCS bucket. We see only 3 daily backups:
2023-05-29 16:09:19 +02:00
< img alt = "retention policy daily after retention cycle" src = "vmbackupmanager_rp_daily_2.png" >
2022-05-08 14:18:39 +02:00
2023-05-16 20:27:23 +02:00
### Protection backups against deletion by retention policy
You can protect any backup against deletion by retention policy with the `vmbackupmanager backups lock` command.
For instance:
```console
./vmbackupmanager backup lock daily/2021-02-13 -dst=< DST_PATH > -storageDataPath=/vmstorage-data -eula
```
After that the backup won't be deleted by retention policy.
You can view the `locked` attribute in backup list:
```console
./vmbackupmanager backup list -dst=< DST_PATH > -storageDataPath=/vmstorage-data -eula
```
To remove protection, you can use the command `vmbackupmanager backups unlock` .
For example:
```console
./vmbackupmanager backup unlock daily/2021-02-13 -dst=< DST_PATH > -storageDataPath=/vmstorage-data -eula
```
2022-05-08 14:18:39 +02:00
2022-10-29 01:30:52 +02:00
## API methods
`vmbackupmanager` exposes the following API methods:
* GET `/api/v1/backups` - returns list of backups in remote storage.
Example output:
```json
2023-04-14 04:29:06 +02:00
[{"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00"},{"name":"hourly/2023-04-07:11","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:06+00:00"},{"name":"latest","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:04+00:00"},{"name":"monthly/2023-04","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:10+00:00"},{"name":"weekly/2023-14","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:09+00:00"}]
2022-10-29 01:30:52 +02:00
```
2023-05-16 20:27:23 +02:00
> Note: `created_at` field is in RFC3339 format.
* GET `/api/v1/backups/<BACKUP_NAME>` - returns backup info by name.
Example output:
```json
{"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00","locked":true}
```
* PUT `/api/v1/backups/<BACKUP_NAME>` - update "locked" attribute for backup by name.
Example request body:
```json
{"locked":true}
```
Example response:
```json
{"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00", "locked": true}
```
2022-10-29 01:30:52 +02:00
* POST `/api/v1/restore` - saves backup name to restore when [performing restore ](#restore-commands ).
Example request body:
```json
{"backup":"daily/2022-10-06"}
```
* GET `/api/v1/restore` - returns backup name from restore mark if it exists.
Example response:
```json
{"backup":"daily/2022-10-06"}
```
* DELETE `/api/v1/restore` - delete restore mark.
## CLI
`vmbackupmanager` exposes CLI commands to work with [API methods ](#api-methods ) without external dependencies.
Supported commands:
```console
vmbackupmanager backup
vmbackupmanager backup list
List backups in remote storage
2023-05-16 20:27:23 +02:00
vmbackupmanager backup lock
Locks backup in remote storage against deletion
vmbackupmanager backup unlock
Unlocks backup in remote storage for deletion
vmbackupmanager restore
2022-10-29 01:30:52 +02:00
Restore backup specified by restore mark if it exists
vmbackupmanager restore get
Get restore mark if it exists
vmbackupmanager restore delete
Delete restore mark if it exists
vmbackupmanager restore create [backup_name]
Create restore mark
```
By default, CLI commands are using `http://127.0.0.1:8300` endpoint to reach `vmbackupmanager` API.
It can be changed by using flag:
```
-apiURL string
vmbackupmanager address to perform API requests (default "http://127.0.0.1:8300")
```
### Backup commands
`vmbackupmanager backup list` lists backups in remote storage:
```console
$ ./vmbackupmanager backup list
2023-04-14 04:29:06 +02:00
[{"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00"},{"name":"hourly/2023-04-07:11","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:06+00:00"},{"name":"latest","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:04+00:00"},{"name":"monthly/2023-04","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:10+00:00"},{"name":"weekly/2023-14","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:09+00:00"}]
2022-10-29 01:30:52 +02:00
```
### Restore commands
Restore commands are used to create, get and delete restore mark.
Restore mark is used by `vmbackupmanager` to store backup name to restore when running restore.
Create restore mark:
```console
$ ./vmbackupmanager restore create daily/2022-10-06
```
Get restore mark if it exists:
```console
$ ./vmbackupmanager restore get
{"backup":"daily/2022-10-06"}
```
Delete restore mark if it exists:
```console
$ ./vmbackupmanager restore delete
```
Perform restore:
```console
$ /vmbackupmanager-prod restore -dst=gs://vmstorage-data/$NODE_IP -credsFilePath=credentials.json -storageDataPath=/vmstorage-data
```
Note that `vmsingle` or `vmstorage` should be stopped before performing restore.
If restore mark doesn't exist at `storageDataPath` (restore wasn't requested) `vmbackupmanager restore` will exit with successful status code.
### How to restore backup via CLI
1. Run `vmbackupmanager backup list` to get list of available backups:
```console
$ /vmbackupmanager-prod backup list
2023-04-14 04:29:06 +02:00
[{"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00"},{"name":"hourly/2023-04-07:11","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:06+00:00"},{"name":"latest","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:04+00:00"},{"name":"monthly/2023-04","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:10+00:00"},{"name":"weekly/2023-14","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:09+00:00"}]
2022-10-29 01:30:52 +02:00
```
2. Run `vmbackupmanager restore create` to create restore mark:
- Use relative path to backup to restore from currently used remote storage:
```console
2023-04-14 04:29:06 +02:00
$ /vmbackupmanager-prod restore create daily/2023-04-07
2022-10-29 01:30:52 +02:00
```
- Use full path to backup to restore from any remote storage:
```console
2023-04-14 04:29:06 +02:00
$ /vmbackupmanager-prod restore create azblob://test1/vmbackupmanager/daily/2023-04-07
2022-10-29 01:30:52 +02:00
```
3. Stop `vmstorage` or `vmsingle` node
4. Run `vmbackupmanager restore` to restore backup:
```console
$ /vmbackupmanager-prod restore -credsFilePath=credentials.json -storageDataPath=/vmstorage-data
```
5. Start `vmstorage` or `vmsingle` node
### How to restore in Kubernetes
2022-12-20 23:12:04 +01:00
1. Ensure there is an init container with `vmbackupmanager restore` in `vmstorage` or `vmsingle` pod.
For [VictoriaMetrics operator ](https://docs.victoriametrics.com/operator/VictoriaMetrics-Operator.html ) deployments it is required to add:
```yaml
vmbackup:
restore:
2023-04-06 07:16:39 +02:00
onStart:
enabled: "true"
2022-12-20 23:12:04 +01:00
```
See operator `VMStorage` schema [here ](https://docs.victoriametrics.com/operator/api.html#vmstorage ) and `VMSingle` [here ](https://docs.victoriametrics.com/operator/api.html#vmsinglespec ).
2. Enter container running `vmbackupmanager`
2022-10-29 01:30:52 +02:00
2. Use `vmbackupmanager backup list` to get list of available backups:
```console
$ /vmbackupmanager-prod backup list
2023-04-14 04:29:06 +02:00
[{"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00"},{"name":"hourly/2023-04-07:11","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:06+00:00"},{"name":"latest","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:04+00:00"},{"name":"monthly/2023-04","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:10+00:00"},{"name":"weekly/2023-14","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:09+00:00"}]
2022-10-29 01:30:52 +02:00
```
3. Use `vmbackupmanager restore create` to create restore mark:
- Use relative path to backup to restore from currently used remote storage:
```console
2023-04-14 04:29:06 +02:00
$ /vmbackupmanager-prod restore create daily/2023-04-07
2022-10-29 01:30:52 +02:00
```
- Use full path to backup to restore from any remote storage:
```console
2023-04-14 04:29:06 +02:00
$ /vmbackupmanager-prod restore create azblob://test1/vmbackupmanager/daily/2023-04-07
2022-10-29 01:30:52 +02:00
```
4. Restart pod
2022-12-20 23:12:04 +01:00
#### Restore cluster into another cluster
These steps are assuming that [VictoriaMetrics operator ](https://docs.victoriametrics.com/operator/VictoriaMetrics-Operator.html ) is used to manage `VMCluster` .
Clusters here are referred to as `source` and `destination` .
1. Create a new cluster with access to *source* cluster `vmbackupmanager` storage and same number of storage nodes.
Add the following section in order to enable restore on start (operator `VMStorage` schema can be found [here ](https://docs.victoriametrics.com/operator/api.html#vmstorage ):
```yaml
vmbackup:
restore:
2023-04-06 07:16:39 +02:00
onStart:
enabled: "true"
2022-12-20 23:12:04 +01:00
```
Note: it is safe to leave this section in the cluster configuration, since it will be ignored if restore mark doesn't exist.
> Important! Use different `-dst` for *destination* cluster to avoid overwriting backup data of the *source* cluster.
2. Enter container running `vmbackupmanager` in *source* cluster
2. Use `vmbackupmanager backup list` to get list of available backups:
```console
$ /vmbackupmanager-prod backup list
2023-04-14 04:29:06 +02:00
[{"name":"daily/2023-04-07","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:07+00:00"},{"name":"hourly/2023-04-07:11","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:06+00:00"},{"name":"latest","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:04+00:00"},{"name":"monthly/2023-04","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:10+00:00"},{"name":"weekly/2023-14","size_bytes":318837,"size":"311.4ki","created_at":"2023-04-07T16:15:09+00:00"}]
2022-12-20 23:12:04 +01:00
```
3. Use `vmbackupmanager restore create` to create restore mark at each pod of the *destination* cluster.
Each pod in *destination* cluster should be restored from backup of respective pod in *source* cluster.
For example: `vmstorage-source-0` in *source* cluster should be restored from `vmstorage-destination-0` in *destination* cluster.
```console
2023-04-14 04:29:06 +02:00
$ /vmbackupmanager-prod restore create s3://source_cluster/vmstorage-source-0/daily/2023-04-07
2022-12-20 23:12:04 +01:00
```
2023-01-05 16:03:06 +01:00
## Monitoring
`vmbackupmanager` exports various metrics in Prometheus exposition format at `http://vmbackupmanager:8300/metrics` page. It is recommended setting up regular scraping of this page
either via [vmagent ](https://docs.victoriametrics.com/vmagent.html ) or via Prometheus, so the exported metrics could be analyzed later.
Use the official [Grafana dashboard ](https://grafana.com/grafana/dashboards/17798-victoriametrics-backupmanager/ ) for `vmbackupmanager` overview.
Graphs on this dashboard contain useful hints - hover the `i` icon in the top left corner of each graph in order to read it.
If you have suggestions for improvements or have found a bug - please open an issue on github or add
a review to the dashboard.
2022-05-08 14:18:39 +02:00
## Configuration
### Flags
Pass `-help` to `vmbackupmanager` in order to see the full list of supported
command-line flags with their descriptions.
The shortlist of configuration flags is the following:
```
vmbackupmanager performs regular backups according to the provided configs.
2022-11-21 14:34:13 +01:00
subcommands:
backup: provides auxiliary backup-related commands
restore: restores backup specified by restore mark if it exists
command-line flags:
-apiURL string
vmbackupmanager address to perform API requests (default "http://127.0.0.1:8300")
2022-05-08 14:18:39 +02:00
-concurrency int
2022-06-21 14:48:51 +02:00
The number of concurrent workers. Higher concurrency may reduce backup duration (default 10)
2022-05-08 14:18:39 +02:00
-configFilePath string
2022-06-21 14:48:51 +02:00
Path to file with S3 configs. Configs are loaded from default location if not set.
See https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html
2022-05-08 14:18:39 +02:00
-configProfile string
2022-06-21 14:48:51 +02:00
Profile name for S3 configs. If no set, the value of the environment variable will be loaded (AWS_PROFILE or AWS_DEFAULT_PROFILE), or if both not set, DefaultSharedConfigProfile is used
2022-05-08 14:18:39 +02:00
-credsFilePath string
2022-06-21 14:48:51 +02:00
Path to file with GCS or S3 credentials. Credentials are loaded from default locations if not set.
See https://cloud.google.com/iam/docs/creating-managing-service-account-keys and https://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html
2022-05-08 14:18:39 +02:00
-customS3Endpoint string
2022-06-21 14:48:51 +02:00
Custom S3 endpoint for use with S3-compatible storages (e.g. MinIO). S3 is used if not set
2022-05-08 14:18:39 +02:00
-disableDaily
2022-06-21 14:48:51 +02:00
Disable daily run. Default false
2022-05-08 14:18:39 +02:00
-disableHourly
2022-06-21 14:48:51 +02:00
Disable hourly run. Default false
2022-05-08 14:18:39 +02:00
-disableMonthly
2022-06-21 14:48:51 +02:00
Disable monthly run. Default false
2022-05-08 14:18:39 +02:00
-disableWeekly
2022-06-21 14:48:51 +02:00
Disable weekly run. Default false
2022-05-08 14:18:39 +02:00
-dst string
2022-06-21 14:48:51 +02:00
The root folder of Victoria Metrics backups. Example: gs://bucket/path/to/backup/dir, s3://bucket/path/to/backup/dir or fs:///path/to/local/backup/dir
2022-05-08 14:18:39 +02:00
-enableTCP6
2023-05-10 09:50:41 +02:00
Whether to enable IPv6 for listening and dialing. By default, only IPv4 TCP and UDP is used
2022-05-08 14:18:39 +02:00
-envflag.enable
2022-06-21 14:48:51 +02:00
Whether to enable reading flags from environment variables additionally to command line. Command line flag values have priority over values from environment vars. Flags are read only from command line if this flag isn't set. See https://docs.victoriametrics.com/#environment-variables for more details
2022-05-08 14:18:39 +02:00
-envflag.prefix string
2022-06-21 14:48:51 +02:00
Prefix for environment variables if -envflag.enable is set
2022-05-08 14:18:39 +02:00
-eula
2022-11-21 14:34:13 +01:00
By specifying this flag, you confirm that you have an enterprise license and accept the EULA https://victoriametrics.com/assets/VM_EULA.pdf . This flag is available only in VictoriaMetrics enterprise. See https://docs.victoriametrics.com/enterprise.html
2022-06-21 14:48:51 +02:00
-flagsAuthKey string
Auth key for /flags endpoint. It must be passed via authKey query arg. It overrides httpAuth.* settings
2022-05-08 14:18:39 +02:00
-fs.disableMmap
2023-05-10 09:50:41 +02:00
Whether to use pread() instead of mmap() for reading data files. By default, mmap() is used for 64-bit arches and pread() is used for 32-bit arches, since they cannot read data files bigger than 2^32 bytes in memory. mmap() is usually faster for reading small data chunks than pread()
2022-05-08 14:18:39 +02:00
-http.connTimeout duration
2022-06-21 14:48:51 +02:00
Incoming http connections are closed after the configured timeout. This may help to spread the incoming load among a cluster of services behind a load balancer. Please note that the real timeout may be bigger by up to 10% as a protection against the thundering herd problem (default 2m0s)
2022-05-08 14:18:39 +02:00
-http.disableResponseCompression
2023-05-10 09:50:41 +02:00
Disable compression of HTTP responses to save CPU resources. By default, compression is enabled to save network bandwidth
2022-05-08 14:18:39 +02:00
-http.idleConnTimeout duration
2022-06-21 14:48:51 +02:00
Timeout for incoming idle http connections (default 1m0s)
2022-05-08 14:18:39 +02:00
-http.maxGracefulShutdownDuration duration
2022-06-21 14:48:51 +02:00
The maximum duration for a graceful shutdown of the HTTP server. A highly loaded server may require increased value for a graceful shutdown (default 7s)
2022-05-08 14:18:39 +02:00
-http.pathPrefix string
2022-06-21 14:48:51 +02:00
An optional prefix to add to all the paths handled by http server. For example, if '-http.pathPrefix=/foo/bar' is set, then all the http requests will be handled on '/foo/bar/*' paths. This may be useful for proxied requests. See https://www.robustperception.io/using-external-urls-and-proxies-with-prometheus
2022-05-08 14:18:39 +02:00
-http.shutdownDelay duration
2022-06-21 14:48:51 +02:00
Optional delay before http server shutdown. During this delay, the server returns non-OK responses from /health page, so load balancers can route new requests to other servers
2022-05-08 14:18:39 +02:00
-httpAuth.password string
2022-06-21 14:48:51 +02:00
Password for HTTP Basic Auth. The authentication is disabled if -httpAuth.username is empty
2022-05-08 14:18:39 +02:00
-httpAuth.username string
2022-06-21 14:48:51 +02:00
Username for HTTP Basic Auth. The authentication is disabled if empty. See also -httpAuth.password
2022-05-08 14:18:39 +02:00
-httpListenAddr string
2022-06-21 14:48:51 +02:00
Address to listen for http connections (default ":8300")
2022-05-08 14:18:39 +02:00
-keepLastDaily int
2022-06-21 14:48:51 +02:00
Keep last N daily backups. If 0 is specified next retention cycle removes all backups for given time period. (default -1)
2022-05-08 14:18:39 +02:00
-keepLastHourly int
2022-06-21 14:48:51 +02:00
Keep last N hourly backups. If 0 is specified next retention cycle removes all backups for given time period. (default -1)
2022-05-08 14:18:39 +02:00
-keepLastMonthly int
2022-06-21 14:48:51 +02:00
Keep last N monthly backups. If 0 is specified next retention cycle removes all backups for given time period. (default -1)
2022-05-08 14:18:39 +02:00
-keepLastWeekly int
2022-06-21 14:48:51 +02:00
Keep last N weekly backups. If 0 is specified next retention cycle removes all backups for given time period. (default -1)
2022-05-08 14:18:39 +02:00
-loggerDisableTimestamps
2022-06-21 14:48:51 +02:00
Whether to disable writing timestamps in logs
2022-05-08 14:18:39 +02:00
-loggerErrorsPerSecondLimit int
2022-06-21 14:48:51 +02:00
Per-second limit on the number of ERROR messages. If more than the given number of errors are emitted per second, the remaining errors are suppressed. Zero values disable the rate limit
2022-05-08 14:18:39 +02:00
-loggerFormat string
2022-06-21 14:48:51 +02:00
Format for logs. Possible values: default, json (default "default")
2023-01-04 07:40:00 +01:00
-loggerJSONFields string
Allows renaming fields in JSON formatted logs. Example: "ts:timestamp,msg:message" renames "ts" to "timestamp" and "msg" to "message". Supported fields: ts, level, caller, msg
2022-05-08 14:18:39 +02:00
-loggerLevel string
2022-06-21 14:48:51 +02:00
Minimum level of errors to log. Possible values: INFO, WARN, ERROR, FATAL, PANIC (default "INFO")
2022-05-08 14:18:39 +02:00
-loggerOutput string
2022-06-21 14:48:51 +02:00
Output for the logs. Supported values: stderr, stdout (default "stderr")
2022-05-08 14:18:39 +02:00
-loggerTimezone string
2022-06-21 14:48:51 +02:00
Timezone to use for timestamps in logs. Timezone must be a valid IANA Time Zone. For example: America/New_York, Europe/Berlin, Etc/GMT+3 or Local (default "UTC")
2022-05-08 14:18:39 +02:00
-loggerWarnsPerSecondLimit int
2022-06-21 14:48:51 +02:00
Per-second limit on the number of WARN messages. If more than the given number of warns are emitted per second, then the remaining warns are suppressed. Zero values disable the rate limit
2022-05-08 14:18:39 +02:00
-maxBytesPerSecond int
2022-06-21 14:48:51 +02:00
The maximum upload speed. There is no limit if it is set to 0
2022-05-08 14:18:39 +02:00
-memory.allowedBytes size
2022-06-21 14:48:51 +02:00
Allowed size of system memory VictoriaMetrics caches may occupy. This option overrides -memory.allowedPercent if set to a non-zero value. Too low a value may increase the cache miss rate usually resulting in higher CPU and disk IO usage. Too high a value may evict too much data from OS page cache resulting in higher disk IO usage
2022-12-15 02:52:32 +01:00
Supports the following optional suffixes for size values: KB, MB, GB, TB, KiB, MiB, GiB, TiB (default 0)
2022-05-08 14:18:39 +02:00
-memory.allowedPercent float
2022-06-21 14:48:51 +02:00
Allowed percent of system memory VictoriaMetrics caches may occupy. See also -memory.allowedBytes. Too low a value may increase cache miss rate usually resulting in higher CPU and disk IO usage. Too high a value may evict too much data from OS page cache which will result in higher disk IO usage (default 60)
2022-05-08 14:18:39 +02:00
-metricsAuthKey string
2022-06-21 14:48:51 +02:00
Auth key for /metrics endpoint. It must be passed via authKey query arg. It overrides httpAuth.* settings
2022-05-08 14:18:39 +02:00
-pprofAuthKey string
2022-06-21 14:48:51 +02:00
Auth key for /debug/pprof/* endpoints. It must be passed via authKey query arg. It overrides httpAuth.* settings
2022-07-26 18:24:24 +02:00
-pushmetrics.extraLabel array
Optional labels to add to metrics pushed to -pushmetrics.url . For example, -pushmetrics.extraLabel='instance="foo"' adds instance="foo" label to all the metrics pushed to -pushmetrics.url
2022-07-21 18:58:22 +02:00
Supports an array of values separated by comma or specified via multiple flags.
-pushmetrics.interval duration
Interval for pushing metrics to -pushmetrics.url (default 10s)
-pushmetrics.url array
2023-05-10 09:50:41 +02:00
Optional URL to push metrics exposed at /metrics page. See https://docs.victoriametrics.com/#push-metrics . By default, metrics exposed at /metrics page aren't pushed to any remote storage
2022-07-21 18:58:22 +02:00
Supports an array of values separated by comma or specified via multiple flags.
2022-05-08 14:18:39 +02:00
-runOnStart
2023-05-10 09:50:41 +02:00
Upload backups immediately after start of the service. Otherwise, the backup starts on new hour
2022-05-08 14:18:39 +02:00
-s3ForcePathStyle
2022-06-21 14:48:51 +02:00
Prefixing endpoint with bucket name when set false, true by default. (default true)
2022-05-08 14:18:39 +02:00
-snapshot.createURL string
2022-06-21 14:48:51 +02:00
VictoriaMetrics create snapshot url. When this is given a snapshot will automatically be created during backup.Example: http://victoriametrics:8428/snapshot/create
2022-05-08 14:18:39 +02:00
-snapshot.deleteURL string
2023-05-10 09:50:41 +02:00
VictoriaMetrics delete snapshot url. Optional. Will be generated from snapshot.createURL if not provided. All created snapshots will be automatically deleted.Example: http://victoriametrics:8428/snapshot/delete
2022-05-08 14:18:39 +02:00
-storageDataPath string
2022-06-21 14:48:51 +02:00
Path to VictoriaMetrics data. Must match -storageDataPath from VictoriaMetrics or vmstorage (default "victoria-metrics-data")
2022-05-08 14:18:39 +02:00
-tls
2022-06-21 14:48:51 +02:00
Whether to enable TLS for incoming HTTP requests at -httpListenAddr (aka https). -tlsCertFile and -tlsKeyFile must be set if -tls is set
2022-05-08 14:18:39 +02:00
-tlsCertFile string
2022-06-21 14:48:51 +02:00
Path to file with TLS certificate if -tls is set. Prefer ECDSA certs instead of RSA certs as RSA certs are slower. The provided certificate file is automatically re-read every second, so it can be dynamically updated
2022-05-08 14:18:39 +02:00
-tlsCipherSuites array
2022-06-21 14:48:51 +02:00
Optional list of TLS cipher suites for incoming requests over HTTPS if -tls is set. See the list of supported cipher suites at https://pkg.go.dev/crypto/tls#pkg-constants
Supports an array of values separated by comma or specified via multiple flags.
2022-05-08 14:18:39 +02:00
-tlsKeyFile string
2022-06-21 14:48:51 +02:00
Path to file with TLS key if -tls is set. The provided key file is automatically re-read every second, so it can be dynamically updated
2022-09-26 16:35:45 +02:00
-tlsMinVersion string
Optional minimum TLS version to use for incoming requests over HTTPS if -tls is set. Supported values: TLS10, TLS11, TLS12, TLS13
2022-05-08 14:18:39 +02:00
-version
2022-06-21 14:48:51 +02:00
Show VictoriaMetrics version
```