数据库采用主从备份方式进行搭建,未及时清理归档,归档文件夹目录不断增大,撑爆整个磁盘。
所谓WAL日志归档,其实就是把在线的WAL日志备份出来。
wal_level='replica'
# - Archiving -
archive_mode = on # enables archiving; off, on, or always
# (change requires restart)
archive_command = 'test ! -f /mnt/backup/%f && cp %p /mnt/backup/%f'
# command to use to archive a logfile segment
# placeholders: %p = path of file to archive
# %f = file name only
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
#archive_timeout = 0 # force a logfile segment switch after this
# number of seconds; 0 disables
#wal_level archive 或更高级别
#archive_mode on 开