You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WireGuard环境下PostgreSQL流复制间歇性TCP连接中断与超时问题求助

WireGuard环境下PostgreSQL流复制间歇性TCP连接中断与超时问题求助

各位好,想请教个困扰我一阵的问题:

我目前有三台服务器,全部通过WireGuard实现了全互联,系统都是Ubuntu Server 22.04,上面跑着用流复制搭建的PostgreSQL集群。虽然每台机器都有公网IP,但PostgreSQL实例和数据库客户端全程都是用WireGuard的内部VPN地址通信的。

今天在其中一台机器的PostgreSQL日志里反复看到这类错误:

2024-07-26 07:23:14.463 UTC [147915] FATAL:  could not receive data from WAL stream: server closed the connection unexpectedly
2024-07-26 07:25:56.242 UTC [148509] FATAL:  could not receive data from WAL stream: server closed the connection unexpectedly
2024-07-26 07:28:17.567 UTC [148818] FATAL:  could not receive data from WAL stream: server closed the connection unexpectedly
2024-07-26 07:33:13.234 UTC [149090] FATAL:  could not receive data from WAL stream: server closed the connection unexpectedly
2024-07-26 07:48:42.721 UTC [149723] FATAL:  terminating walreceiver due to timeout
2024-07-26 07:52:17.298 UTC [151521] FATAL:  could not receive data from WAL stream: server closed the connection unexpectedly

这些错误是间歇性出现的,一会儿是连接被主库意外关闭,一会儿又是walreceiver因为超时被终止,导致流复制时不时中断又自动重试,但频繁出现的话还是会影响集群稳定性。

有没有大佬遇到过类似的情况?或者能给一些排查的方向?比如是不是WireGuard的连接稳定性问题?还是PostgreSQL的流复制参数需要调整?

备注:内容来源于stack exchange,提问作者nagylzs

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 10:52:56