I have two PostgreSQL 9 servers running on Amazon EC2. One is the master, the other is a replication server in standby.
The replication server is continuing to fail as the hard drive fills up. It appears that the following directory is constantly growing:
/usr/local/pgsql/wals
There are thousands of files like:
-rw------- 1 pgsql users 16777216 Jan 3 20:36 000000010000001B000000A2
-rw------- 1 pgsql users 16777216 Jan 3 20:40 000000010000001B000000A3
-rw------- 1 pgsql users 16777216 Jan 3 20:46 000000010000001B000000A4
How does one set this up to not cause failure? Do I need to auto-rotate the wal files?
You should configure an archive_cleanup_command
in your recovery.conf
file. Check out pg_archivecleanup
; it's made for this purpose.
The WAL files could also serve as an archive for backup and recovery purposes, so they are not automatically deleted if you are just doing replication.
(Alternatively, you could use whatever hand-crafted method you like to clean up the archive, but that could be a bit difficult and error prone.)