Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3891514
  • 博文数量: 534
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4800
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(534)

文章存档

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(253)

2006年(73)

分类: Mysql/postgreSQL

2019-11-26 16:51:44

PG归档模式:

一旦某个日志删除了,还没有归档,下次启动还会继续从这个日志开始归档。
然后还找不到这个日志对应,pg_log下面有提示:
cp: cannot stat `pg_xlog/00000001000000000000008E': No such file or directory
2019-11-26 16:26:46 CST LOG:  archive command failed with exit code 1
2019-11-26 16:26:46 CST DETAIL:  The failed archive command was: test ! -f /opt/PostgreSQL/9.5/data/archivedir/00000001000000000000008E && cp pg_xlog/00000001000000000000008E /opt/PostgreSQL/9.5/data/archivedir/00000001000000000000008E
2019-11-26 16:26:46 CST WARNING:  archiving transaction log file "00000001000000000000008E" failed too many times, will try again later

怎么办?

试过办法1:
1、先修改为非归档
修改postgresql.conf中archive_mode =off,然后重启pg。
发现pg会把然后没有归档日志自己给删除掉了。包括没有归档的。【好奇怪,不理解数据库为什么这么干,PG 9.5版本】
2、然后再修改为archive_mode=on,再重启pg
气死了,还继续从00000001000000000000008E开始归档。报错继续。。。

怎么办呢?
本来想试图修改数据库让他从别的日志开始归档,但找了半天没找到。如是感觉应该可以从:
archive_command 命令下手,想办法修改这个归档命令,骗过数据库说归档成功了。应该也可以吧。

==========
最终解决办法:
1、修改postgresql.conf
archive_mode=on 
archive_command = 'ls -l /opt/PostgreSQL/9.5/data/pg_xlog/ '  #可能别的命令也可以,只要执行的时候不报错应该就可以。达到骗过pg的目的就可以了。

2、重启数据库。
发现还真都成功了。

3、修改postgresql.conf为正常了。
archive_mode=on, 
archive_command = 'test ! -f /opt/PostgreSQL/9.5/data/archivedir/%f && cp %p /opt/PostgreSQL/9.5/data/archivedir/%f'
然后重启数据库。这样就一切恢复正常了。

阅读(3765) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~