Documentation

InfluxDB 配置选项

通过使用 influxd 配置标志、自定义环境变量或在配置文件中定义配置选项来定制您的 InfluxDB 配置。

查看您的运行时服务器配置

使用 influx CLI 或 InfluxDB API 获取您的 InfluxDB 实例的运行时服务器配置。

服务器配置命令需要一个 Operator token

通过CLI查看您的服务器配置

使用influx server-config命令来检索您的运行时服务器配置。

influx server-config

通过API查看您的服务器配置

使用 /api/v2/config InfluxDB API 端点来检索您的运行时服务器配置。

GET http://localhost:8086/api/v2/config

配置优先级

InfluxDB 尊重配置设置的优先级如下:

  1. influxd 标志
  2. 环境变量
  3. 配置文件设置

InfluxDB 配置文件

influxd 启动时,它会检查当前工作目录中是否有名为 config.* 的文件。 文件扩展名取决于配置文件的语法。 InfluxDB 配置文件支持以下语法:

  • YAML (.yaml, .yml)
  • TOML (.toml)
  • JSON (.json)

要自定义配置文件的目录路径,请将 INFLUXD_CONFIG_PATH 环境变量设置为您自定义的路径。

export INFLUXD_CONFIG_PATH=/path/to/custom/config/directory

在启动时, influxd 将检查 INFLUXD_CONFIG_PATH 目录下的 config.* 文件。

示例配置文件
query-concurrency: 20
query-queue-size: 15
secret-store: vault
session-length: 120
tls-cert: /path/to/influxdb.crt
tls-key: /path/to/influxdb.key
query-concurrency = 20
query-queue-size = 15
secret-store = "vault"
session-length = 120
tls-cert = "/path/to/influxdb.crt"
tls-key = "/path/to/influxdb.key"
{
  "query-concurrency": 20,
  "query-queue-size": 15,
  "secret-store": "vault",
  "session-length": 120,
  "tls-cert": "/path/to/influxdb.crt",
  "tls-key": "/path/to/influxdb.key"
}

仅需要在配置文件中定义非默认设置。

配置选项

要配置 InfluxDB,在启动influxd服务时使用以下配置选项:


资产路径

通过从指定目录提供资产,覆盖默认的 InfluxDB 用户界面 (UI) 资产。通常仅用于 InfluxData 内部。

influxd 标志环境变量配置键
--assets-pathINFLUXD_ASSETS_PATHassets-path
influxd 标志
influxd --assets-path=/path/to/custom/assets-dir
环境变量
export INFLUXD_ASSETS_PATH=/path/to/custom/assets-dir
配置文件
assets-path: /path/to/custom/assets-dir
assets-path = "/path/to/custom/assets-dir"
{
  "assets-path": "/path/to/custom/assets-dir"
}

螺栓路径

BoltDB数据库的路径。 BoltDB是用Go编写的键值存储。 InfluxDB使用BoltDB来存储数据,包括组织和 用户信息、用户界面数据、REST资源以及其他键值数据。

默认: ~/.influxdbv2/influxd.bolt

influxd 标志环境变量配置键
--bolt-pathINFLUXD_BOLT_PATHbolt-path
influxd 标志
influxd --bolt-path=~/.influxdbv2/influxd.bolt
环境变量
export INFLUXD_BOLT_PATH=~/.influxdbv2/influxd.bolt
配置文件
bolt-path: ~/.influxdbv2/influxd.bolt
bolt-path = "~/.influxdbv2/influxd.bolt"
{
  "bolt-path": "~/.influxdbv2/influxd.bolt"
}

端到端测试

向InfluxDB HTTP API添加一个/debug/flush端点以清除存储。 InfluxData在端到端测试中使用此端点。

influxd 标志环境变量配置键
--e2e-testingINFLUXD_E2E_TESTINGe2e-testing
influxd 标志
influxd --e2e-testing
环境变量
export INFLUXD_E2E_TESTING=true
配置文件
e2e-testing: true
e2e-testing = true
{
  "e2e-testing": true
}

引擎路径

InfluxDB存储所有时间结构合并树(TSM)数据在磁盘上的持久存储引擎文件的路径。

默认: ~/.influxdbv2/engine

influxd 标志环境变量配置键
--engine-pathINFLUXD_ENGINE_PATHengine-path
influxd 标志
influxd --engine-path=~/.influxdbv2/engine
环境变量
export INFLUXD_ENGINE_PATH=~/.influxdbv2/engine
配置文件
engine-path: ~/.influxdbv2/engine
engine-path = "~/.influxdbv2/engine"
{
  "engine-path": "~/.influxdbv2/engine"
}

功能标志

启用、禁用或覆盖功能标志的默认值。

特性标志用于开发和测试实验性特性,旨在仅供内部使用。

influxd 标志环境变量配置键
--feature-flagsINFLUXD_FEATURE_FLAGSfeature-flags
influxd 标志
influxd --feature-flags flag1=value2,flag2=value2
环境变量
export INFLUXD_FEATURE_FLAGS="{\"flag1\":\value1\",\"flag2\":\"value2\"}"
配置文件
feature-flags:
  flag1: "value1"
  flag2: "value2"
[feature-flags]
  flag1 = "value1"
  glag2 = "value2"
{
  "feature-flags": {
    "flag1": "value1",
    "flag2": "value2"
  }
}

启用flux日志

包括显示Flux查询详细日志的选项,包括以下日志字段:

  • compiler_type: 处理查询所使用的编译器(将始终是 Flux)。
  • response_size: 响应的大小,以字节为单位。
  • query: 查询的文本表示。
  • err: 处理查询时遇到的错误。
  • stat_total_duration: 处理查询的总持续时间。
  • stat_compile_duration: 编译查询的持续时间。
  • stat_execute_duration: 执行查询的持续时间。
  • stat_max_allocated: 处理查询时分配的最大内存量,以字节为单位。
  • stat_total_allocated: 查询处理过程中分配的总内存量,以字节为单位。这包括被释放后再次使用的内存。

默认: false

influxd 标志环境变量配置键
--flux-log-enabledINFLUXD_FLUX_LOG_ENABLEDflux-log-enabled
influxd 标志
influxd --flux-log-enabled
环境变量
export INFLUXD_FLUX_LOG_ENABLED=true
配置文件
flux-log-enabled: true
flux-log-enabled = "true"
{
  "flux-log-enabled": "true"
}

启用加固

启用 附加安全功能 在 InfluxDB 中。默认: false

influxd 标志环境变量配置键
--hardening-enabledINFLUXD_HARDENING_ENABLED硬化启用
influxd 标志
influxd --hardening-enabled
环境变量
export INFLUXD_HARDENING_ENABLED=true
配置文件
hardening-enabled: true
hardening-enabled = true
{
  "hardening-enabled": true
}

http-绑定-地址

用于InfluxDB HTTP API的绑定地址。
自定义InfluxDB API和UI的URL和端口。

默认: :8086

influxd 标志环境变量配置键
--http-bind-addressINFLUXD_HTTP_BIND_ADDRESShttp-bind-address
influxd 标志
influxd --http-bind-address=:8086
环境变量
export INFLUXD_HTTP_BIND_ADDRESS=:8086
配置文件
http-bind-address: ":8086"
http-bind-address = ":8086"
{
  "http-bind-address": ":8086"
}

http-闲置超时

服务器在等待新请求时,应该保持已建立连接存活的最长时间。 设置为 0 表示没有超时。

默认: 3m0s

influxd 标志环境变量配置键
--http-idle-timeoutINFLUXD_HTTP_IDLE_TIMEOUThttp-idle-timeout
influxd 标志
influxd --http-idle-timeout=3m0s
环境变量
export INFLUXD_HTTP_IDLE_TIMEOUT=3m0s
配置文件
http-idle-timeout: 3m0s
http-idle-timeout = "3m0s"
{
  "http-idle-timeout": "3m0s"
}

http-读取头超时

服务器应尝试读取新请求的HTTP头的最大持续时间。 设置为 0 表示无限制。

默认: 10s

influxd 标志环境变量配置键
--http-read-header-timeoutINFLUXD_HTTP_READ_HEADER_TIMEOUThttp-read-header-timeout
influxd 标志
influxd --http-read-header-timeout=10s
环境变量
export INFLUXD_HTTP_READ_HEADER_TIMEOUT=10s
配置文件
http-read-header-timeout: 10s
http-read-header-timeout = "10s"
{
  "http-read-header-timeout": "10s"
}

HTTP读取超时

服务器尝试读取新请求的最大持续时间。 设置为 0 表示没有超时。

默认: 0

设置特定于您的工作负载的超时

虽然默认情况下没有设置 http-read-timeout,我们强烈建议根据您的工作负载设置特定的超时时间。HTTP 超时可以防止大量打开的连接可能对性能造成影响。

influxd 标志环境变量配置键
--http-read-timeoutINFLUXD_HTTP_READ_TIMEOUThttp-read-timeout
influxd 标志
influxd --http-read-timeout=10s
环境变量
export INFLUXD_HTTP_READ_TIMEOUT=10s
配置文件
http-read-timeout: 10s
http-read-timeout = "10s"
{
  "http-read-timeout": "10s"
}

http-写入超时

在响应写入超时之前最大等待时间。 它不允许处理程序决定每个请求的持续时间。

当读取新的请求头时,超时被重置。

设置为 0 表示没有超时。

默认: 0

为您的工作负载设置超时

虽然默认情况下没有设置 http-write-timeout,我们强烈建议根据您的工作负载设置超时。HTTP 超时可以防止大量打开的连接,这可能会影响性能。

influxd 标志环境变量配置键
--http-write-timeoutINFLUXD_HTTP_WRITE_TIMEOUThttp-write-timeout
influxd 标志
influxd --http-write-timeout=10s
环境变量
export INFLUXD_HTTP_WRITE_TIMEOUT=10s
配置文件
http-write-timeout: 10s
http-write-timeout = "10s"
{
  "http-write-timeout": "10s"
}

influxql-最大选择桶

一个 SELECT 语句可以创建的按时间分组的最大桶数量。0 允许创建无限数量的桶。

默认: 0

influxd 标志环境变量配置键
--influxql-max-select-bucketsINFLUXD_INFLUXQL_MAX_SELECT_BUCKETSinfluxql-max-select-buckets
influxd 标志
influxd --influxql-max-select-buckets=0
环境变量
export INFLUXD_INFLUXQL_MAX_SELECT_BUCKETS=0
配置文件
influxql-max-select-buckets: 0
influxql-max-select-buckets = 0
{
  "influxql-max-select-buckets": 0
}

influxql-最大选择点

一个 SELECT 语句可以处理的最大点数。0 允许无限数量的点。InfluxDB 每秒检查点数(所以超过最大值的查询不会立即中止)。

默认: 0

influxd 标志环境变量配置键
--influxql-max-select-pointINFLUXD_INFLUXQL_MAX_SELECT_POINTinfluxql-max-select-point
influxd 标志
influxd --influxql-max-select-point=0
环境变量
export INFLUXD_INFLUXQL_MAX_SELECT_POINT=0
配置文件
influxql-max-select-point: 0
influxql-max-select-point = 0
{
  "influxql-max-select-point": 0
}

influxql-最大选择系列

一个 SELECT 语句可以返回的最大系列数量。0 允许无限数量的系列。

默认: 0

influxd 标志环境变量配置键
--influxql-max-select-seriesINFLUXD_INFLUXQL_MAX_SELECT_SERIESinfluxql-max-select-series
influxd 标志
influxd --influxql-max-select-series=0
环境变量
export INFLUXD_INFLUXQL_MAX_SELECT_SERIES=0
配置文件
influxql-max-select-series: 0
influxql-max-select-series = 0
{
  "influxql-max-select-series": 0
}

实例 ID

在复制过程中识别边缘节点,并防止两个边缘节点写入相同的 measurement,tagset 时发生冲突。

influxd 标志环境变量配置键
--instance-idINFLUXD_INSTANCE_IDinstance-id
influxd 标志
influxd --instance-id=:8086
环境变量
export INFLUXD_INSTANCE_ID=:8086
配置文件
instance-id: ":8086"
instance-id = ":8086"
{
  "instance-id": ":8086"
}

日志级别

日志输出级别。 InfluxDB 输出的日志条目具有大于或等于指定级别的严重性级别。

选项: debug, info, error
默认: info

influxd 标志环境变量配置键
--log-levelINFLUXD_LOG_LEVEL日志级别
influxd 标志
influxd --log-level=info
环境变量
export INFLUXD_LOG_LEVEL=info
配置文件
log-level: info
log-level = "info"
{
  "log-level": "info"
}

指标禁用

禁用HTTP /metrics 端点,该端点公开了内部InfluxDB指标

默认: false

influxd 标志环境变量配置键
--metrics-disabledINFLUXD_METRICS_DISABLEDmetrics-disabled
influxd 标志
influxd --metrics-disabled
环境变量
export INFLUXD_METRICS_DISABLED=true
配置文件
metrics-disabled: true
metrics-disabled = true
{
  "metrics-disabled": true
}

nats-max-payload-bytes

nats-max-payload-bytesInfluxDB 2.2中已被弃用,不再具有任何效果。

在NATS消息有效负载中允许的最大字节数。

默认: 1048576

influxd 标志环境变量配置键
--nats-max-payload-bytesINFLUXD_NATS_MAX_PAYLOAD_BYTESnats-max-payload-bytes
influxd 标志
influxd --nats-max-payload-bytes=1048576
环境变量
export INFLUXD_NATS_MAX_PAYLOAD_BYTES=1048576
配置文件
nats-max-payload-bytes: 1048576
nats-max-payload-bytes = 1048576
{
  "nats-max-payload-bytes": 1048576
}

nats-port

nats-portInfluxDB 2.2 中已不再推荐使用,并且不再产生任何效果。

NATS 流媒体服务器的端口。 -1 选择一个随机端口。

默认: -1

influxd 标志环境变量配置键
--nats-portINFLUXD_NATS_PORTnats-port
influxd 标志
influxd --nats-port=-1
环境变量
export INFLUXD_NATS_PORT=-1
配置文件
nats-port: -1
nats-port = -1
{
  "nats-port": -1
}

无任务

禁用任务调度程序。 如果有问题的任务阻止 InfluxDB 启动,请使用此选项在不调度或执行任务的情况下启动 InfluxDB。

默认: false

influxd 标志环境变量配置键
--no-tasksINFLUXD_NO_TASKSno-tasks
influxd 标志
influxd --no-tasks
环境变量
export INFLUXD_NO_TASKS=true
配置文件
no-tasks: true
no-tasks = true
{
  "no-tasks": true
}

pprof禁用

禁用 /debug/pprof HTTP 端点。 此端点提供运行时分析数据,在调试时可能会很有帮助。

默认: false

influxd 标志环境变量配置键
--pprof-disabledINFLUXD_PPROF_DISABLEDpprof-disabled
influxd 标志
influxd --pprof-disabled
环境变量
export INFLUXD_PPROF_DISABLED=true
配置文件
pprof-disabled: true
pprof-disabled = true
{
  "pprof-disabled": true
}

查询并发

允许并发执行的查询数量。将其设置为 0 允许无限数量的并发查询。

默认: 0

influxd 标志环境变量配置键
--query-concurrencyINFLUXD_QUERY_CONCURRENCYquery-concurrency
influxd 标志
influxd --query-concurrency=10
环境变量
export INFLUXD_QUERY_CONCURRENCY=10
配置文件
query-concurrency: 10
query-concurrency = 10
{
  "query-concurrency": 10
}

查询初始内存字节数

为查询分配的初始内存字节。

默认: 等于 query-memory-bytes

influxd 标志环境变量配置键
--query-initial-memory-bytesINFLUXD_QUERY_INITIAL_MEMORY_BYTESquery-initial-memory-bytes
influxd 标志
influxd --query-initial-memory-bytes=10485760
环境变量
export INFLUXD_QUERY_INITIAL_MEMORY_BYTES=10485760
配置文件
query-initial-memory-bytes: 10485760
query-initial-memory-bytes = 10485760
{
  "query-initial-memory-bytes": 10485760
}

查询最大内存字节数

允许查询的最大内存字节总数。

默认: 等于 query-concurrency × query-memory-bytes

influxd 标志环境变量配置键
--query-max-memory-bytesINFLUXD_QUERY_MAX_MEMORY_BYTESquery-max-memory-bytes
influxd 标志
influxd --query-max-memory-bytes=104857600
环境变量
export INFLUXD_QUERY_MAX_MEMORY_BYTES=104857600
配置文件
query-max-memory-bytes: 104857600
query-max-memory-bytes = 104857600
{
  "query-max-memory-bytes": 104857600
}

查询内存字节

单个查询允许的最大内存字节数。

默认: 无限

必须大于或等于 query-initial-memory-bytes

influxd 标志环境变量配置键
--query-memory-bytesINFLUXD_QUERY_MEMORY_BYTESquery-memory-bytes
influxd 标志
influxd --query-memory-bytes=10485760
环境变量
export INFLUXD_QUERY_MEMORY_BYTES=10485760
配置文件
query-memory-bytes: 10485760
query-memory-bytes = 10485760
{
  "query-memory-bytes": 10485760
}

查询队列大小

执行队列中允许的最大查询数。当队列限制达到时,新查询会被拒绝。将其设置为 0 允许队列中有无限数量的查询。

默认: 0

influxd 标志环境变量配置键
--query-queue-sizeINFLUXD_QUERY_QUEUE_SIZEquery-queue-size
influxd 标志
influxd --query-queue-size=10
环境变量
export INFLUXD_QUERY_QUEUE_SIZE=10
配置文件
query-queue-size: 10
query-queue-size = 10
{
  "query-queue-size": 10
}

报告禁用

禁用向 InfluxData 发送遥测数据。
InfluxData 遥测 页面提供了有关收集了哪些数据以及 InfluxData 如何使用这些数据的信息。

默认: false

influxd 标志环境变量配置键
--reporting-disabledINFLUXD_REPORTING_DISABLEDreporting-disabled
influxd 标志
influxd --reporting-disabled
环境变量
export INFLUXD_REPORTING_DISABLED=true
配置文件
reporting-disabled: true
reporting-disabled = true
{
  "reporting-disabled": true
}

秘密存储

指定密码和令牌等秘密的数据存储。 将秘密存储在 InfluxDB 内部 BoltDB 或者 Vault 中。

选项: bolt, vault
默认: bolt

influxd 标志环境变量配置键
--secret-storeINFLUXD_SECRET_STOREsecret-store
influxd 标志
influxd --secret-store=bolt
环境变量
export INFLUXD_SECRET_STORE=bolt
配置文件
secret-store: bolt
secret-store = "bolt"
{
  "secret-store": "bolt"
}

会话长度

指定新创建用户会话的生存时间 (TTL) 以分钟为单位

默认: 60

influxd 标志环境变量配置键
--session-lengthINFLUXD_SESSION_LENGTHsession-length
influxd 标志
influxd --session-length=60
环境变量
export INFLUXD_SESSION_LENGTH=60
配置文件
session-length: 60
session-length = 60
{
  "session-length": 60
}

会话续订禁用

禁用在每次请求时自动延长用户会话TTL。 默认情况下,每个请求将会话的过期时间设置为从现在起五分钟。 当禁用时,会话在指定的 会话时长 之后过期,即使用户最近活跃也会被重定向到登录页面。

默认: false

influxd 标志环境变量配置键
--session-renew-disabledINFLUXD_SESSION_RENEW_DISABLEDsession-renew-disabled
influxd 标志
influxd --session-renew-disabled
环境变量
export INFLUXD_SESSION_RENEW_DISABLED=true
配置文件
session-renew-disabled: true
session-renew-disabled = true
{
  "session-renew-disabled": true
}

sqlite-路径

SQLite数据库文件的路径。 SQLite数据库用于存储笔记本和注释的元数据。

默认: influxd.sqlite 在与 bolt-path 相同的目录中。

influxd 标志环境变量配置键
--sqlite-pathINFLUXD_SQLITE_PATHsqlite-path
influxd 标志
influxd --sqlite-path ~/.influxdbv2/influxd.sqlite
环境变量
export INFLUXD_SQLITE_PATH=~/.influxdbv2/influxd.sqlite
配置文件
sqlite-path: ~/.influxdbv2/influxd.sqlite
sqlite-path = "~/.influxdbv2/influxd.sqlite"
{
  "sqlite-path": "~/.influxdbv2/influxd.sqlite"
}

存储缓存最大内存大小

分片缓存可以达到的最大大小(以字节为单位),超过该大小后将开始拒绝写入。

默认: 1073741824

influxd 标志环境变量配置键
--storage-cache-max-memory-sizeINFLUXD_STORAGE_CACHE_MAX_MEMORY_SIZEstorage-cache-max-memory-size
influxd 标志
influxd --storage-cache-max-memory-size=1073741824
环境变量
export INFLUXD_STORAGE_CACHE_MAX_MEMORY_SIZE=1073741824
配置文件
storage-cache-max-memory-size: 1073741824
storage-cache-max-memory-size = 1073741824
{
  "storage-cache-max-memory-size": 1073741824
}

存储-缓存-快照-内存-大小

存储引擎将在此大小(以字节为单位)对缓存进行快照并将其写入TSM文件,以释放更多内存。

默认: 26214400)

influxd 标志环境变量配置键
--storage-cache-snapshot-memory-sizeINFLUXD_STORAGE_CACHE_SNAPSHOT_MEMORY_SIZEstorage-cache-snapshot-memory-size
influxd 标志
influxd --storage-cache-snapshot-memory-size=26214400
环境变量
export INFLUXD_STORAGE_CACHE_SNAPSHOT_MEMORY_SIZE=26214400
配置文件
storage-cache-snapshot-memory-size: 26214400
storage-cache-snapshot-memory-size = 26214400
{
  "storage-cache-snapshot-memory-size": 26214400
}

存储-缓存-快照-写入-冷却-持续时间

如果分片没有接收到写入或删除操作,存储引擎将在此持续时间内快照缓存并将其写入新的TSM文件。

默认: 10m0s

influxd 标志环境变量配置键
--storage-cache-snapshot-write-cold-durationINFLUXD_STORAGE_CACHE_SNAPSHOT_WRITE_COLD_DURATIONstorage-cache-snapshot-write-cold-duration
influxd 标志
influxd --storage-cache-snapshot-write-cold-duration=10m0s
环境变量
export INFLUXD_STORAGE_CACHE_SNAPSHOT_WRITE_COLD_DURATION=10m0s
配置文件
storage-cache-snapshot-write-cold-duration: 10m0s
storage-cache-snapshot-write-cold-duration = "10m0s"
{
  "storage-cache-snapshot-write-cold-duration": "10m0s"
}

存储-压缩-完整-写入-冷却-持续时间

在未收到写入或删除操作的情况下,存储引擎将在此持续时间内对分片中的所有TSM文件进行压缩。

默认: 4h0m0s

influxd 标志环境变量配置键
--storage-compact-full-write-cold-durationINFLUXD_STORAGE_COMPACT_FULL_WRITE_COLD_DURATIONstorage-compact-full-write-cold-duration
influxd 标志
influxd --storage-compact-full-write-cold-duration=4h0m0s
环境变量
export INFLUXD_STORAGE_COMPACT_FULL_WRITE_COLD_DURATION=4h0m0s
配置文件
storage-compact-full-write-cold-duration: 4h0m0s
storage-compact-full-write-cold-duration = "4h0m0s"
{
  "storage-compact-full-write-cold-duration": "4h0m0s"
}

存储-压缩-吞吐量-突发

TSM压缩可以写入磁盘的速率限制(以每秒字节为单位)。

默认: 50331648

influxd 标志环境变量配置键
--storage-compact-throughput-burstINFLUXD_STORAGE_COMPACT_THROUGHPUT_BURSTstorage-compact-throughput-burst
influxd 标志
influxd --storage-compact-throughput-burst=50331648
环境变量
export INFLUXD_STORAGE_COMPACT_THROUGHPUT_BURST=50331648
配置文件
storage-compact-throughput-burst: 50331648
storage-compact-throughput-burst = 50331648
{
  "storage-compact-throughput-burst": 50331648
}

存储最大并发压缩

可以同时运行的完整和级别压缩的最大数量。 值为 0 时,运行时使用 runtime.GOMAXPROCS(0) 的 50%。 任何大于零的数字将压缩限制为该值。 此设置不适用于缓存快照。

默认: 0

influxd 标志环境变量配置键
--storage-max-concurrent-compactionsINFLUXD_STORAGE_MAX_CONCURRENT_COMPACTIONSstorage-max-concurrent-compactions
influxd 标志
influxd --storage-max-concurrent-compactions=0
环境变量
export INFLUXD_STORAGE_MAX_CONCURRENT_COMPACTIONS=0
配置文件
storage-max-concurrent-compactions: 0
storage-max-concurrent-compactions = 0
{
  "storage-max-concurrent-compactions": 0
}

存储最大索引日志文件大小

索引预写日志 (WAL) 文件压缩成索引文件时的大小(以字节为单位)。较小的大小会导致日志文件更快地被压缩,并在牺牲写入吞吐量的情况下减少堆使用。

默认: 1048576

influxd 标志环境变量配置键
--storage-max-index-log-file-sizeINFLUXD_STORAGE_MAX_INDEX_LOG_FILE_SIZEstorage-max-index-log-file-size
influxd 标志
influxd --storage-max-index-log-file-size=1048576
环境变量
export INFLUXD_STORAGE_MAX_INDEX_LOG_FILE_SIZE=1048576
配置文件
storage-max-index-log-file-size: 1048576
storage-max-index-log-file-size = 1048576
{
  "storage-max-index-log-file-size": 1048576
}

存储-不验证字段大小

跳过对传入写请求的字段大小验证。

默认: false

influxd 标志环境变量配置键
--storage-no-validate-field-sizeINFLUXD_STORAGE_NO_VALIDATE_FIELD_SIZEstorage-no-validate-field-size
influxd 标志
influxd --storage-no-validate-field-size
环境变量
export INFLUXD_STORAGE_NO_VALIDATE_FIELD_SIZE=true
配置文件
storage-no-validate-field-size: true
storage-no-validate-field-size = true
{
  "storage-no-validate-field-size": true
}

存储保留检查间隔

保留策略执行检查的间隔。

默认: 30m0s

influxd 标志环境变量配置键
--storage-retention-check-intervalINFLUXD_STORAGE_RETENTION_CHECK_INTERVALstorage-retention-check-interval
influxd 标志
influxd --storage-retention-check-interval=30m0s
环境变量
export INFLUXD_STORAGE_RETENTION_CHECK_INTERVAL=30m0s
配置文件
storage-retention-check-interval: 30m0s
storage-retention-check-interval = "30m0s"
{
  "storage-retention-check-interval": "30m0s"
}

存储系列文件最大并发快照压缩

数据库中可以并发运行的快照压缩的最大数量。

默认: 0

influxd 标志环境变量配置键
--storage-series-file-max-concurrent-snapshot-compactionsINFLUXD_STORAGE_SERIES_FILE_MAX_CONCURRENT_SNAPSHOT_COMPACTIONSstorage-series-file-max-concurrent-snapshot-compactions
influxd 标志
influxd --storage-series-file-max-concurrent-snapshot-compactions=0
环境变量
export INFLUXD_STORAGE_SERIES_FILE_MAX_CONCURRENT_SNAPSHOT_COMPACTIONS=0
配置文件
storage-series-file-max-concurrent-snapshot-compactions: 0
storage-series-file-max-concurrent-snapshot-compactions = 0
{
  "storage-series-file-max-concurrent-snapshot-compactions": 0
}

存储系列 ID 设置缓存大小

用于存储先前计算的系列结果的TSI索引中使用的内部缓存的大小。 缓存结果会被快速返回,而无需在执行具有相同标签键/值谓词的后续查询时重新计算。 将此值设置为 0 将禁用缓存,并可能降低查询性能。

默认: 100

仅当数据库中所有测量的常用标签键/值谓词的集合大于100时,才应增加该值。增加缓存大小可能导致堆使用量增加。

influxd 标志环境变量配置键
--storage-series-id-set-cache-sizeINFLUXD_STORAGE_SERIES_ID_SET_CACHE_SIZEstorage-series-id-set-cache-size
influxd 标志
influxd --storage-series-id-set-cache-size=100
环境变量
export INFLUXD_STORAGE_SERIES_ID_SET_CACHE_SIZE=100
配置文件
storage-series-id-set-cache-size: 100
storage-series-id-set-cache-size = 100
{
  "storage-series-id-set-cache-size": 100
}

存储分片预创建高级周期

继承分片组创建之前的时间。

默认: 30m0s

influxd 标志环境变量配置键
--storage-shard-precreator-advance-periodINFLUXD_STORAGE_SHARD_PRECREATOR_ADVANCE_PERIODstorage-shard-precreator-advance-period
influxd 标志
influxd --storage-shard-precreator-advance-period=30m0s
环境变量
export INFLUXD_STORAGE_SHARD_PRECREATOR_ADVANCE_PERIOD=30m0s
配置文件
storage-shard-precreator-advance-period: 30m0s
storage-shard-precreator-advance-period = "30m0s"
{
  "storage-shard-precreator-advance-period": "30m0s"
}

存储-分片-预创建-检查-间隔

预创建新分片检查的间隔。

默认: 10m0s

influxd 标志环境变量配置键
--storage-shard-precreator-check-intervalINFLUXD_STORAGE_SHARD_PRECREATOR_CHECK_INTERVALstorage-shard-precreator-check-interval
influxd 标志
influxd --storage-shard-precreator-check-interval=10m0s
环境变量
export INFLUXD_STORAGE_SHARD_PRECREATOR_CHECK_INTERVAL=10m0s
配置文件
storage-shard-precreator-check-interval: 10m0s
storage-shard-precreator-check-interval = "10m0s"
{
  "storage-shard-precreator-check-interval": "10m0s"
}

存储-tsm-使用-madv-需要

通知内核 InfluxDB 打算分页 mmap 的 TSM 文件部分。

默认: false

influxd 标志环境变量配置键
--storage-tsm-use-madv-willneedINFLUXD_STORAGE_TSM_USE_MADV_WILLNEEDstorage-tsm-use-madv-willneed
influxd 标志
influxd --storage-tsm-use-madv-willneed
环境变量
export INFLUXD_STORAGE_TSM_USE_MADV_WILLNEED=true
配置文件
storage-tsm-use-madv-willneed: true
storage-tsm-use-madv-willneed = true
{
  "storage-tsm-use-madv-willneed": true
}

存储验证键

验证传入的写入,以确保键仅包含有效的unicode字符。

默认: false

influxd 标志环境变量配置键
--storage-validate-keysINFLUXD_STORAGE_VALIDATE_KEYSstorage-validate-keys
influxd 标志
influxd --storage-validate-keys
环境变量
export INFLUXD_STORAGE_VALIDATE_KEYS=true
配置文件
storage-validate-keys: true
storage-validate-keys = true
{
  "storage-validate-keys": true
}

存储-wal-同步延迟

写入将在fsync之前等待的持续时间。 大于 0 的持续时间会将多个fsync调用批处理。 这对于较慢的磁盘或存在WAL写入争用时很有用。

默认: 0s

influxd 标志环境变量配置键
--storage-wal-fsync-delayINFLUXD_STORAGE_WAL_FSYNC_DELAYstorage-wal-fsync-delay
influxd 标志
influxd --storage-wal-fsync-delay=0s
环境变量
export INFLUXD_STORAGE_WAL_FSYNC_DELAY=0s
配置文件
storage-wal-fsync-delay: 0s
storage-wal-fsync-delay = "0s"
{
  "storage-wal-fsync-delay": "0s"
}

存储-wal-最大并发写入

同时尝试写入WAL目录的最大数量。

默认: 0 (可用处理单元数 × 2)

influxd 标志环境变量配置键
--storage-wal-max-concurrent-writesINFLUXD_STORAGE_WAL_MAX_CONCURRENT_WRITESstorage-wal-max-concurrent-writes
influxd 标志
influxd --storage-wal-max-concurrent-writes=0
环境变量
export INFLUXD_STORAGE_WAL_MAX_CONCURRENT_WRITES=0
配置文件
storage-wal-max-concurrent-writes: 0
storage-wal-max-concurrent-writes = 0
{
  "storage-wal-max-concurrent-writes": 0
}

存储-wal-最大写延迟

写请求在达到WAL目录的最大并发活动写入数量时,最多等待的时间。设置为0以禁用超时。

默认: 10m

influxd 标志环境变量配置键
--storage-wal-max-write-delayINFLUXD_STORAGE_WAL_MAX_WRITE_DELAYstorage-wal-max-write-delay
influxd 标志
influxd --storage-wal-max-write-delay=10m
环境变量
export INFLUXD_STORAGE_WAL_MAX_WRITE_DELAY=10m
配置文件
storage-wal-max-write-delay: 10m
storage-wal-max-write-delay = "10m"
{
  "storage-wal-max-write-delay": "10m"
}

存储写入超时

存储引擎在超时之前处理写请求的最大时间。

默认: 10s

influxd 标志环境变量配置键
--storage-write-timeoutINFLUXD_STORAGE_WRITE_TIMEOUTstorage-write-timeout
influxd 标志
influxd --storage-write-timeout=10s
环境变量
export INFLUXD_STORAGE_WRITE_TIMEOUT=10s
配置文件
storage-write-timeout: 10s
storage-write-timeout = "10s"
{
  "storage-write-timeout": "10s"
}

商店

指定REST资源的数据存储。

选项: disk, memory
默认: disk

为了向后兼容,此标志还接受 bolt 作为值。当使用 disk 时,REST 资源使用 bolt-pathsqlite-path 存储在磁盘上。

memory 是用于瞬态环境的,例如测试环境,在这些环境中数据持久性并不重要。InfluxData 不推荐在生产环境中使用 memory

influxd 标志环境变量配置键
--storeINFLUXD_STORE存储
influxd 标志
influxd --store=bolt
环境变量
export INFLUXD_STORE=bolt
配置文件
store: bolt
store = "bolt"
{
  "store": "bolt"
}

强密码

要求密码至少包含八个字符,并且至少包括以下四个字符类中的三个:

  • 大写字母 (A-Z)
  • 小写字母 (a-z)
  • 数字 (0-9)
  • 特殊字符 (!@#$%^&*()_+)
influxd 标志环境变量配置键
--strong-passwordsINFLUXD_STRONG_PASSWORDSstrong-passwords
influxd 标志
influxd --strong-passwords
环境变量
export INFLUXD_STRONG_PASSWORDS=true
配置文件
strong-passwords: true
strong-passwords = true
{
  "strong-passwords": true
}

测试-始终允许设置

确保 /api/v2/setup 端点始终返回 true 以允许入门。 此配置选项主要用于持续集成测试。

默认: false

influxd 标志环境变量配置键
--始终允许设置测试INFLUXD_TESTING_ALWAYS_ALLOW_SETUPtesting-always-allow-setup
influxd 标志
influxd --testing-always-allow-setup
环境变量
export INFLUXD_TESTING_ALWAYS_ALLOW_SETUP=true
配置文件
testing-always-allow-setup: true
testing-always-allow-setup = true
{
  "testing-always-allow-setup": true
}

tls证书

TLS证书文件的路径。
需要设置tls-key

如需更多信息,请参阅 启用TLS加密

influxd 标志环境变量配置键
--tls-certINFLUXD_TLS_CERTtls-cert
influxd 标志
influxd --tls-cert=/path/to/influxdb.crt
环境变量
export INFLUXD_TLS_CERT=/path/to/influxdb.crt
配置文件
tls-cert: /path/to/influxdb.crt
tls-cert = "/path/to/influxdb.crt"
{
  "tls-cert": "/path/to/influxdb.crt"
}

tls-密钥

TLS密钥文件的路径。
需要设置tls-cert

有关更多信息,请参见 启用TLS加密

influxd 标志环境变量配置键
--tls-keyINFLUXD_TLS_KEYtls-key
influxd 标志
influxd --tls-key=/path/to/influxdb.key
环境变量
export INFLUXD_TLS_KEY=/path/to/influxdb.key
配置文件
tls-key: /path/to/influxdb.key
tls-key = "/path/to/influxdb.key"
{
  "tls-key": "/path/to/influxdb.key"
}

tls-min-version

接受的最低TLS版本。

默认: 1.2

influxd 标志环境变量配置键
--tls-min-versionINFLUXD_TLS_MIN_VERSIONtls-min-version
influxd 标志
influxd --tls-min-version=1.2
环境变量
export INFLUXD_TLS_MIN_VERSION=1.2
配置文件
tls-min-version: "1.2"
tls-min-version = "1.2"
{
  "tls-min-version": "1.2"
}

严格的 TLS 密钥交换算法

限制接受的 TLS 密钥交换协议为:

  • ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
  • ECDHE_RSA_WITH_AES_128_GCM_SHA256
  • ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
  • ECDHE_RSA_WITH_AES_256_GCM_SHA384
  • ECDHE_ECDSA_WITH_CHACHA20_POLY1305
  • ECDHE_RSA_WITH_CHACHA20_POLY1305

默认: false

influxd 标志环境变量配置键
--tls-strict-ciphersINFLUXD_TLS_STRICT_CIPHERStls-strict-ciphers
influxd 标志
influxd --tls-strict-ciphers
环境变量
export INFLUXD_TLS_STRICT_CIPHERS=true
配置文件
tls-strict-ciphers: true
tls-strict-ciphers = true
{
  "tls-strict-ciphers": true
}

跟踪类型

启用InfluxDB中的追踪并指定追踪类型。追踪默认为禁用。

选项: log, jaeger

influxd 标志环境变量配置键
--tracing-typeINFLUXD_TRACING_TYPEtracing-type
influxd 标志
influxd --tracing-type=log
环境变量
export INFLUXD_TRACING_TYPE=log
配置文件
tracing-type: log
tracing-type = "log"
{
  "tracing-type": "log"
}

用户界面禁用

禁用 InfluxDB 用户界面 (UI)。
用户界面默认启用。

默认: false

influxd 标志环境变量配置键
--ui-disabledINFLUXD_UI_DISABLEDui-disabled
influxd 标志
influxd --ui-disabled
环境变量
export INFLUXD_UI_DISABLED=true
配置文件
ui-disabled: true
ui-disabled = true
{
  "ui-disabled": true
}

密钥库地址

指定Vault服务器的地址,以URL和端口的形式表示。
例如: https://127.0.0.1:8200/

influxd 标志环境变量配置键
--vault-addrVAULT_ADDRvault-addr
influxd 标志
influxd --vault-addr=https://127.0.0.1:8200/
环境变量
export VAULT_ADDR=https://127.0.0.1:8200/
配置文件
vault-addr: https://127.0.0.1:8200/
vault-addr = "https://127.0.0.1:8200/"
{
  "vault-addr": "https://127.0.0.1:8200/"
}

vault-cacert

指定本地磁盘上PEM编码的CA证书文件路径。 该文件用于验证Vault服务器的SSL证书。 此设置优先于--vault-capath设置。

influxd 标志环境变量配置键
--vault-cacertVAULT_CACERTvault-cacert
influxd 标志
influxd  --vault-cacert=/path/to/ca.pem
环境变量
export VAULT_CACERT=/path/to/ca.pem
配置文件
vault-cacert: /path/to/ca.pem
vault-cacert = "/path/to/ca.pem"
{
  "vault-cacert": "/path/to/ca.pem"
}

保险库-证书路径

指定本地磁盘上PEM编码的CA证书文件目录的路径。这些证书用于验证Vault服务器的SSL证书。

influxd 标志环境变量配置键
--vault-capathVAULT_CAPATHvault-capath
influxd 标志
influxd --vault-capath=/path/to/certs/
环境变量
export VAULT_CAPATH=/path/to/certs/
配置文件
vault-capath: /path/to/certs/
vault-capath = "/path/to/certs/"
{
  "vault-capath": "/path/to/certs/"
}

保险库客户端证书

指定本地磁盘上PEM编码的客户端证书的路径。 此文件用于与Vault服务器进行TLS通信。

influxd 标志环境变量配置键
--vault-client-certVAULT_CLIENT_CERTvault-client-cert
influxd 标志
influxd --vault-client-cert=/path/to/client_cert.pem
环境变量
export VAULT_CLIENT_CERT=/path/to/client_cert.pem
配置文件
vault-client-cert: /path/to/client_cert.pem
vault-client-cert = "/path/to/client_cert.pem"
{
  "vault-client-cert": "/path/to/client_cert.pem"
}

保管库客户端密钥

指定磁盘上未加密的PEM编码私钥的路径,该私钥与匹配的客户端证书相对应。

influxd 标志环境变量配置键
--vault-client-keyVAULT_CLIENT_KEYvault-client-key
influxd 标志
influxd --vault-client-key=/path/to/private_key.pem
环境变量
export VAULT_CLIENT_KEY=/path/to/private_key.pem
配置文件
vault-client-key: /path/to/private_key.pem
vault-client-key = "/path/to/private_key.pem"
{
  "vault-client-key": "/path/to/private_key.pem"
}

最大重试次数

指定在遇到5xx错误代码时的最大重试次数。 默认值为2(总共三次尝试)。将此设置为0或更少以禁用重试。

默认: 2

influxd 标志环境变量配置键
--vault-max-retriesVAULT_MAX_RETRIESvault-max-retries
influxd 标志
influxd --vault-max-retries=2
环境变量
export VAULT_MAX_RETRIES=2
配置文件
vault-max-retries: 2
vault-max-retries = 2
{
  "vault-max-retries": 2
}

保险库客户端超时

指定Vault客户端超时时间。

默认: 60s

influxd 标志环境变量配置键
--vault-client-timeoutVAULT_CLIENT_TIMEOUTvault-client-timeout
influxd 标志
influxd --vault-client-timeout=60s
环境变量
export VAULT_CLIENT_TIMEOUT=60s
配置文件
vault-client-timeout: 60s
vault-client-timeout = "60s"
{
  "vault-client-timeout": "60s"
}

跳过验证

在与Vault通信时跳过证书验证。 设置此变量将使Vault的安全模型无效, 并且不推荐

默认: false

influxd 标志环境变量配置键
--vault-skip-verifyVAULT_SKIP_VERIFYvault-skip-verify
influxd 标志
influxd --vault-skip-verify
环境变量
export VAULT_SKIP_VERIFY=true
配置文件
vault-skip-verify: true
vault-skip-verify = true
{
  "vault-skip-verify": true
}

vault-tls-服务器名称

指定在通过TLS连接时作为服务器名称指示(SNI)主机使用的名称。

influxd 标志环境变量配置键
--vault-tls-server-nameVAULT_TLS_SERVER_NAMEvault-tls-server-name
influxd 标志
influxd --vault-tls-server-name=secure.example.com
环境变量
export VAULT_TLS_SERVER_NAME=secure.example.com
配置文件
vault-tls-server-name: secure.example.com
vault-tls-server-name = "secure.example.com"
{
  "vault-tls-server-name": "secure.example.com"
}

密钥库令牌

指定使用的Vault令牌,以便与Vault进行身份验证。

influxd 标志环境变量配置键
--vault-tokenVAULT_TOKENvault-token
influxd 标志
influxd --vault-token=exAmple-t0ken-958a-f490-c7fd0eda5e9e
环境变量
export VAULT_TOKEN=exAmple-t0ken-958a-f490-c7fd0eda5e9e
配置文件
vault-token: exAmple-t0ken-958a-f490-c7fd0eda5e9e
vault-token = "exAmple-t0ken-958a-f490-c7fd0eda5e9e"
{
  "vault-token": "exAmple-t0ken-958a-f490-c7fd0eda5e9e"
}


Flux的未来

Flux 正在进入维护模式。您可以像现在一样继续使用它,而无需对您的代码进行任何更改。

阅读更多

InfluxDB 3 开源版本现已公开Alpha测试

InfluxDB 3 Open Source is now available for alpha testing, licensed under MIT or Apache 2 licensing.

我们将发布两个产品作为测试版的一部分。

InfluxDB 3 核心,是我们新的开源产品。 它是一个用于时间序列和事件数据的实时数据引擎。 InfluxDB 3 企业版是建立在核心基础之上的商业版本,增加了历史查询能力、读取副本、高可用性、可扩展性和细粒度安全性。

有关如何开始的更多信息,请查看: