
当我启动我的从库的时候,发现日志提示wal文件已经被移除,我的理解出现这种情况是因为wal文件在被传送到从库前,主库wal文件已经被更新覆盖导致
2020-03-20 09:09:20 CSTFATAL: the database system is starting up
2020-03-20 09:09:23 CSTLOG: started streaming WAL from primary at 644A/2B000000 on timeline 2
2020-03-20 09:09:23 CSTFATAL: could not receive data from WAL stream: ERROR: requested WAL segment 000000020000644A0000002B has already been removed
2020-03-20 09:09:31 CSTLOG: started streaming WAL from primary at 644A/2B000000 on timeline 2
2020-03-20 09:09:31 CSTFATAL: could not receive data from WAL stream: ERROR: requested WAL segment 000000020000644A0000002B has already been removed
我查询了主库上的slot依然存在
postgres=# select * from pg_replication_slots;
slot_name | plugin | slot_type | datoid | database | active | active_pid | xmin | catalog_xmin | restart_lsn
-----------±-------±----------±-------±---------±-------±-----------±-----------±-------------±--------------
slot_188 | | physical | | | f | | 3308828477 | | 64AB/D2F16E20
据我了解replication slots是提供了一种自动化的方法来确保主控机在所有的后备机收到 WAL 段 之前不会移除它们,并且主控机也不会移除可能导致恢复冲突的行,即使后备机断开也是如此。为什么我的某台从库依然会出现wal被移除的情况,请问有大佬可以帮忙解答下吗
