Re: Too many WAL archive files

Поиск
Список
Период
Сортировка
От Keith Ouellette
Тема Re: Too many WAL archive files
Дата
Msg-id 417C5AF7C228B94490192951394BEFE7B4805F@AIPHLEXDAG01B.airgas.com
обсуждение исходный текст
Ответ на Re: Too many WAL archive files  (Matheus de Oliveira <matioli.matheus@gmail.com>)
Список pgsql-admin

Okay, I guess it makes sense that I am at 16GB based on your explanation below. I do not have a space constraint, so having 16GB is not the problem. The problem is that we have experienced connectivity issues in the past where replication would not startup. I would do a "manual" sync using rsync for the data directory. That includes the archive directory. I tried to exclude the archive directory, but when restarting PostgreSQL, I would get the archive missing errors in the startup log and PostgreSQL would not start. I guess I could reduce the number from 1000 (which looks like about 55 days with an average of 18 files being created each day) to a lower number. We picked 1000 as this is a new application for us and we did not know how fast the WAL files would fill.  If I do make that change, will the excess files be automatically deleted or do I have to do that manually?

 

Thanks,

Keith

 


From: Matheus de Oliveira [matioli.matheus@gmail.com]
Sent: Saturday, September 14, 2013 11:55 AM
To: Keith Ouellette
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Too many WAL archive files


On Sat, Sep 14, 2013 at 11:19 AM, Keith Ouellette <Keith.Ouellette@airgas.com> wrote:

My company is using PostgreSQL 9.1 for one of our applications. We have it set up replicating between two sites using WAL and Pacemaker to manage the cluster and failover. I have noticed that archive folder is growing very large 16G out of the 19G that the data directory is in total. We have the wal_keep_segments = 1000 set in the postgresql.conf file.

 

I thought that meant to keep the last 1000 files in the event that it was needed to catch up after falling behind.


No. PostgreSQL will always keep at least (can be a little more) wal_keep_segments files in any situation. So, wal_keep_segments is set to 1000, and each wal file has 16MB, doing the math it means PostgreSQL will use at least 15.625GB (~16GB) for wal files, it is what you have. If you don't have enough space for this, you should set keep wal_keep_segments to a lower value.

I am noticing that I have 12000 files in the archive directory. I know that includes the .backup files as well, but that is a smaller portion of the files in that directory.


Unless you have a lot of .backup files, there is no way 12000 wal file will use only 16GB, it would be 187.5GB, so this number seems wrong.

Also check if you have set up archiving and if it is working, because if archive_command fails, PostgreSQL will keep the "failed on archive" files on pg_xlog path and keep trying it.

Best regards,
-- 
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br nível F!
www.dextra.com.br/postgres

В списке pgsql-admin по дате отправления:

Предыдущее
От: Kevin Grittner
Дата:
Сообщение: Re: New autovacuum messages in postgres log after upgrade
Следующее
От: Roberto Grandi
Дата:
Сообщение: Script timeout