【问题标题】:Postgres 11 replication slot file has wrong magic numberPostgres 11 复制槽文件有错误的幻数
【发布时间】:2021-07-31 18:12:05
【问题描述】:

我们有一个 Postgres 11 集群,其中包含一台主服务器和一台热复制服务器。复制服务器已停止工作很长时间。但是,主服务器遇到了意外的电源故障。之后,它无法重新启动,并且日志显示:

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

有什么办法可以解决这个问题?非常感谢。

【问题讨论】:

    标签: postgresql replication


    【解决方案1】:

    关闭PostgreSQL,进入数据目录运行

    rm -r pg_replslot/replica_1_slot
    

    如果这是您唯一的问题,那么移除复制槽就可以解决问题。

    但是,复制槽通常不会像那样损坏。可能还有其他损坏的文件。

    如果您可以这样启动服务器,请立即使用pg_dumpall,如果成功,请将其恢复到不同硬件上的新集群。如果无法启动服务器,请对数据目录进行文件系统备份。

    测试你的硬件,可能是问题所在。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-27
      • 2017-12-13
      • 1970-01-01
      相关资源
      最近更新 更多