--- title: "VictoriaMetrics" type: entity aliases: [VictoriaMetrics, VM, vmstorage] tags: [time-series, prometheus, long-term-storage, monitoring, scalable] date: 2025-11-11 --- # VictoriaMetrics ## Overview VictoriaMetrics 是高性能、成本优化的时序数据库,专为 Prometheus 设计,提供长期存储和高可用方案。相比原生 Prometheus TSDB,VictoriaMetrics 支持几乎无限的存储扩展,同时保持与 Prometheus Remote Write API 和 PromQL 的完全兼容。常见于单主机和小型集群场景的长期存储替代。 ## Key Characteristics - **Prometheus 兼容**:100% 兼容 PromQL,支持 Remote Write 协议 - **高性能写入**:单节点支持每秒百万级指标写入 - **资源效率**:比 Prometheus TSDB 更低内存和磁盘占用 - **长期存储**:支持数据分层(热数据/冷数据)和压缩归档 - **集群模式**:支持水平扩展,满足大规模需求 - **单一二进制**:无外部依赖,开箱即用 ## Prometheus Remote Write Integration ```yaml # prometheus.yml remote_write: - url: http://victoriametrics:8428/api/v1/write # 可选:queue 配置 queue_config: capacity: 10000 max_shards: 30 min_shards: 1 max_samples_per_send: 10000 ``` ## Use Cases 1. **长期数据保留**:存储超过 30 天的指标数据 2. **多 Prometheus 聚合**:接收多个 Prometheus 实例数据集中查询 3. **高性能写入**:高 cardinality 指标场景(如微服务 Kubernetes 集群) 4. **成本优化**:降低 Prometheus 存储成本 ## Comparison | 维度 | VictoriaMetrics | Prometheus TSDB | Thanos | |------|---------------|----------------|--------| | 部署复杂度 | 低 | 极低 | 高 | | 扩展性 | 中(集群模式) | 无 | 高 | | 存储成本 | 低 | 中 | 中 | | 兼容性 | PromQL 100% | 原生 | Sidecar 模式 | | 适用规模 | 中小型 | 单实例 | 大型多租户 | ## Related Sources - [[家庭监控方案-prometheus-grafana-node-exporter-cadvisor-blackbox]] ## Related Entities - [[Prometheus]] — 数据源和写入端 ## Related Concepts - [[时序数据库]] — 数据存储层 - [[Exporter]] — 数据来源