GuanceDB 引擎部署¶
注意
本文介绍如何部署 GuanceDB for Metrics 组件和 GuanceDB for Logs 组件。2 个组件部署均使用一个 Charts。
架构图¶
- GuanceDB chart 包含 GuanceDB for Metrics 组件和 GuanceDB for Logs 两个 组件,这两个组件共享 guance-insert 和 guance-select 服务,提供统一的写入和查询接口。
- 部署 GuanceDB for Metrics 组件会部署 GuanceDB for Metrics Storage
核心组件¶
1.写入负载均衡器 (guance-insert)
- 负责接收原始数据
- 通过一致性哈希算法将数据分发到存储节点
- 支持高可用部署
2.查询引擎 (guance-select)
- 支持 DQL 和 PromQL 查询语言
- 从所有存储节点获取数据并计算
- 返回最终查询结果
3.存储节点 (guance-storage)
- 采用 share nothing 架构
- 节点间无通信,无中心协调
- 支持水平扩展
前提条件¶
- Helm 版本要求:3.7+
- 确保存储性能满足需求
- 建议预留足够的系统资源
部署默认配置信息¶
服务名称 | 地址 | 端口 |
---|---|---|
guance-insert | guance-insert.guancedb | 8480 |
guance-select | guance-select.guancedb | 8481 |
容量规划¶
1.内存预留
- 所有组件至少预留 50% 内存
- 用于应对突发写入,避免 OOM
2.CPU 预留
- 所有组件至少预留 50% CPU
- 避免突发写入导致的慢写入和慢查询
3.存储空间预留
- guance-storage 节点预留 20% 存储空间
- 可通过
-storage.minFreeDiskSpaceBytes
参数配置
参考配置¶
以 100w 时间线为例(每 10s 写入一次,实时写入 QPS 10w/s,查询 QPS 100,数据保存 1 个月):
组件 | CPU | 内存 | 磁盘 |
---|---|---|---|
guance-insert | 4c | 4G | - |
guance-select | 8c | 8G | - |
guance-storage | 16c | 96G | 500G |
注:实际部署时可根据时间线数量线性调整资源规模。各组件默认支持 2 个实例。
GuanceDB 部署¶
注意
GuanceDB for Metrics 和 GuanceDB for Logs 部署有先后关系,你可先部署 GuanceDB for Metrics,待 Doris 部署完成,可以配置 Doris 信息,安装 GuanceDB for Logs。如果只想部署 GuanceDB for Logs 组件,可设置 guance_storage.enabled=false
。
存储类设置¶
OpenEBS 参考文档:OpenEBS 部署
如果使用共有云,请参考共有云存储块组件
部署以下 yaml 配置:
apiVersion: storage.k8s.io/v1
allowVolumeExpansion: true
kind: StorageClass
metadata:
annotations:
cas.openebs.io/config: |
- name: StorageType
value: "hostpath"
- name: BasePath
value: "/data"
name: guancedb-cs
provisioner: openebs.io/local
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
/data
目录请确保磁盘容量足够。
部署以下 yaml 配置:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: guancedb-cs
provisioner: diskplugin.csi.alibabacloud.com
parameters:
type: cloud_auto
fstype: ext4
# diskTags: "a:b,b:c"
encrypted: "false"
performanceLevel: PL1 # 通过云盒使用时,需设置为PL0。
provisionedIops: "40000"
burstingEnabled: "false"
volumeBindingMode: WaitForFirstConsumer
reclaimPolicy: Retain
allowVolumeExpansion: true
部署以下 yaml 配置:
---
allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: guancedb-cs
parameters:
csi.storage.k8s.io/csi-driver-name: disk.csi.everest.io
csi.storage.k8s.io/fstype: ext4
everest.io/disk-volume-type: SSD ## 修改磁盘类型
everest.io/passthrough: "true"
provisioner: everest-csi-provisioner
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer
下载 Chart¶
下载 chart 包:
--untar 为不压缩,默认是压缩
配置安装 GuanceDB for Metrics¶
1.配置 GuanceDB for Metrics
进入 guancedb 目录,修改 values.yaml
# 修改全局存储类
global:
storageClass: 'guancedb-cs'
# 关闭 scopedb 开关
scopedb:
enabled: false
guance_select:
...
# 服务副本数
replicaCount: 2
image:
# 如果离线环境修改镜像地址,没有对应需求可以不修改
repository: pubrepo.guance.com/guancedb/guance-select
# 修改 nodeSelector 和 tolerations 来调度 guance-select 容器,没有对应需求可以不修改
nodeSelector: {}
tolerations:
[]
# - key: "key"
# operator: "Equal|Exists"
# value: "value"
# effect: "NoSchedule|PreferNoSchedule"
guance_insert:
...
# 服务副本数
replicaCount: 2
image:
# 如果离线环境修改镜像地址,没有对应需求可以不修改
repository: pubrepo.guance.com/guancedb/guance-insert
# 修改 nodeSelector 和 tolerations 来调度 guance-insert 容器,没有对应需求可以不修改
nodeSelector: {}
tolerations:
[]
# - key: "key"
# operator: "Equal|Exists"
# value: "value"
# effect: "NoSchedule|PreferNoSchedule"
guance_storage:
...
# 服务副本数
replicaCount: 2
image:
# 如果离线环境修改镜像地址,没有对应需求可以不修改
repository: pubrepo.guance.com/guancedb/guance-storage
# 修改 nodeSelector 和 tolerations 来调度 guance-storage 容器,没有对应需求可以不修改
nodeSelector: {}
tolerations:
[]
# - key: "key"
# operator: "Equal|Exists"
# value: "value"
# effect: "NoSchedule|PreferNoSchedule"
2.安装 GuanceDB for Metrics 组件
helm upgrade -i guancedb oci://pubrepo.guance.com.com/guancedb/guancedb \
-n guancedb --create-namespace -f values.yaml
3.查看状态 {#helm-check}
> kubectl get pod -n guancedb -l app.kubernetes.io/instance=guancedb
NAME READY STATUS RESTARTS AGE
guance-insert-0 1/1 Running 0 107s
guance-select-db5dfb66b-qsncr 1/1 Running 0 84s
guance-storage-0 1/1 Running 0 44s
guance-storage-1 1/1 Running 0 28s
配置安装 GuanceDB for Logs¶
注意
如果已经部署 GuanceDB for Metrics 组件,安装 GuanceDB for Logs,不会新增新的服务,只会添加服务的启动参数。
1.配置 GuanceDB for Logs
进入 guancedb 目录,修改 values.yaml
注意
values.yaml 为 配置 GuanceDB for Metrics 的文件,如果 values.yaml,丢失可执行 helm get values -n guancedb guancedb > values.yaml
获得。
...
doris:
# 启用 GuanceDB for Logs
enabled: true
# 添加 Doris fe 节点
feIPs: []
# ["xx.xx.xx.xx","xx.xx.xx.xx"]
# Doris root 密码
rootPassword: ''
# Doris 普通用户密码
userReadPassword: ''
# memory size for cache data
cacheSizeLimit: 4Gi
guance_throttler:
# 开启
enabled: true
...
2.安装 GuanceDB for Logs
helm upgrade -i guancedb oci://pubrepo.guance.com.com/guancedb/guancedb \
-n guancedb --create-namespace -f values.yaml
3.查看状态 {#helm-check-logs}
> kubectl get pod -n guancedb -l app.kubernetes.io/instance=guancedb
NAME READY STATUS RESTARTS AGE
guance-insert-0 1/1 Running 0 107s
guance-select-db5dfb66b-qsncr 1/1 Running 0 84s
guance-storage-0 1/1 Running 0 44s
guance-storage-1 1/1 Running 0 28s
卸载¶
其他¶
修改组件参数¶
1.修改 values.yaml
guance_storage:
...
# 可以在此出添加 storage 参数
extraArgs:
retentionFilters.config: http://kodo.forethought-kodo:9527/v1/workspace_retention
envflag.enable: 'true'
loggerFormat: json
loggerMaxArgLen: '10000'
loggerTimezone: Asia/Shanghai
guance_insert:
...
# 可以在此出添加 insert 参数
extraArgs:
envflag.enable: 'true'
loggerFormat: json
loggerMaxArgLen: '10000'
loggerTimezone: Asia/Shanghai
streamaggr.insertVerify: 'true'
guance_select:
# 可以在此出添加 select 参数
...
extraArgs:
envflag.enable: 'true'
loggerFormat: json
loggerMaxArgLen: '10000'
loggerTimezone: Asia/Shanghai
http.disableResponseCompression: 'true'
search.denyPartialResponse: true
search.maxQueryDuration: 110s
slowQueryDuration: 1ms
streamaggr.selectVerify: 'true'
2.更新部署:
helm upgrade -i guancedb oci://pubrepo.guance.com.com/guancedb/guancedb \
-n guancedb --create-namespace -f values.yaml
服务参数说明¶
Guance Select 参数说明¶
参数名 | 类型 | 默认值 | 中文说明 |
---|---|---|---|
-blockcache.missesBeforeCaching | int | 2 | 缓存块被放入缓存前的缓存未命中次数。值越大可能减少 indexdb/dataBlocks 缓存大小,但会增加 CPU 和磁盘读操作。 |
-cacheDataPath | string | "/tmp/guance-select" | 缓存文件目录路径。为空时不保存缓存。 |
-cacheExpireDuration | duration | 30m0s | 内存缓存项在未访问指定时间后被移除。较低值可减少内存使用,但会增加 CPU 使用。 |
-dedup.minScrapeInterval | duration | 1ms | 每个时间序列在每个离散时间间隔内只保留最后一个采样,防止重复。 |
-denyQueryTracing | bool | 是否禁用查询追踪功能。 | |
-doris.coldDataTierOnly | bool | 仅使用冷存储。 | |
-doris.disableBFOnNewTables | bool | 新表不使用布隆过滤器。 | |
-doris.disableUnicodeTokenizer | bool | 使用中文分词器替代 Unicode 分词器。 | |
-doris.enableBFOnOldTables | bool | 旧表使用布隆过滤器。 | |
-doris.enableFileCacheTTL | bool | 使用云数据库 SelectDB 版本的数据缓存。 | |
-doris.enableWarmDataTier | bool | 使用热加温存储而非热加冷存储。 | |
-doris.indexCacheTTL | duration | 30m0s | Doris 索引缓存的过期时间。 |
-doris.onlyQueryFE | bool | 启用后不直接从后端(be)查询数据。 | |
-doris.onlyWriteFE | bool | 启用后不直接写数据到后端(be)。 | |
-doris.replicationFactor | int | 1 | Doris 表的副本数量。 |
-doris.storageResource | string | "s3_default" | 存储策略使用的资源名称。 |
-doris.variantSchemaMode | string | 支持值:'none','minimal','full'。 | |
-dorisCluster | string | "default_cluster" | Doris 集群名称。 |
-dorisFENode | array | Doris FE 节点地址列表,逗号分隔。 | |
-dorisHTTPPort | int | 8030 | Doris HTTP 端口。 |
-dorisMySQLPort | int | 9030 | Doris MySQL 端口。 |
-dorisPassword | string | Doris 密码。 | |
-dorisUsername | string | "root" | Doris 用户名。 |
-enableTCP6 | bool | 是否启用 IPv6 监听和拨号。默认仅使用 IPv4。 | |
-envflag.enable | bool | 是否允许从环境变量读取参数,命令行参数优先。 | |
-envflag.prefix | string | 环境变量前缀,仅在启用环境变量读取时生效。 | |
-filestream.disableFadvise | bool | 是否禁用 fadvise() 系统调用,读取大文件时可减少 CPU 使用,但一般不建议关闭。 | |
-flagsAuthKey | value | /flags 端点的认证密钥。支持从文件或 URL 读取。 | |
-fs.disableMmap | bool | 是否使用 pread() 替代 mmap() 读取数据文件。默认 64 位架构使用 mmap(),32 位使用 pread()。 | |
-globalReplicationFactor | int | 1 | 每个样本在 vmstorage 组中的副本数。支持高可用。 |
-http.connTimeout | duration | 2m0s | HTTP 连接超时时间,超时后关闭连接。0 表示不关闭。 |
-http.disableResponseCompression | bool | 是否禁用 HTTP 响应压缩以节省 CPU。默认启用压缩以节省带宽。 | |
-http.header.csp | string | 设置 Content-Security-Policy 头,推荐:"default-src 'self'"。 | |
-http.header.frameOptions | string | 设置 X-Frame-Options 头。 | |
-http.header.hsts | string | 设置 Strict-Transport-Security 头,推荐:'max-age=31536000; includeSubDomains'。 | |
-http.idleConnTimeout | duration | 1m0s | HTTP 空闲连接超时时间。 |
-http.maxGracefulShutdownDuration | duration | 7s | HTTP 服务器优雅关闭最大时长。 |
-http.pathPrefix | string | 为所有 HTTP 路径添加前缀,适用于代理路径。 | |
-http.shutdownDelay | duration | HTTP 服务器关闭前的延迟,期间 /health 返回非 OK,方便负载均衡切换请求。 | |
-httpAuth.password | value | HTTP 基本认证密码,支持从文件或 URL 读取。 | |
-httpAuth.username | string | HTTP 基本认证用户名,为空则禁用认证。 | |
-httpListenAddr | array | HTTP 监听地址列表,支持多值或逗号分隔。 | |
-httpListenAddr.useProxyProtocol | array | 指定监听地址是否启用代理协议,启用后无法提供常规 /metrics 端点。 | |
-insert.maxFutureTimeDrift | duration | 1h0m0s | 拒绝时间戳超过当前时间加此值的事件。 |
-insert.maxPastTimeDrift | duration | 拒绝时间戳早于当前时间减此值的事件。 | |
-insertNode | array | Guance-insert 节点地址列表,逗号分隔。 | |
-internStringCacheExpireDuration | duration | 6m0s | 字符串驻留缓存过期时间。 |
-internStringDisableCache | bool | 是否禁用字符串驻留缓存,禁用会减少内存但增加 CPU 使用。 | |
-internStringMaxLen | int | 500 | 最大驻留字符串长度,较低值减少内存但增加 CPU 使用。 |
-loggerDisableTimestamps | bool | false | 是否禁用日志中的时间戳写入 |
-loggerErrorsPerSecondLimit | int | 0 | 每秒错误日志限制,超过限制的错误会被抑制,0表示不限制 |
-loggerFormat | string | "default" | 日志格式,可选"default"或"json" |
-loggerJSONFields | string | - | JSON格式日志字段重命名,例如"ts:timestamp,msg:message" |
-loggerLevel | string | "INFO" | 日志最低级别,支持INFO, WARN, ERROR, FATAL, PANIC |
-loggerMaxArgLen | int | 1000 | 单个日志参数最大长度,超出部分会用前后缀替代 |
-loggerOutput | string | "stderr" | 日志输出位置,支持stderr和stdout |
-loggerTimezone | string | "UTC" | 日志时间戳使用的时区,需为有效IANA时区名称 |
-loggerWarnsPerSecondLimit | int | 0 | 每秒警告日志限制,超过限制的警告会被抑制,0表示不限制 |
-memory.allowedBytes | size | 0 | VictoriaMetrics缓存可使用的系统内存大小,设置后覆盖 -memory.allowedPercent |
-memory.allowedPercent | float | 60 | VictoriaMetrics缓存可使用的系统内存百分比 |
-metrics.exposeMetadata | bool | false | 是否在/metrics页面暴露TYPE和HELP元数据 |
-metricsAuthKey | value | - | /metrics端点的认证密钥,支持从文件或URL读取 |
-pprofAuthKey | value | - | /debug/pprof/*端点的认证密钥,支持从文件或URL读取 |
-prevCacheRemovalPercent | float | 0.1 | 上一次缓存中服务请求比例低于该值时移除缓存条目,提升内存使用效率但增加CPU使用 |
-pushmetrics.disableCompression | bool | false | 是否禁用推送指标时的请求体压缩 |
-pushmetrics.extraLabel | array | - | 推送指标时附加的标签,如instance="foo" |
-pushmetrics.header | array | - | 推送指标时附加的HTTP请求头 |
-pushmetrics.interval | duration | 10s | 推送指标的时间间隔 |
-pushmetrics.url | array | - | 指定推送指标的URL列表 |
-queryPermitRatio | float | 1 | 允许的查询请求比例 |
-replicationFactor | array | 1 | 每条样本的副本数,支持key:value形式 |
-retentionFilters.cleanInterval | duration | 360h | 清理过期数据的间隔 |
-retentionFilters.config | string | - | 保留过滤器配置文件路径 |
-retentionFilters.configCheckInterval | duration | 1h | 保留过滤器配置文件变更检测间隔 |
-scopeDB.dbName | string | "scopedb" | ScopeDB数据库名 |
-scopeDB.dumpIngestBody | bool | false | 失败时是否打印写入内容 |
-scopeDB.ensureJob | bool | false | 是否启用确保任务功能 |
-scopeDB.indexCacheTTL | duration | 5m | ScopeDB索引缓存TTL |
-scopeDB.maxConcurrentIndexRequests | int | 32 | 最大并发索引请求数 |
-scopeDB.node | array | - | ScopeDB节点地址列表 |
-scopeDB.nodegroup.ctl | string | "query-meta" | 控制面节点组名称 |
-scopeDB.nodegroup.detailQuery | string | "detail-query" | 非聚合查询节点组名称 |
-scopeDB.nodegroup.job | string | "job" | 任务执行节点组名称 |
-scopeDB.nodegroup.largeQuery | string | "large-query" | 大型查询节点组名称 |
-scopeDB.nodegroup.query | string | "query" | 普通查询节点组名称 |
-scopeDB.nodegroup.systemQuery | string | "system-query" | 来自referrers如"func"和"kodo"的系统查询节点组名称 |
-scopeDB.nodesUpdateInterval | duration | 10s | 节点更新间隔 |
-scopeDB.onlyUseBootstrapNodes | bool | false | 是否只使用引导节点 |
-scopeDB.password | string | - | ScopeDB密码 |
-scopeDB.port | uint | 6543 | ScopeDB端口 |
-scopeDB.storage.accessKeyID | string | - | ScopeDB存储访问Key ID |
-scopeDB.storage.bucket | string | - | ScopeDB存储桶 |
-scopeDB.storage.endpoint | string | - | ScopeDB存储服务端点 |
-scopeDB.storage.prefix | string | - | ScopeDB存储前缀 |
-scopeDB.storage.region | string | - | ScopeDB存储区域 |
-scopeDB.storage.secretAccessKey | string | - | ScopeDB存储Secret访问密钥 |
-scopeDB.storage.type | string | - | ScopeDB存储类型 |
-scopeDB.username | string | - | ScopeDB用户名 |
-search.cacheTimestampOffset | duration | 5m | 查询响应数据最大时间偏移,避免因时钟同步问题产生响应空缺 |
-search.compatibleMode | bool | false | 启用Prometheus兼容模式 |
-search.debugThrottler | bool | false | 调试限流器 |
-search.denyPartialResponse | bool | false | 是否拒绝部分响应以换取数据一致性 |
-search.disableCache | bool | false | 禁用响应缓存,适合回填历史数据 |
-search.disableImplicitConversion | bool | false | 禁用隐式子查询转换相关查询 |
-search.dorisColdQueryCPULimit | int | 4 | 冷数据查询的SQL变量CPU限制 |
-search.dorisDisableADBC | bool | false | 优先使用Thrift而非ADBC |
-search.dorisDisableSampling | bool | false | 禁用采样 |
-search.dorisEnableSmallColdGroup | bool | false | 为小型冷查询使用专用工作组 |
-search.dorisLargeColdQueryRowCount | int | - | 已弃用,使用search.minRowsForLargeQuery替代 |
-search.dorisMaxCursorRows | int | 50000000 | 游标查询最大扫描行数 |
-search.dorisMaxLiteralArraySize | int | 1000 | 数组字面量最大元素数量 |
-search.dorisMaxOrderingRows | int | - | 自定义排序查询最大扫描行数 |
-search.dorisMaxRowsForOrder | int | - | 非时间列ORDER BY最大使用行数 |
-search.dorisMaxSamplingRows | int | - | 已弃用,使用search.numRowsToSample替代 |
-search.dorisThrottlerURL | string | - | 限流器API地址 |
-search.latencyOffset | duration | 30s | 数据点在采集后变为查询结果可见的延迟时间。可以通过查询参数 latency_offset 覆盖。过小值可能导致查询结果最后数据点不完整。 |
-search.logImplicitConversion | bool | - | 是否记录隐式子查询转换的查询。详情见 隐式转换说明。可用 -search.disableImplicitConversion 禁用。 |
-search.logQueryMemoryUsage | size | 524288000 (500MB) | 记录占用内存超过该值的查询,便于检测和优化大查询。默认关闭。支持 KB, MB, GB 等单位。 |
-search.maxConcurrentRequestsPerTenant | int | 5 | 每租户最大并发查询请求数。过高会导致 CPU 和内存资源紧张。 |
-search.maxExportDuration | duration | 720h (30天) | /api/v1/export 接口最大调用时长。 |
-search.maxGroups | int | 100000 | 查询结果中允许的最大分组数量。 |
-search.maxLabelsAPIDuration | duration | 5s | /api/v1/labels、/api/v1/label/.../values 和 /api/v1/series 接口最大响应时长。 |
-search.maxLimit | int | 10000 | 查询结果中允许的最大行数。 |
-search.maxLookback | duration | 动态检测 | 与 Prometheus 的 -search.lookback-delta 同义。可用 max_lookback 参数覆盖。影响查询中回溯时间窗口。 |
-search.maxMemoryPerQuery | size | 0 | 单个查询允许使用的最大内存,超过则拒绝执行。支持 KB, MB, GB 等单位。 |
-search.maxMetrics | int | 10000000 | 已废弃,迁移至 -search.maxShowUniqueTimeseries 和 -search.maxQueryUniqueTimeseries。 |
-search.maxPointsPerTimeseries | int | 30000 | /api/v1/query_range 返回的单个时间序列最大数据点数,主要限制绘图客户端的点数。 |
-search.maxPointsSubqueryPerTimeseries | int | 100000 | 子查询每个时间序列最大生成数据点数。详情见相关博客。 |
-search.maxQueryDuration | duration | 30s | 查询最大执行时长。 |
-search.maxQueryLen | size | 16384 (16KB) | 查询语句最大长度。支持 KB, MB 等单位。 |
-search.maxQueryUniqueTimeseries | int | 300000 | /api/v1/query 查询中允许选择的最大唯一时间序列数。限制内存使用。 |
-search.maxQueueDuration | duration | 10s | 当达到最大并发请求数限制时,请求最大排队等待时间。 |
-search.maxResponseSeries | int | 0 (无限制) | /api/v1/query 和 /api/v1/query_range 最大返回时间序列数,0 表示不限制。 |
-search.maxSamplesPerQuery | int | 1000000000 | 单个查询最多扫描的原始样本数。防止过大查询导致资源耗尽。 |
-search.maxSamplesPerSeries | int | 30000000 | 每个时间序列最大扫描原始样本数。 |
-search.maxSeriesPerAggrFunc | int | 1000000 | 聚合函数最多可生成的时间序列数。 |
-search.maxShowUniqueTimeseries | int | 10000000 | show 函数允许显示的最大时间序列数,限制内存使用。 |
-search.maxStalenessInterval | duration | 动态计算 | 失效(staleness)计算最大时间间隔,默认根据样本中位间隔自动计算。 |
-search.maxStatusRequestDuration | duration | 5m0s | /api/v1/status/* 请求最大响应时间。 |
-search.maxStepForPointsAdjustment | duration | 1m0s | /api/v1/query_range 接口调整距离当前时间小于 latencyOffset 的点时的最大 step。 |
-search.maxWorkersPerQuery | int | 2 | 单个查询允许使用的最大 CPU 核数。可调节以优化性能,不能超过物理 CPU 核数。 |
-search.minRowsForLargeQuery | int | 10000000 | 大查询的最小扫描行数。 |
-search.minStalenessInterval | duration | - | 失效计算的最小时间间隔,用于去除采样间隔不规则导致的图表断点。 |
-search.minTimeRangeForLargeQuery | duration | 12h0m0s | 大查询的最小时间范围。 |
-search.minWindowForInstantRollupOptimization | duration | 3h | 针对带有回看窗口的即时查询启用缓存优化的最小窗口值。 |
-search.noStaleMarkers | bool | false | 如果数据库无 Prometheus 失效标记,设置为 true 可节省 CPU 资源。 |
-search.queryStats.lastQueriesCount | int | 20000 | /api/v1/status/top_queries 跟踪的最近查询数量,0 表示禁用。 |
-search.queryStats.minQueryDuration | duration | 1ms | 统计中记录的最短查询时长阈值,低于该时长的查询忽略。 |
-search.resetRollupResultCacheOnStartup | bool | false | 是否启动时重置 rollup 结果缓存。 |
-search.rowsToSample | int | 10000000 | 采样查询最大扫描行数。 |
-search.rowsToSampleForFacet | int | 10000000 | show_x_field 或 distinct 查询最大扫描行数。 |
-search.scopeDB.firstCursorScanRows | int | 10000000 | cursor 分页查询时首次扫描的最大行数。 |
-search.scopeDB.logQuery | bool | true | 是否记录 scopeDB 的查询语句。 |
-search.scopeDB.maxLiteralArraySize | int | 1000 | 数组字面量最大元素数。 |
-search.scopeDB.maxRowsForOrder | int | 100000 | 非时间列的 order by 最大行数。 |
-search.scopeDB.maxTimeRange | duration | - | 查询的最大时间范围。 |
-search.setLookbackToStep | bool | false | 是否将 lookback 固定为 step 参数,调整查询模型使其更像 InfluxDB。启用后忽略 -search.maxLookback 和 -search.maxStalenessInterval。 |
-search.skipSlowReplicas | bool | false | 查询时是否跳过复制因子中最慢的 vmstorage 节点,可能提高查询速度但风险数据不完整。 |
-search.treatDotsAsIsInRegexps | bool | false | 是否在正则表达式中过滤点字符。此选项已弃用,推荐使用 graphite 语法。 |
-slowQueryDuration | duration | 1s | 超过该时长的查询将被记录为慢查询。 |
-storageNode | array | - | guance-storage 节点地址数组,用逗号分隔或多次指定。 |
-streamaggr.cleanupInterval | duration | 10m0s | 过期查询清理间隔。 |
-streamaggr.dataBlocksCacheSize | int | 157286400 (150MB) | 数据块缓存大小。 |
-streamaggr.ignoreContinuousCheck | bool | false | 是否忽略连续性检查。 |
-streamaggr.indexBlocksCacheSize | int | 52428800 (50MB) | 索引块缓存大小。 |
-streamaggr.queryRetentionPeriod | duration | 168h0m0s (7天) | 查询保留期。 |
-streamaggr.retentionMonths | int | 6 | 流聚合数据保留月数。 |
-streamaggr.selectVerify | bool | false | 是否验证流聚合结果。 |
-tls | array | 无 | 是否启用针对指定 -httpListenAddr 的 TLS(即 HTTPS)。设置此参数时必须同时设置 -tlsCertFile 和 -tlsKeyFile。支持用逗号分隔的多个值或多次设置。空值视为 false。 |
-tlsCertFile | array | 无 | 对应 -httpListenAddr 的 TLS 证书文件路径。建议使用 ECDSA 证书替代 RSA 证书,因为 RSA 证书速度较慢。证书文件会每秒自动重新读取,可动态更新。支持多值。 |
-tlsCipherSuites | array | 无 | 可选的 TLS 密码套件列表,用于启用 TLS 时的 HTTPS 请求。支持多值。详细支持列表见:https://pkg.go.dev/crypto/tls#pkg-constants |
-tlsKeyFile | array | 无 | 对应 -httpListenAddr 的 TLS 密钥文件路径。密钥文件会每秒自动重新读取,可动态更新。支持多值。 |
-tlsMinVersion | array | 无 | TLS 最低版本限制(可选)。支持 TLS10、TLS11、TLS12、TLS13。支持多值。 |
-version | 无参数 | 无 | 显示 VictoriaMetrics 的版本信息。 |
-vmstorageDialTimeout | duration | 3s | vmselect 与 vmstorage 建立 RPC 连接的超时时间。详见 -vmstorageUserTimeout。 |
-vmstorageUserTimeout | duration | 3s | vmselect 与 vmstorage 之间 RPC 连接的网络超时时间(仅限 Linux)。较低值会降低网络故障时最大查询持续时间。详见 TCP_USER_TIMEOUT 说明。 |
-zipkin.batchSize | int | 100 | 单次批量发送的最大 Span 数量。 |
-zipkin.bufferSize | int | 10000 | 缓冲的最大 Span 数量。 |
-zipkin.endpoint | string | 无 | Zipkin 收集器的端点 URL,例如:http://localhost:9529。 |
-zipkin.flushPeriod | duration | 1s | 最大刷新间隔时间。 |
-zipkin.serviceName | string | guance-select | Zipkin Span 中使用的服务名称。 |
Guance Insert 参数说明¶
参数名 | 类型 | 默认值 | 中文说明 |
---|---|---|---|
-blockcache.missesBeforeCaching | int | 2 | 缓存块被放入缓存前的未命中次数。值越高可能减少缓存大小,但会增加 CPU 和磁盘读取压力。 |
-cacheExpireDuration | duration | 30m0s | 内存缓存中数据在未被访问一段时间后会被移除。较小的值可降低内存占用,但会增加 CPU 使用率。 |
-denyQueryTracing | 无 | 无 | 是否禁用查询追踪功能。详见:https://docs.victoriametrics.com/#query-tracing |
-disableInflux | 无 | true | 是否禁用 Influx 格式的支持。 |
-disableRerouting | 无 | true | 是否禁用数据重路由。当部分 vmstorage 写入速度较慢时可触发重路由,关闭此功能可减少滚动重启时的活跃时序。 |
-disableReroutingOnUnavailable | 无 | 无 | vmstorage 节点不可用时是否禁用重路由。禁用后若某节点不可用会停止数据写入,可减少重启或序列剧烈变更时的影响。 |
-doris.cacheDataPath | string | /data/file-queue | 缓存文件路径。 |
-doris.coldDataTierOnly | 无 | 无 | 仅使用冷数据存储层。 |
-doris.debugIndexName | string | default | 需要添加调试日志的 indexName。 |
-doris.debugMeasurement | string | 无 | 需要添加调试日志的 measurement。 |
-doris.debugNamespace | string | 无 | 需要添加调试日志的 namespace。 |
-doris.debugTenantID | uint | 无 | 需要添加调试日志的租户 ID(accountID)。 |
-doris.disableBFOnNewTables | 无 | 无 | 新建表不启用布隆过滤器。 |
-doris.disableKeepAlives | 无 | 无 | 禁用 stream load 中的 keep-alive。 |
-doris.disableUnicodeTokenizer | 无 | 无 | 使用 Chinese 分词器替代 Unicode 分词器。 |
-doris.enableBFOnOldTables | 无 | 无 | 为旧表启用布隆过滤器。 |
-doris.enableFileCacheTTL | 无 | 无 | 启用云数据库 SelectDB 数据缓存:https://help.aliyun.com/document_detail/2638759.html |
-doris.enableWarmDataTier | 无 | 无 | 启用热+温存储模式,替代热+冷模式。 |
-doris.forceFlushInterval | duration | 30s | 非事件数据的强制 flush 间隔。 |
-doris.indexCacheTTL | duration | 30m0s | doris 索引缓存 TTL。 |
-doris.loadToSingleTablet | 无 | 无 | stream load 请求中使用 load_to_single_tablet 头部。 |
-doris.maxCacheSize | size | 0 | 已废弃,请使用 fileQueue.maxTotalSize。总缓存数据的最大字节数。 |
-doris.maxConcurrentInserts | int | 无 | 已废弃,请使用 fileQueue.workers。 |
-doris.maxFieldCount | size | 512 | 每个 measurement 中允许的最大字段数量。支持 KB、MB、GB、等单位。 |
-doris.maxFieldSize | size | 33554432 | 单个字段的最大字节大小。支持 KB、MB、GB、等单位。 |
-doris.maxSizePerRequest | size | 0 | 已废弃,请使用 fileQueue.maxFileSize。单次解析中单行最大大小。 |
-doris.onlyQueryFE | 无 | 无 | 启用后仅从 FE 节点查询数据,不直接访问 BE。 |
-doris.onlyWriteFE | 无 | 无 | 启用后仅向 FE 节点写入数据,不直接写入 BE。 |
-doris.replicationFactor | int | 1 | Doris 表的副本因子。 |
-doris.sampleIndexName | string | 无 | sample 索引名称。 |
-doris.sampleInsertRatio | int | 无 | sample 写入比例。 |
-doris.sampleInterval | value | 1s | sample 间隔时间,支持 s/m/h/d/w/y 作为单位。默认以月计。 |
-doris.sampleNamespace | string | 无 | sample 命名空间。 |
-doris.sampleTenantID | string | 无 | sample 租户 ID。 |
-doris.storageResource | string | s3_default | Doris 使用的存储策略资源名。 |
-doris.variantSchemaMode | string | 无 | schema 模式,支持 'none'、'minimal'、'full'。 |
-dorisCluster | string | default_cluster | Doris 集群名称。 |
-dorisFENode | array | 无 | Doris-FE 节点地址(多个用逗号分隔)。 |
-dorisHTTPPort | int | 8030 | Doris 的 HTTP 端口。 |
-dorisMySQLPort | int | 9030 | Doris 的 MySQL 端口。 |
-dorisPassword | string | 无 | 连接 Doris 的密码。 |
-dorisUsername | string | root | 连接 Doris 的用户名。 |
-dropSamplesOnOverload | 无 | 无 | 如果 vmstorage 节点过载或不可用,是否丢弃样本以保证集群可用性。注意该操作在复制前执行,慎用。 |
-enableTCP6 | 无 | 无 | 是否启用 IPv6 监听和拨号。默认仅启用 IPv4。 |
-envflag.enable | 无 | 无 | 是否允许从环境变量读取参数。命令行参数优先生效。详见:https://docs.victoriametrics.com/#environment-variables |
-envflag.prefix | string | 无 | 环境变量的前缀(需搭配 -envflag.enable 使用)。 |
-fileQueue.maxFileSize | size | 104857600 | file queue 中单个文件的最大大小(默认 100MB)。 |
-fileQueue.maxTotalSize | size | 3758096384 | file queue 总大小上限(默认 3.5GB)。 |
-fileQueue.workers | int | 8 | 向 ScopeDB 或 Doris 并发插入的最大线程数。 |
-filedb.maxFileSize | int | 10485760 | filedb 的最大文件大小(默认 10MB)。 |
-filestream.disableFadvise | 无 | 无 | 是否禁用 fadvise() 系统调用,用于防止读取大文件时最近数据被 OS 缓存驱逐。 |
-flagsAuthKey | value | 无 | 用于 /flags 接口的认证密钥。可通过文件或 URL 读取。 |
-fs.disableMmap | 无 | 无 | 是否禁用 mmap(),改用 pread() 读取数据文件。对 64 位系统默认启用 mmap()。 |
-gcolumnCompressLevel | int | 无 | guance column 协议的压缩等级。数值越高压缩越好,但占用 CPU;负值可减少 CPU 使用但增大网络传输。 |
-http.connTimeout | duration | 2m0s | HTTP 连接超时时间。可用于使负载均衡器更均匀分发流量。0 表示不超时。 |
-http.disableResponseCompression | 无 | 无 | 是否禁用 HTTP 响应压缩以节省 CPU。默认启用压缩节省网络带宽。 |
-http.header.csp | string | 无 | 设置 Content-Security-Policy 头部的值,推荐值:"default-src 'self'"。 |
-http.header.frameOptions | string | 无 | 设置 X-Frame-Options 头部的值。 |
-http.header.hsts | string | 无 | 设置 Strict-Transport-Security 头部的值,推荐值:"max-age=31536000; includeSubDomains"。 |
-http.idleConnTimeout | duration | 1m0s | 空闲 HTTP 连接的超时时间。 |
-http.maxGracefulShutdownDuration | duration | 7s | HTTP 服务优雅关闭的最长等待时间。高负载服务器可能需更高值。 |
-http.pathPrefix | string | 无 | 所有 HTTP 路径的前缀,例如设置为 /foo/bar 后,所有路径都以此开头,便于反向代理。 |
-http.shutdownDelay | duration | 无 | HTTP 服务关闭前的延迟时间。在此期间 /health 接口返回非 OK,用于通知负载均衡器切换流量。 |
-httpAuth.password | value | 无 | HTTP Basic Auth 密码。用户名为空时不启用。支持从文件或 URL 加载。 |
-httpAuth.username | string | 无 | HTTP Basic Auth 用户名。为空时表示不启用。需配合 -httpAuth.password 使用。 |
-httpListenAddr | array | 无 | HTTP 服务监听地址。支持多个地址。 |
-httpListenAddr.useProxyProtocol | array | false | 是否对 -httpListenAddr 接收到的连接使用 proxy protocol。启用后,HTTP 服务器将无法提供 /metrics 端点,请使用 -pushmetrics.url 进行指标推送。支持用逗号分隔或多次设置。空值为 false。 |
-influx.defaultBatchLinesCount | size | 16 | InfluxDB 解析时每个批次默认包含的行数。支持单位后缀:KB、MB、GB、TB、KiB、MiB、GiB、TiB。 |
-influx.defaultBatchSize | size | 1048576 | InfluxDB 解析时每个批次默认的字节大小。支持单位后缀:KB、MB、GB、TB、KiB、MiB、GiB、TiB。 |
-insert.maxFutureTimeDrift | duration | 1h0m0s | 插入数据时,如果事件时间戳大于当前时间加上该值,将被拒绝。 |
-insert.maxPastTimeDrift | duration | 插入数据时,如果事件时间戳小于当前时间减去该值,将被拒绝。 | |
-insertNode | array | 指定 guance-insert 节点的地址,多个用逗号分隔,支持带引号或括号的值。 | |
-internStringCacheExpireDuration | duration | 6m0s | interned 字符串缓存的过期时间。详见:https://en.wikipedia.org/wiki/String_interning。 |
-internStringDisableCache | false | 是否禁用 interned 字符串缓存。可能减少内存占用,但增加 CPU 使用率。 | |
-internStringMaxLen | int | 500 | interned 字符串的最大长度。设置较小值可能减少内存占用但增加 CPU 使用率。 |
-loggerDisableTimestamps | false | 是否禁用日志中的时间戳记录。 | |
-loggerErrorsPerSecondLimit | int | 每秒允许输出的 ERROR 日志数量,超过后将抑制多余日志。设为 0 表示不限制。 | |
-loggerFormat | string | default | 日志格式,可选:default、json。 |
-loggerJSONFields | string | 修改 JSON 日志中的字段名,例如:"ts:timestamp,msg:message"。支持字段有 ts, level, caller, msg。 | |
-loggerLevel | string | INFO | 日志输出的最低级别,可选:INFO、WARN、ERROR、FATAL、PANIC。 |
-loggerMaxArgLen | int | 1000 | 单个日志参数的最大长度。超出后将用前后截取显示,如 'arg_start..arg_end'。 |
-loggerOutput | string | stderr | 日志输出目标,支持:stderr、stdout。 |
-loggerTimezone | string | UTC | 日志中时间戳使用的时区,需为 IANA 标准格式,如 America/New_York、Etc/GMT+3 或 Local。 |
-loggerWarnsPerSecondLimit | int | 每秒允许输出的 WARN 日志数量,超过后将抑制多余日志。设为 0 表示不限制。 | |
-maxConcurrentInserts | int | 24 | 允许的最大并发插入请求数量。默认值适用于大多数情况,在网络较慢时可适当提高。 |
-maxInsertRequestSize | size | 134217728 | 单次 gcolumn 插入请求的最大字节大小。支持单位后缀:KB、MB、GB、TB、KiB、MiB、GiB、TiB。 |
-maxLabelValueLen | int | 16384 | 接收的时间序列中标签值的最大长度。超过部分将被截断,同时在 /metrics 页面中的 vm_too_long_label_values_total 指标会增加。 |
-maxLabelsPerTimeseries | int | 256 | 每个时间序列允许的最大标签数量。多余的标签将被丢弃,对应的 /metrics 页面指标 vm_metrics_with_dropped_labels_total 将增加。 |
-memory.allowedBytes | size | 0 | VictoriaMetrics 缓存可占用的系统内存上限(字节)。该值若非 0,将覆盖 -memory.allowedPercent。设置过小会增加缓存未命中率,设置过大可能影响 OS 页面缓存。 |
-memory.allowedPercent | float | 60 | VictoriaMetrics 缓存可占用的系统内存百分比。设置过小可能增加 CPU 和磁盘 IO,过大会影响页面缓存。 |
-metrics.exposeMetadata | false | 是否在 /metrics 页面暴露 TYPE 和 HELP 元数据,某些系统(如 Google Cloud 的 Managed Prometheus)需要此信息。 | |
-metricsAuthKey | value | 用于 /metrics 端点的认证 key,可通过 authKey 查询参数传入。支持从文件或 URL 中读取 key。 | |
-pprofAuthKey | value | 用于 /debug/pprof/* 的认证 key,可通过 authKey 查询参数传入。支持从文件或 URL 中读取 key。 | |
-prevCacheRemovalPercent | float | 0.1 | 当旧缓存的命中率低于该值时进行移除。值越高,内存占用减少但 CPU 占用可能上升。 |
-pushmetrics.disableCompression | false | 是否禁用向每个 -pushmetrics.url 推送指标时的请求体压缩。 | |
-pushmetrics.extraLabel | array | 推送到每个 -pushmetrics.url 的额外标签,如:-pushmetrics.extraLabel='instance="foo"' 。支持逗号、引号和括号。 |
|
-pushmetrics.header | array | 向每个 -pushmetrics.url 推送请求时携带的 HTTP Header,如:Authorization: Basic foobar 。支持逗号、引号和括号。 |
|
-pushmetrics.interval | duration | 10s | 向每个 -pushmetrics.url 推送指标的时间间隔。 |
-pushmetrics.url | array | 指定推送 /metrics 页面数据的目标地址。默认不推送。支持多个地址和复杂语法。 | |
-relabelConfig | string | 指定重写规则配置文件路径(本地或 http 地址),在收到 SIGHUP 信号时会自动重新加载。详见:https://docs.victoriametrics.com/#relabeling | |
-replicationFactor | int | 1 | 数据的副本数,即每条数据在不同 -storageNode 中的拷贝数。若该值 >1,vmselect 必须设置 -dedup.minScrapeInterval=1ms 以实现去重。 |
-retentionFilters.cleanInterval | duration | 360h0m0s | 清理过期数据的时间间隔。 |
-retentionFilters.config | string | 保留策略配置文件路径。 | |
-retentionFilters.configCheckInterval | duration | 1h0m0s | 检查保留策略配置文件更新的时间间隔。 |
-rpc.disableCompression | false | 是否禁用从 vminsert 向 vmstorage 发送数据时的压缩。禁用后减少 CPU 使用,但增加网络带宽使用。 | |
-scopeDB.dbName | string | scopedb | ScopeDB 数据库名称。 |
-scopeDB.dumpIngestBody | false | 是否在插入失败时输出请求体内容。 | |
-scopeDB.ensureJob | false | 是否启用 ensure job。 | |
-scopeDB.indexCacheTTL | duration | 5m0s | ScopeDB 索引缓存的生存时间 |
-scopeDB.maxConcurrentIndexRequests | int | 32 | ScopeDB 允许的最大并发索引请求数 |
-scopeDB.maxFieldCount | size | 512 | 每个索引的最大字段数 |
-scopeDB.maxFieldSize | size | 33554432 | 单个 gcolumn 字段的最大字节数 |
-scopeDB.node | array | ScopeDB 节点的地址列表,支持多种格式 | |
-scopeDB.nodegroup.ctl | string | ingest-meta | 控制平面使用的 ScopeDB 节点组 |
-scopeDB.nodegroup.ingest | string | ingest | 用于数据写入的 ScopeDB 节点组 |
-scopeDB.nodesUpdateInterval | duration | 10s | ScopeDB 节点信息更新的时间间隔 |
-scopeDB.onlyUseBootstrapNodes | bool | false | 是否仅使用引导节点 |
-scopeDB.password | string | ScopeDB 的访问密码 | |
-scopeDB.port | uint | 6543 | ScopeDB 的访问端口 |
-scopeDB.username | string | ScopeDB 的用户名 | |
-search.debugThrottler | bool | false | 调试限流器 |
-search.denyPartialResponse | bool | false | 是否拒绝部分响应(提高一致性,牺牲可用性) |
-search.dorisColdQueryCPULimit | int | 4 | 冷数据查询使用的 Doris CPU 限制 |
-search.dorisDisableADBC | bool | false | 是否禁用 ADBC(优先使用 Thrift) |
-search.dorisDisableSampling | bool | false | 是否禁用采样 |
-search.dorisEnableSmallColdGroup | bool | false | 为小型冷查询启用专用工作组 |
-search.dorisMaxCursorRows | int | 50000000 | 游标查询中最多扫描的行数 |
-search.dorisMaxLiteralArraySize | int | 1000 | 字面值数组中的最大元素数 |
-search.dorisMaxOrderingRows | int | 自定义排序的查询中最多扫描的行数 | |
-search.dorisMaxRowsForOrder | int | 按非时间列排序的最大行数 | |
-search.dorisThrottlerURL | string | Throttler 的 API 地址 | |
-search.logQueryMemoryUsage | size | 524288000 | 记录内存使用超过指定大小的查询 |
-search.maxExportDuration | duration | 720h0m0s | /api/v1/export 请求的最长持续时间 |
-search.maxGroups | int | 100000 | 查询结果中允许的最大分组数 |
-search.maxLabelsAPIDuration | duration | 5s | /api/v1/labels、/api/v1/label/.../values 和 /api/v1/series 请求的最大持续时间 |
-search.maxLimit | int | 10000 | 查询结果允许的最大行数 |
-search.maxMemoryPerQuery | size | 0 | 单个查询允许使用的最大内存,超过则拒绝查询 |
-search.maxQueryDuration | duration | 30s | 查询执行的最大持续时间 |
-search.maxStatusRequestDuration | duration | 5m0s | /api/v1/status/* 请求的最大持续时间 |
-search.minTimeRangeForLargeQuery | duration | 12h0m0s | 大查询扫描的最小时长 |
-search.scopeDB.firstCursorScanRows | int | 10000000 | 游标分页查询中扫描的行数 |
-search.scopeDB.logQuery | bool | true | 是否记录 ScopeDB 查询语句 |
-search.scopeDB.maxLiteralArraySize | int | 1000 | 字面值数组的最大元素数 |
-search.scopeDB.maxRowsForOrder | int | 100000 | 按非时间列排序的最大行数 |
-search.scopeDB.maxTimeRange | duration | 查询的最大时间范围 | |
-sortLabels | bool | false | 是否对写入存储的标签进行排序,减少内存使用但可能降低写入性能 |
-storageNode | array | guance-storage 节点地址列表,支持多种格式 | |
-streamaggr.cleanupInterval | duration | 10m0s | 过期查询清理的间隔 |
-streamaggr.dataBlocksCacheSize | int | 157286400 | 数据块缓存大小(字节) |
-streamaggr.ignoreContinuousCheck | bool | false | 是否忽略连续检查 |
-streamaggr.indexBlocksCacheSize | int | 52428800 | 索引块缓存大小(字节) |
-streamaggr.insertVerify | bool | false | 启用 streamaggr 验证模式 |
-streamaggr.queryRetentionPeriod | duration | 168h0m0s | 查询保留周期 |
-streamaggr.replay | bool | false | 启用 streamaggr 重放模式 |
-streamaggr.retentionMonths | int | 6 | 流聚合数据保留的月份数 |
-streamaggrDataPath | string | 存储数据路径 | |
-tls | array | 是否为指定的 httpListenAddr 启用 TLS,需要设置 -tlsCertFile 和 -tlsKeyFile | |
-tlsCertFile | array | TLS 证书文件路径,支持动态更新 | |
-tlsCipherSuites | array | 可选的 TLS 密码套件列表 | |
-tlsKeyFile | array | TLS 密钥文件路径,支持动态更新 | |
-tlsMinVersion | array | TLS 的最小版本(TLS10、TLS11、TLS12、TLS13) | |
-usePromCompatibleNaming | bool | false | 是否将不支持的 Prometheus 字符替换为下划线 |
-version | bool | false | 显示 VictoriaMetrics 版本信息 |
-vmstorageDialTimeout | duration | 3s | vminsert 到 vmstorage 建立 RPC 连接超时 |
-vmstorageUserTimeout | duration | 3s | vminsert 到 vmstorage 的网络超时(Linux 专用) |
-zipkin.batchSize | int | 100 | 单批次发送的最大 span 数量 |
-zipkin.bufferSize | int | 10000 | 缓冲的最大 span 数量 |
-zipkin.endpoint | string | Zipkin 收集器端点 URL | |
-zipkin.flushPeriod | duration | 1s | 最大刷新间隔 |
-zipkin.serviceName | string | guance-insert | Zipkin Span 使用的服务名称 |
Guance Stroage 参数说明¶
参数名 | 类型 | 默认值 | 中文说明 |
---|---|---|---|
-bigMergeConcurrency | int | 无 | 已废弃:该参数不再起作用。 |
-blockcache.missesBeforeCaching | int | 2 | 缓存块被放入缓存前的缓存未命中次数。值越大可能减少 indexdb/dataBlocks 缓存大小,但会增加 CPU 和磁盘读操作。 |
-cacheExpireDuration | duration | 30m0s | 内存缓存中未被访问的条目在此时间后被移除。值越低可能减少内存使用,但增加 CPU 使用。详见 -prevCacheRemovalPercent。 |
-dedup.minScrapeInterval | duration | 无 | 每个时间序列在指定的离散间隔内只保留最后一个样本,需设置大于 0。详见去重文档。 |
-denyQueriesOutsideRetention | bool | false | 是否拒绝查询超出配置的 -retentionPeriod 范围的数据。开启后,/api/v1/query_range 对超期查询返回 503 错误。 |
-denyQueryTracing | bool | false | 是否禁用查询追踪功能。详见查询追踪文档。 |
-enableTCP6 | bool | false | 是否启用 IPv6 用于监听和拨号,默认只启用 IPv4。 |
-envflag.enable | bool | false | 是否启用从环境变量读取参数,命令行参数优先。若不启用,仅从命令行读取。详见环境变量文档。 |
-envflag.prefix | string | 无 | 当启用 -envflag.enable 时,环境变量前缀。 |
-filestream.disableFadvise | bool | false | 是否禁用读取大文件时的 fadvise() 系统调用。该调用防止最近访问的数据被系统缓存驱逐,部分情况下禁用可降低 CPU 使用。 |
-finalMergeDelay | duration | 无 | 已废弃:该参数不再起作用。 |
-flagsAuthKey | value | 无 | /flags 端点的认证密钥,需通过 authKey 查询参数传递。支持从文件或 HTTP(S) URL 读取密钥值。 |
-forceFlushAuthKey | value | 无 | /internal/force_flush 页面所需的认证密钥,支持从文件或 HTTP(S) URL 读取。 |
-forceMergeAuthKey | value | 无 | /internal/force_merge 页面所需的认证密钥,支持从文件或 HTTP(S) URL 读取。 |
-fs.disableMmap | bool | false | 是否使用 pread() 代替 mmap() 读取数据文件。64 位架构默认 mmap(),32 位架构默认 pread()。mmap() 读取小数据块更快。 |
-http.connTimeout | duration | 2m0s | 对 -httpListenAddr 的连接超时关闭时间。可帮助负载均衡均匀分布请求。0 值禁用超时关闭。 |
-http.disableResponseCompression | bool | false | 是否禁用 HTTP 响应压缩,默认启用压缩以节省网络带宽,禁用可节省 CPU。 |
-http.header.csp | string | "default-src 'self'" | 设置 HTTP 头部 Content-Security-Policy,推荐值为 "default-src 'self'"。 |
-http.header.frameOptions | string | 无 | 设置 HTTP 头部 X-Frame-Options。 |
-http.header.hsts | string | "max-age=31536000; includeSubDomains" | 设置 HTTP 头部 Strict-Transport-Security,推荐值如示例。 |
-http.idleConnTimeout | duration | 1m0s | HTTP 空闲连接超时关闭时间。 |
-http.maxGracefulShutdownDuration | duration | 7s | HTTP 服务器优雅关闭的最长等待时间,高负载服务器建议增大此值。 |
-http.pathPrefix | string | 无 | 给所有 HTTP 路径加前缀,例如用于代理时访问路径前缀。详见相关文档。 |
-http.shutdownDelay | duration | 无 | HTTP 服务器关闭前的延迟,在此期间 /health 返回非 OK 状态,方便负载均衡转移请求。 |
-httpAuth.password | value | 无 | HTTP 基本认证密码。未设置用户名时认证失效。支持从文件或 HTTP(S) URL 读取。 |
-httpAuth.username | string | 无 | HTTP 基本认证用户名,未设置时认证失效。 |
-httpListenAddr | array | 无 | HTTP 监听地址,可通过逗号或多次参数传入,支持复杂格式。 |
-httpListenAddr.useProxyProtocol | array | false | 是否为指定监听地址启用 Proxy Protocol,启用后无法使用常规 /metrics 端点。详见 HAProxy 文档。 |
-inmemoryDataFlushInterval | duration | 5s | 内存数据持久化到磁盘的间隔,保存数据以防不正常关机。间隔越大闪存寿命越长,越小磁盘 IO 负载越高。最小 1 秒。 |
-insert.maxQueueDuration | duration | 1m0s | 当最大并发插入达到时,插入请求在队列中的最大等待时间。 |
-internStringCacheExpireDuration | duration | 6m0s | 字符串驻留缓存过期时间,详见字符串驻留机制。 |
-internStringDisableCache | bool | false | 是否禁用字符串驻留缓存,禁用后降低内存但增加 CPU 使用。 |
-internStringMaxLen | int | 500 | 字符串驻留的最大长度,较低值节省内存但增加 CPU 使用。 |
-logNewSeries | bool | false | 是否记录新时间序列日志,仅用于调试,可能影响性能。 |
-loggerDisableTimestamps | bool | 无 | 是否禁用日志中的时间戳写入。 |
-loggerErrorsPerSecondLimit | int | 0 | 每秒允许的最大 ERROR 日志数量。超过该值的错误日志将被抑制。0 表示不限制。 |
-loggerFormat | string | "default" | 日志格式。可选值:default, json(默认"default")。 |
-loggerJSONFields | string | 无 | 重命名 JSON 格式日志中的字段。例如:"ts:timestamp,msg:message" 将 "ts" 改为 "timestamp","msg" 改为 "message"。支持字段:ts, level, caller, msg。 |
-loggerLevel | string | "INFO" | 最低日志级别。可选值:INFO, WARN, ERROR, FATAL, PANIC(默认"INFO")。 |
-loggerMaxArgLen | int | 1000 | 单个日志参数的最大长度。超过该长度的参数会被截断显示为 'arg_start..arg_end',其中前后部分长度不超过 -loggerMaxArgLen / 2。 |
-loggerOutput | string | "stderr" | 日志输出位置。支持值:stderr, stdout(默认"stderr")。 |
-loggerTimezone | string | "UTC" | 日志时间戳使用的时区。时区需为有效的 IANA 时区名称,例如 America/New_York、Europe/Berlin、Etc/GMT+3 或 Local(默认"UTC")。 |
-loggerWarnsPerSecondLimit | int | 0 | 每秒允许的最大 WARN 日志数量。超过该值的警告日志将被抑制。0 表示不限制。 |
-maxConcurrentInserts | int | 4 | 最大并发插入请求数。客户端网络慢时可调高。默认值依 CPU 核数设定,一般适用。详见 -insert.maxQueueDuration。 |
-memory.allowedBytes | size | 0 | VictoriaMetrics 缓存可占用的系统内存大小(字节)。设置非零值时覆盖 -memory.allowedPercent。值过低会增加缓存未命中率,导致更高 CPU 和磁盘 IO。支持单位后缀 KB, MB, GB 等。 |
-memory.allowedPercent | float | 60 | VictoriaMetrics 缓存允许占用的系统内存百分比。详见 -memory.allowedBytes。过低会增加缓存未命中率,过高可能导致更多磁盘 IO。 |
-metrics.exposeMetadata | bool | 无 | 是否在 /metrics 页面暴露 TYPE 和 HELP 元数据。某些系统(如 Google Cloud Managed Prometheus)需要这些信息。 |
-metricsAuthKey | string | 无 | /metrics 接口的认证密钥。通过 authKey 查询参数传递,优先于 httpAuth.* 设置。可从文件或 HTTP/HTTPS URL 读取。 |
-pprofAuthKey | string | 无 | /debug/pprof/* 接口的认证密钥。通过 authKey 查询参数传递,优先于 httpAuth.* 设置。可从文件或 HTTP/HTTPS URL 读取。 |
-precisionBits | int | 64 | 每个值存储的精度位数。位数越低压缩率越高,但精度损失越大。(默认64) |
-prevCacheRemovalPercent | float | 0.1 | 当前缓存服务请求比例低于该值时,上一缓存中的条目被移除。提高该值降低内存使用但增加 CPU 使用。详见 -cacheExpireDuration。 |
-pushmetrics.disableCompression | bool | 无 | 是否禁用推送到所有 -pushmetrics.url 的请求体压缩。 |
-pushmetrics.extraLabel | array | 无 | 向所有 -pushmetrics.url 推送的指标添加额外标签。例如 -pushmetrics.extraLabel='instance="foo"'。支持数组和多次设置。 |
-pushmetrics.header | array | 无 | 向所有 -pushmetrics.url 发送的 HTTP 请求头。例如 -pushmetrics.header='Authorization: Basic foobar'。支持数组和多次设置。 |
-pushmetrics.interval | duration | 10s | 向所有 -pushmetrics.url 推送指标的时间间隔。 |
-loggerDisableTimestamps | bool | false | 是否禁用日志中时间戳的写入。 |
-loggerErrorsPerSecondLimit | int | 0 | 每秒允许输出的 ERROR 消息数量上限,超过限制的错误将被抑制。0 表示不限制。 |
-loggerFormat | string | "default" | 日志格式。可选值:default, json。 |
-loggerJSONFields | string | "" | JSON 格式日志中字段重命名,例如 "ts:timestamp,msg:message" 将 "ts" 重命名为 "timestamp"。支持字段:ts, level, caller, msg。 |
-loggerLevel | string | "INFO" | 日志最低输出级别。可选值:INFO, WARN, ERROR, FATAL, PANIC。 |
-loggerMaxArgLen | int | 1000 | 单个日志参数的最大长度,超过长度的参数会被截断为 'arg_start..arg_end'。 |
-loggerOutput | string | "stderr" | 日志输出位置。支持值:stderr, stdout。 |
-loggerTimezone | string | "UTC" | 日志时间戳使用的时区,需为有效的 IANA 时区名称,例如 America/New_York。 |
-loggerWarnsPerSecondLimit | int | 0 | 每秒允许输出的 WARN 消息数量上限,超过限制的警告将被抑制。0 表示不限制。 |
-maxConcurrentInserts | int | 4 | 最大并发写入请求数量,默认根据 CPU 核心数自动设置。 |
-memory.allowedBytes | size | 0 | VictoriaMetrics 缓存可使用的系统内存大小,优先级高于 -memory.allowedPercent。支持单位 KB, MB, GB 等。 |
-memory.allowedPercent | float | 60 | VictoriaMetrics 缓存可使用的系统内存百分比。 |
-metrics.exposeMetadata | bool | false | 是否在 /metrics 页面暴露 TYPE 和 HELP 元数据。 |
-metricsAuthKey | string | "" | /metrics 端点访问的认证密钥。支持从文件或 URL 读取。 |
-pprofAuthKey | string | "" | /debug/pprof/* 端点访问的认证密钥。支持从文件或 URL 读取。 |
-precisionBits | int | 64 | 每个数值存储的精度位数,较低值可提高压缩率但降低精度。 |
-prevCacheRemovalPercent | float | 0.1 | 上一代缓存中的条目被清除的阈值百分比,较高值减少内存使用但增加 CPU 使用。 |
-pushmetrics.disableCompression | bool | false | 推送指标时是否禁用请求体压缩。 |
-pushmetrics.extraLabel | array | [] | 额外添加到推送指标的标签数组,例如 instance="foo"。 |
-pushmetrics.header | array | [] | 推送指标时附加的 HTTP 请求头,例如 Authorization。 |
-pushmetrics.interval | duration | 10s | 推送指标的时间间隔。 |
-pushmetrics.url | array | [] | 需要推送指标的远程 URL 列表。默认不推送。 |
-retentionFilters.cleanInterval | duration | 360h | 清理过期数据的时间间隔。 |
-retentionFilters.config | string | "" | 保留过滤配置文件路径。 |
-retentionFilters.configCheckInterval | duration | 1h | 保留过滤配置文件变更检查间隔。 |
-retentionPeriod | value | 1 | 数据保留周期,超出此周期数据自动删除,支持单位 s,m,h,d,w,y。 |
-retentionTimezoneOffset | duration | 0 | indexdb 轮转执行的时区偏移,0 表示 UTC 4 点。 |
-rpc.disableCompression | bool | false | 是否禁用 vmstorage 到 vmselect 之间数据压缩,禁用可减少 CPU 但增加网络带宽。 |
-search.maxConcurrentRequests | int | 4 | vmstorage 能处理的最大 vmselect 并发请求数。 |
-search.maxQueueDuration | duration | 10s | 请求排队最长等待时间。 |
-search.maxTagKeys | int | 100000 | 单次搜索返回的最大标签键数量。 |
-search.maxTagValues | int | 100000 | 单次搜索返回的最大标签值数量。 |
-search.maxUniqueTimeseries | int | 0 | 查询时可扫描的最大唯一时间序列数,0 表示无限制。 |
-smallMergeConcurrency | int | (废弃) | 已废弃,当前无作用。 |
-snapshotAuthKey | string | "" | /snapshot* 页面访问认证密钥,支持文件或 URL 读取。 |
-snapshotCreateTimeout | duration | (废弃) | 已废弃,无作用。 |
-snapshotsMaxAge | value | 0 | 自动删除超过此时间的快照,支持单位 s,m,h,d,w,y。 |
-storage.cacheSizeIndexDBDataBlocks | size | 0 | indexdb/dataBlocks 缓存最大尺寸。 |
-storage.cacheSizeIndexDBIndexBlocks | size | 0 | indexdb/indexBlocks 缓存最大尺寸。 |
-storage.cacheSizeIndexDBTagFilters | size | 0 | indexdb/tagFiltersToMetricIDs 缓存最大尺寸。 |
-storage.cacheSizeStorageTSID | size | 0 | storage/tsid 缓存最大尺寸。 |
-storage.maxDailySeries | int | 0 | 24 小时内可新增的最大唯一序列数,超过的序列将被丢弃并记录日志。 |
-storage.maxHourlySeries | int | 0 | 1 小时内可新增的最大唯一序列数,超过的序列将被丢弃并记录日志。 |
-storage.maxSeriesPerSecond | int | 2000 | 每秒最大可创建的序列数,超过限制会丢弃并记录日志。 |
-storage.minFreeDiskSpaceBytes | size | 10000000 | 存储路径剩余最小磁盘空间,低于该值存储停止接收数据。 |
-storage.vminsertConnsShutdownDuration | duration | 25s | 优雅关闭 vminsert 连接所需时间,控制关闭速度以减少负载波动。 |
-storageDataPath | string | "vmstorage-data" | 存储数据路径。 |
-tls | array | [] | 是否为指定 HTTP 监听地址启用 TLS,需同时设置证书和密钥文件。 |
-tlsCertFile | array | [] | TLS 证书文件路径,支持动态更新。 |
-tlsCipherSuites | array | [] | TLS 加密套件列表。 |
-tlsKeyFile | array | [] | TLS 密钥文件路径,支持动态更新。 |
-tlsMinVersion | array | [] | TLS 最低版本要求,支持 TLS10, TLS11, TLS12, TLS13。 |
-version | bool | false | 显示 VictoriaMetrics 版本。 |
-vminsertAddr | string | ":8400" | vminsert 服务监听地址。 |
-vmselectAddr | string | ":8401" | vmselect 服务监听地址。 |