9.4.1中的PostgreSQL切换和回切
环境: PostgreSQL EDB 9.4.1 操作系统:rhel 7 我已将流式复制配置为连续存档。 我已经执行了以下切换和返回步骤 我读过其他文章 我不知道如果存档位置不是共享位置会发生什么。 我已按照以下步骤进行切换和返回 转换 在主机上(192.xxxx.128)9.4.1中的PostgreSQL切换和回切,postgresql,replication,postgresql-9.4,Postgresql,Replication,Postgresql 9.4,环境: PostgreSQL EDB 9.4.1 操作系统:rhel 7 我已将流式复制配置为连续存档。 我已经执行了以下切换和返回步骤 我读过其他文章 我不知道如果存档位置不是共享位置会发生什么。 我已按照以下步骤进行切换和返回 转换 在主机上(192.xxxx.128) 创建recovery.conf: standby_mode = 'on' primary_conninfo = 'user=replication password=Replication@123 host=192.xx
- 创建
:recovery.conf
standby_mode = 'on' primary_conninfo = 'user=replication password=Replication@123 host=192.xxx.129 port=5432' recovery_target_timeline = 'latest' trigger_file = '/tmp/node1' restore_command = 'rsync -a /home/postgres/restore/%f %p
- 连接应用程序并进行测试
- 创建
并添加recovery.conf
standby_mode = 'on' primary_conninfo = 'user=replication password=postgres host=192.xxx.128 port=5432 sslmode=prefer sslcompression=1 krbsrvname=postgres' restore_command = 'cp %p /home/postgres/restore_5444/%f' recovery_target_timeline = 'latest' trigger_file='/tmp/pg_promote_5432'`
recovery\u target\u timeline='latest'
,则它将使用在存档中找到的时间线,但在我的环境中,存档不是共享装载点
如果在存档中找不到时间线,是否通过流式复制接收?是,包含时间线开关的历史文件也将流式传输到备用服务器 它将显示在待机的
pg_wal
目录中。关联的日志消息为:
LOG: fetching timeline history file for timeline 2 from primary server
待机设备将能够通过时间线开关跟随主设备。再次抱歉,我测试了相同的场景,这次我没有提到恢复\u target\u timeline='latest',但当prod进入恢复时,在我提示从设备到主设备后,DR没有启动复制,显示复制已由主设备终止服务器,即使我已发送000002.history文件以将位置还原到dr,但仍不工作。。。请帮助我…如果你想我可以发布新问题我已经发布了关于这个的新问题,请检查。
psql -U postgres -c "select pg_is_in_recovery()"
ps -ef | grep postgres
touch locationoftrigeerfile
pg_ctl -D $PGDATA stop --mode=fast
standby_mode = 'on'
primary_conninfo = 'user=replication password=postgres host=192.xxx.128 port=5432 sslmode=prefer sslcompression=1 krbsrvname=postgres'
restore_command = 'cp %p /home/postgres/restore_5444/%f'
recovery_target_timeline = 'latest'
trigger_file='/tmp/pg_promote_5432'`
pg_ctl -D $PGDATA start --mode=fast
psql -U postgres -c "select pg_is_in_recovery();"
ps -ef | grep postgres
touch locationoftrigeerfile
LOG: fetching timeline history file for timeline 2 from primary server