I have two Postgresql 9.5 servers configured in streaming replication. There are no errors in log files and the servers seem to be in sync.
archive_command = 'test ! -f mnt/server/archivedir/%f && cp %p mnt/server/archivedir/%f' wal_keep_segments = 32
Everything else is pretty much default. And yet I have 1600+ files in the archive directory! Because of space constraints I have dared to delete some of them. I would like to figure out what is causing this. I also see that there are only very old files on the slave for the same directory.
The only thing I can think of is that I recently did a restore on a database. I dropped the database, created it and did a backup restore. I did this several times. The slave seems to have caught up with the changes. But I have a ton of WAL files in the archive folder for each of the backup restores. Would appreciate some insight into what could be happening.