按容灾级别(冷备/T+1/热备/多活)分层描述架构、RPO/RTO、数据路径、变更与演练、以及成本模型。方案完全贴合你给出的“OTLP 优先、双链路(OTel Gateway + Kafka 旁路)、OpenObserve + Kafka + PostgreSQL( Timescale/pgvector/AGE/HLL )”参考架构。
目标
原则
等级 | 典型场景 | RPO/RTO(参考) | 数据路径(简化) | 读写策略 | 成本系数* |
---|---|---|---|---|---|
L1 冷备份 | 合规留存/低频审计 | RPO=T+1;RTO=小时~天 | OTel → OpenObserve(主);S3 CRR 复制到 DR;Kafka 日归档→对象存储 | 故障时离线恢复 | 1.0 |
L2 T+1 分析 | 次日分析、月报/审计 | RPO=T+1;RTO=1~4h | OTel → OpenObserve(主)、Kafka(主) → 每日 ETL → PG(主/DR) | DR 只读分析 | 1.2 |
L3 热备(主动-被动) | 需较快恢复 | RPO≤515min;RTO≤3060min | OTel → 双写 OpenObserve(主/DR) + Kafka(主)→Mirror→Kafka(DR);PG 物理/逻辑复制 | 故障切写到 DR;读本地优先 | 1.6~2.0 |
L4 多活(双活/跨区就近) | 近零丢失/高可用 | RPO≈01min;RTO≤510min | OTel → 双写 OpenObserve(A/B) + Kafka(A/B) 互镜;PG 双集群分域+必要表双向逻辑复制 | 就近写/就近读,对端为备 | 2.2~3.0 |
* 成本系数为相对量纲:以 L1=1.0 作为基线,综合计算:存储 × 保留期 + 计算 × 峰值写入 + 跨区流量。
[Edge / Host / Pod]
└─ Vector(Filelog/Prom) → OTLP/gRPC
↘ (Option) → Kafka.<region>.raw (RF≥3)
[Regional Ingest/Gateway (LB前置)]
└─ OTel Collector (file_storage + sending_queue)
└─ Exporter Fanout:
- OpenObserve.regionX (Search/Alert/Visual)
- Kafka.regionX.raw (System of Record, replay)
- (Option) OpenObserve.regionY (for L3/L4)
[Storage & Analytics]
├─ OpenObserve.regionX (objstore + WAL)
├─ Kafka.regionX (Mirror/Link to regionY)
└─ ETL (Benthos/Flink/Connect) → PostgreSQL( Timescale/pgvector/AGE/HLL )
└─ 连续聚合(CAGG)、TopK/HLL、向量与图分析
OTel Collector(双写 + 旁路 Kafka + 落盘队列)
extensions:
file_storage:
directory: /var/lib/otelcol/queue
receivers:
otlp:
protocols: { grpc: {}, http: {} }
processors:
memory_limiter: { check_interval: 1s, limit_percentage: 75, spike_limit_percentage: 15 }
batch: { send_batch_size: 8192, timeout: 5s }
resourcedetection/system:
detectors: ["system"]; system: { hostname_sources: ["os"] }
exporters:
otlphttp/openobserve_primary:
endpoint: https://oo.regionA.example/api/default/
headers: { Authorization: "Basic xxx" }
sending_queue: { enabled: true, num_consumers: 8, storage: file_storage }
retry_on_failure: { enabled: true, max_elapsed_time: 300s }
otlphttp/openobserve_dr:
endpoint: https://oo.regionB.example/api/default/
headers: { Authorization: "Basic yyy" }
sending_queue: { enabled: true, num_consumers: 8, storage: file_storage }
retry_on_failure: { enabled: true, max_elapsed_time: 300s }
kafka:
brokers: [ "kafka-a-1:9092","kafka-a-2:9092","kafka-a-3:9092" ]
topic: otlp_raw
encoding: otlp_proto
service:
extensions: [ file_storage ]
pipelines:
logs: { receivers: [otlp], processors: [memory_limiter,batch,resourcedetection/system], exporters: [otlphttp/openobserve_primary, otlphttp/openobserve_dr, kafka] }
metrics: { receivers: [otlp], processors: [memory_limiter,batch,resourcedetection/system], exporters: [otlphttp/openobserve_primary, otlphttp/openobserve_dr, kafka] }
traces: { receivers: [otlp], processors: [memory_limiter,batch,resourcedetection/system], exporters: [otlphttp/openobserve_primary, otlphttp/openobserve_dr, kafka] }
Vector(边缘端:本地缓冲 + 双路)
[sources.journald] type = "journald"
[sources.filelog] type = "file"; include = ["/var/log/**.log"]
[transforms.to_otlp] type = "remap"
# 归一字段/标签、生成 log_id = sha256(host+path+offset+ts)
source = '''
.log_id = md5!(.host + to_string!(.file) + to_string!(.timestamp) + to_string!(.message))
'''
[sinks.otel]
type = "otlp"; inputs = ["to_otlp"]; endpoint = "http://otel-gw.local:4317"; mode = "grpc"
request.timeout_secs = 5; acknowledgements.enabled = true; buffer.type = "disk"; buffer.max_size = 268435456
[sinks.kafka]
type = "kafka"; inputs = ["to_otlp"]; bootstrap_servers = "kafka-a-1:9092,kafka-a-2:9092"
topic = "otlp_raw"; compression = "lz4"; acknowledgements = "all"; queue.max_length = 100000
*.raw
(绕过解析,方便二次 ETL)*.norm
(已统一 schema,便于 PG 入仓)REFRESH MATERIALIZED VIEW CONCURRENTLY
补齐窗口;故障切换(L3 示例)
定期演练(季度)
记号:I = 日均摄取量(TB/日)、R = 保留天数、k = 双写系数(多活≈2.0,热备≈1.5,冷备≈1.0)对象存储:
Cost_obj ≈ I * R * k * 单价(TB·月)
计算(OpenObserve/索引与压缩):Cost_cpu ≈ f(I峰值, 并发查询, 压缩率)
跨区流量:Cost_xregion ≈ I * (双写或镜像比例)
Kafka:按吞吐与 RF,磁盘(NVMe)+ 备份(对象存储) PG:SSD 容量(明细+聚合)+ 逻辑/物理副本算力经验系数:L1/L2:跨区流量最低; L3:跨区单向写 + Kafka 镜像; L4:双向写 + 双镜像,流量最高。 优化杠杆:关键租户双写、一般租户单活+冷备;日志正文降噪(采样/模板化)、指标窗口聚合(CAGG)、Trace Tail-based Sampling(保关键异常/高延时)。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。