服务端写入批量处理
GreptimeDB 可以在将写入刷写到存储之前进行批量处理。请在 standalone 或 frontend 配置文件中配置。写入批量处理默认关闭。
[pending_rows_batcher] 对写入普通表的请求进行批量处理。[pending_rows_batcher.logical_table] 对使用 metric engine 逻辑表的 Prometheus Remote Write 和 Prometheus 兼容格式的 OTLP 指标进行批量处理。
普通表批量处理
要为普通表启用批量处理,请配置至少一个协议和非零刷写间隔:
[pending_rows_batcher]
protocols = ["influxdb"]
pending_rows_flush_interval = "500ms"
此批量写入器支持 influxdb、opentsdb、otlp、logs、loki、splunk、elasticsearch、http_sql、mysql、postgres 和 prom。
未启用 metric engine 时,Prometheus Remote Write 使用此批量写入器。OTLP 日志、追踪和未使用 metric engine 的 OTLP 指标也使用它。MySQL 和 PostgreSQL 对符合条件的 INSERT 使用它。它不支持流式 Flow 源表。
Metric engine 逻辑表批量处理
此批量写入器仅支持 prom 和 otlp。启用 metric engine 后,它处理 Prometheus Remote Write 和 Prometheus 兼容格式的 OTLP 指标:
[prom_store]
with_metric_engine = true
[pending_rows_batcher.logical_table]
protocols = ["prom"]
pending_rows_flush_interval = "500ms"
日志、追踪和使用旧写入格式的 OTLP 指标不使用此批量写入器。它的配置独立于 [pending_rows_batcher]。省略的字段使用该配置节的默认值,不会继承父配置节的值。
配置空 protocols 数组或 0s 间隔会禁用逻辑表批量处理,且不会回退到旧配置。
为保持兼容性,仅当省略 [pending_rows_batcher.logical_table] 且 [pending_rows_batcher] 未启用 prom 时,GreptimeDB 才使用现有的 [prom_store] 批量写入配置。