zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.31k stars 977 forks source link

requested WAL segment 00000001000000040000002D has already been removed #2486

Open avi1818 opened 10 months ago

avi1818 commented 10 months ago

Hi

I have Postgres/patroni cluster with 1 master and 2 slaves. The slaves do not sync from master since some WAL files are missing. How do I force the slaves to sync the database from scratch? (pg_basebackup?).

2023-11-27 16:00:47 UTC [3631]: [4-1] 6564bd2f.e2f 0 [unknown] standby nms-postgres-cluster-1 10.xx ERROR: requested WAL segment 00000001000000040000002D has already been removed 2023-11-27 16:00:47 UTC [3631]: [5-1] 6564bd2f.e2f 0 [unknown] standby nms-postgres-cluster-1 10.xx STATEMENT: START_REPLICATION SLOT "nms_postgres_cluster_1" 4/2D000000 TIMELINE 1 2023-11-27 16:00:47 UTC [3632]: [4-1] 6564bd2f.e30 0 [unknown] standby nms-postgres-cluster-2 10.yy ERROR: requested WAL segment 00000001000000040000002D has already been removed 2023-11-27 16:00:47 UTC [3632]: [5-1] 6564bd2f.e30 0 [unknown] standby nms-postgres-cluster-2 10.yy STATEMENT: START_REPLICATION SLOT "nms_postgres_cluster_2" 4/2D000000 TIMELINE 1

FxKu commented 10 months ago

You can use patronictl reinit to recreate cluster members. Depending on the time of the last basebackup the replica will be bootstrapped from your WAL archive or from another cluster instance (primary or another secondary). That's the easiest way.