I had a problem with PostgreSQL server.
I took over PostgreSQL server from my former colleague, and today my server crashed due to filled up disk space with wal_archives.
Usually wal segments were put in root directory /wal_archive/
, I checked it - its empty. Some time ago I checked it and it had some segments...
I dug deeper and find out that all wal segments were stored in pg_data/pg_xlog
directory.
How could this happen? While postgresql.conf
is set up like this (showing only enabled segment of 'write ahead log' rows)
wal_level = hot_standby # minimal, archive, hot_standby, or
archive_mode = on # allows archiving to be done
archive_command = 'test ! -f /wal_archive/%f && cp %p /wal_archive/%f'
Why my wal_archive directory now is empty wwhile config settings showing different information?
The wal_archive
directory was owned by root user
pg_hba.conf
file does not have any replication user - I assume that there is no replication on the server also. There are no files like recovery.conf
anywhere.
cp: cannot stat 'pg_xlog/000000010000033C00000081': No such file or directory
2018-12-05 14:37:54 EET [7540-1860] LOG: archive command failed with exit code 1
2018-12-05 14:37:54 EET [7540-1861] DETAIL: The failed archive command was: test ! -f /wal_archive/000000010000033C00000081 && cp pg_xlog/000000010000033C00000081 /wal_archive/000000010000033C00000081
2018-12-05 14:37:54 EET [7540-1862] WARNING: archiving transaction log file "000000010000033C00000081" failed too many times, will try again later
Also due to panic, I accidentally deleted big chunk of wal segments in xlog directory, to fire up server. Everything is working ok now, but I want to ensure that there will be no problems in the future.