From 1484cf55880e88556f1c025b0d399ece8de16655 Mon Sep 17 00:00:00 2001 From: Vika Date: Fri, 8 Sep 2023 21:27:26 +0000 Subject: [PATCH] update wiki pages --- CHANGELOG.md | 3 ++- vmauth.md | 60 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c750dd1..e27746c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,7 @@ The following `tip` changes can be tested by building VictoriaMetrics components * FEATURE: dashboards: provide copies of Grafana dashboards alternated with VictoriaMetrics datasource at [dashboards/vm](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/master/dashboards/vm). * FEATURE: [vmauth](https://docs.victoriametrics.com/vmauth.html): added ability to set, override and clear request and response headers on a per-user and per-path basis. See [this i ssue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4825) and [these docs](https://docs.victoriametrics.com/vmauth.html#auth-config) for details. -* FEATURE: [vmauth](https://docs.victoriametrics.com/vmauth.html): automatically retry requests to the remaining backends if they return 5xx response codes and if the size of the request body doesn't exceed the value specified by `-maxRequestBodySizeToRetry` command-line flag. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4893). +* FEATURE: [vmauth](https://docs.victoriametrics.com/vmauth.html): add ability to retry requests to the [remaining backends](https://docs.victoriametrics.com/vmauth.html#load-balancing) if they return response status codes specified in the `retry_status_codes` list. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4893). * FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): add `eval_offset` attribute for [Groups](https://docs.victoriametrics.com/vmalert.html#groups). If specified, Group will be evaluated at the exact time offset on the range of [0...evaluationInterval]. The setting might be useful for cron-like rules which must be evaluated at specific moments of time. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3409) for details. * FEATURE: limit the length of string params in log messages to 500 chars. Longer string params are replaced with the `first_250_chars..last_250_chars`. This prevents from too long log lines, which can be emitted by VictoriaMetrics components. @@ -52,6 +52,7 @@ ssue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4825) and [these * BUGFIX: properly build production armv5 binaries for `GOARCH=arm`. This has been broken after the upgrading of Go builder to Go1.21.0. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4965). * BUGFIX: [vmselect](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html): return `503 Service Unavailable` status code when [partial responses](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#cluster-availability) are denied and some of `vmstorage` nodes are temporarily unavailable. Previously `422 Unprocessable Entiry` status code was mistakenly returned in this case, which could prevent from automatic recovery by re-sending the request to healthy cluster replica in another availability zone. * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): fix the bug when Group's `params` fields with multiple values were overriding each other instead of adding up. The bug was introduced in [this commit](https://github.com/VictoriaMetrics/VictoriaMetrics/commit/eccecdf177115297fa1dc4d42d38e23de9a9f2cb) starting from [v1.91.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.91.1). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4908). +* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): fix possble corruption of labels in the collected samples if `-remoteWrite.label` is set toghether with multiple `-remoteWrite.url` options. The bug has been introduced in [v1.93.1](#v1931). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4972). ## [v1.93.3](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.93.3) diff --git a/vmauth.md b/vmauth.md index cbe8b65..d6e631a 100644 --- a/vmauth.md +++ b/vmauth.md @@ -46,9 +46,42 @@ accounting and rate limiting such as [vmgateway](https://docs.victoriametrics.co Each `url_prefix` in the [-auth.config](#auth-config) may contain either a single url or a list of urls. In the latter case `vmauth` balances load among the configured urls in least-loaded round-robin manner. -`vmauth` retries failing `GET` requests across the configured list of urls. -This feature is useful for balancing the load among multiple `vmselect` and/or `vminsert` nodes -in [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). + +If the backend at the configured url isn't available, then `vmauth` tries sending the request to the remaining configured urls. + +It is possible to configure automatic retry of requests if the backend responds with status code from optional `retry_status_codes` list. + +Load balancing feature can be used in the following cases: + +- Balancing the load among multiple `vmselect` and/or `vminsert` nodes in [VictoriaMetrics cluster](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). + The following `-auth.config` file can be used for spreading incoming requests among 3 vmselect nodes and re-trying failed requests + or requests with 500 and 502 response status codes: + + ```yml + unauthorized_user: + url_prefix: + - http://vmselect1:8481/ + - http://vmselect2:8481/ + - http://vmselect3:8481/ + retry_status_codes: [500, 502] + ``` + +- Spreading select queries among multiple availability zones (AZs) with identical data. For example, the following config spreads select queries + among 3 AZs. Requests are re-tried if some AZs are temporarily unavailable or if some `vmstorage` nodes in some AZs are temporarily unavailable. + `vmauth` adds `deny_partial_response=1` query arg to all the queries in order to guarantee to get full response from every AZ. + See [these docs](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html#cluster-availability) for details. + + ```yml + unauthorized_user: + url_prefix: + - https://vmselect-az1/?deny_partial_response=1 + - https://vmselect-az2/?deny_partial_response=1 + - https://vmselect-az3/?deny_partial_response=1 + retry_status_codes: [500, 502, 503] + ``` + +Load balancig can also be configured independently per each user and per each `url_map` entry. +See [auth config docs](#auth-config) for more details. ## Concurrency limiting @@ -188,6 +221,7 @@ users: # - http://vmselect2:8481/select/42/prometheus # For example, http://vmauth:8427/api/v1/query is proxied to http://vmselect1:8480/select/42/prometheus/api/v1/query # or to http://vmselect2:8480/select/42/prometheus/api/v1/query . + # Requests are re-tried at other url_prefix backends if response status codes match 500 or 502. # # - Requests to http://vmauth:8427/api/v1/write are proxied to http://vminsert:8480/insert/42/prometheus/api/v1/write . # The "X-Scope-OrgID: abc" http header is added to these requests. @@ -207,6 +241,7 @@ users: url_prefix: - "http://vmselect1:8481/select/42/prometheus" - "http://vmselect2:8481/select/42/prometheus" + retry_status_codes: [500, 502] - src_paths: ["/api/v1/write"] url_prefix: "http://vminsert:8480/insert/42/prometheus" headers: @@ -220,16 +255,14 @@ users: - "http://default2:8888/unsupported_url_handler" # Requests without Authorization header are routed according to `unauthorized_user` section. +# Requests are routed in round-robin fashion between `url_prefix` backends. +# The deny_partial_response query arg is added to all the routed requests. +# The requests are re-tried if url_prefix backends send 500 or 503 response status codes. unauthorized_user: - url_map: - - src_paths: - - /api/v1/query - - /api/v1/query_range - url_prefix: - - http://vmselect1:8481/select/0/prometheus - - http://vmselect2:8481/select/0/prometheus - ip_filters: - allow_list: [8.8.8.8] + url_prefix: + - http://vmselect-az1/?deny_partial_response=1 + - http://vmselect-az2/?deny_partial_response=1 + retry_status_codes: [503, 500] ip_filters: allow_list: ["1.2.3.0/24", "127.0.0.1"] @@ -435,6 +468,9 @@ See the docs at https://docs.victoriametrics.com/vmauth.html . The maximum number of concurrent requests vmauth can process. Other requests are rejected with '429 Too Many Requests' http status code. See also -maxConcurrentPerUserRequests and -maxIdleConnsPerBackend command-line options (default 1000) -maxIdleConnsPerBackend int The maximum number of idle connections vmauth can open per each backend host. See also -maxConcurrentRequests (default 100) + -maxRequestBodySizeToRetry size + The maximum request body size, which can be cached and re-tried at other backends. Bigger values may require more memory + Supports the following optional suffixes for size values: KB, MB, GB, TB, KiB, MiB, GiB, TiB (default 16384) -memory.allowedBytes size 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 the OS page cache resulting in higher disk IO usage Supports the following optional suffixes for size values: KB, MB, GB, TB, KiB, MiB, GiB, TiB (default 0)