【发布时间】:2019-11-20 08:06:29
【问题描述】:
环境:
PostgreSQL EDB 9.4.1 操作系统:rhel 7
我已将流式复制配置为连续归档。 我已执行以下步骤进行切换和切回。
我看过this其他文章。
我很困惑如果存档位置不是共享位置会发生什么。 我已按照以下步骤进行切换和切回。
切换
在主人(192.xxxx.128)
pg_ctl -D /opt/PostgresPlus/9.4AS/data stop --mode=fast-
创建
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 pg_ctl -D /opt/PostgresPlus/9.4AS/data startpsql -U postgres -c "select pg_is_in_recovery()"
待机时(192.xx.129):
ps -ef | grep postgrestouch locationoftrigeerfile
在主要 (192.xx.129):
- 连接应用程序和测试
以上步骤完成切换。
现在切换
在主要 (192.xx.129):
pg_ctl -D $PGDATA stop --mode=fast-
创建
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'` pg_ctl -D $PGDATA start --mode=fastpsql -U postgres -c "select pg_is_in_recovery();"
在中学(192.xxx.128):
ps -ef | grep postgrestouch locationoftrigeerfile
我的问题:
对于每个促销活动,都会根据 PostgreSQL documentation 创建一个新的时间线 ID。
如果我们使用recovery_target_timeline='latest',那么它将使用在存档中找到的时间线,但在我的环境中存档不是共享挂载点。
如果在存档中找不到时间线,是否通过流复制接收?
【问题讨论】:
标签: postgresql replication postgresql-9.4