删除WAL文件后,PostgreSQL热备用将无法启动

时间:2013-02-10 03:24:01

标签: postgresql postgresql-9.1

我有一个PostgreSQL 9.1热备用服务器。 WAL文件最终占用了整个HD,所以我最终删除了所有的WAP文件。我想如何重新启动服务器以便运行:

/usr/local/pgsql/bin/pg_ctl start  -D /usr/local/pgsql/data

问题是服务器从未完全启动。我看到以下是不停丢失的WAL文件日志输出:

server starting
sh-4.1$ LOG:  database system was shut down in recovery at 2013-02-10 03:17:06 UTC
LOG:  entering standby mode
cp: cannot stat `/usr/local/pgsql/wals/0000000100000035000000A4': No such file or directory
LOG:  redo starts at 35/A4943928
LOG:  consistent recovery state reached at 35/A4AE8EB8
LOG:  database system is ready to accept read only connections
LOG:  invalid record length at 35/A4AE8EB8
cp: cannot stat `/usr/local/pgsql/wals/0000000100000035000000A4': No such file or directory
LOG:  streaming replication successfully connected to primary
FATAL:  could not receive data from WAL stream: FATAL:  requested WAL segment 0000000100000035000000A4 has already been removed

如何恢复服务器?

2 个答案:

答案 0 :(得分:3)

您需要从转储(或文件系统副本)重新创建热备用服务器。

您可以在本手册中找到有关如何操作的详细信息:High Availability, Load Balancing, and Replication

答案 1 :(得分:0)

在以流模式将从属设备连接到主要主机之前,请检查所需的wal是否位于要恢复初始恢复的位置...由于您要恢复的位置上的wal段不可用,可能会出现上述问题初始恢复...如果这种情况很好,那么请检查recovery.conf中的restore_command。