fix(postgres): 放宽跨地域 WAL 连接抖动窗口

将生产 WAL sender/receiver timeout 从 CNPG 隐式 5 秒显式调整为 30 秒,避免短时控制面或 Pod 网络停顿反复拆除复制流并触发异步降级。保留 preferred 同步策略,防止副本不可达时冻结全部写入。\n\n影响:仅修改生产 CNPG 参数、发布门禁和运维说明,不改变应用镜像和迁移。仍需通过同步复制、六向链路与验收硬门禁。\n\n验证:kubectl kustomize、bash -n、ShellCheck、manual-release-test。
This commit is contained in:
2026-08-02 00:10:25 +08:00
parent a4046c2b81
commit ac8d6dcf45
3 changed files with 10 additions and 1 deletions
@@ -128,6 +128,13 @@ spec:
shared_buffers: 512MB
wal_compression: "on"
wal_keep_size: 1GB
# CNPG defaults these cross-region liveness timers to 5 seconds. A short
# control-plane or pod-network stall can otherwise tear down a healthy
# WAL stream and make preferred synchronous replication fall back to
# async. Keep failure detection bounded without amplifying a transient
# multi-second stall into repeated reconnects.
wal_sender_timeout: 30s
wal_receiver_timeout: 30s
monitoring:
enablePodMonitor: false
projectedVolumeTemplate:
+1 -1
View File
@@ -41,7 +41,7 @@ NodePort 公网入口。节点防火墙继续由原有 UFW 管理,接入脚本
[生产同构验收模式与高媒体压力测试](production-acceptance.md)。
- 健康双库:同步复制,RPO=0。
- 单库降级:`dataDurability: preferred` 保持写入,`archive_timeout=5min`,灾难 RPO 目标不超过 5 分钟。生产 WAL 段为 16 MiB;禁止把该值降到 60 秒,否则仅空闲切段就要求跨地域链路持续承载至少 2.24 Mbit/s,会使同步副本在当前带宽下永久追不平。
- 单库降级:`dataDurability: preferred` 保持写入,`archive_timeout=5min`,灾难 RPO 目标不超过 5 分钟。生产 WAL 段为 16 MiB;禁止把该值降到 60 秒,否则仅空闲切段就要求跨地域链路持续承载至少 2.24 Mbit/s,会使同步副本在当前带宽下永久追不平。生产同时显式设置 `wal_sender_timeout=30s``wal_receiver_timeout=30s`,避免 5 秒级控制面或 Pod 网络抖动反复拆除 WAL 流;该配置只降低瞬时抖动放大,不替代同步复制、六向链路和复制日志门禁。
- 数据库故障 RTO:不超过 5 分钟。
- 应用发布:香港验收后再滚动宁波,计划内零停机。
- 公网入口:双 NGINX 加人工 AliDNS 切换。接入带健康检查的 GTM 前,不宣称公网入口自动高可用。
+2
View File
@@ -305,6 +305,8 @@ if grep -Fq 'archive_timeout: 60s' "$root/deploy/kubernetes/production/database.
echo 'production archive timeout would exceed the certified cross-region bandwidth floor' >&2
exit 1
fi
grep -Fq 'wal_sender_timeout: 30s' "$root/deploy/kubernetes/production/database.yaml"
grep -Fq 'wal_receiver_timeout: 30s' "$root/deploy/kubernetes/production/database.yaml"
"$root/tests/release/cluster-release-helper-test.sh" >/dev/null
"$root/tests/release/production-acceptance-script-test.sh" >/dev/null