首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Postgresql pg_standby永远不能执行故障切换

Postgresql pg_standby永远不能执行故障切换
EN

Stack Overflow用户
提问于 2010-08-11 19:23:26
回答 2查看 1.9K关注 0票数 2

我有一个工作的WAL运输设置与应用WAL文件的热备用从属服务器。

当我创建pg_standby触发器文件时,它会立即检测到这一点,但需要大约10-15分钟才能真正准备好接受连接。大部分时间都花在等待.history文件上。

触发器文件为空,因此应执行“智能”故障转移。我能做些什么来使故障转移(更)更快吗?

日志输出:

代码语言:javascript
复制
WAL file not present yet. Checking for trigger file...
trigger file found: smart failover
LOG:  could not open file "pg_xlog/000000010000000000000089" (log file 0, segment 137): No such file or directory
LOG:  redo done at 0/88003428
LOG:  last completed transaction was at log time 2010-08-10 13:26:20.232799+00
Trigger file        : /psql_archive/role.master
Waiting for WAL file    : 000000010000000000000088
WAL file path       : /psql_archive/000000010000000000000088
Restoring to        : pg_xlog/RECOVERYXLOG
Sleep interval      : 60 seconds
Max wait interval   : 0 forever
Command for restore : cp "/psql_archive/000000010000000000000088" "pg_xlog/RECOVERYXLOG"
Keep archive history    : 000000000000000000000000 and later
trigger file found: smart failover
running restore     : OK

LOG:  restored log file "000000010000000000000088" from archive
Trigger file        : /psql_archive/role.master
Waiting for WAL file    : 00000002.history
WAL file path       : /psql_archive/00000002.history
Restoring to        : pg_xlog/RECOVERYHISTORY
Sleep interval      : 60 seconds
Max wait interval   : 0 forever
Command for restore : cp "/psql_archive/00000002.history" "pg_xlog/RECOVERYHISTORY"
Keep archive history    : 000000000000000000000000 and later
running restore     :cp: cannot stat `/psql_archive/00000002.history': No such file or directory
cp: cannot stat `/psql_archive/00000002.history': No such file or directory
cp: cannot stat `/psql_archive/00000002.history': No such file or directory
cp: cannot stat `/psql_archive/00000002.history': No such file or directory
not restored
history file not found
LOG:  selected new timeline ID: 2
Trigger file        : /psql_archive/role.master
Waiting for WAL file    : 00000001.history
WAL file path       : /psql_archive/00000001.history
Restoring to        : pg_xlog/RECOVERYHISTORY
Sleep interval      : 60 seconds
Max wait interval   : 0 forever
Command for restore : cp "/psql_archive/00000001.history" "pg_xlog/RECOVERYHISTORY"
Keep archive history    : 000000000000000000000000 and later
running restore     :cp: cannot stat `/psql_archive/00000001.history': No such file or directory
cp: cannot stat `/psql_archive/00000001.history': No such file or directory
cp: cannot stat `/psql_archive/00000001.history': No such file or directory
cp: cannot stat `/psql_archive/00000001.history': No such file or directory
not restored
history file not found
LOG:  archive recovery complete
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

谢谢。

-dennis

EN

回答 2

Stack Overflow用户

发布于 2010-08-12 00:53:52

简而言之,如果您不使用快速故障转移,pg_standby将继续处理剩下的所有日志(它应该这样做),以最大限度地减少数据丢失。

为了让你的生活更轻松,我会看看PITRTools。

票数 1
EN

Stack Overflow用户

发布于 2010-08-11 22:46:13

根据文档:http://www.postgresql.org/docs/current/static/pgstandby.html

快速故障切换:在快速故障切换中,服务器会立即启动。存档中任何尚未应用的WAL文件都将被忽略,并且这些文件中的所有事务都将丢失。要触发快速故障切换,请创建触发器文件并将单词fast写入其中。还可以将pg_standby配置为在定义的时间间隔内未出现新的WAL文件时自动执行快速故障转移。

或者查看“表F-23. pg_standby选项”中描述的最大等待时间。

干杯

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3457727

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档