9.4.1中的PostgreSQL切换和切回 在主服务器(192.xxxx.128)在备用(192.xx.129): AT主要(192.xx.129): AT主要(192.xx.129):在辅助(192.xxx.128):

环境:

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 start
    
  • psql -U postgres -c "select pg_is_in_recovery()"
    

在备用(192.xx.129):

  • ps -ef | grep postgres
    
  • touch locationoftrigeerfile
    

AT主要(192.xx.129):

  • 连接应用程序并进行测试

通过上述步骤完成了切换。

立即切换

AT主要(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=fast
    
  • psql -U postgres -c "select pg_is_in_recovery();"
    

在辅助(192.xxx.128):

  • ps -ef | grep postgres
    
  • touch locationoftrigeerfile
    

我的问题:

对于每个促销活动,都会根据PostgreSQL documentation创建一个新的时间轴ID。

如果我们使用recovery_target_timeline='latest',它将使用在归档文件中找到的时间轴,但是在我的环境中,归档文件不是共享的安装点。

如果在存档中未找到时间线,是否通过流复制接收到时间线?

hinaliuyinyuan1 回答:9.4.1中的PostgreSQL切换和切回 在主服务器(192.xxxx.128)在备用(192.xx.129): AT主要(192.xx.129): AT主要(192.xx.129):在辅助(192.xxx.128):

是的,包含时间轴开关的历史记录文件也将流式传输到备用服务器。

它将显示在备用数据库的pg_wal目录中。关联的日志消息为:

LOG:  fetching timeline history file for timeline 2 from primary server

备用服务器将能够通过时间轴开关跟随主服务器。

本文链接:https://www.f2er.com/3067778.html

大家都在问