首页 > 解决方案 > Postgresql 复制意外停止 从属服务器的服务未启动。如何恢复复制?

问题描述

Postgres 复制在 Postgresql 9.5 版中运行良好。当创建了具有 10gb 数据的 DB 模板然后从服务器停止时。它的 Postgres 服务现在还没有启动。你能建议如何重新配置​​复制吗?我曾尝试重新安装并执行相同的复制过程,但在从主服务器复制数据文件夹后,服务没有运行,除了 conf 文件。这些是我遵循的步骤: 在大师中:-

*C:\Programfiles\PostgreSql\9.5\data\postgresql.conf
Modifications:
listen_addresses = '*'
wal_level = hot_standby
max_wal_senders = 1
wal_keep_segments = 5
* C:\Programfiles\PostgreSql\9.5\data\pg_hba.conf
    Add:                                
host    replication     postgres        x.x.x.x/32         trust

在奴隶:

'*C:\Programfiles\PostgreSql\9.5\data\postgresql.conf'
    'hot_standby = on'

然后在路径下创建一个名为recovery.conf的文件

‘C:\Programfiles\PostgreSql\9.5\data\’  and add:'
'standby_mode = 'on'
'primary_conninfo = 'host=x.x.x.x port=5432  user=postgres'  
'password=*****''
'trigger_file = 'E:\replication\trigger.txt'    

在 Master 中:启动 Postgresql 服务。打开 Sql Shell(psql) 输入命令

select pg_start_backup('base backup');

然后将除postmaster.pid之外的数据目录的所有内容,以及所有配置文件(.conf)复制到Slave系统的数据目录下,输入命令

select pg_stop_backup();

请提出一种恢复此复制的方法。

这是错误日志

2018-07-30 15:26:57 +04 FATAL:  the database system is starting up
2018-07-30 15:26:57 +04 LOG:  database system was interrupted while in 
recovery at log time 2018-07-07 12:21:38 +04
2018-07-30 15:26:57 +04 HINT:  If this has occurred more than once some data 
might be corrupted and you might need to choose an earlier recovery target.
2018-07-30 15:26:58 +04 FATAL:  the database system is starting up
2018-07-30 15:26:59 +04 FATAL:  the database system is starting up
2018-07-30 15:27:00 +04 FATAL:  the database system is starting up
2018-07-30 15:27:00 +04 LOG:  entering standby mode
2018-07-30 15:27:00 +04 LOG:  redo starts at 6F/5B387B70
2018-07-30 15:27:01 +04 LOG:  consistent recovery state reached at 
6F/5BD384F0
2018-07-30 15:27:01 +04 WARNING:  page 4 of relation base/16394/27254 does 
not exist
2018-07-30 15:27:01 +04 CONTEXT:  xlog redo Heap2/VISIBLE: cutoff xid 0
2018-07-30 15:27:01 +04 PANIC:  WAL contains references to invalid pages
2018-07-30 15:27:01 +04 CONTEXT:  xlog redo Heap2/VISIBLE: cutoff xid 0
2018-07-30 15:27:01 +04 LOG:  database system is ready to accept read only 
connections
2018-07-30 15:27:01 +04 FATAL:  role "WIN-6QQN9PM6AUG$" does not exist
2018-07-30 15:27:01 +04 LOG:  startup process (PID 2808) was terminated by         
exception 0xC0000409
2018-07-30 15:27:01 +04 HINT:  See C include file "ntstatus.h" for a 
description of the hexadecimal value.
2018-07-30 15:27:01 +04 LOG:  terminating any other active server processes

标签: postgresqldatabase-replicationpostgresql-9.5

解决方案


推荐阅读