环境
redis-ha主从部署到了k8s上
主从报错日志
主库日志
1:M 29 Nov 2023 07:00:19.277 # Diskless rdb transfer, done reading from pipe, 1 replicas still up.
1:M 29 Nov 2023 07:00:20.058 * Background RDB transfer terminated with success
1:M 29 Nov 2023 07:00:20.058 * Streamed RDB transfer with replica 10.97.141.243:6379 succeeded (socket). Waiting for REPLCONF ACK from slave to enable streaming
1:M 29 Nov 2023 07:00:20.058 * Synchronization with replica 10.97.141.243:6379 succeeded
1:M 29 Nov 2023 07:00:20.058 * Starting BGSAVE for SYNC with target: replicas sockets
1:M 29 Nov 2023 07:00:20.691 * Background RDB transfer started by pid 897
1:M 29 Nov 2023 07:02:50.161 # Connection with replica 10.97.141.243:6379 lost.
从报错可知,是开启了无盘复制参数 repl-diskless-sync
从库日志
1:S 29 Nov 2023 06:54:45.961 * MASTER <-> REPLICA sync: receiving streamed RDB from master with EOF to disk
1:S 29 Nov 2023 07:00:18.665 * MASTER <-> REPLICA sync: Flushing old data
1:signal-handler (1701241365) Received SIGTERM scheduling shutdown...
经过一系列的排查未发现 redis 及内存方面的原因导致这种情况出现,最后describe pod 的时候发现存活性检测失败的问题,进一步排查发现从库在 Flushing old data 的时候会阻塞那个存活性检测脚本,导致失败,然后 kill 掉 pod,固日志中会有 Received SIGTERM scheduling shutdown 这个信号。
解决方法
将 livenessProbe 中 timeoutSeconds 调大即可。
livenessProbe:initialDelaySeconds: 30periodSeconds: 15timeoutSeconds: 900successThreshold: 1failureThreshold: 5