简体   繁体   中英

Postgres 11 replication slot file has wrong magic number

We had a Postgres 11 cluster contains one master server and had one hot replication server. The replications server had stopped working for a long time. However, the master server encountered an unexpected power failure. Afterwards, it can not restart and the log says:

2021-05-10 10:20:09.134 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2021-05-10 10:20:09.134 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2021-05-10 10:20:09.137 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2021-05-10 10:20:09.245 UTC [22] LOG:  database system was shut down at 2021-05-10 09:30:22 UTC
2021-05-10 10:20:09.248 UTC [22] PANIC:  replication slot file "pg_replslot/replica_1_slot/state" has wrong magic number: 842020920 instead of 17112225
2021-05-10 10:20:09.531 UTC [1] LOG:  startup process (PID 22) was terminated by signal 6
2021-05-10 10:20:09.531 UTC [1] LOG:  aborting startup due to startup process failure
2021-05-10 10:20:09.546 UTC [1] LOG:  database system is shut down

Any way to solve this problem? Many thanks.

Shutdown PostgreSQL, go to the data directory and run

rm -r pg_replslot/replica_1_slot

If that is your only problem, removing the replication slot like that will solve it.

However, replication slots don't normally get corrupted like that. Chances are that there are other corrupted files as well.

If you can start the server like that, take a pg_dumpall right away, and if that succeeds, restore it to a new cluster on different hardware. If you cannot start the server, take a file system backup of the data directory.

Test your hardware, it may be the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM