| 写入方向 | InfluxDB 推送(HTTP/客户端),Prometheus 主动拉取(scrape) |
|---|---|
| 数据模型 | InfluxDB:measurement/tag/field;Prometheus:指标名 + 标签集 + 值 |
| 本地存储 | Prometheus 按时间分块(常见 2 小时块)+ WAL,按时间/大小保留 |
| 长期化 | Prometheus 通过 remote_write 或联邦方案扩展;InfluxDB 靠 bucket/RP 与集群 |
示例
示例
InfluxDB push:
cpu,host=web-1 usage=0.73 1719792000000000000
Prometheus pull(scrape 配置):
scrape_configs:
- job_name: node
static_configs:
- targets: ["web-1:9100"]选型看采集方式与生态:已有 Prometheus 体系常用远程写扩存;需要应用侧直接写入与灵活保留策略时 InfluxDB 更贴合。