我希望有人可以帮助我解决WAL运费和热备用问题。我的备用系统运行了好几个星期,然后它突然开始寻找不存在的.history文件。然后它崩溃了,我无法在不重建备用数据库的情况下成功重启它。
两个系统都运行CentOS 4.5和postgres 8.4.1。他们使用NFS在待机状态下存储生产中的WAL文件。
日志的相关部分,带有我的评论:
[** Recovery is running normally **]
Trigger file : /tmp/pgsql.trigger
Waiting for WAL file : 00000001000000830000005B
WAL file path : /var/tafkan_backup_from_db1/00000001000000830000005B
Restoring to : pg_xlog/RECOVERYXLOG
Sleep interval : 2 seconds
Max wait interval : 0 forever
Command for restore : cp "/var/tafkan_backup_from_db1/00000001000000830000005B" "pg_xlog/RECOVERYXLOG"
Keep archive history : 00000001000000830000004D and later
WAL file not present yet. Checking for trigger file...
WAL file not present yet. Checking for trigger file...
WAL file not present yet. Checking for trigger file...
running restore : OK
Trigger file : /tmp/pgsql.trigger
Waiting for WAL file : 00000001000000830000005B
WAL file path : /var/tafkan_backup_from_db1/00000001000000830000005B
Restoring to : pg_xlog/RECOVERYXLOG
Sleep interval : 2 seconds
Max wait interval : 0 forever
Command for restore : cp "/var/tafkan_backup_from_db1/00000001000000830000005B" "pg_xlog/RECOVERYXLOG"
Keep archive history : 000000000000000000000000 and later
running restore : OK
[** All of a sudden it starts looks for .history files **]
Trigger file : /tmp/pgsql.trigger
Waiting for WAL file : 00000002.history
WAL file path : /var/tafkan_backup_from_db1/00000002.history
Restoring to : pg_xlog/RECOVERYHISTORY
Sleep interval : 2 seconds
Max wait interval : 0 forever
Command for restore : cp "/var/tafkan_backup_from_db1/00000002.history" "pg_xlog/RECOVERYHISTORY"
Keep archive history : 000000000000000000000000 and later
running restore :cp: cannot stat `/var/tafkan_backup_from_db1/00000002.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000002.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000002.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000002.history': No such file or directory
not restored
history file not found
Trigger file : /tmp/pgsql.trigger
Waiting for WAL file : 00000001.history
WAL file path : /var/tafkan_backup_from_db1/00000001.history
Restoring to : pg_xlog/RECOVERYHISTORY
Sleep interval : 2 seconds
Max wait interval : 0 forever
Command for restore : cp "/var/tafkan_backup_from_db1/00000001.history" "pg_xlog/RECOVERYHISTORY"
Keep archive history : 000000000000000000000000 and later
running restore :cp: cannot stat `/var/tafkan_backup_from_db1/00000001.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000001.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000001.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000001.history': No such file or directory
not restored
history file not found
[** I stopped Postgres, renamed recovery.done to recovery.conf, and restarted it. **]
Trigger file : /tmp/pgsql.trigger
Waiting for WAL file : 00000002.history
WAL file path : /var/tafkan_backup_from_db1/00000002.history
Restoring to : pg_xlog/RECOVERYHISTORY
Sleep interval : 2 seconds
Max wait interval : 0 forever
Command for restore : cp "/var/tafkan_backup_from_db1/00000002.history" "pg_xlog/RECOVERYHISTORY"
Keep archive history : 000000000000000000000000 and later
running restore :cp: cannot stat `/var/tafkan_backup_from_db1/00000002.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000002.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000002.history': No such file or directory
cp: cannot stat `/var/tafkan_backup_from_db1/00000002.history': No such file or directory
not restored
history file not found
Trigger file : /tmp/pgsql.trigger
Waiting for WAL file : 0000000200000083000000A2
WAL file path : /var/tafkan_backup_from_db1/0000000200000083000000A2
Restoring to : pg_xlog/RECOVERYXLOG
Sleep interval : 2 seconds
Max wait interval : 0 forever
Command for restore : cp "/var/tafkan_backup_from_db1/0000000200000083000000A2" "pg_xlog/RECOVERYXLOG"
Keep archive history : 000000000000000000000000 and later
WAL file not present yet. Checking for trigger file...
WAL file not present yet. Checking for trigger file...
WAL file not present yet. Checking for trigger file...
WAL file not present yet. Checking for trigger file...
[** This file is not present. All WAL files start with 00000001. **]
有什么想法吗?我甚至都不知道.history文件是什么,而且(大多数优秀的)文档在这方面都不是很清楚。
PS。我希望我正在运行虚拟机,所以我可以使用link text而不必担心任何这个应用程序级别的HA废话: - )
更新:此时是备用服务器的一些日志。它看起来像服务器停止恢复和上线,但我不知道是什么。我很确定没有任何东西可以创建触发器文件。
2010-01-20 03:30:15 EST 4b3a5c63.401b LOG: restored log file "00000001000000830000005A" from archive
2010-01-20 03:30:23 EST 4b3a5c63.401b LOG: restored log file "00000001000000830000005B" from archive
2010-01-20 03:30:23 EST 4b3a5c63.401b LOG: record with zero length at 83/5BFA2FF8
2010-01-20 03:30:23 EST 4b3a5c63.401b LOG: redo done at 83/5BFA2FAC
2010-01-20 03:30:23 EST 4b3a5c63.401b LOG: last completed transaction was at log time 2010-01-20 03:28:04.594399-05
2010-01-20 03:30:25 EST 4b3a5c63.401b LOG: restored log file "00000001000000830000005B" from archive
2010-01-20 03:30:37 EST 4b3a5c63.401b LOG: selected new timeline ID: 2
2010-01-20 03:30:49 EST 4b3a5c63.401b LOG: archive recovery complete
2010-01-20 03:30:59 EST 4b3a5c62.4019 LOG: database system is ready to accept connections
答案 0 :(得分:1)
HA的一种完全不同的方法可能是在两台机器之间共享的DRBD设备上托管PG数据库。
答案 1 :(得分:1)
您是否使用自己的恢复脚本/程序?如果是 - 请不要这样做。使用PostgreSQL contrib。
中的pg_standby否则 - 只需忽略.history文件。
答案 2 :(得分:1)
您的复制副本在某个时候上线了。 “00000002.history”正在寻找时间轴00000002的历史文件,而其余的日志则以00000001开始,这是原始时间轴。
我会在开始查找历史文件之前检查你的PostgreSQL日志,看看是否有任何关于数据库上线的迹象,即使是片刻。
答案 3 :(得分:1)
我能够通过更新我的两个PostgreSQL服务器上的CentOS操作系统来解决这个问题。因此,我认为这是某种基础网络错误的症状。