Reputation: 111060
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?
Upvotes: 2
Views: 2051
Reputation: 36759
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.)
Upvotes: 1
Reputation: 3036
There is a setting in the postgresql.conf file called wal_keep_segments=
and checkpoint_segments=
I have mine set to wal_keep_segments=128
and checkpoint_segments=128
with replication fine.
wal_keep_segments
are the minimum wal_files in the directory.
checkpoint_segments
are the maximum.
I set it on both.
Upvotes: 0