mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/{vmalert,vmbackup}/README.md: sync with docs after the commit 47d1612bf8
This commit is contained in:
parent
5bd3518e4d
commit
e58630401e
2 changed files with 23 additions and 23 deletions
|
@ -21,8 +21,8 @@ implementation and aims to be compatible with its syntax.
|
||||||
* `vmalert` execute queries against remote datasource which has reliability risks because of network.
|
* `vmalert` execute queries against remote datasource which has reliability risks because of network.
|
||||||
It is recommended to configure alerts thresholds and rules expressions with understanding that network request
|
It is recommended to configure alerts thresholds and rules expressions with understanding that network request
|
||||||
may fail;
|
may fail;
|
||||||
* by default, rules execution is sequential within one group, but persisting of execution results to remote
|
* by default, rules execution is sequential within one group, but persistence of execution results to remote
|
||||||
storage is asynchronous. Hence, user shouldn't rely on recording rules chaining when result of previous
|
storage is asynchronous. Hence, user shouldn't rely on chaining of recording rules when result of previous
|
||||||
recording rule is reused in next one;
|
recording rule is reused in next one;
|
||||||
|
|
||||||
## QuickStart
|
## QuickStart
|
||||||
|
@ -55,7 +55,7 @@ Then configure `vmalert` accordingly:
|
||||||
-external.label=replica=a # Multiple external labels may be set
|
-external.label=replica=a # Multiple external labels may be set
|
||||||
```
|
```
|
||||||
|
|
||||||
See the fill list of configuration flags in [configuration](#configuration) section.
|
See the full list of configuration flags in [configuration](#configuration) section.
|
||||||
|
|
||||||
If you run multiple `vmalert` services for the same datastore or AlertManager - do not forget
|
If you run multiple `vmalert` services for the same datastore or AlertManager - do not forget
|
||||||
to specify different `external.label` flags in order to define which `vmalert` generated rules or alerts.
|
to specify different `external.label` flags in order to define which `vmalert` generated rules or alerts.
|
||||||
|
@ -113,14 +113,14 @@ expression and then act according to the Rule type.
|
||||||
|
|
||||||
There are two types of Rules:
|
There are two types of Rules:
|
||||||
* [alerting](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) -
|
* [alerting](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) -
|
||||||
Alerting rules allows to define alert conditions via `expr` field and to send notifications
|
Alerting rules allow to define alert conditions via `expr` field and to send notifications to
|
||||||
[Alertmanager](https://github.com/prometheus/alertmanager) if execution result is not empty.
|
[Alertmanager](https://github.com/prometheus/alertmanager) if execution result is not empty.
|
||||||
* [recording](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) -
|
* [recording](https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/) -
|
||||||
Recording rules allows to define `expr` which result will be than backfilled to configured
|
Recording rules allow to define `expr` which result will be then backfilled to configured
|
||||||
`-remoteWrite.url`. Recording rules are used to precompute frequently needed or computationally
|
`-remoteWrite.url`. Recording rules are used to precompute frequently needed or computationally
|
||||||
expensive expressions and save their result as a new set of time series.
|
expensive expressions and save their result as a new set of time series.
|
||||||
|
|
||||||
`vmalert` forbids to define duplicates - rules with the same combination of name, expression and labels
|
`vmalert` forbids defining duplicates - rules with the same combination of name, expression and labels
|
||||||
within one group.
|
within one group.
|
||||||
|
|
||||||
#### Alerting rules
|
#### Alerting rules
|
||||||
|
@ -182,18 +182,18 @@ the process alerts state will be lost. To avoid this situation, `vmalert` should
|
||||||
* `-remoteWrite.url` - URL to VictoriaMetrics (Single) or vminsert (Cluster). `vmalert` will persist alerts state
|
* `-remoteWrite.url` - URL to VictoriaMetrics (Single) or vminsert (Cluster). `vmalert` will persist alerts state
|
||||||
into the configured address in the form of time series named `ALERTS` and `ALERTS_FOR_STATE` via remote-write protocol.
|
into the configured address in the form of time series named `ALERTS` and `ALERTS_FOR_STATE` via remote-write protocol.
|
||||||
These are regular time series and may be queried from VM just as any other time series.
|
These are regular time series and may be queried from VM just as any other time series.
|
||||||
The state stored to the configured address on every rule evaluation.
|
The state is stored to the configured address on every rule evaluation.
|
||||||
* `-remoteRead.url` - URL to VictoriaMetrics (Single) or vmselect (Cluster). `vmalert` will try to restore alerts state
|
* `-remoteRead.url` - URL to VictoriaMetrics (Single) or vmselect (Cluster). `vmalert` will try to restore alerts state
|
||||||
from configured address by querying time series with name `ALERTS_FOR_STATE`.
|
from configured address by querying time series with name `ALERTS_FOR_STATE`.
|
||||||
|
|
||||||
Both flags are required for the proper state restoring. Restore process may fail if time series are missing
|
Both flags are required for proper state restoring. Restore process may fail if time series are missing
|
||||||
in configured `-remoteRead.url`, weren't updated in the last `1h` (controlled by `-remoteRead.lookback`)
|
in configured `-remoteRead.url`, weren't updated in the last `1h` (controlled by `-remoteRead.lookback`)
|
||||||
or received state doesn't match current `vmalert` rules configuration.
|
or received state doesn't match current `vmalert` rules configuration.
|
||||||
|
|
||||||
|
|
||||||
### Multitenancy
|
### Multitenancy
|
||||||
|
|
||||||
There are the following approaches for alerting and recording rules across
|
The following are the approaches for alerting and recording rules across
|
||||||
[multiple tenants](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#multitenancy):
|
[multiple tenants](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#multitenancy):
|
||||||
|
|
||||||
* To run a separate `vmalert` instance per each tenant.
|
* To run a separate `vmalert` instance per each tenant.
|
||||||
|
@ -234,7 +234,7 @@ at [release page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) a
|
||||||
tags at [Docker Hub](https://hub.docker.com/r/victoriametrics/vmalert/tags).
|
tags at [Docker Hub](https://hub.docker.com/r/victoriametrics/vmalert/tags).
|
||||||
|
|
||||||
|
|
||||||
### WEB
|
### Web
|
||||||
|
|
||||||
`vmalert` runs a web-server (`-httpListenAddr`) for serving metrics and alerts endpoints:
|
`vmalert` runs a web-server (`-httpListenAddr`) for serving metrics and alerts endpoints:
|
||||||
* `http://<vmalert-addr>` - UI;
|
* `http://<vmalert-addr>` - UI;
|
||||||
|
@ -257,7 +257,7 @@ to set `-datasource.appendTypePrefix` flag to `true`, so vmalert can adjust URL
|
||||||
## Rules backfilling
|
## Rules backfilling
|
||||||
|
|
||||||
vmalert supports alerting and recording rules backfilling (aka `replay`). In replay mode vmalert
|
vmalert supports alerting and recording rules backfilling (aka `replay`). In replay mode vmalert
|
||||||
can read the same rules configuration as normally, evaluate them on the given time range and backfill
|
can read the same rules configuration as normal, evaluate them on the given time range and backfill
|
||||||
results via remote write to the configured storage. vmalert supports any PromQL/MetricsQL compatible
|
results via remote write to the configured storage. vmalert supports any PromQL/MetricsQL compatible
|
||||||
data source for backfilling.
|
data source for backfilling.
|
||||||
|
|
||||||
|
@ -303,8 +303,8 @@ max range per request: 8h20m0s
|
||||||
In `replay` mode all groups are executed sequentially one-by-one. Rules within the group are
|
In `replay` mode all groups are executed sequentially one-by-one. Rules within the group are
|
||||||
executed sequentially as well (`concurrency` setting is ignored). Vmalert sends rule's expression
|
executed sequentially as well (`concurrency` setting is ignored). Vmalert sends rule's expression
|
||||||
to [/query_range](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) endpoint
|
to [/query_range](https://prometheus.io/docs/prometheus/latest/querying/api/#range-queries) endpoint
|
||||||
of the configured `-datasource.url`. Returned data then processed according to the `group.type` and
|
of the configured `-datasource.url`. Returned data is then processed according to the rule type and
|
||||||
backfilled to `-remoteWrite.url` via [remote write protocol](https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations).
|
backfilled to `-remoteWrite.url` via [remote Write protocol](https://prometheus.io/docs/prometheus/latest/storage/#remote-storage-integrations).
|
||||||
Vmalert respects `evaluationInterval` value set by flag or per-group during the replay.
|
Vmalert respects `evaluationInterval` value set by flag or per-group during the replay.
|
||||||
Vmalert automatically disables caching on VictoriaMetrics side by sending `nocache=1` param. It allows
|
Vmalert automatically disables caching on VictoriaMetrics side by sending `nocache=1` param. It allows
|
||||||
to prevent cache pollution and unwanted time range boundaries adjustment during backfilling.
|
to prevent cache pollution and unwanted time range boundaries adjustment during backfilling.
|
||||||
|
|
|
@ -9,8 +9,8 @@ Supported storage systems for backups:
|
||||||
* Any S3-compatible storage such as [MinIO](https://github.com/minio/minio), [Ceph](https://docs.ceph.com/docs/mimic/radosgw/s3/) or [Swift](https://www.swiftstack.com/docs/admin/middleware/s3_middleware.html). See [these docs](#advanced-usage) for details.
|
* Any S3-compatible storage such as [MinIO](https://github.com/minio/minio), [Ceph](https://docs.ceph.com/docs/mimic/radosgw/s3/) or [Swift](https://www.swiftstack.com/docs/admin/middleware/s3_middleware.html). See [these docs](#advanced-usage) for details.
|
||||||
* Local filesystem. Example: `fs://</absolute/path/to/backup>`
|
* Local filesystem. Example: `fs://</absolute/path/to/backup>`
|
||||||
|
|
||||||
`vmbackup` supports incremental and full backups. Incremental backups created automatically if the destination path already contains data from the previous backup.
|
`vmbackup` supports incremental and full backups. Incremental backups are created automatically if the destination path already contains data from the previous backup.
|
||||||
Full backups can be sped up with `-origin` pointing to already existing backup on the same remote storage. In this case `vmbackup` makes server-side copy for the shared
|
Full backups can be sped up with `-origin` pointing to an already existing backup on the same remote storage. In this case `vmbackup` makes server-side copy for the shared
|
||||||
data between the existing backup and new backup. It saves time and costs on data transfer.
|
data between the existing backup and new backup. It saves time and costs on data transfer.
|
||||||
|
|
||||||
Backup process can be interrupted at any time. It is automatically resumed from the interruption point when restarting `vmbackup` with the same args.
|
Backup process can be interrupted at any time. It is automatically resumed from the interruption point when restarting `vmbackup` with the same args.
|
||||||
|
@ -34,7 +34,7 @@ vmbackup -storageDataPath=</path/to/victoria-metrics-data> -snapshotName=<local-
|
||||||
```
|
```
|
||||||
|
|
||||||
* `</path/to/victoria-metrics-data>` - path to VictoriaMetrics data pointed by `-storageDataPath` command-line flag in single-node VictoriaMetrics or in cluster `vmstorage`.
|
* `</path/to/victoria-metrics-data>` - path to VictoriaMetrics data pointed by `-storageDataPath` command-line flag in single-node VictoriaMetrics or in cluster `vmstorage`.
|
||||||
There is no need to stop VictoriaMetrics for creating backups, since they are performed from immutable [instant snapshots](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-work-with-snapshots).
|
There is no need to stop VictoriaMetrics for creating backups since they are performed from immutable [instant snapshots](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-work-with-snapshots).
|
||||||
* `<local-snapshot>` is the snapshot to back up. See [how to create instant snapshots](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-work-with-snapshots). `vmbackup` can create the snapshot on itself if `-snapshot.createURL` command-line flag is set to an url for creating snapshots. In this case `-snapshotName` flag isn't needed.
|
* `<local-snapshot>` is the snapshot to back up. See [how to create instant snapshots](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-work-with-snapshots). `vmbackup` can create the snapshot on itself if `-snapshot.createURL` command-line flag is set to an url for creating snapshots. In this case `-snapshotName` flag isn't needed.
|
||||||
* `<bucket>` is an already existing name for [GCS bucket](https://cloud.google.com/storage/docs/creating-buckets).
|
* `<bucket>` is an already existing name for [GCS bucket](https://cloud.google.com/storage/docs/creating-buckets).
|
||||||
* `<path/to/new/backup>` is the destination path where new backup will be placed.
|
* `<path/to/new/backup>` is the destination path where new backup will be placed.
|
||||||
|
@ -54,7 +54,7 @@ It saves time and network bandwidth costs by performing server-side copy for the
|
||||||
|
|
||||||
### Incremental backups
|
### Incremental backups
|
||||||
|
|
||||||
Incremental backups performed if `-dst` points to an already existing backup. In this case only new data uploaded to remote storage.
|
Incremental backups are performed if `-dst` points to an already existing backup. In this case only new data is uploaded to remote storage.
|
||||||
It saves time and network bandwidth costs when working with big backups:
|
It saves time and network bandwidth costs when working with big backups:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -87,7 +87,7 @@ Where `<daily-snapshot>` is the snapshot for the last day `<YYYYMMDD>`.
|
||||||
This apporach saves network bandwidth costs on hourly backups (since they are incremental) and allows recovering data from either the last hour (`latest` backup)
|
This apporach saves network bandwidth costs on hourly backups (since they are incremental) and allows recovering data from either the last hour (`latest` backup)
|
||||||
or from any day (`YYYYMMDD` backups). Note that hourly backup shouldn't run when creating daily backup.
|
or from any day (`YYYYMMDD` backups). Note that hourly backup shouldn't run when creating daily backup.
|
||||||
|
|
||||||
Do not forget removing old snapshots and backups when they are no longer needed for saving storage costs.
|
Do not forget to remove old snapshots and backups when they are no longer needed in order to save storage costs.
|
||||||
|
|
||||||
See also [vmbackupmanager tool](https://docs.victoriametrics.com/vmbackupmanager.html) for automating smart backups.
|
See also [vmbackupmanager tool](https://docs.victoriametrics.com/vmbackupmanager.html) for automating smart backups.
|
||||||
|
|
||||||
|
@ -97,19 +97,19 @@ See also [vmbackupmanager tool](https://docs.victoriametrics.com/vmbackupmanager
|
||||||
The backup algorithm is the following:
|
The backup algorithm is the following:
|
||||||
|
|
||||||
1. Collect information about files in the `-snapshotName`, in the `-dst` and in the `-origin`.
|
1. Collect information about files in the `-snapshotName`, in the `-dst` and in the `-origin`.
|
||||||
2. Determine files in `-dst`, which are missing in `-snapshotName`, and delete them. These are usually small files, which are already merged into bigger files in the snapshot.
|
2. Determine which files in `-dst` are missing in `-snapshotName`, and delete them. These are usually small files, which are already merged into bigger files in the snapshot.
|
||||||
3. Determine files from `-snapshotName`, which are missing in `-dst`. These are usually small new files and bigger merged files.
|
3. Determine which files in `-snapshotName` are missing in `-dst`. These are usually small new files and bigger merged files.
|
||||||
4. Determine files from step 3, which exist in the `-origin`, and perform server-side copy of these files from `-origin` to `-dst`.
|
4. Determine which files from step 3 exist in the `-origin`, and perform server-side copy of these files from `-origin` to `-dst`.
|
||||||
These are usually the biggest and the oldest files, which are shared between backups.
|
These are usually the biggest and the oldest files, which are shared between backups.
|
||||||
5. Upload the remaining files from step 3 from `-snapshotName` to `-dst`.
|
5. Upload the remaining files from step 3 from `-snapshotName` to `-dst`.
|
||||||
|
|
||||||
The algorithm splits source files into 1 GiB chunks in the backup. Each chunk stored as a separate file in the backup.
|
The algorithm splits source files into 1 GiB chunks in the backup. Each chunk is stored as a separate file in the backup.
|
||||||
Such splitting minimizes the amounts of data to re-transfer after temporary errors.
|
Such splitting minimizes the amounts of data to re-transfer after temporary errors.
|
||||||
|
|
||||||
`vmbackup` relies on [instant snapshot](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) properties:
|
`vmbackup` relies on [instant snapshot](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) properties:
|
||||||
|
|
||||||
- All the files in the snapshot are immutable.
|
- All the files in the snapshot are immutable.
|
||||||
- Old files periodically merged into new files.
|
- Old files are periodically merged into new files.
|
||||||
- Smaller files have higher probability to be merged.
|
- Smaller files have higher probability to be merged.
|
||||||
- Consecutive snapshots share many identical files.
|
- Consecutive snapshots share many identical files.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue