加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

备份 – PostgreSQL连续归档未运行archive_command

发布时间:2020-12-13 16:20:50 所属栏目:百科 来源:网络整理
导读:我一直在尝试为一个简单的测试PostgreSQL 9.0数据库设置连续存档,按照 the documentation.在postgres.conf中,我设置了: wal_level = archive archive_mode = on archive_command = ‘touch /home/myusername/backup/testtouch’ archive_timeout = 30s …并
我一直在尝试为一个简单的测试PostgreSQL 9.0数据库设置连续存档,按照 the documentation.在postgres.conf中,我设置了:

wal_level = archive
archive_mode = on
archive_command = ‘touch /home/myusername/backup/testtouch’
archive_timeout = 30s

…并重新启动PostgreSQL.触摸列出的文件永远不会出现.我可以手动运行touch命令,它按预期工作.
如果我尝试创建备份,它会永远等待archive_command.在psql中;

postgres=# SELECT pg_start_backup(‘touchtest’);
pg_start_backup
—————–
0/14000020 (1 row)

postgres=# SELECT pg_stop_backup();
NOTICE: pg_stop_backup cleanup done,waiting for required WAL segments to be archived > WARNING: pg_stop_backup still waiting for all required WAL segments to be archived (60 seconds elapsed)
HINT: Check that your archive_command is executing properly. pg_stop_backup can be cancelled safely,but the database backup will not be usable without all the WAL segments.

什么会导致这个?我该如何排除故障?

附加信息:在CentOS 5.4上运行.以root身份安装PostgreSQL 9.0.2.

更新:我首先尝试使用cp -i%p / home / myusername / backup /%f< / dev / null和test进行归档! -f / home / myusername / backup /%f&& cp%p / home / myusername / backup /%f以匹配手册.我将其简化为更简单的触摸呼叫以进行故障排除.

Postgres配置看起来正确

CentOS默认情况下将用户目录模式设置为700,因此请检查是否确实是这种情况,以及是否可以使用su作为root用户触摸该文件

su - postgres -c "touch /home/myusername/backup/testtouch"

如果确实有效,那么尝试在postgres中使用详细日志记录并检查postgres日志以获取更多错误.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读