From 7f0a8d4bdb16603bc7696f684ddebb53731b0264 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 13 Sep 2021 17:04:28 +0300 Subject: [PATCH] docs: consistency renaming: Influx -> InfluxDB --- README.md | 276 ++++++++----------------- app/vmagent/README.md | 16 +- app/vmagent/influx/request_handler.go | 4 +- app/vmagent/main.go | 2 +- app/vmctl/README.md | 14 +- app/vmctl/flags.go | 12 +- app/vminsert/influx/request_handler.go | 4 +- app/vminsert/main.go | 2 +- docs/CHANGELOG.md | 4 +- docs/Cluster-VictoriaMetrics.md | 12 +- docs/README.md | 276 ++++++++----------------- docs/Single-server-VictoriaMetrics.md | 276 ++++++++----------------- docs/vmagent.md | 16 +- docs/vmctl.md | 14 +- lib/httpserver/httpserver.go | 2 +- lib/ingestserver/influx/server.go | 36 ++-- lib/protoparser/influx/parser.go | 4 +- lib/protoparser/influx/streamparser.go | 4 +- 18 files changed, 337 insertions(+), 637 deletions(-) diff --git a/README.md b/README.md index cea80e9af..aee8ab17e 100644 --- a/README.md +++ b/README.md @@ -12,16 +12,15 @@ VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database. -It is available in [binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases), -[docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/), [Snap package](https://snapcraft.io/victoriametrics) -and in [source code](https://github.com/VictoriaMetrics/VictoriaMetrics). Just download VictoriaMetrics and see [how to start it](#how-to-start-victoriametrics). -If you use Ubuntu, then just run `snap install victoriametrics` in order to install and run it. +VictoriaMetrics is available in [binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases), +in [Docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/), in [Snap packages](https://snapcraft.io/victoriametrics) +and in [source code](https://github.com/VictoriaMetrics/VictoriaMetrics). Just download VictoriaMetrics follow [these instructions](#how-to-start-victoriametrics). Then read [Prometheus setup](#prometheus-setup) and [Grafana setup](#grafana-setup) docs. -Cluster version is available [here](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). +Cluster version of VictoriaMetrics is available [here](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). -[Contact us](mailto:info@victoriametrics.com) if you need paid enterprise support for VictoriaMetrics. -See [features available for enterprise customers](https://victoriametrics.com/enterprise.html). +[Contact us](mailto:info@victoriametrics.com) if you need enterprise support for VictoriaMetrics. +See [features available in enterprise package](https://victoriametrics.com/enterprise.html). Enterprise binaries can be downloaded and evaluated for free from [the releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases). @@ -52,188 +51,101 @@ See also [articles and slides about VictoriaMetrics from our users](https://docs ## Prominent features -* VictoriaMetrics can be used as long-term storage for Prometheus or for [vmagent](https://docs.victoriametrics.com/vmagent.html). - See [these docs](#prometheus-setup) for details. -* VictoriaMetrics supports [Prometheus querying API](https://prometheus.io/docs/prometheus/latest/querying/api/), so it can be used as Prometheus drop-in replacement in Grafana. -* VictoriaMetrics implements [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html) query language backwards compatible with PromQL. -* VictoriaMetrics provides global query view. Multiple Prometheus instances or any other data sources may ingest data into VictoriaMetrics. - Later this data may be queried via a single query. -* High performance and good scalability for both [inserts](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b) - and [selects](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4). - [Outperforms InfluxDB and TimescaleDB by up to 20x](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae). -* [Uses 10x less RAM than InfluxDB](https://medium.com/@valyala/insert-benchmarks-with-inch-influxdb-vs-victoriametrics-e31a41ae2893) - and [up to 7x less RAM than Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f) - when dealing with millions of unique time series (aka [high cardinality](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality)). -* Optimized for time series with [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate). Think about [prometheus-operator](https://github.com/coreos/prometheus-operator) metrics from frequent deployments in Kubernetes. -* High data compression, so [up to 70x more data points](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4) - may be crammed into limited storage comparing to TimescaleDB - and [up to 7x less storage space is required comparing to Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f). -* Optimized for storage with high-latency IO and low IOPS (HDD and network storage in AWS, Google Cloud, Microsoft Azure, etc). - See [graphs from these benchmarks](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b). -* A single-node VictoriaMetrics may substitute moderately sized clusters built with competing solutions such as Thanos, M3DB, Cortex, InfluxDB or TimescaleDB. - See [vertical scalability benchmarks](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae), - [comparing Thanos to VictoriaMetrics cluster](https://medium.com/@valyala/comparing-thanos-to-victoriametrics-cluster-b193bea1683) - and [Remote Write Storage Wars](https://promcon.io/2019-munich/talks/remote-write-storage-wars/) talk - from [PromCon 2019](https://promcon.io/2019-munich/talks/remote-write-storage-wars/). -* Easy operation: +VictoriaMetrics has the following prominent features: + +* It can be used as long-term storage for Prometheus. See [these docs](#prometheus-setup) for details. +* It can be used as drop-in replacement for Prometheus in Grafana, because it supports [Prometheus querying API](#prometheus-querying-api-usage). +* It can be used as drop-in replacement for Graphite in Grafana, because it supports [Graphite API](#graphite-api-usage). +* It features easy setup and operation: * VictoriaMetrics consists of a single [small executable](https://medium.com/@valyala/stripping-dependency-bloat-in-victoriametrics-docker-image-983fb5912b0d) without external dependencies. * All the configuration is done via explicit command-line flags with reasonable defaults. * All the data is stored in a single directory pointed by `-storageDataPath` command-line flag. - * Easy and fast backups from [instant snapshots](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) - to S3 or GCS with [vmbackup](https://docs.victoriametrics.com/vmbackup.html) / [vmrestore](https://docs.victoriametrics.com/vmrestore.html). - See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time-series-databases-533c1a927883) for more details. -* Storage is protected from corruption on unclean shutdown (i.e. OOM, hardware reset or `kill -9`) thanks to [the storage architecture](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282). -* Supports metrics' scraping, ingestion and [backfilling](#backfilling) via the following protocols: - * [Metrics from Prometheus exporters](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format) - such as [node_exporter](https://github.com/prometheus/node_exporter). See [these docs](#how-to-scrape-prometheus-exporters-such-as-node-exporter) for details. - * [Prometheus remote write API](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) - * [InfluxDB line protocol](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) over HTTP, TCP and UDP. - * [Graphite plaintext protocol](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) with [tags](https://graphite.readthedocs.io/en/latest/tags.html#carbon) - if `-graphiteListenAddr` is set. - * [OpenTSDB put message](#sending-data-via-telnet-put-protocol) if `-opentsdbListenAddr` is set. - * [HTTP OpenTSDB /api/put requests](#sending-opentsdb-data-via-http-apiput-requests) if `-opentsdbHTTPListenAddr` is set. - * [JSON line format](#how-to-import-data-in-json-line-format). - * [Native binary format](#how-to-import-data-in-native-format). + * Easy and fast backups from [instant snapshots](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) to S3 or GCS can be done with [vmbackup](https://docs.victoriametrics.com/vmbackup.html) / [vmrestore](https://docs.victoriametrics.com/vmrestore.html) tools. See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time-series-databases-533c1a927883) for more details. +* It implements PromQL-based query language - [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html), which provides improved functionality on top of PromQL. +* It provides global query view. Multiple Prometheus instances or any other data sources may ingest data into VictoriaMetrics. Later this data may be queried via a single query. +* It provides high performance and good vertical and horizontal scalability for both [data ingestion](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b) and [data querying](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4). It [outperforms InfluxDB and TimescaleDB by up to 20x](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae). +* It [uses 10x less RAM than InfluxDB](https://medium.com/@valyala/insert-benchmarks-with-inch-influxdb-vs-victoriametrics-e31a41ae2893) and [up to 7x less RAM than Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f) when dealing with millions of unique time series (aka [high cardinality](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality)). +* It is optimized for time series with [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate). +* It provides high data compression, so [up to 70x more data points](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4) may be crammed into limited storage comparing to TimescaleDB and [up to 7x less storage space is required compared to Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f). +* It is optimized for storage with high-latency IO and low IOPS (HDD and network storage in AWS, Google Cloud, Microsoft Azure, etc). See [disk IO graphs from these benchmarks](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b). +* A single-node VictoriaMetrics may substitute moderately sized clusters built with competing solutions such as Thanos, M3DB, Cortex, InfluxDB or TimescaleDB. See [vertical scalability benchmarks](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae), [comparing Thanos to VictoriaMetrics cluster](https://medium.com/@valyala/comparing-thanos-to-victoriametrics-cluster-b193bea1683) and [Remote Write Storage Wars](https://promcon.io/2019-munich/talks/remote-write-storage-wars/) talk from [PromCon 2019](https://promcon.io/2019-munich/talks/remote-write-storage-wars/). +* It protects the storage from data corruption on unclean shutdown (i.e. OOM, hardware reset or `kill -9`) thanks to [the storage architecture](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282). +* It supports metrics' scraping, ingestion and [backfilling](#backfilling) via the following protocols: + * [Metrics scraping from Prometheus exporters](#how-to-scrape-prometheus-exporters-such-as-node-exporter). + * [Prometheus remote write API](#prometheus-setup). * [Prometheus exposition format](#how-to-import-data-in-prometheus-exposition-format). + * [InfluxDB line protocol](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) over HTTP, TCP and UDP. + * [Graphite plaintext protocol](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) with [tags](https://graphite.readthedocs.io/en/latest/tags.html#carbon). + * [OpenTSDB put message](#sending-data-via-telnet-put-protocol). + * [HTTP OpenTSDB /api/put requests](#sending-opentsdb-data-via-http-apiput-requests). + * [JSON line format](#how-to-import-data-in-json-line-format). * [Arbitrary CSV data](#how-to-import-csv-data). -* Supports metrics' relabeling. See [these docs](#relabeling) for details. -* Can deal with [high cardinality issues](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality) and [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate) issues using [series limiter](#cardinality-limiter). -* Ideally works with big amounts of time series data from APM, Kubernetes, IoT sensors, connected cars, industrial telemetry, financial data and various [Enterprise workloads](https://victoriametrics.com/enterprise.html). -* Has open source [cluster version](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). -* See also technical [Articles about VictoriaMetrics](https://docs.victoriametrics.com/Articles.html). + * [Native binary format](#how-to-import-data-in-native-format). +* It supports metrics' relabeling. See [these docs](#relabeling) for details. +* It can deal with [high cardinality issues](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality) and [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate) issues via [series limiter](#cardinality-limiter). +* It ideally works with big amounts of time series data from APM, Kubernetes, IoT sensors, connected cars, industrial telemetry, financial data and various [Enterprise workloads](https://victoriametrics.com/enterprise.html). +* It has open source [cluster version](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). + +See also [various Articles about VictoriaMetrics](https://docs.victoriametrics.com/Articles.html). ## Operation -### Table of contents - -* [How to start VictoriaMetrics](#how-to-start-victoriametrics) - * [Environment variables](#environment-variables) - * [Configuration with snap package](#configuration-with-snap-package) -* [Prometheus setup](#prometheus-setup) -* [Grafana setup](#grafana-setup) -* [How to upgrade VictoriaMetrics](#how-to-upgrade-victoriametrics) -* [How to apply new config to VictoriaMetrics](#how-to-apply-new-config-to-victoriametrics) -* [How to scrape Prometheus exporters such as node_exporter](#how-to-scrape-prometheus-exporters-such-as-node-exporter) -* [How to send data from InfluxDB-compatible agents such as Telegraf](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) -* [How to send data from Graphite-compatible agents such as StatsD](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) -* [Querying Graphite data](#querying-graphite-data) -* [How to send data from OpenTSDB-compatible agents](#how-to-send-data-from-opentsdb-compatible-agents) -* [Prometheus querying API usage](#prometheus-querying-api-usage) - * [Prometheus querying API enhancements](#prometheus-querying-api-enhancements) -* [Graphite API usage](#graphite-api-usage) - * [Graphite Render API usage](#graphite-render-api-usage) - * [Graphite Metrics API usage](#graphite-metrics-api-usage) - * [Graphite Tags API usage](#graphite-tags-api-usage) -* [How to build from sources](#how-to-build-from-sources) - * [Development build](#development-build) - * [Production build](#production-build) - * [ARM build](#arm-build) - * [Pure Go build (CGO_ENABLED=0)](#pure-go-build-cgo_enabled0) - * [Building docker images](#building-docker-images) -* [Start with docker-compose](#start-with-docker-compose) -* [Setting up service](#setting-up-service) -* [How to work with snapshots](#how-to-work-with-snapshots) -* [How to delete time series](#how-to-delete-time-series) -* [Forced merge](#forced-merge) -* [How to export time series](#how-to-export-time-series) - * [How to export data in native format](#how-to-export-data-in-native-format) - * [How to export data in JSON line format](#how-to-export-data-in-json-line-format) - * [How to export CSV data](#how-to-export-csv-data) -* [How to import time series data](#how-to-import-time-series-data) - * [How to import data in native format](#how-to-import-data-in-native-format) - * [How to import data in json line format](#how-to-import-data-in-json-line-format) - * [How to import CSV data](#how-to-import-csv-data) - * [How to import data in Prometheus exposition format](#how-to-import-data-in-prometheus-exposition-format) -* [Relabeling](#relabeling) -* [Federation](#federation) -* [Capacity planning](#capacity-planning) -* [High availability](#high-availability) -* [Deduplication](#deduplication) -* [Retention](#retention) -* [Multiple retentions](#multiple-retentions) -* [Downsampling](#downsampling) -* [Multi-tenancy](#multi-tenancy) -* [Scalability and cluster version](#scalability-and-cluster-version) -* [Alerting](#alerting) -* [Security](#security) -* [Tuning](#tuning) -* [Monitoring](#monitoring) -* [TSDB stats](#tsdb-stats) -* [Cardinality limiter](#cardinality-limiter) -* [Troubleshooting](#troubleshooting) -* [Data migration](#data-migration) -* [Backfilling](#backfilling) -* [Data updates](#data-updates) -* [Replication](#replication) -* [Backups](#backups) -* [Profiling](#profiling) -* [Integrations](#integrations) -* [Third-party contributions](#third-party-contributions) -* [Contacts](#contacts) -* [Community and contributions](#community-and-contributions) -* [Reporting bugs](#reporting-bugs) -* [VictoriaMetrics Logo](#victoria-metrics-logo) - * [Logo Usage Guidelines](#logo-usage-guidelines) - * [Font used](#font-used) - * [Color Palette](#color-palette) - * [We kindly ask](#we-kindly-ask) -* [List of command-line flags](#list-of-command-line-flags) - - ## How to start VictoriaMetrics -Start VictoriaMetrics [executable](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) -or [docker image](https://hub.docker.com/r/victoriametrics/victoria-metrics/) with the desired command-line flags. +Just download [VictoriaMetrics executable](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) or [Docker image](https://hub.docker.com/r/victoriametrics/victoria-metrics/) and start it with the desired command-line flags. The following command-line flags are used the most: -* `-storageDataPath` - path to data directory. VictoriaMetrics stores all the data in this directory. Default path is `victoria-metrics-data` in the current working directory. +* `-storageDataPath` - VictoriaMetrics stores all the data in this directory. Default path is `victoria-metrics-data` in the current working directory. * `-retentionPeriod` - retention for stored data. Older data is automatically deleted. Default retention is 1 month. See [these docs](#retention) for more details. Other flags have good enough default values, so set them only if you really need this. Pass `-help` to see [all the available flags with description and default values](#list-of-command-line-flags). -See how to [ingest data to VictoriaMetrics](#how-to-import-time-series-data), how to [query VictoriaMetrics](#grafana-setup) -and how to [handle alerts](#alerting). +See how to [ingest data to VictoriaMetrics](#how-to-import-time-series-data), how to [query VictoriaMetrics via Grafana](#grafana-setup), how to [query VictoriaMetrics via Graphite API](#graphite-api-usage) and how to [handle alerts](#alerting). + VictoriaMetrics accepts [Prometheus querying API requests](#prometheus-querying-api-usage) on port `8428` by default. It is recommended setting up [monitoring](#monitoring) for VictoriaMetrics. + ### Environment variables Each flag value can be set via environment variables according to these rules: -* The `-envflag.enable` flag must be set -* Each `.` char in flag name must be substituted by `_` (for example `-insert.maxQueueDuration ` will translate to `insert_maxQueueDuration=`) -* For repeating flags an alternative syntax can be used by joining the different values into one using `,` char as separator (for example `-storageNode -storageNode ` will translate to `storageNode=,`) -* It is possible setting prefix for environment vars with `-envflag.prefix`. For instance, if `-envflag.prefix=VM_`, then env vars must be prepended with `VM_` +* The `-envflag.enable` flag must be set. +* Each `.` char in flag name must be substituted with `_` (for example `-insert.maxQueueDuration ` will translate to `insert_maxQueueDuration=`). +* For repeating flags an alternative syntax can be used by joining the different values into one using `,` char as separator (for example `-storageNode -storageNode ` will translate to `storageNode=,`). +* Environment var prefix can be set via `-envflag.prefix` flag. For instance, if `-envflag.prefix=VM_`, then env vars must be prepended with `VM_`. + ### Configuration with snap package - Command-line flags can be changed with following command: +Snap package for VictoriaMetrics is available [here](https://snapcraft.io/victoriametrics). + +Command-line flags for Snap package can be set with following command: ```text echo 'FLAGS="-selfScrapeInterval=10s -search.logSlowQueryDuration=20s"' > $SNAP_DATA/var/snap/victoriametrics/current/extra_flags snap restart victoriametrics ``` - Or add needed command-line flags to the file `$SNAP_DATA/var/snap/victoriametrics/current/extra_flags`. - Note you cannot change value for `-storageDataPath` flag, for safety snap package has limited access to host system. +Do not change value for `-storageDataPath` flag, because snap package has limited access to host filesystem. - Changing scrape configuration is possible with text editor: - ```text - vi $SNAP_DATA/var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml - ``` - After changes was made, trigger config re-read with command `curl 127.0.0.1:8248/-/reload`. +Changing scrape configuration is possible with text editor: + +```text +vi $SNAP_DATA/var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml +``` + +After changes were made, trigger config re-read with the command `curl 127.0.0.1:8248/-/reload`. ## Prometheus setup -Prometheus must be configured with [remote_write](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) -in order to send data to VictoriaMetrics. Add the following lines -to Prometheus config file (it is usually located at `/etc/prometheus/prometheus.yml`): +Add the following lines to Prometheus config file (it is usually located at `/etc/prometheus/prometheus.yml`) in order to send data to VictoriaMetrics: ```yml remote_write: @@ -251,7 +163,7 @@ Prometheus writes incoming data to local storage and replicates it to remote sto This means that data remains available in local storage for `--storage.tsdb.retention.time` duration even if remote storage is unavailable. -If you plan to send data to VictoriaMetrics from multiple Prometheus instances, then add the following lines into `global` section +If you plan sending data to VictoriaMetrics from multiple Prometheus instances, then add the following lines into `global` section of [Prometheus config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file): ```yml @@ -260,11 +172,11 @@ global: datacenter: dc-123 ``` -This instructs Prometheus to add `datacenter=dc-123` label to each time series sent to remote storage. +This instructs Prometheus to add `datacenter=dc-123` label to each sample before sending it to remote storage. The label name can be arbitrary - `datacenter` is just an example. The label value must be unique -across Prometheus instances, so those time series may be filtered and grouped by this label. +across Prometheus instances, so time series could be filtered and grouped by this label. -For highly loaded Prometheus instances (400k+ samples per second) the following tuning may be applied: +For highly loaded Prometheus instances (200k+ samples per second) the following tuning may be applied: ```yaml remote_write: @@ -275,14 +187,13 @@ remote_write: max_shards: 30 ``` -Using remote write increases memory usage for Prometheus up to ~25% and depends on the shape of data. If you are experiencing issues with -too high memory consumption try to lower `max_samples_per_send` and `capacity` params (keep in mind that these two params are tightly connected). +Using remote write increases memory usage for Prometheus by up to ~25%. If you are experiencing issues with +too high memory consumption of Prometheus, then try to lower `max_samples_per_send` and `capacity` params. Keep in mind that these two params are tightly connected. Read more about tuning remote write for Prometheus [here](https://prometheus.io/docs/practices/remote_write). It is recommended upgrading Prometheus to [v2.12.0](https://github.com/prometheus/prometheus/releases) or newer, since previous versions may have issues with `remote_write`. -Take a look also at [vmagent](https://docs.victoriametrics.com/vmagent.html) -and [vmalert](https://docs.victoriametrics.com/vmalert.html), +Take a look also at [vmagent](https://docs.victoriametrics.com/vmagent.html) and [vmalert](https://docs.victoriametrics.com/vmalert.html), which can be used as faster and less resource-hungry alternative to Prometheus. @@ -296,27 +207,22 @@ http://:8428 Substitute `` with the hostname or IP address of VictoriaMetrics. -Then build graphs with the created datasource using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) -or [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). VictoriaMetrics supports [Prometheus querying API](#prometheus-querying-api-usage), -which is used by Grafana. +Then build graphs and dashboards for the created datasource using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) or [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). ## How to upgrade VictoriaMetrics -It is safe upgrading VictoriaMetrics to new versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) -say otherwise. It is safe skipping multiple versions during the upgrade unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. -It is recommended performing regular upgrades to the latest version, since it may contain important bug fixes, performance optimizations or new features. +It is safe upgrading VictoriaMetrics to new versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. It is safe skipping multiple versions during the upgrade unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. It is recommended performing regular upgrades to the latest version, since it may contain important bug fixes, performance optimizations or new features. -It is also safe downgrading to the previous version unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. +It is also safe downgrading to older versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. -The following steps must be performed during the upgrade / downgrade: +The following steps must be performed during the upgrade / downgrade procedure: * Send `SIGINT` signal to VictoriaMetrics process in order to gracefully stop it. * Wait until the process stops. This can take a few seconds. * Start the upgraded VictoriaMetrics. -Prometheus doesn't drop data during VictoriaMetrics restart. -See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. +Prometheus doesn't drop data during VictoriaMetrics restart. See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. The same applies also to [vmagent](https://docs.victoriametrics.com/vmagent.html). ## How to apply new config to VictoriaMetrics @@ -327,15 +233,12 @@ VictoriaMetrics is configured via command-line flags, so it must be restarted wh * Wait until the process stops. This can take a few seconds. * Start VictoriaMetrics with the new command-line flags. -Prometheus doesn't drop data during VictoriaMetrics restart. -See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. +Prometheus doesn't drop data during VictoriaMetrics restart. See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. The same applies alos to [vmagent](https://docs.victoriametrics.com/vmagent.html). ## How to scrape Prometheus exporters such as [node-exporter](https://github.com/prometheus/node_exporter) -VictoriaMetrics can be used as drop-in replacement for Prometheus for scraping targets configured in `prometheus.yml` config file according to [the specification](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file). -Just set `-promscrape.config` command-line flag to the path to `prometheus.yml` config - and VictoriaMetrics should start scraping the configured targets. -Currently the following [scrape_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) types are supported: +VictoriaMetrics can be used as drop-in replacement for Prometheus for scraping targets configured in `prometheus.yml` config file according to [the specification](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file). Just set `-promscrape.config` command-line flag to the path to `prometheus.yml` config - and VictoriaMetrics should start scraping the configured targets. Currently the following [scrape_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) types are supported: * [static_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config) * [file_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config) @@ -352,7 +255,7 @@ Currently the following [scrape_config](https://prometheus.io/docs/prometheus/la * [http_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config) -Other `*_sd_config` types will be supported in the future. +File a [feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues) if you need support for other `*_sd_config` types. The file pointed by `-promscrape.config` may contain `%{ENV_VAR}` placeholders, which are substituted by the corresponding `ENV_VAR` environment variable values. @@ -371,21 +274,18 @@ For instance, put the following lines into `Telegraf` config, so it sends data t urls = ["http://:8428"] ``` -Another option is to enable TCP and UDP receiver for Influx line protocol via `-influxListenAddr` command-line flag -and stream plain Influx line protocol data to the configured TCP and/or UDP addresses. +Another option is to enable TCP and UDP receiver for InfluxDB line protocol via `-influxListenAddr` command-line flag +and stream plain InfluxDB line protocol data to the configured TCP and/or UDP addresses. -VictoriaMetrics maps Influx data using the following rules: +VictoriaMetrics performs the following transformations to the ingested InfluxDB data: * [`db` query arg](https://docs.influxdata.com/influxdb/v1.7/tools/api/#write-http-endpoint) is mapped into `db` label value - unless `db` tag exists in the Influx line. -* Field names are mapped to time series names prefixed with `{measurement}{separator}` value, - where `{separator}` equals to `_` by default. It can be changed with `-influxMeasurementFieldSeparator` command-line flag. - See also `-influxSkipSingleField` command-line flag. - If `{measurement}` is empty or `-influxSkipMeasurement` command-line flag is set, then time series names correspond to field names. + unless `db` tag exists in the InfluxDB line. +* Field names are mapped to time series names prefixed with `{measurement}{separator}` value, where `{separator}` equals to `_` by default. It can be changed with `-influxMeasurementFieldSeparator` command-line flag. See also `-influxSkipSingleField` command-line flag. If `{measurement}` is empty or if `-influxSkipMeasurement` command-line flag is set, then time series names correspond to field names. * Field values are mapped to time series values. * Tags are mapped to Prometheus labels as-is. -For example, the following Influx line: +For example, the following InfluxDB line: ```raw foo,tag1=value1,tag2=value2 field1=12,field2=40 @@ -398,7 +298,7 @@ foo_field1{tag1="value1", tag2="value2"} 12 foo_field2{tag1="value1", tag2="value2"} 40 ``` -Example for writing data with [Influx line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/) +Example for writing data with [InfluxDB line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/) to local VictoriaMetrics using `curl`: ```bash @@ -419,7 +319,7 @@ The `/api/v1/export` endpoint should return the following response: {"metric":{"__name__":"measurement_field2","tag1":"value1","tag2":"value2"},"values":[1.23],"timestamps":[1560272508147]} ``` -Note that Influx line protocol expects [timestamps in *nanoseconds* by default](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/#timestamp), +Note that InfluxDB line protocol expects [timestamps in *nanoseconds* by default](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/#timestamp), while VictoriaMetrics stores them with *milliseconds* precision. Extra labels may be added to all the written time series by passing `extra_label=name=value` query args. @@ -889,7 +789,7 @@ The exported CSV data can be imported to VictoriaMetrics via [/api/v1/import/csv Time series data can be imported via any supported ingestion protocol: * [Prometheus remote_write API](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write). See [these docs](#prometheus-setup) for details. -* Influx line protocol. See [these docs](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for details. +* InfluxDB line protocol. See [these docs](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for details. * Graphite plaintext protocol. See [these docs](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) for details. * OpenTSDB telnet put protocol. See [these docs](#sending-data-via-telnet-put-protocol) for details. * OpenTSDB http `/api/put` protocol. See [these docs](#sending-opentsdb-data-via-http-apiput-requests) for details. @@ -1632,18 +1532,18 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li Comma-separated list of database names to return from /query and /influx/query API. This can be needed for accepting data from Telegraf plugins such as https://github.com/fangli/fluent-plugin-influxdb Supports an array of values separated by comma or specified via multiple flags. -influx.maxLineSize size - The maximum size in bytes for a single Influx line during parsing + The maximum size in bytes for a single InfluxDB line during parsing Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) -influxListenAddr string - TCP and UDP address to listen for Influx line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8428/write + TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8428/write -influxMeasurementFieldSeparator string - Separator for '{measurement}{separator}{field_name}' metric name when inserted via Influx line protocol (default "_") + Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol (default "_") -influxSkipMeasurement Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator' -influxSkipSingleField - Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if Influx line contains only a single field + Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field -influxTrimTimestamp duration - Trim timestamps for Influx line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) + Trim timestamps for InfluxDB line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) -insert.maxQueueDuration duration The maximum duration for waiting in the queue for insert requests due to -maxConcurrentInserts (default 1m0s) -logNewSeries diff --git a/app/vmagent/README.md b/app/vmagent/README.md index 695bf592b..c94d2c61f 100644 --- a/app/vmagent/README.md +++ b/app/vmagent/README.md @@ -21,7 +21,7 @@ to `vmagent` such as the ability to push metrics instead of pulling them. We did See [Quick Start](#quick-start) for details. * Can add, remove and modify labels (aka tags) via Prometheus relabeling. Can filter data before sending it to remote storage. See [these docs](#relabeling) for details. * Accepts data via all ingestion protocols supported by VictoriaMetrics: - * Influx line protocol via `http://:8429/write`. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf). + * InfluxDB line protocol via `http://:8429/write`. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf). * Graphite plaintext protocol if `-graphiteListenAddr` command-line flag is set. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-graphite-compatible-agents-such-as-statsd). * OpenTSDB telnet and http protocols if `-opentsdbListenAddr` command-line flag is set. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-opentsdb-compatible-agents). * Prometheus remote write protocol via `http://:8429/api/v1/write`. @@ -53,13 +53,13 @@ Example command line: /path/to/vmagent -promscrape.config=/path/to/prometheus.yml -remoteWrite.url=https://victoria-metrics-host:8428/api/v1/write ``` -If you only need to collect Influx data, then the following command is sufficient: +If you only need to collect InfluxDB data, then the following command is sufficient: ``` /path/to/vmagent -remoteWrite.url=https://victoria-metrics-host:8428/api/v1/write ``` -Then send Influx data to `http://vmagent-host:8429`. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for more details. +Then send InfluxDB data to `http://vmagent-host:8429`. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for more details. `vmagent` is also available in [docker images](https://hub.docker.com/r/victoriametrics/vmagent/tags). @@ -641,18 +641,18 @@ See the docs at https://docs.victoriametrics.com/vmagent.html . Comma-separated list of database names to return from /query and /influx/query API. This can be needed for accepting data from Telegraf plugins such as https://github.com/fangli/fluent-plugin-influxdb Supports an array of values separated by comma or specified via multiple flags. -influx.maxLineSize size - The maximum size in bytes for a single Influx line during parsing + The maximum size in bytes for a single InfluxDB line during parsing Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) -influxListenAddr string - TCP and UDP address to listen for Influx line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8429/write + TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8429/write -influxMeasurementFieldSeparator string - Separator for '{measurement}{separator}{field_name}' metric name when inserted via Influx line protocol (default "_") + Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol (default "_") -influxSkipMeasurement Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator' -influxSkipSingleField - Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if Influx line contains only a single field + Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field -influxTrimTimestamp duration - Trim timestamps for Influx line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) + Trim timestamps for InfluxDB line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) -insert.maxQueueDuration duration The maximum duration for waiting in the queue for insert requests due to -maxConcurrentInserts (default 1m0s) -loggerDisableTimestamps diff --git a/app/vmagent/influx/request_handler.go b/app/vmagent/influx/request_handler.go index 74027d305..63444071d 100644 --- a/app/vmagent/influx/request_handler.go +++ b/app/vmagent/influx/request_handler.go @@ -21,8 +21,8 @@ import ( ) var ( - measurementFieldSeparator = flag.String("influxMeasurementFieldSeparator", "_", "Separator for '{measurement}{separator}{field_name}' metric name when inserted via Influx line protocol") - skipSingleField = flag.Bool("influxSkipSingleField", false, "Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if Influx line contains only a single field") + measurementFieldSeparator = flag.String("influxMeasurementFieldSeparator", "_", "Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol") + skipSingleField = flag.Bool("influxSkipSingleField", false, "Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field") skipMeasurement = flag.Bool("influxSkipMeasurement", false, "Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator'") ) diff --git a/app/vmagent/main.go b/app/vmagent/main.go index a9f909c3f..1a2ed2a60 100644 --- a/app/vmagent/main.go +++ b/app/vmagent/main.go @@ -41,7 +41,7 @@ var ( httpListenAddr = flag.String("httpListenAddr", ":8429", "TCP address to listen for http connections. "+ "Set this flag to empty value in order to disable listening on any port. This mode may be useful for running multiple vmagent instances on the same server. "+ "Note that /targets and /metrics pages aren't available if -httpListenAddr=''") - influxListenAddr = flag.String("influxListenAddr", "", "TCP and UDP address to listen for Influx line protocol data. Usually :8189 must be set. Doesn't work if empty. "+ + influxListenAddr = flag.String("influxListenAddr", "", "TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. "+ "This flag isn't needed when ingesting data over HTTP - just send it to http://:8429/write") graphiteListenAddr = flag.String("graphiteListenAddr", "", "TCP and UDP address to listen for Graphite plaintext data. Usually :2003 must be set. Doesn't work if empty") opentsdbListenAddr = flag.String("opentsdbListenAddr", "", "TCP and UDP address to listen for OpentTSDB metrics. "+ diff --git a/app/vmctl/README.md b/app/vmctl/README.md index 3943283da..6ced12294 100644 --- a/app/vmctl/README.md +++ b/app/vmctl/README.md @@ -34,8 +34,8 @@ to the data source and common list of flags for destination (prefixed with `vm` ``` ./vmctl influx --help OPTIONS: - --influx-addr value Influx server addr (default: "http://localhost:8086") - --influx-user value Influx user [$INFLUX_USERNAME] + --influx-addr value InfluxDB server addr (default: "http://localhost:8086") + --influx-user value InfluxDB user [$INFLUX_USERNAME] ... --vm-addr vmctl VictoriaMetrics address to perform import requests. Should be the same as --httpListenAddr value for single-node version or vminsert component. @@ -216,16 +216,16 @@ Found 40000 timeseries to import. Continue? [Y/n] y ### Data mapping -Vmctl maps Influx data the same way as VictoriaMetrics does by using the following rules: +Vmctl maps InfluxDB data the same way as VictoriaMetrics does by using the following rules: -* `influx-database` arg is mapped into `db` label value unless `db` tag exists in the Influx line. +* `influx-database` arg is mapped into `db` label value unless `db` tag exists in the InfluxDB line. * Field names are mapped to time series names prefixed with {measurement}{separator} value, where {separator} equals to _ by default. It can be changed with `--influx-measurement-field-separator` command-line flag. * Field values are mapped to time series values. * Tags are mapped to Prometheus labels format as-is. -For example, the following Influx line: +For example, the following InfluxDB line: ``` foo,tag1=value1,tag2=value2 field1=12,field2=40 ``` @@ -294,7 +294,7 @@ if flags `--prom-filter-time-start` or `--prom-filter-time-end` were set. The ex Please note that stats are not taking into account timeseries or samples filtering. This will be done during importing process. The importing process takes the snapshot blocks revealed from Explore procedure and processes them one by one -accumulating timeseries and samples. Please note, that `vmctl` relies on responses from Influx on this stage, +accumulating timeseries and samples. Please note, that `vmctl` relies on responses from InfluxDB on this stage, so ensure that Explore queries are executed without errors or limits. Please see this [issue](https://github.com/VictoriaMetrics/vmctl/issues/30) for details. The data processed in chunks and then sent to VM. @@ -484,7 +484,7 @@ See more details for cluster version [here](https://github.com/VictoriaMetrics/V ## Tuning -### Influx mode +### InfluxDB mode The flag `--influx-concurrency` controls how many concurrent requests may be sent to InfluxDB while fetching timeseries. Please set it wisely to avoid InfluxDB overwhelming. diff --git a/app/vmctl/flags.go b/app/vmctl/flags.go index 6a910776a..4ff0e999f 100644 --- a/app/vmctl/flags.go +++ b/app/vmctl/flags.go @@ -189,26 +189,26 @@ var ( &cli.StringFlag{ Name: influxAddr, Value: "http://localhost:8086", - Usage: "Influx server addr", + Usage: "InfluxDB server addr", }, &cli.StringFlag{ Name: influxUser, - Usage: "Influx user", + Usage: "InfluxDB user", EnvVars: []string{"INFLUX_USERNAME"}, }, &cli.StringFlag{ Name: influxPassword, - Usage: "Influx user password", + Usage: "InfluxDB user password", EnvVars: []string{"INFLUX_PASSWORD"}, }, &cli.StringFlag{ Name: influxDB, - Usage: "Influx database", + Usage: "InfluxDB database", Required: true, }, &cli.StringFlag{ Name: influxRetention, - Usage: "Influx retention policy", + Usage: "InfluxDB retention policy", Value: "autogen", }, &cli.IntFlag{ @@ -223,7 +223,7 @@ var ( }, &cli.StringFlag{ Name: influxFilterSeries, - Usage: "Influx filter expression to select series. E.g. \"from cpu where arch='x86' AND hostname='host_2753'\".\n" + + Usage: "InfluxDB filter expression to select series. E.g. \"from cpu where arch='x86' AND hostname='host_2753'\".\n" + "See for details https://docs.influxdata.com/influxdb/v1.7/query_language/schema_exploration#show-series", }, &cli.StringFlag{ diff --git a/app/vminsert/influx/request_handler.go b/app/vminsert/influx/request_handler.go index f1c81bf80..3b1ae6c38 100644 --- a/app/vminsert/influx/request_handler.go +++ b/app/vminsert/influx/request_handler.go @@ -20,8 +20,8 @@ import ( ) var ( - measurementFieldSeparator = flag.String("influxMeasurementFieldSeparator", "_", "Separator for '{measurement}{separator}{field_name}' metric name when inserted via Influx line protocol") - skipSingleField = flag.Bool("influxSkipSingleField", false, "Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if Influx line contains only a single field") + measurementFieldSeparator = flag.String("influxMeasurementFieldSeparator", "_", "Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol") + skipSingleField = flag.Bool("influxSkipSingleField", false, "Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field") skipMeasurement = flag.Bool("influxSkipMeasurement", false, "Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator'") ) diff --git a/app/vminsert/main.go b/app/vminsert/main.go index be8ecda35..88238fa06 100644 --- a/app/vminsert/main.go +++ b/app/vminsert/main.go @@ -35,7 +35,7 @@ import ( var ( graphiteListenAddr = flag.String("graphiteListenAddr", "", "TCP and UDP address to listen for Graphite plaintext data. Usually :2003 must be set. Doesn't work if empty") - influxListenAddr = flag.String("influxListenAddr", "", "TCP and UDP address to listen for Influx line protocol data. Usually :8189 must be set. Doesn't work if empty. "+ + influxListenAddr = flag.String("influxListenAddr", "", "TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. "+ "This flag isn't needed when ingesting data over HTTP - just send it to http://:8428/write") opentsdbListenAddr = flag.String("opentsdbListenAddr", "", "TCP and UDP address to listen for OpentTSDB metrics. "+ "Telnet put messages and HTTP /api/put messages are simultaneously served on TCP port. "+ diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 09d2a7df4..022e855e0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -247,7 +247,7 @@ Thanks to @johnseekins! * `process_resident_memory_peak_bytes` - peak RSS usage for the process. * `process_virtual_memory_peak_bytes` - peak virtual memory usage for the process. * FEATURE: accept and enforce `extra_label==` query arg at [Graphite APIs](https://docs.victoriametrics.com/#graphite-api-usage). -* FEATURE: use Influx field as metric name if measurement is empty and `-influxSkipSingleField` command-line is set. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1139). +* FEATURE: use InfluxDB field as metric name if measurement is empty and `-influxSkipSingleField` command-line is set. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1139). * FEATURE: vmagent: add `-promscrape.consul.waitTime` command-line flag for tuning the maximum wait time for Consul service discovery. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1144). * FEATURE: vmagent: add `vm_promscrape_discovery_kubernetes_stale_resource_versions_total` metric for monitoring the frequency of `too old resource version` errors during Kubernetes service discovery. * FEATURE: single-node VictoriaMetrics: log metrics with timestamps older than `-search.cacheTimestampOffset` compared to the current time. See [these docs](https://docs.victoriametrics.com/#backfilling) for details. @@ -656,7 +656,7 @@ in front of VictoriaMetrics. [Contact us](mailto:sales@victoriametrics.com) if y See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/728 . * FEATURE: vmalert: make `-maxIdleConnections` configurable for datasource HTTP client. This option can be used for minimizing connection churn. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/795 . -* FEATURE: add `-influx.maxLineSize` command-line flag for configuring the maximum size for a single Influx line during parsing. +* FEATURE: add `-influx.maxLineSize` command-line flag for configuring the maximum size for a single InfluxDB line during parsing. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/807 * BUGFIX: properly handle `inf` values during [background merge of LSM parts](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282). diff --git a/docs/Cluster-VictoriaMetrics.md b/docs/Cluster-VictoriaMetrics.md index 683daa731..64adeb83a 100644 --- a/docs/Cluster-VictoriaMetrics.md +++ b/docs/Cluster-VictoriaMetrics.md @@ -192,7 +192,7 @@ It is recommended setting up alerts in [vmalert](https://docs.victoriametrics.co where `projectID` is also arbitrary 32-bit integer. If `projectID` isn't set, then it equals to `0`. - `` may have the following values: - `prometheus` and `prometheus/api/v1/write` - for inserting data with [Prometheus remote write API](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) - - `influx/write` and `influx/api/v2/write` - for inserting data with [Influx line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/). + - `influx/write` and `influx/api/v2/write` - for inserting data with [InfluxDB line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/). - `opentsdb/api/put` - for accepting [OpenTSDB HTTP /api/put requests](http://opentsdb.net/docs/build/html/api_http/put.html). This handler is disabled by default. It is exposed on a distinct TCP address set via `-opentsdbHTTPListenAddr` command-line flag. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#sending-opentsdb-data-via-http-apiput-requests) for details. @@ -503,18 +503,18 @@ Below is the output for `/path/to/vminsert -help`: Comma-separated list of database names to return from /query and /influx/query API. This can be needed for accepting data from Telegraf plugins such as https://github.com/fangli/fluent-plugin-influxdb Supports an array of values separated by comma or specified via multiple flags. -influx.maxLineSize size - The maximum size in bytes for a single Influx line during parsing + The maximum size in bytes for a single InfluxDB line during parsing Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) -influxListenAddr string - TCP and UDP address to listen for Influx line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8480/insert//influx/write + TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8480/insert//influx/write -influxMeasurementFieldSeparator string - Separator for '{measurement}{separator}{field_name}' metric name when inserted via Influx line protocol (default "_") + Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol (default "_") -influxSkipMeasurement Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator' -influxSkipSingleField - Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if Influx line contains only a single field + Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field -influxTrimTimestamp duration - Trim timestamps for Influx line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) + Trim timestamps for InfluxDB line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) -insert.maxQueueDuration duration The maximum duration for waiting in the queue for insert requests due to -maxConcurrentInserts (default 1m0s) -loggerDisableTimestamps diff --git a/docs/README.md b/docs/README.md index cea80e9af..aee8ab17e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,16 +12,15 @@ VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database. -It is available in [binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases), -[docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/), [Snap package](https://snapcraft.io/victoriametrics) -and in [source code](https://github.com/VictoriaMetrics/VictoriaMetrics). Just download VictoriaMetrics and see [how to start it](#how-to-start-victoriametrics). -If you use Ubuntu, then just run `snap install victoriametrics` in order to install and run it. +VictoriaMetrics is available in [binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases), +in [Docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/), in [Snap packages](https://snapcraft.io/victoriametrics) +and in [source code](https://github.com/VictoriaMetrics/VictoriaMetrics). Just download VictoriaMetrics follow [these instructions](#how-to-start-victoriametrics). Then read [Prometheus setup](#prometheus-setup) and [Grafana setup](#grafana-setup) docs. -Cluster version is available [here](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). +Cluster version of VictoriaMetrics is available [here](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). -[Contact us](mailto:info@victoriametrics.com) if you need paid enterprise support for VictoriaMetrics. -See [features available for enterprise customers](https://victoriametrics.com/enterprise.html). +[Contact us](mailto:info@victoriametrics.com) if you need enterprise support for VictoriaMetrics. +See [features available in enterprise package](https://victoriametrics.com/enterprise.html). Enterprise binaries can be downloaded and evaluated for free from [the releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases). @@ -52,188 +51,101 @@ See also [articles and slides about VictoriaMetrics from our users](https://docs ## Prominent features -* VictoriaMetrics can be used as long-term storage for Prometheus or for [vmagent](https://docs.victoriametrics.com/vmagent.html). - See [these docs](#prometheus-setup) for details. -* VictoriaMetrics supports [Prometheus querying API](https://prometheus.io/docs/prometheus/latest/querying/api/), so it can be used as Prometheus drop-in replacement in Grafana. -* VictoriaMetrics implements [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html) query language backwards compatible with PromQL. -* VictoriaMetrics provides global query view. Multiple Prometheus instances or any other data sources may ingest data into VictoriaMetrics. - Later this data may be queried via a single query. -* High performance and good scalability for both [inserts](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b) - and [selects](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4). - [Outperforms InfluxDB and TimescaleDB by up to 20x](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae). -* [Uses 10x less RAM than InfluxDB](https://medium.com/@valyala/insert-benchmarks-with-inch-influxdb-vs-victoriametrics-e31a41ae2893) - and [up to 7x less RAM than Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f) - when dealing with millions of unique time series (aka [high cardinality](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality)). -* Optimized for time series with [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate). Think about [prometheus-operator](https://github.com/coreos/prometheus-operator) metrics from frequent deployments in Kubernetes. -* High data compression, so [up to 70x more data points](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4) - may be crammed into limited storage comparing to TimescaleDB - and [up to 7x less storage space is required comparing to Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f). -* Optimized for storage with high-latency IO and low IOPS (HDD and network storage in AWS, Google Cloud, Microsoft Azure, etc). - See [graphs from these benchmarks](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b). -* A single-node VictoriaMetrics may substitute moderately sized clusters built with competing solutions such as Thanos, M3DB, Cortex, InfluxDB or TimescaleDB. - See [vertical scalability benchmarks](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae), - [comparing Thanos to VictoriaMetrics cluster](https://medium.com/@valyala/comparing-thanos-to-victoriametrics-cluster-b193bea1683) - and [Remote Write Storage Wars](https://promcon.io/2019-munich/talks/remote-write-storage-wars/) talk - from [PromCon 2019](https://promcon.io/2019-munich/talks/remote-write-storage-wars/). -* Easy operation: +VictoriaMetrics has the following prominent features: + +* It can be used as long-term storage for Prometheus. See [these docs](#prometheus-setup) for details. +* It can be used as drop-in replacement for Prometheus in Grafana, because it supports [Prometheus querying API](#prometheus-querying-api-usage). +* It can be used as drop-in replacement for Graphite in Grafana, because it supports [Graphite API](#graphite-api-usage). +* It features easy setup and operation: * VictoriaMetrics consists of a single [small executable](https://medium.com/@valyala/stripping-dependency-bloat-in-victoriametrics-docker-image-983fb5912b0d) without external dependencies. * All the configuration is done via explicit command-line flags with reasonable defaults. * All the data is stored in a single directory pointed by `-storageDataPath` command-line flag. - * Easy and fast backups from [instant snapshots](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) - to S3 or GCS with [vmbackup](https://docs.victoriametrics.com/vmbackup.html) / [vmrestore](https://docs.victoriametrics.com/vmrestore.html). - See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time-series-databases-533c1a927883) for more details. -* Storage is protected from corruption on unclean shutdown (i.e. OOM, hardware reset or `kill -9`) thanks to [the storage architecture](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282). -* Supports metrics' scraping, ingestion and [backfilling](#backfilling) via the following protocols: - * [Metrics from Prometheus exporters](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format) - such as [node_exporter](https://github.com/prometheus/node_exporter). See [these docs](#how-to-scrape-prometheus-exporters-such-as-node-exporter) for details. - * [Prometheus remote write API](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) - * [InfluxDB line protocol](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) over HTTP, TCP and UDP. - * [Graphite plaintext protocol](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) with [tags](https://graphite.readthedocs.io/en/latest/tags.html#carbon) - if `-graphiteListenAddr` is set. - * [OpenTSDB put message](#sending-data-via-telnet-put-protocol) if `-opentsdbListenAddr` is set. - * [HTTP OpenTSDB /api/put requests](#sending-opentsdb-data-via-http-apiput-requests) if `-opentsdbHTTPListenAddr` is set. - * [JSON line format](#how-to-import-data-in-json-line-format). - * [Native binary format](#how-to-import-data-in-native-format). + * Easy and fast backups from [instant snapshots](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) to S3 or GCS can be done with [vmbackup](https://docs.victoriametrics.com/vmbackup.html) / [vmrestore](https://docs.victoriametrics.com/vmrestore.html) tools. See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time-series-databases-533c1a927883) for more details. +* It implements PromQL-based query language - [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html), which provides improved functionality on top of PromQL. +* It provides global query view. Multiple Prometheus instances or any other data sources may ingest data into VictoriaMetrics. Later this data may be queried via a single query. +* It provides high performance and good vertical and horizontal scalability for both [data ingestion](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b) and [data querying](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4). It [outperforms InfluxDB and TimescaleDB by up to 20x](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae). +* It [uses 10x less RAM than InfluxDB](https://medium.com/@valyala/insert-benchmarks-with-inch-influxdb-vs-victoriametrics-e31a41ae2893) and [up to 7x less RAM than Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f) when dealing with millions of unique time series (aka [high cardinality](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality)). +* It is optimized for time series with [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate). +* It provides high data compression, so [up to 70x more data points](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4) may be crammed into limited storage comparing to TimescaleDB and [up to 7x less storage space is required compared to Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f). +* It is optimized for storage with high-latency IO and low IOPS (HDD and network storage in AWS, Google Cloud, Microsoft Azure, etc). See [disk IO graphs from these benchmarks](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b). +* A single-node VictoriaMetrics may substitute moderately sized clusters built with competing solutions such as Thanos, M3DB, Cortex, InfluxDB or TimescaleDB. See [vertical scalability benchmarks](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae), [comparing Thanos to VictoriaMetrics cluster](https://medium.com/@valyala/comparing-thanos-to-victoriametrics-cluster-b193bea1683) and [Remote Write Storage Wars](https://promcon.io/2019-munich/talks/remote-write-storage-wars/) talk from [PromCon 2019](https://promcon.io/2019-munich/talks/remote-write-storage-wars/). +* It protects the storage from data corruption on unclean shutdown (i.e. OOM, hardware reset or `kill -9`) thanks to [the storage architecture](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282). +* It supports metrics' scraping, ingestion and [backfilling](#backfilling) via the following protocols: + * [Metrics scraping from Prometheus exporters](#how-to-scrape-prometheus-exporters-such-as-node-exporter). + * [Prometheus remote write API](#prometheus-setup). * [Prometheus exposition format](#how-to-import-data-in-prometheus-exposition-format). + * [InfluxDB line protocol](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) over HTTP, TCP and UDP. + * [Graphite plaintext protocol](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) with [tags](https://graphite.readthedocs.io/en/latest/tags.html#carbon). + * [OpenTSDB put message](#sending-data-via-telnet-put-protocol). + * [HTTP OpenTSDB /api/put requests](#sending-opentsdb-data-via-http-apiput-requests). + * [JSON line format](#how-to-import-data-in-json-line-format). * [Arbitrary CSV data](#how-to-import-csv-data). -* Supports metrics' relabeling. See [these docs](#relabeling) for details. -* Can deal with [high cardinality issues](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality) and [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate) issues using [series limiter](#cardinality-limiter). -* Ideally works with big amounts of time series data from APM, Kubernetes, IoT sensors, connected cars, industrial telemetry, financial data and various [Enterprise workloads](https://victoriametrics.com/enterprise.html). -* Has open source [cluster version](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). -* See also technical [Articles about VictoriaMetrics](https://docs.victoriametrics.com/Articles.html). + * [Native binary format](#how-to-import-data-in-native-format). +* It supports metrics' relabeling. See [these docs](#relabeling) for details. +* It can deal with [high cardinality issues](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality) and [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate) issues via [series limiter](#cardinality-limiter). +* It ideally works with big amounts of time series data from APM, Kubernetes, IoT sensors, connected cars, industrial telemetry, financial data and various [Enterprise workloads](https://victoriametrics.com/enterprise.html). +* It has open source [cluster version](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). + +See also [various Articles about VictoriaMetrics](https://docs.victoriametrics.com/Articles.html). ## Operation -### Table of contents - -* [How to start VictoriaMetrics](#how-to-start-victoriametrics) - * [Environment variables](#environment-variables) - * [Configuration with snap package](#configuration-with-snap-package) -* [Prometheus setup](#prometheus-setup) -* [Grafana setup](#grafana-setup) -* [How to upgrade VictoriaMetrics](#how-to-upgrade-victoriametrics) -* [How to apply new config to VictoriaMetrics](#how-to-apply-new-config-to-victoriametrics) -* [How to scrape Prometheus exporters such as node_exporter](#how-to-scrape-prometheus-exporters-such-as-node-exporter) -* [How to send data from InfluxDB-compatible agents such as Telegraf](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) -* [How to send data from Graphite-compatible agents such as StatsD](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) -* [Querying Graphite data](#querying-graphite-data) -* [How to send data from OpenTSDB-compatible agents](#how-to-send-data-from-opentsdb-compatible-agents) -* [Prometheus querying API usage](#prometheus-querying-api-usage) - * [Prometheus querying API enhancements](#prometheus-querying-api-enhancements) -* [Graphite API usage](#graphite-api-usage) - * [Graphite Render API usage](#graphite-render-api-usage) - * [Graphite Metrics API usage](#graphite-metrics-api-usage) - * [Graphite Tags API usage](#graphite-tags-api-usage) -* [How to build from sources](#how-to-build-from-sources) - * [Development build](#development-build) - * [Production build](#production-build) - * [ARM build](#arm-build) - * [Pure Go build (CGO_ENABLED=0)](#pure-go-build-cgo_enabled0) - * [Building docker images](#building-docker-images) -* [Start with docker-compose](#start-with-docker-compose) -* [Setting up service](#setting-up-service) -* [How to work with snapshots](#how-to-work-with-snapshots) -* [How to delete time series](#how-to-delete-time-series) -* [Forced merge](#forced-merge) -* [How to export time series](#how-to-export-time-series) - * [How to export data in native format](#how-to-export-data-in-native-format) - * [How to export data in JSON line format](#how-to-export-data-in-json-line-format) - * [How to export CSV data](#how-to-export-csv-data) -* [How to import time series data](#how-to-import-time-series-data) - * [How to import data in native format](#how-to-import-data-in-native-format) - * [How to import data in json line format](#how-to-import-data-in-json-line-format) - * [How to import CSV data](#how-to-import-csv-data) - * [How to import data in Prometheus exposition format](#how-to-import-data-in-prometheus-exposition-format) -* [Relabeling](#relabeling) -* [Federation](#federation) -* [Capacity planning](#capacity-planning) -* [High availability](#high-availability) -* [Deduplication](#deduplication) -* [Retention](#retention) -* [Multiple retentions](#multiple-retentions) -* [Downsampling](#downsampling) -* [Multi-tenancy](#multi-tenancy) -* [Scalability and cluster version](#scalability-and-cluster-version) -* [Alerting](#alerting) -* [Security](#security) -* [Tuning](#tuning) -* [Monitoring](#monitoring) -* [TSDB stats](#tsdb-stats) -* [Cardinality limiter](#cardinality-limiter) -* [Troubleshooting](#troubleshooting) -* [Data migration](#data-migration) -* [Backfilling](#backfilling) -* [Data updates](#data-updates) -* [Replication](#replication) -* [Backups](#backups) -* [Profiling](#profiling) -* [Integrations](#integrations) -* [Third-party contributions](#third-party-contributions) -* [Contacts](#contacts) -* [Community and contributions](#community-and-contributions) -* [Reporting bugs](#reporting-bugs) -* [VictoriaMetrics Logo](#victoria-metrics-logo) - * [Logo Usage Guidelines](#logo-usage-guidelines) - * [Font used](#font-used) - * [Color Palette](#color-palette) - * [We kindly ask](#we-kindly-ask) -* [List of command-line flags](#list-of-command-line-flags) - - ## How to start VictoriaMetrics -Start VictoriaMetrics [executable](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) -or [docker image](https://hub.docker.com/r/victoriametrics/victoria-metrics/) with the desired command-line flags. +Just download [VictoriaMetrics executable](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) or [Docker image](https://hub.docker.com/r/victoriametrics/victoria-metrics/) and start it with the desired command-line flags. The following command-line flags are used the most: -* `-storageDataPath` - path to data directory. VictoriaMetrics stores all the data in this directory. Default path is `victoria-metrics-data` in the current working directory. +* `-storageDataPath` - VictoriaMetrics stores all the data in this directory. Default path is `victoria-metrics-data` in the current working directory. * `-retentionPeriod` - retention for stored data. Older data is automatically deleted. Default retention is 1 month. See [these docs](#retention) for more details. Other flags have good enough default values, so set them only if you really need this. Pass `-help` to see [all the available flags with description and default values](#list-of-command-line-flags). -See how to [ingest data to VictoriaMetrics](#how-to-import-time-series-data), how to [query VictoriaMetrics](#grafana-setup) -and how to [handle alerts](#alerting). +See how to [ingest data to VictoriaMetrics](#how-to-import-time-series-data), how to [query VictoriaMetrics via Grafana](#grafana-setup), how to [query VictoriaMetrics via Graphite API](#graphite-api-usage) and how to [handle alerts](#alerting). + VictoriaMetrics accepts [Prometheus querying API requests](#prometheus-querying-api-usage) on port `8428` by default. It is recommended setting up [monitoring](#monitoring) for VictoriaMetrics. + ### Environment variables Each flag value can be set via environment variables according to these rules: -* The `-envflag.enable` flag must be set -* Each `.` char in flag name must be substituted by `_` (for example `-insert.maxQueueDuration ` will translate to `insert_maxQueueDuration=`) -* For repeating flags an alternative syntax can be used by joining the different values into one using `,` char as separator (for example `-storageNode -storageNode ` will translate to `storageNode=,`) -* It is possible setting prefix for environment vars with `-envflag.prefix`. For instance, if `-envflag.prefix=VM_`, then env vars must be prepended with `VM_` +* The `-envflag.enable` flag must be set. +* Each `.` char in flag name must be substituted with `_` (for example `-insert.maxQueueDuration ` will translate to `insert_maxQueueDuration=`). +* For repeating flags an alternative syntax can be used by joining the different values into one using `,` char as separator (for example `-storageNode -storageNode ` will translate to `storageNode=,`). +* Environment var prefix can be set via `-envflag.prefix` flag. For instance, if `-envflag.prefix=VM_`, then env vars must be prepended with `VM_`. + ### Configuration with snap package - Command-line flags can be changed with following command: +Snap package for VictoriaMetrics is available [here](https://snapcraft.io/victoriametrics). + +Command-line flags for Snap package can be set with following command: ```text echo 'FLAGS="-selfScrapeInterval=10s -search.logSlowQueryDuration=20s"' > $SNAP_DATA/var/snap/victoriametrics/current/extra_flags snap restart victoriametrics ``` - Or add needed command-line flags to the file `$SNAP_DATA/var/snap/victoriametrics/current/extra_flags`. - Note you cannot change value for `-storageDataPath` flag, for safety snap package has limited access to host system. +Do not change value for `-storageDataPath` flag, because snap package has limited access to host filesystem. - Changing scrape configuration is possible with text editor: - ```text - vi $SNAP_DATA/var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml - ``` - After changes was made, trigger config re-read with command `curl 127.0.0.1:8248/-/reload`. +Changing scrape configuration is possible with text editor: + +```text +vi $SNAP_DATA/var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml +``` + +After changes were made, trigger config re-read with the command `curl 127.0.0.1:8248/-/reload`. ## Prometheus setup -Prometheus must be configured with [remote_write](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) -in order to send data to VictoriaMetrics. Add the following lines -to Prometheus config file (it is usually located at `/etc/prometheus/prometheus.yml`): +Add the following lines to Prometheus config file (it is usually located at `/etc/prometheus/prometheus.yml`) in order to send data to VictoriaMetrics: ```yml remote_write: @@ -251,7 +163,7 @@ Prometheus writes incoming data to local storage and replicates it to remote sto This means that data remains available in local storage for `--storage.tsdb.retention.time` duration even if remote storage is unavailable. -If you plan to send data to VictoriaMetrics from multiple Prometheus instances, then add the following lines into `global` section +If you plan sending data to VictoriaMetrics from multiple Prometheus instances, then add the following lines into `global` section of [Prometheus config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file): ```yml @@ -260,11 +172,11 @@ global: datacenter: dc-123 ``` -This instructs Prometheus to add `datacenter=dc-123` label to each time series sent to remote storage. +This instructs Prometheus to add `datacenter=dc-123` label to each sample before sending it to remote storage. The label name can be arbitrary - `datacenter` is just an example. The label value must be unique -across Prometheus instances, so those time series may be filtered and grouped by this label. +across Prometheus instances, so time series could be filtered and grouped by this label. -For highly loaded Prometheus instances (400k+ samples per second) the following tuning may be applied: +For highly loaded Prometheus instances (200k+ samples per second) the following tuning may be applied: ```yaml remote_write: @@ -275,14 +187,13 @@ remote_write: max_shards: 30 ``` -Using remote write increases memory usage for Prometheus up to ~25% and depends on the shape of data. If you are experiencing issues with -too high memory consumption try to lower `max_samples_per_send` and `capacity` params (keep in mind that these two params are tightly connected). +Using remote write increases memory usage for Prometheus by up to ~25%. If you are experiencing issues with +too high memory consumption of Prometheus, then try to lower `max_samples_per_send` and `capacity` params. Keep in mind that these two params are tightly connected. Read more about tuning remote write for Prometheus [here](https://prometheus.io/docs/practices/remote_write). It is recommended upgrading Prometheus to [v2.12.0](https://github.com/prometheus/prometheus/releases) or newer, since previous versions may have issues with `remote_write`. -Take a look also at [vmagent](https://docs.victoriametrics.com/vmagent.html) -and [vmalert](https://docs.victoriametrics.com/vmalert.html), +Take a look also at [vmagent](https://docs.victoriametrics.com/vmagent.html) and [vmalert](https://docs.victoriametrics.com/vmalert.html), which can be used as faster and less resource-hungry alternative to Prometheus. @@ -296,27 +207,22 @@ http://:8428 Substitute `` with the hostname or IP address of VictoriaMetrics. -Then build graphs with the created datasource using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) -or [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). VictoriaMetrics supports [Prometheus querying API](#prometheus-querying-api-usage), -which is used by Grafana. +Then build graphs and dashboards for the created datasource using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) or [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). ## How to upgrade VictoriaMetrics -It is safe upgrading VictoriaMetrics to new versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) -say otherwise. It is safe skipping multiple versions during the upgrade unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. -It is recommended performing regular upgrades to the latest version, since it may contain important bug fixes, performance optimizations or new features. +It is safe upgrading VictoriaMetrics to new versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. It is safe skipping multiple versions during the upgrade unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. It is recommended performing regular upgrades to the latest version, since it may contain important bug fixes, performance optimizations or new features. -It is also safe downgrading to the previous version unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. +It is also safe downgrading to older versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. -The following steps must be performed during the upgrade / downgrade: +The following steps must be performed during the upgrade / downgrade procedure: * Send `SIGINT` signal to VictoriaMetrics process in order to gracefully stop it. * Wait until the process stops. This can take a few seconds. * Start the upgraded VictoriaMetrics. -Prometheus doesn't drop data during VictoriaMetrics restart. -See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. +Prometheus doesn't drop data during VictoriaMetrics restart. See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. The same applies also to [vmagent](https://docs.victoriametrics.com/vmagent.html). ## How to apply new config to VictoriaMetrics @@ -327,15 +233,12 @@ VictoriaMetrics is configured via command-line flags, so it must be restarted wh * Wait until the process stops. This can take a few seconds. * Start VictoriaMetrics with the new command-line flags. -Prometheus doesn't drop data during VictoriaMetrics restart. -See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. +Prometheus doesn't drop data during VictoriaMetrics restart. See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. The same applies alos to [vmagent](https://docs.victoriametrics.com/vmagent.html). ## How to scrape Prometheus exporters such as [node-exporter](https://github.com/prometheus/node_exporter) -VictoriaMetrics can be used as drop-in replacement for Prometheus for scraping targets configured in `prometheus.yml` config file according to [the specification](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file). -Just set `-promscrape.config` command-line flag to the path to `prometheus.yml` config - and VictoriaMetrics should start scraping the configured targets. -Currently the following [scrape_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) types are supported: +VictoriaMetrics can be used as drop-in replacement for Prometheus for scraping targets configured in `prometheus.yml` config file according to [the specification](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file). Just set `-promscrape.config` command-line flag to the path to `prometheus.yml` config - and VictoriaMetrics should start scraping the configured targets. Currently the following [scrape_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) types are supported: * [static_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config) * [file_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config) @@ -352,7 +255,7 @@ Currently the following [scrape_config](https://prometheus.io/docs/prometheus/la * [http_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config) -Other `*_sd_config` types will be supported in the future. +File a [feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues) if you need support for other `*_sd_config` types. The file pointed by `-promscrape.config` may contain `%{ENV_VAR}` placeholders, which are substituted by the corresponding `ENV_VAR` environment variable values. @@ -371,21 +274,18 @@ For instance, put the following lines into `Telegraf` config, so it sends data t urls = ["http://:8428"] ``` -Another option is to enable TCP and UDP receiver for Influx line protocol via `-influxListenAddr` command-line flag -and stream plain Influx line protocol data to the configured TCP and/or UDP addresses. +Another option is to enable TCP and UDP receiver for InfluxDB line protocol via `-influxListenAddr` command-line flag +and stream plain InfluxDB line protocol data to the configured TCP and/or UDP addresses. -VictoriaMetrics maps Influx data using the following rules: +VictoriaMetrics performs the following transformations to the ingested InfluxDB data: * [`db` query arg](https://docs.influxdata.com/influxdb/v1.7/tools/api/#write-http-endpoint) is mapped into `db` label value - unless `db` tag exists in the Influx line. -* Field names are mapped to time series names prefixed with `{measurement}{separator}` value, - where `{separator}` equals to `_` by default. It can be changed with `-influxMeasurementFieldSeparator` command-line flag. - See also `-influxSkipSingleField` command-line flag. - If `{measurement}` is empty or `-influxSkipMeasurement` command-line flag is set, then time series names correspond to field names. + unless `db` tag exists in the InfluxDB line. +* Field names are mapped to time series names prefixed with `{measurement}{separator}` value, where `{separator}` equals to `_` by default. It can be changed with `-influxMeasurementFieldSeparator` command-line flag. See also `-influxSkipSingleField` command-line flag. If `{measurement}` is empty or if `-influxSkipMeasurement` command-line flag is set, then time series names correspond to field names. * Field values are mapped to time series values. * Tags are mapped to Prometheus labels as-is. -For example, the following Influx line: +For example, the following InfluxDB line: ```raw foo,tag1=value1,tag2=value2 field1=12,field2=40 @@ -398,7 +298,7 @@ foo_field1{tag1="value1", tag2="value2"} 12 foo_field2{tag1="value1", tag2="value2"} 40 ``` -Example for writing data with [Influx line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/) +Example for writing data with [InfluxDB line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/) to local VictoriaMetrics using `curl`: ```bash @@ -419,7 +319,7 @@ The `/api/v1/export` endpoint should return the following response: {"metric":{"__name__":"measurement_field2","tag1":"value1","tag2":"value2"},"values":[1.23],"timestamps":[1560272508147]} ``` -Note that Influx line protocol expects [timestamps in *nanoseconds* by default](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/#timestamp), +Note that InfluxDB line protocol expects [timestamps in *nanoseconds* by default](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/#timestamp), while VictoriaMetrics stores them with *milliseconds* precision. Extra labels may be added to all the written time series by passing `extra_label=name=value` query args. @@ -889,7 +789,7 @@ The exported CSV data can be imported to VictoriaMetrics via [/api/v1/import/csv Time series data can be imported via any supported ingestion protocol: * [Prometheus remote_write API](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write). See [these docs](#prometheus-setup) for details. -* Influx line protocol. See [these docs](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for details. +* InfluxDB line protocol. See [these docs](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for details. * Graphite plaintext protocol. See [these docs](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) for details. * OpenTSDB telnet put protocol. See [these docs](#sending-data-via-telnet-put-protocol) for details. * OpenTSDB http `/api/put` protocol. See [these docs](#sending-opentsdb-data-via-http-apiput-requests) for details. @@ -1632,18 +1532,18 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li Comma-separated list of database names to return from /query and /influx/query API. This can be needed for accepting data from Telegraf plugins such as https://github.com/fangli/fluent-plugin-influxdb Supports an array of values separated by comma or specified via multiple flags. -influx.maxLineSize size - The maximum size in bytes for a single Influx line during parsing + The maximum size in bytes for a single InfluxDB line during parsing Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) -influxListenAddr string - TCP and UDP address to listen for Influx line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8428/write + TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8428/write -influxMeasurementFieldSeparator string - Separator for '{measurement}{separator}{field_name}' metric name when inserted via Influx line protocol (default "_") + Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol (default "_") -influxSkipMeasurement Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator' -influxSkipSingleField - Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if Influx line contains only a single field + Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field -influxTrimTimestamp duration - Trim timestamps for Influx line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) + Trim timestamps for InfluxDB line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) -insert.maxQueueDuration duration The maximum duration for waiting in the queue for insert requests due to -maxConcurrentInserts (default 1m0s) -logNewSeries diff --git a/docs/Single-server-VictoriaMetrics.md b/docs/Single-server-VictoriaMetrics.md index 499198d1e..62ae54114 100644 --- a/docs/Single-server-VictoriaMetrics.md +++ b/docs/Single-server-VictoriaMetrics.md @@ -16,16 +16,15 @@ sort: 1 VictoriaMetrics is a fast, cost-effective and scalable monitoring solution and time series database. -It is available in [binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases), -[docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/), [Snap package](https://snapcraft.io/victoriametrics) -and in [source code](https://github.com/VictoriaMetrics/VictoriaMetrics). Just download VictoriaMetrics and see [how to start it](#how-to-start-victoriametrics). -If you use Ubuntu, then just run `snap install victoriametrics` in order to install and run it. +VictoriaMetrics is available in [binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases), +in [Docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/), in [Snap packages](https://snapcraft.io/victoriametrics) +and in [source code](https://github.com/VictoriaMetrics/VictoriaMetrics). Just download VictoriaMetrics follow [these instructions](#how-to-start-victoriametrics). Then read [Prometheus setup](#prometheus-setup) and [Grafana setup](#grafana-setup) docs. -Cluster version is available [here](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). +Cluster version of VictoriaMetrics is available [here](https://docs.victoriametrics.com/Cluster-VictoriaMetrics.html). -[Contact us](mailto:info@victoriametrics.com) if you need paid enterprise support for VictoriaMetrics. -See [features available for enterprise customers](https://victoriametrics.com/enterprise.html). +[Contact us](mailto:info@victoriametrics.com) if you need enterprise support for VictoriaMetrics. +See [features available in enterprise package](https://victoriametrics.com/enterprise.html). Enterprise binaries can be downloaded and evaluated for free from [the releases page](https://github.com/VictoriaMetrics/VictoriaMetrics/releases). @@ -56,188 +55,101 @@ See also [articles and slides about VictoriaMetrics from our users](https://docs ## Prominent features -* VictoriaMetrics can be used as long-term storage for Prometheus or for [vmagent](https://docs.victoriametrics.com/vmagent.html). - See [these docs](#prometheus-setup) for details. -* VictoriaMetrics supports [Prometheus querying API](https://prometheus.io/docs/prometheus/latest/querying/api/), so it can be used as Prometheus drop-in replacement in Grafana. -* VictoriaMetrics implements [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html) query language backwards compatible with PromQL. -* VictoriaMetrics provides global query view. Multiple Prometheus instances or any other data sources may ingest data into VictoriaMetrics. - Later this data may be queried via a single query. -* High performance and good scalability for both [inserts](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b) - and [selects](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4). - [Outperforms InfluxDB and TimescaleDB by up to 20x](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae). -* [Uses 10x less RAM than InfluxDB](https://medium.com/@valyala/insert-benchmarks-with-inch-influxdb-vs-victoriametrics-e31a41ae2893) - and [up to 7x less RAM than Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f) - when dealing with millions of unique time series (aka [high cardinality](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality)). -* Optimized for time series with [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate). Think about [prometheus-operator](https://github.com/coreos/prometheus-operator) metrics from frequent deployments in Kubernetes. -* High data compression, so [up to 70x more data points](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4) - may be crammed into limited storage comparing to TimescaleDB - and [up to 7x less storage space is required comparing to Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f). -* Optimized for storage with high-latency IO and low IOPS (HDD and network storage in AWS, Google Cloud, Microsoft Azure, etc). - See [graphs from these benchmarks](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b). -* A single-node VictoriaMetrics may substitute moderately sized clusters built with competing solutions such as Thanos, M3DB, Cortex, InfluxDB or TimescaleDB. - See [vertical scalability benchmarks](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae), - [comparing Thanos to VictoriaMetrics cluster](https://medium.com/@valyala/comparing-thanos-to-victoriametrics-cluster-b193bea1683) - and [Remote Write Storage Wars](https://promcon.io/2019-munich/talks/remote-write-storage-wars/) talk - from [PromCon 2019](https://promcon.io/2019-munich/talks/remote-write-storage-wars/). -* Easy operation: +VictoriaMetrics has the following prominent features: + +* It can be used as long-term storage for Prometheus. See [these docs](#prometheus-setup) for details. +* It can be used as drop-in replacement for Prometheus in Grafana, because it supports [Prometheus querying API](#prometheus-querying-api-usage). +* It can be used as drop-in replacement for Graphite in Grafana, because it supports [Graphite API](#graphite-api-usage). +* It features easy setup and operation: * VictoriaMetrics consists of a single [small executable](https://medium.com/@valyala/stripping-dependency-bloat-in-victoriametrics-docker-image-983fb5912b0d) without external dependencies. * All the configuration is done via explicit command-line flags with reasonable defaults. * All the data is stored in a single directory pointed by `-storageDataPath` command-line flag. - * Easy and fast backups from [instant snapshots](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) - to S3 or GCS with [vmbackup](https://docs.victoriametrics.com/vmbackup.html) / [vmrestore](https://docs.victoriametrics.com/vmrestore.html). - See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time-series-databases-533c1a927883) for more details. -* Storage is protected from corruption on unclean shutdown (i.e. OOM, hardware reset or `kill -9`) thanks to [the storage architecture](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282). -* Supports metrics' scraping, ingestion and [backfilling](#backfilling) via the following protocols: - * [Metrics from Prometheus exporters](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format) - such as [node_exporter](https://github.com/prometheus/node_exporter). See [these docs](#how-to-scrape-prometheus-exporters-such-as-node-exporter) for details. - * [Prometheus remote write API](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) - * [InfluxDB line protocol](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) over HTTP, TCP and UDP. - * [Graphite plaintext protocol](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) with [tags](https://graphite.readthedocs.io/en/latest/tags.html#carbon) - if `-graphiteListenAddr` is set. - * [OpenTSDB put message](#sending-data-via-telnet-put-protocol) if `-opentsdbListenAddr` is set. - * [HTTP OpenTSDB /api/put requests](#sending-opentsdb-data-via-http-apiput-requests) if `-opentsdbHTTPListenAddr` is set. - * [JSON line format](#how-to-import-data-in-json-line-format). - * [Native binary format](#how-to-import-data-in-native-format). + * Easy and fast backups from [instant snapshots](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) to S3 or GCS can be done with [vmbackup](https://docs.victoriametrics.com/vmbackup.html) / [vmrestore](https://docs.victoriametrics.com/vmrestore.html) tools. See [this article](https://medium.com/@valyala/speeding-up-backups-for-big-time-series-databases-533c1a927883) for more details. +* It implements PromQL-based query language - [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html), which provides improved functionality on top of PromQL. +* It provides global query view. Multiple Prometheus instances or any other data sources may ingest data into VictoriaMetrics. Later this data may be queried via a single query. +* It provides high performance and good vertical and horizontal scalability for both [data ingestion](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b) and [data querying](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4). It [outperforms InfluxDB and TimescaleDB by up to 20x](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae). +* It [uses 10x less RAM than InfluxDB](https://medium.com/@valyala/insert-benchmarks-with-inch-influxdb-vs-victoriametrics-e31a41ae2893) and [up to 7x less RAM than Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f) when dealing with millions of unique time series (aka [high cardinality](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality)). +* It is optimized for time series with [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate). +* It provides high data compression, so [up to 70x more data points](https://medium.com/@valyala/when-size-matters-benchmarking-victoriametrics-vs-timescale-and-influxdb-6035811952d4) may be crammed into limited storage comparing to TimescaleDB and [up to 7x less storage space is required compared to Prometheus, Thanos or Cortex](https://valyala.medium.com/prometheus-vs-victoriametrics-benchmark-on-node-exporter-metrics-4ca29c75590f). +* It is optimized for storage with high-latency IO and low IOPS (HDD and network storage in AWS, Google Cloud, Microsoft Azure, etc). See [disk IO graphs from these benchmarks](https://medium.com/@valyala/high-cardinality-tsdb-benchmarks-victoriametrics-vs-timescaledb-vs-influxdb-13e6ee64dd6b). +* A single-node VictoriaMetrics may substitute moderately sized clusters built with competing solutions such as Thanos, M3DB, Cortex, InfluxDB or TimescaleDB. See [vertical scalability benchmarks](https://medium.com/@valyala/measuring-vertical-scalability-for-time-series-databases-in-google-cloud-92550d78d8ae), [comparing Thanos to VictoriaMetrics cluster](https://medium.com/@valyala/comparing-thanos-to-victoriametrics-cluster-b193bea1683) and [Remote Write Storage Wars](https://promcon.io/2019-munich/talks/remote-write-storage-wars/) talk from [PromCon 2019](https://promcon.io/2019-munich/talks/remote-write-storage-wars/). +* It protects the storage from data corruption on unclean shutdown (i.e. OOM, hardware reset or `kill -9`) thanks to [the storage architecture](https://medium.com/@valyala/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282). +* It supports metrics' scraping, ingestion and [backfilling](#backfilling) via the following protocols: + * [Metrics scraping from Prometheus exporters](#how-to-scrape-prometheus-exporters-such-as-node-exporter). + * [Prometheus remote write API](#prometheus-setup). * [Prometheus exposition format](#how-to-import-data-in-prometheus-exposition-format). + * [InfluxDB line protocol](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) over HTTP, TCP and UDP. + * [Graphite plaintext protocol](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) with [tags](https://graphite.readthedocs.io/en/latest/tags.html#carbon). + * [OpenTSDB put message](#sending-data-via-telnet-put-protocol). + * [HTTP OpenTSDB /api/put requests](#sending-opentsdb-data-via-http-apiput-requests). + * [JSON line format](#how-to-import-data-in-json-line-format). * [Arbitrary CSV data](#how-to-import-csv-data). -* Supports metrics' relabeling. See [these docs](#relabeling) for details. -* Can deal with [high cardinality issues](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality) and [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate) issues using [series limiter](#cardinality-limiter). -* Ideally works with big amounts of time series data from APM, Kubernetes, IoT sensors, connected cars, industrial telemetry, financial data and various [Enterprise workloads](https://victoriametrics.com/enterprise.html). -* Has open source [cluster version](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). -* See also technical [Articles about VictoriaMetrics](https://docs.victoriametrics.com/Articles.html). + * [Native binary format](#how-to-import-data-in-native-format). +* It supports metrics' relabeling. See [these docs](#relabeling) for details. +* It can deal with [high cardinality issues](https://docs.victoriametrics.com/FAQ.html#what-is-high-cardinality) and [high churn rate](https://docs.victoriametrics.com/FAQ.html#what-is-high-churn-rate) issues via [series limiter](#cardinality-limiter). +* It ideally works with big amounts of time series data from APM, Kubernetes, IoT sensors, connected cars, industrial telemetry, financial data and various [Enterprise workloads](https://victoriametrics.com/enterprise.html). +* It has open source [cluster version](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster). + +See also [various Articles about VictoriaMetrics](https://docs.victoriametrics.com/Articles.html). ## Operation -### Table of contents - -* [How to start VictoriaMetrics](#how-to-start-victoriametrics) - * [Environment variables](#environment-variables) - * [Configuration with snap package](#configuration-with-snap-package) -* [Prometheus setup](#prometheus-setup) -* [Grafana setup](#grafana-setup) -* [How to upgrade VictoriaMetrics](#how-to-upgrade-victoriametrics) -* [How to apply new config to VictoriaMetrics](#how-to-apply-new-config-to-victoriametrics) -* [How to scrape Prometheus exporters such as node_exporter](#how-to-scrape-prometheus-exporters-such-as-node-exporter) -* [How to send data from InfluxDB-compatible agents such as Telegraf](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) -* [How to send data from Graphite-compatible agents such as StatsD](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) -* [Querying Graphite data](#querying-graphite-data) -* [How to send data from OpenTSDB-compatible agents](#how-to-send-data-from-opentsdb-compatible-agents) -* [Prometheus querying API usage](#prometheus-querying-api-usage) - * [Prometheus querying API enhancements](#prometheus-querying-api-enhancements) -* [Graphite API usage](#graphite-api-usage) - * [Graphite Render API usage](#graphite-render-api-usage) - * [Graphite Metrics API usage](#graphite-metrics-api-usage) - * [Graphite Tags API usage](#graphite-tags-api-usage) -* [How to build from sources](#how-to-build-from-sources) - * [Development build](#development-build) - * [Production build](#production-build) - * [ARM build](#arm-build) - * [Pure Go build (CGO_ENABLED=0)](#pure-go-build-cgo_enabled0) - * [Building docker images](#building-docker-images) -* [Start with docker-compose](#start-with-docker-compose) -* [Setting up service](#setting-up-service) -* [How to work with snapshots](#how-to-work-with-snapshots) -* [How to delete time series](#how-to-delete-time-series) -* [Forced merge](#forced-merge) -* [How to export time series](#how-to-export-time-series) - * [How to export data in native format](#how-to-export-data-in-native-format) - * [How to export data in JSON line format](#how-to-export-data-in-json-line-format) - * [How to export CSV data](#how-to-export-csv-data) -* [How to import time series data](#how-to-import-time-series-data) - * [How to import data in native format](#how-to-import-data-in-native-format) - * [How to import data in json line format](#how-to-import-data-in-json-line-format) - * [How to import CSV data](#how-to-import-csv-data) - * [How to import data in Prometheus exposition format](#how-to-import-data-in-prometheus-exposition-format) -* [Relabeling](#relabeling) -* [Federation](#federation) -* [Capacity planning](#capacity-planning) -* [High availability](#high-availability) -* [Deduplication](#deduplication) -* [Retention](#retention) -* [Multiple retentions](#multiple-retentions) -* [Downsampling](#downsampling) -* [Multi-tenancy](#multi-tenancy) -* [Scalability and cluster version](#scalability-and-cluster-version) -* [Alerting](#alerting) -* [Security](#security) -* [Tuning](#tuning) -* [Monitoring](#monitoring) -* [TSDB stats](#tsdb-stats) -* [Cardinality limiter](#cardinality-limiter) -* [Troubleshooting](#troubleshooting) -* [Data migration](#data-migration) -* [Backfilling](#backfilling) -* [Data updates](#data-updates) -* [Replication](#replication) -* [Backups](#backups) -* [Profiling](#profiling) -* [Integrations](#integrations) -* [Third-party contributions](#third-party-contributions) -* [Contacts](#contacts) -* [Community and contributions](#community-and-contributions) -* [Reporting bugs](#reporting-bugs) -* [VictoriaMetrics Logo](#victoria-metrics-logo) - * [Logo Usage Guidelines](#logo-usage-guidelines) - * [Font used](#font-used) - * [Color Palette](#color-palette) - * [We kindly ask](#we-kindly-ask) -* [List of command-line flags](#list-of-command-line-flags) - - ## How to start VictoriaMetrics -Start VictoriaMetrics [executable](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) -or [docker image](https://hub.docker.com/r/victoriametrics/victoria-metrics/) with the desired command-line flags. +Just download [VictoriaMetrics executable](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) or [Docker image](https://hub.docker.com/r/victoriametrics/victoria-metrics/) and start it with the desired command-line flags. The following command-line flags are used the most: -* `-storageDataPath` - path to data directory. VictoriaMetrics stores all the data in this directory. Default path is `victoria-metrics-data` in the current working directory. +* `-storageDataPath` - VictoriaMetrics stores all the data in this directory. Default path is `victoria-metrics-data` in the current working directory. * `-retentionPeriod` - retention for stored data. Older data is automatically deleted. Default retention is 1 month. See [these docs](#retention) for more details. Other flags have good enough default values, so set them only if you really need this. Pass `-help` to see [all the available flags with description and default values](#list-of-command-line-flags). -See how to [ingest data to VictoriaMetrics](#how-to-import-time-series-data), how to [query VictoriaMetrics](#grafana-setup) -and how to [handle alerts](#alerting). +See how to [ingest data to VictoriaMetrics](#how-to-import-time-series-data), how to [query VictoriaMetrics via Grafana](#grafana-setup), how to [query VictoriaMetrics via Graphite API](#graphite-api-usage) and how to [handle alerts](#alerting). + VictoriaMetrics accepts [Prometheus querying API requests](#prometheus-querying-api-usage) on port `8428` by default. It is recommended setting up [monitoring](#monitoring) for VictoriaMetrics. + ### Environment variables Each flag value can be set via environment variables according to these rules: -* The `-envflag.enable` flag must be set -* Each `.` char in flag name must be substituted by `_` (for example `-insert.maxQueueDuration ` will translate to `insert_maxQueueDuration=`) -* For repeating flags an alternative syntax can be used by joining the different values into one using `,` char as separator (for example `-storageNode -storageNode ` will translate to `storageNode=,`) -* It is possible setting prefix for environment vars with `-envflag.prefix`. For instance, if `-envflag.prefix=VM_`, then env vars must be prepended with `VM_` +* The `-envflag.enable` flag must be set. +* Each `.` char in flag name must be substituted with `_` (for example `-insert.maxQueueDuration ` will translate to `insert_maxQueueDuration=`). +* For repeating flags an alternative syntax can be used by joining the different values into one using `,` char as separator (for example `-storageNode -storageNode ` will translate to `storageNode=,`). +* Environment var prefix can be set via `-envflag.prefix` flag. For instance, if `-envflag.prefix=VM_`, then env vars must be prepended with `VM_`. + ### Configuration with snap package - Command-line flags can be changed with following command: +Snap package for VictoriaMetrics is available [here](https://snapcraft.io/victoriametrics). + +Command-line flags for Snap package can be set with following command: ```text echo 'FLAGS="-selfScrapeInterval=10s -search.logSlowQueryDuration=20s"' > $SNAP_DATA/var/snap/victoriametrics/current/extra_flags snap restart victoriametrics ``` - Or add needed command-line flags to the file `$SNAP_DATA/var/snap/victoriametrics/current/extra_flags`. - Note you cannot change value for `-storageDataPath` flag, for safety snap package has limited access to host system. +Do not change value for `-storageDataPath` flag, because snap package has limited access to host filesystem. - Changing scrape configuration is possible with text editor: - ```text - vi $SNAP_DATA/var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml - ``` - After changes was made, trigger config re-read with command `curl 127.0.0.1:8248/-/reload`. +Changing scrape configuration is possible with text editor: + +```text +vi $SNAP_DATA/var/snap/victoriametrics/current/etc/victoriametrics-scrape-config.yaml +``` + +After changes were made, trigger config re-read with the command `curl 127.0.0.1:8248/-/reload`. ## Prometheus setup -Prometheus must be configured with [remote_write](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) -in order to send data to VictoriaMetrics. Add the following lines -to Prometheus config file (it is usually located at `/etc/prometheus/prometheus.yml`): +Add the following lines to Prometheus config file (it is usually located at `/etc/prometheus/prometheus.yml`) in order to send data to VictoriaMetrics: ```yml remote_write: @@ -255,7 +167,7 @@ Prometheus writes incoming data to local storage and replicates it to remote sto This means that data remains available in local storage for `--storage.tsdb.retention.time` duration even if remote storage is unavailable. -If you plan to send data to VictoriaMetrics from multiple Prometheus instances, then add the following lines into `global` section +If you plan sending data to VictoriaMetrics from multiple Prometheus instances, then add the following lines into `global` section of [Prometheus config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file): ```yml @@ -264,11 +176,11 @@ global: datacenter: dc-123 ``` -This instructs Prometheus to add `datacenter=dc-123` label to each time series sent to remote storage. +This instructs Prometheus to add `datacenter=dc-123` label to each sample before sending it to remote storage. The label name can be arbitrary - `datacenter` is just an example. The label value must be unique -across Prometheus instances, so those time series may be filtered and grouped by this label. +across Prometheus instances, so time series could be filtered and grouped by this label. -For highly loaded Prometheus instances (400k+ samples per second) the following tuning may be applied: +For highly loaded Prometheus instances (200k+ samples per second) the following tuning may be applied: ```yaml remote_write: @@ -279,14 +191,13 @@ remote_write: max_shards: 30 ``` -Using remote write increases memory usage for Prometheus up to ~25% and depends on the shape of data. If you are experiencing issues with -too high memory consumption try to lower `max_samples_per_send` and `capacity` params (keep in mind that these two params are tightly connected). +Using remote write increases memory usage for Prometheus by up to ~25%. If you are experiencing issues with +too high memory consumption of Prometheus, then try to lower `max_samples_per_send` and `capacity` params. Keep in mind that these two params are tightly connected. Read more about tuning remote write for Prometheus [here](https://prometheus.io/docs/practices/remote_write). It is recommended upgrading Prometheus to [v2.12.0](https://github.com/prometheus/prometheus/releases) or newer, since previous versions may have issues with `remote_write`. -Take a look also at [vmagent](https://docs.victoriametrics.com/vmagent.html) -and [vmalert](https://docs.victoriametrics.com/vmalert.html), +Take a look also at [vmagent](https://docs.victoriametrics.com/vmagent.html) and [vmalert](https://docs.victoriametrics.com/vmalert.html), which can be used as faster and less resource-hungry alternative to Prometheus. @@ -300,27 +211,22 @@ http://:8428 Substitute `` with the hostname or IP address of VictoriaMetrics. -Then build graphs with the created datasource using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) -or [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). VictoriaMetrics supports [Prometheus querying API](#prometheus-querying-api-usage), -which is used by Grafana. +Then build graphs and dashboards for the created datasource using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) or [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html). ## How to upgrade VictoriaMetrics -It is safe upgrading VictoriaMetrics to new versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) -say otherwise. It is safe skipping multiple versions during the upgrade unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. -It is recommended performing regular upgrades to the latest version, since it may contain important bug fixes, performance optimizations or new features. +It is safe upgrading VictoriaMetrics to new versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. It is safe skipping multiple versions during the upgrade unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. It is recommended performing regular upgrades to the latest version, since it may contain important bug fixes, performance optimizations or new features. -It is also safe downgrading to the previous version unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. +It is also safe downgrading to older versions unless [release notes](https://github.com/VictoriaMetrics/VictoriaMetrics/releases) say otherwise. -The following steps must be performed during the upgrade / downgrade: +The following steps must be performed during the upgrade / downgrade procedure: * Send `SIGINT` signal to VictoriaMetrics process in order to gracefully stop it. * Wait until the process stops. This can take a few seconds. * Start the upgraded VictoriaMetrics. -Prometheus doesn't drop data during VictoriaMetrics restart. -See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. +Prometheus doesn't drop data during VictoriaMetrics restart. See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. The same applies also to [vmagent](https://docs.victoriametrics.com/vmagent.html). ## How to apply new config to VictoriaMetrics @@ -331,15 +237,12 @@ VictoriaMetrics is configured via command-line flags, so it must be restarted wh * Wait until the process stops. This can take a few seconds. * Start VictoriaMetrics with the new command-line flags. -Prometheus doesn't drop data during VictoriaMetrics restart. -See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. +Prometheus doesn't drop data during VictoriaMetrics restart. See [this article](https://grafana.com/blog/2019/03/25/whats-new-in-prometheus-2.8-wal-based-remote-write/) for details. The same applies alos to [vmagent](https://docs.victoriametrics.com/vmagent.html). ## How to scrape Prometheus exporters such as [node-exporter](https://github.com/prometheus/node_exporter) -VictoriaMetrics can be used as drop-in replacement for Prometheus for scraping targets configured in `prometheus.yml` config file according to [the specification](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file). -Just set `-promscrape.config` command-line flag to the path to `prometheus.yml` config - and VictoriaMetrics should start scraping the configured targets. -Currently the following [scrape_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) types are supported: +VictoriaMetrics can be used as drop-in replacement for Prometheus for scraping targets configured in `prometheus.yml` config file according to [the specification](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#configuration-file). Just set `-promscrape.config` command-line flag to the path to `prometheus.yml` config - and VictoriaMetrics should start scraping the configured targets. Currently the following [scrape_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) types are supported: * [static_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config) * [file_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#file_sd_config) @@ -356,7 +259,7 @@ Currently the following [scrape_config](https://prometheus.io/docs/prometheus/la * [http_sd_config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config) -Other `*_sd_config` types will be supported in the future. +File a [feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues) if you need support for other `*_sd_config` types. The file pointed by `-promscrape.config` may contain `%{ENV_VAR}` placeholders, which are substituted by the corresponding `ENV_VAR` environment variable values. @@ -375,21 +278,18 @@ For instance, put the following lines into `Telegraf` config, so it sends data t urls = ["http://:8428"] ``` -Another option is to enable TCP and UDP receiver for Influx line protocol via `-influxListenAddr` command-line flag -and stream plain Influx line protocol data to the configured TCP and/or UDP addresses. +Another option is to enable TCP and UDP receiver for InfluxDB line protocol via `-influxListenAddr` command-line flag +and stream plain InfluxDB line protocol data to the configured TCP and/or UDP addresses. -VictoriaMetrics maps Influx data using the following rules: +VictoriaMetrics performs the following transformations to the ingested InfluxDB data: * [`db` query arg](https://docs.influxdata.com/influxdb/v1.7/tools/api/#write-http-endpoint) is mapped into `db` label value - unless `db` tag exists in the Influx line. -* Field names are mapped to time series names prefixed with `{measurement}{separator}` value, - where `{separator}` equals to `_` by default. It can be changed with `-influxMeasurementFieldSeparator` command-line flag. - See also `-influxSkipSingleField` command-line flag. - If `{measurement}` is empty or `-influxSkipMeasurement` command-line flag is set, then time series names correspond to field names. + unless `db` tag exists in the InfluxDB line. +* Field names are mapped to time series names prefixed with `{measurement}{separator}` value, where `{separator}` equals to `_` by default. It can be changed with `-influxMeasurementFieldSeparator` command-line flag. See also `-influxSkipSingleField` command-line flag. If `{measurement}` is empty or if `-influxSkipMeasurement` command-line flag is set, then time series names correspond to field names. * Field values are mapped to time series values. * Tags are mapped to Prometheus labels as-is. -For example, the following Influx line: +For example, the following InfluxDB line: ```raw foo,tag1=value1,tag2=value2 field1=12,field2=40 @@ -402,7 +302,7 @@ foo_field1{tag1="value1", tag2="value2"} 12 foo_field2{tag1="value1", tag2="value2"} 40 ``` -Example for writing data with [Influx line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/) +Example for writing data with [InfluxDB line protocol](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/) to local VictoriaMetrics using `curl`: ```bash @@ -423,7 +323,7 @@ The `/api/v1/export` endpoint should return the following response: {"metric":{"__name__":"measurement_field2","tag1":"value1","tag2":"value2"},"values":[1.23],"timestamps":[1560272508147]} ``` -Note that Influx line protocol expects [timestamps in *nanoseconds* by default](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/#timestamp), +Note that InfluxDB line protocol expects [timestamps in *nanoseconds* by default](https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_tutorial/#timestamp), while VictoriaMetrics stores them with *milliseconds* precision. Extra labels may be added to all the written time series by passing `extra_label=name=value` query args. @@ -893,7 +793,7 @@ The exported CSV data can be imported to VictoriaMetrics via [/api/v1/import/csv Time series data can be imported via any supported ingestion protocol: * [Prometheus remote_write API](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write). See [these docs](#prometheus-setup) for details. -* Influx line protocol. See [these docs](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for details. +* InfluxDB line protocol. See [these docs](#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for details. * Graphite plaintext protocol. See [these docs](#how-to-send-data-from-graphite-compatible-agents-such-as-statsd) for details. * OpenTSDB telnet put protocol. See [these docs](#sending-data-via-telnet-put-protocol) for details. * OpenTSDB http `/api/put` protocol. See [these docs](#sending-opentsdb-data-via-http-apiput-requests) for details. @@ -1636,18 +1536,18 @@ Pass `-help` to VictoriaMetrics in order to see the list of supported command-li Comma-separated list of database names to return from /query and /influx/query API. This can be needed for accepting data from Telegraf plugins such as https://github.com/fangli/fluent-plugin-influxdb Supports an array of values separated by comma or specified via multiple flags. -influx.maxLineSize size - The maximum size in bytes for a single Influx line during parsing + The maximum size in bytes for a single InfluxDB line during parsing Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) -influxListenAddr string - TCP and UDP address to listen for Influx line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8428/write + TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8428/write -influxMeasurementFieldSeparator string - Separator for '{measurement}{separator}{field_name}' metric name when inserted via Influx line protocol (default "_") + Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol (default "_") -influxSkipMeasurement Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator' -influxSkipSingleField - Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if Influx line contains only a single field + Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field -influxTrimTimestamp duration - Trim timestamps for Influx line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) + Trim timestamps for InfluxDB line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) -insert.maxQueueDuration duration The maximum duration for waiting in the queue for insert requests due to -maxConcurrentInserts (default 1m0s) -logNewSeries diff --git a/docs/vmagent.md b/docs/vmagent.md index 7c9c3e83d..fcb994cd5 100644 --- a/docs/vmagent.md +++ b/docs/vmagent.md @@ -25,7 +25,7 @@ to `vmagent` such as the ability to push metrics instead of pulling them. We did See [Quick Start](#quick-start) for details. * Can add, remove and modify labels (aka tags) via Prometheus relabeling. Can filter data before sending it to remote storage. See [these docs](#relabeling) for details. * Accepts data via all ingestion protocols supported by VictoriaMetrics: - * Influx line protocol via `http://:8429/write`. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf). + * InfluxDB line protocol via `http://:8429/write`. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf). * Graphite plaintext protocol if `-graphiteListenAddr` command-line flag is set. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-graphite-compatible-agents-such-as-statsd). * OpenTSDB telnet and http protocols if `-opentsdbListenAddr` command-line flag is set. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-opentsdb-compatible-agents). * Prometheus remote write protocol via `http://:8429/api/v1/write`. @@ -57,13 +57,13 @@ Example command line: /path/to/vmagent -promscrape.config=/path/to/prometheus.yml -remoteWrite.url=https://victoria-metrics-host:8428/api/v1/write ``` -If you only need to collect Influx data, then the following command is sufficient: +If you only need to collect InfluxDB data, then the following command is sufficient: ``` /path/to/vmagent -remoteWrite.url=https://victoria-metrics-host:8428/api/v1/write ``` -Then send Influx data to `http://vmagent-host:8429`. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for more details. +Then send InfluxDB data to `http://vmagent-host:8429`. See [these docs](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-influxdb-compatible-agents-such-as-telegraf) for more details. `vmagent` is also available in [docker images](https://hub.docker.com/r/victoriametrics/vmagent/tags). @@ -645,18 +645,18 @@ See the docs at https://docs.victoriametrics.com/vmagent.html . Comma-separated list of database names to return from /query and /influx/query API. This can be needed for accepting data from Telegraf plugins such as https://github.com/fangli/fluent-plugin-influxdb Supports an array of values separated by comma or specified via multiple flags. -influx.maxLineSize size - The maximum size in bytes for a single Influx line during parsing + The maximum size in bytes for a single InfluxDB line during parsing Supports the following optional suffixes for size values: KB, MB, GB, KiB, MiB, GiB (default 262144) -influxListenAddr string - TCP and UDP address to listen for Influx line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8429/write + TCP and UDP address to listen for InfluxDB line protocol data. Usually :8189 must be set. Doesn't work if empty. This flag isn't needed when ingesting data over HTTP - just send it to http://:8429/write -influxMeasurementFieldSeparator string - Separator for '{measurement}{separator}{field_name}' metric name when inserted via Influx line protocol (default "_") + Separator for '{measurement}{separator}{field_name}' metric name when inserted via InfluxDB line protocol (default "_") -influxSkipMeasurement Uses '{field_name}' as a metric name while ignoring '{measurement}' and '-influxMeasurementFieldSeparator' -influxSkipSingleField - Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if Influx line contains only a single field + Uses '{measurement}' instead of '{measurement}{separator}{field_name}' for metic name if InfluxDB line contains only a single field -influxTrimTimestamp duration - Trim timestamps for Influx line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) + Trim timestamps for InfluxDB line protocol data to this duration. Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data (default 1ms) -insert.maxQueueDuration duration The maximum duration for waiting in the queue for insert requests due to -maxConcurrentInserts (default 1m0s) -loggerDisableTimestamps diff --git a/docs/vmctl.md b/docs/vmctl.md index de96ea1cb..49ba085fb 100644 --- a/docs/vmctl.md +++ b/docs/vmctl.md @@ -38,8 +38,8 @@ to the data source and common list of flags for destination (prefixed with `vm` ``` ./vmctl influx --help OPTIONS: - --influx-addr value Influx server addr (default: "http://localhost:8086") - --influx-user value Influx user [$INFLUX_USERNAME] + --influx-addr value InfluxDB server addr (default: "http://localhost:8086") + --influx-user value InfluxDB user [$INFLUX_USERNAME] ... --vm-addr vmctl VictoriaMetrics address to perform import requests. Should be the same as --httpListenAddr value for single-node version or vminsert component. @@ -220,16 +220,16 @@ Found 40000 timeseries to import. Continue? [Y/n] y ### Data mapping -Vmctl maps Influx data the same way as VictoriaMetrics does by using the following rules: +Vmctl maps InfluxDB data the same way as VictoriaMetrics does by using the following rules: -* `influx-database` arg is mapped into `db` label value unless `db` tag exists in the Influx line. +* `influx-database` arg is mapped into `db` label value unless `db` tag exists in the InfluxDB line. * Field names are mapped to time series names prefixed with {measurement}{separator} value, where {separator} equals to _ by default. It can be changed with `--influx-measurement-field-separator` command-line flag. * Field values are mapped to time series values. * Tags are mapped to Prometheus labels format as-is. -For example, the following Influx line: +For example, the following InfluxDB line: ``` foo,tag1=value1,tag2=value2 field1=12,field2=40 ``` @@ -298,7 +298,7 @@ if flags `--prom-filter-time-start` or `--prom-filter-time-end` were set. The ex Please note that stats are not taking into account timeseries or samples filtering. This will be done during importing process. The importing process takes the snapshot blocks revealed from Explore procedure and processes them one by one -accumulating timeseries and samples. Please note, that `vmctl` relies on responses from Influx on this stage, +accumulating timeseries and samples. Please note, that `vmctl` relies on responses from InfluxDB on this stage, so ensure that Explore queries are executed without errors or limits. Please see this [issue](https://github.com/VictoriaMetrics/vmctl/issues/30) for details. The data processed in chunks and then sent to VM. @@ -488,7 +488,7 @@ See more details for cluster version [here](https://github.com/VictoriaMetrics/V ## Tuning -### Influx mode +### InfluxDB mode The flag `--influx-concurrency` controls how many concurrent requests may be sent to InfluxDB while fetching timeseries. Please set it wisely to avoid InfluxDB overwhelming. diff --git a/lib/httpserver/httpserver.go b/lib/httpserver/httpserver.go index 512b8deb7..462191d4c 100644 --- a/lib/httpserver/httpserver.go +++ b/lib/httpserver/httpserver.go @@ -256,7 +256,7 @@ func handlerWrapper(s *server, w http.ResponseWriter, r *http.Request, rh Reques http.Error(w, errMsg, http.StatusServiceUnavailable) return case "/ping": - // This is needed for compatibility with Influx agents. + // This is needed for compatibility with InfluxDB agents. // See https://docs.influxdata.com/influxdb/v1.7/tools/api/#ping-http-endpoint status := http.StatusNoContent if verbose := r.FormValue("verbose"); verbose == "true" { diff --git a/lib/ingestserver/influx/server.go b/lib/ingestserver/influx/server.go index 8a14f2b90..8a412e239 100644 --- a/lib/ingestserver/influx/server.go +++ b/lib/ingestserver/influx/server.go @@ -24,7 +24,7 @@ var ( writeErrorsUDP = metrics.NewCounter(`vm_ingestserver_request_errors_total{type="influx", name="write", net="udp"}`) ) -// Server accepts Influx line protocol over TCP and UDP. +// Server accepts InfluxDB line protocol over TCP and UDP. type Server struct { addr string lnTCP net.Listener @@ -33,22 +33,22 @@ type Server struct { cm ingestserver.ConnsMap } -// MustStart starts Influx server on the given addr. +// MustStart starts InfluxDB server on the given addr. // // The incoming connections are processed with insertHandler. // // MustStop must be called on the returned server when it is no longer needed. func MustStart(addr string, insertHandler func(r io.Reader) error) *Server { - logger.Infof("starting TCP Influx server at %q", addr) + logger.Infof("starting TCP InfluxDB server at %q", addr) lnTCP, err := netutil.NewTCPListener("influx", addr) if err != nil { - logger.Fatalf("cannot start TCP Influx server at %q: %s", addr, err) + logger.Fatalf("cannot start TCP InfluxDB server at %q: %s", addr, err) } - logger.Infof("starting UDP Influx server at %q", addr) + logger.Infof("starting UDP InfluxDB server at %q", addr) lnUDP, err := net.ListenPacket(netutil.GetUDPNetwork(), addr) if err != nil { - logger.Fatalf("cannot start UDP Influx server at %q: %s", addr, err) + logger.Fatalf("cannot start UDP InfluxDB server at %q: %s", addr, err) } s := &Server{ @@ -61,30 +61,30 @@ func MustStart(addr string, insertHandler func(r io.Reader) error) *Server { go func() { defer s.wg.Done() s.serveTCP(insertHandler) - logger.Infof("stopped TCP Influx server at %q", addr) + logger.Infof("stopped TCP InfluxDB server at %q", addr) }() s.wg.Add(1) go func() { defer s.wg.Done() s.serveUDP(insertHandler) - logger.Infof("stopped UDP Influx server at %q", addr) + logger.Infof("stopped UDP InfluxDB server at %q", addr) }() return s } // MustStop stops the server. func (s *Server) MustStop() { - logger.Infof("stopping TCP Influx server at %q...", s.addr) + logger.Infof("stopping TCP InfluxDB server at %q...", s.addr) if err := s.lnTCP.Close(); err != nil { - logger.Errorf("cannot close TCP Influx server: %s", err) + logger.Errorf("cannot close TCP InfluxDB server: %s", err) } - logger.Infof("stopping UDP Influx server at %q...", s.addr) + logger.Infof("stopping UDP InfluxDB server at %q...", s.addr) if err := s.lnUDP.Close(); err != nil { - logger.Errorf("cannot close UDP Influx server: %s", err) + logger.Errorf("cannot close UDP InfluxDB server: %s", err) } s.cm.CloseAll() s.wg.Wait() - logger.Infof("TCP and UDP Influx servers at %q have been stopped", s.addr) + logger.Infof("TCP and UDP InfluxDB servers at %q have been stopped", s.addr) } func (s *Server) serveTCP(insertHandler func(r io.Reader) error) { @@ -102,9 +102,9 @@ func (s *Server) serveTCP(insertHandler func(r io.Reader) error) { if strings.Contains(err.Error(), "use of closed network connection") { break } - logger.Fatalf("unrecoverable error when accepting TCP Influx connections: %s", err) + logger.Fatalf("unrecoverable error when accepting TCP InfluxDB connections: %s", err) } - logger.Fatalf("unexpected error when accepting TCP Influx connections: %s", err) + logger.Fatalf("unexpected error when accepting TCP InfluxDB connections: %s", err) } if !s.cm.Add(c) { _ = c.Close() @@ -120,7 +120,7 @@ func (s *Server) serveTCP(insertHandler func(r io.Reader) error) { writeRequestsTCP.Inc() if err := insertHandler(c); err != nil { writeErrorsTCP.Inc() - logger.Errorf("error in TCP Influx conn %q<->%q: %s", c.LocalAddr(), c.RemoteAddr(), err) + logger.Errorf("error in TCP InfluxDB conn %q<->%q: %s", c.LocalAddr(), c.RemoteAddr(), err) } }() } @@ -153,14 +153,14 @@ func (s *Server) serveUDP(insertHandler func(r io.Reader) error) { break } } - logger.Errorf("cannot read Influx UDP data: %s", err) + logger.Errorf("cannot read InfluxDB UDP data: %s", err) continue } bb.B = bb.B[:n] writeRequestsUDP.Inc() if err := insertHandler(bb.NewReader()); err != nil { writeErrorsUDP.Inc() - logger.Errorf("error in UDP Influx conn %q<->%q: %s", s.lnUDP.LocalAddr(), addr, err) + logger.Errorf("error in UDP InfluxDB conn %q<->%q: %s", s.lnUDP.LocalAddr(), addr, err) continue } } diff --git a/lib/protoparser/influx/parser.go b/lib/protoparser/influx/parser.go index 0e8680697..07c7c8218 100644 --- a/lib/protoparser/influx/parser.go +++ b/lib/protoparser/influx/parser.go @@ -213,7 +213,7 @@ func unmarshalRow(dst []Row, s string, tagsPool []Tag, fieldsPool []Field, noEsc tagsPool, fieldsPool, err = r.unmarshal(s, tagsPool, fieldsPool, noEscapeChars) if err != nil { dst = dst[:len(dst)-1] - logger.Errorf("cannot unmarshal Influx line %q: %s; skipping it", s, err) + logger.Errorf("cannot unmarshal InfluxDB line %q: %s; skipping it", s, err) invalidLines.Inc() } return dst, tagsPool, fieldsPool @@ -312,7 +312,7 @@ func parseFieldValue(s string, hasQuotedFields bool) (float64, error) { if len(s) < 2 || s[len(s)-1] != '"' { return 0, fmt.Errorf("missing closing quote for quoted field value %s", s) } - // Try converting quoted string to number, since sometimes Influx agents + // Try converting quoted string to number, since sometimes InfluxDB agents // send numbers as strings. s = s[1 : len(s)-1] return fastfloat.ParseBestEffort(s), nil diff --git a/lib/protoparser/influx/streamparser.go b/lib/protoparser/influx/streamparser.go index c8479cbbc..7bc98a0fd 100644 --- a/lib/protoparser/influx/streamparser.go +++ b/lib/protoparser/influx/streamparser.go @@ -16,8 +16,8 @@ import ( ) var ( - maxLineSize = flagutil.NewBytes("influx.maxLineSize", 256*1024, "The maximum size in bytes for a single Influx line during parsing") - trimTimestamp = flag.Duration("influxTrimTimestamp", time.Millisecond, "Trim timestamps for Influx line protocol data to this duration. "+ + maxLineSize = flagutil.NewBytes("influx.maxLineSize", 256*1024, "The maximum size in bytes for a single InfluxDB line during parsing") + trimTimestamp = flag.Duration("influxTrimTimestamp", time.Millisecond, "Trim timestamps for InfluxDB line protocol data to this duration. "+ "Minimum practical duration is 1ms. Higher duration (i.e. 1s) may be used for reducing disk space usage for timestamp data") )