【问题标题】:PostgreSQL-12.1 :: Streaming Replication ErrorPostgreSQL-12.1 :: 流复制错误
【发布时间】:2020-04-13 03:29:24
【问题描述】:

我已经在 PostgreSQL 12.1

上设置了流复制

主从配置如下,WAL 文件在主控上累积。

但是,当我收到关于MASTER 上的pg_restore 后缺少 WAL 文件的投诉时,出现了问题

大师

postgres@srvm:~$ 2019-12-20 16:35:07.910 CET [1334] replicator@[unknown] ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:35:12.920 CET [1338] replicator@[unknown] ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:35:17.925 CET [1340] replicator@[unknown] ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:35:22.932 CET [1362] replicator@[unknown] ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:35:27.935 CET [1364] replicator@[unknown] ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:35:32.942 CET [1365] replicator@[unknown] ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:35:37.948 CET [1366] replicator@[unknown] ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:35:42.954 CET [1367] replicator@[unknown] ERROR:  requested WAL segment 000000010000000100000076 has already been removed

奴隶

postgres@srvs:~$ 2019-12-20 16:36:53.027 CET [21978] LOG:  started streaming WAL from primary at 1/76000000 on timeline 1
2019-12-20 16:36:53.027 CET [21978] FATAL:  could not receive data from WAL stream: ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:36:58.029 CET [21979] LOG:  started streaming WAL from primary at 1/76000000 on timeline 1
2019-12-20 16:36:58.029 CET [21979] FATAL:  could not receive data from WAL stream: ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:37:03.040 CET [21980] LOG:  started streaming WAL from primary at 1/76000000 on timeline 1
2019-12-20 16:37:03.040 CET [21980] FATAL:  could not receive data from WAL stream: ERROR:  requested WAL segment 000000010000000100000076 has already been removed
2019-12-20 16:37:08.042 CET [21981] LOG:  started streaming WAL from primary at 1/76000000 on timeline 1
2019-12-20 16:37:08.042 CET [21981] FATAL:  could not receive data from WAL stream: ERROR:  requested WAL segment 000000010000000100000076 has already been removed

然后运行pg_basebackup 并启动从站。

slave 有备份时的所有数据,但是没有来自 WAL 文件的新数据,以及上面的错误。

max_wal_senders = 10          
wal_keep_segments = 120

我配置错了什么?我们是否需要为流复制启用archive_mode = on

【问题讨论】:

    标签: database-backups master-slave pg-restore postgresql-12


    【解决方案1】:

    这是我的流复制配置:

    主配置

    listen_addresses = 'localhost,[IP_ADDRESS_OF_PRIMARY_ON_LAN]'              # what IP address(es) to listen on; 
    wal_level = 'replica'
    archive_mode = on
    archive_command = 'cd .'
    max_wal_senders = 5
    primary_conninfo = 'host=[REPLICA_IP] port=5432 user=replication password=[REPLICATION PASSWORD]'
    hot_standby = on
    
    max_wal_senders = 10          
    wal_keep_segments = 48
    
    

    从站配置:

    listen_addresses = 'localhost,[IP_ADDRESS_OF_REPLIACA_ON_LAN]'              # what IP address(es) to listen on; 
    max_connections = 100 # Ensure that this value is the same as the primary's
    wal_level = 'replica'
    archive_mode = on
    archive_command = 'cd .'
    max_wal_senders = 5
    primary_conninfo = 'host=[PRIMARY_IP] port=5432 user=replication password=[REPLICATION PASSWORD]'
    hot_standby = on
    
    max_wal_senders = 10          
    wal_keep_segments = 48
    
    

    我使用以下资源设置我的服务器:https://www.gab.lc/articles/postgresql-12-replication/

    【讨论】:

      猜你喜欢
      • 2020-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-13
      • 2019-04-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多