I’m using PostgreSQL 14.4 with docker. I’ve configured the postgresql.conf archive to delete the wal files automatically, but somehow it’s not working.
the archive_cleanup_command is configured, but it’s not cleaning the folder which contains the archived wal files.
Here’s my postgresql conf file:
#------------------------------------------------------------------------------
# WRITE-AHEAD LOG
#------------------------------------------------------------------------------
# - Settings -
wal_level = logical
#fsync = on
#synchronous_commit = on
#wal_sync_method = fsync
#full_page_writes = on
#wal_log_hints = off
#wal_compression = off
#wal_init_zero = on
#wal_recycle = on
wal_buffers = 8MB
#wal_writer_delay = 200ms
#wal_writer_flush_after = 1MB
#wal_skip_threshold = 2MB
#commit_delay = 0
#commit_siblings = 5
# - Checkpoints -
#checkpoint_timeout = 5min
#checkpoint_completion_target = 0.9
#checkpoint_flush_after = 256kB
#checkpoint_warning = 30s
max_wal_size = 2GB
min_wal_size = 1GB
# - Archiving -
archive_mode = on
archive_command = 'cp %p /var/lib/postgresql/data/wal_archive/%f' /mnt/server/archivedir/%f'
#archive_timeout = 0
# - Archive Recovery -
#restore_command = 'cp /var/lib/postgresql/data/pg_wal/%f %p'
archive_cleanup_command = 'pg_archivecleanup /var/lib/postgresql/data/wal_archive 0000000100000059000000DC >> /var/lib/postgresql/data/pg_log/archive_cleanup.log 2>&1'
#recovery_end_command = ''