[ClusterLabs] Postgresql pg_archive directory seems to keep growing

NAKAHIRA Kazutomo nakahira_kazutomo_b1 at lab.ntt.co.jp
Thu Apr 2 02:58:58 EDT 2015


Hi, Domi

Excuse me for lack of explanation.

Your backup_label file is exists in the backuped $PGDATA directory,
it is not exists in the running $PGDATA directory.
# It is exist in the running $PGDATA directory between
# pg_start_backup('backup_label') to pg_stop_backup().

If you use pg_basebackup command to create backup files, then
backup_label is included in the backup files automatically.

Best regards,
Kazutomo NAKAHIRA

On 2015/03/30 21:02, "Tomcsányi, Domonkos" wrote:
> Thank you Kazutomo, here is my situation:
> I checked the backup_label file, but only found a file called
> backup_label.old (there is no backup_label file). It seems it was
> created 6 months ago, when I did the last base_backup. So I'm a little
> confused what to do about this, I would like to automate if possible the
> deletion of the unnecessary files. But till then I think we will just
> log in to the server and see what files could be deleted based on their
> modification date.
>
> Regards,
> Domi
>
> 2015.03.12. 7:22 keltezéssel, NAKAHIRA Kazutomo írta:
>> Hi, Domi
>>
>> archive_cleanup_command is used for recovery.conf
>> and cleanup works only slave node.
>>
>> Administrator have to delete archive files in the master node
>> who's own responsibility.
>>
>> Old archive files can be removed from running master after base_backup.
>>
>> "START WAL LOCATION:" in the $PGDATA/backup_label shows latest archive
>> file name that must be keep in the archive directory.
>>
>> And *.history file just before latest archive file must be keep
>> in the archive directory.
>>
>> The other older files can be delete from archive directory.
>>
>> Strictly, how to determine deletable archive files in the running
>> master is a little complex because it is needed that consider latest
>> checkpoint status in the slave(REDO point and timeline ID).
>>
>> But, it is not a cause for concern when slave is synchronous with master.
>>
>> Best regards,
>> Kazutomo NAKAHIRA
>>
>> On 2015/03/12 1:00, "Tomcsányi, Domonkos" wrote:
>>> Hello everyone,
>>>
>>> I just have a quick question: I have a PostgreSQL master-slave cluster
>>> set up using Pacemaker pretty much following this guide:
>>> http://clusterlabs.org/wiki/PgSQL_Replicated_Cluster
>>> I ended up with a working cluster, we tested it, failover happened just
>>> fine, slave became master etc. so we put it in production.
>>> Now what I see is that the pg_archive directory keeps on growing. I
>>> thought it was supposed to get cleaned after the slave received the WAL
>>> files needed to be in sync with the master, but that didn't happen.
>>> I'm using the following archive command:
>>> archive_command = 'cp %p /var/lib/postgresql/9.3/main/pg_archive/%f'
>>>
>>> It feels weird to me, since I also saw some guides telling me to using
>>> rsync here, or use cp, but then run a cron job to regurarly rsync the
>>> contents of the directory to the slave node. Somehow I can't figure out
>>> if rsync is really needed or not, to be honest I can't truly figure out
>>> how exactly Postgres works in terms of replication.
>>> I also tried adding the following to my RA config:
>>> archive_cleanup_command="/usr/lib/postgresql/9.3/bin/pg_archivecleanup
>>> /var/lib/postgresql/9.3/main/pg_archive %r"
>>>
>>> but it didn't change the fact that my archive directory seems to be just
>>> growing and growing, and it has some files in it that were not touched
>>> in a month or so.
>>>
>>> I'm confused, so I'd really appreciate any help :).
>>>
>>> Thank you,
>>> Domi
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list: Users at clusterlabs.org
>>> http://clusterlabs.org/mailman/listinfo/users
>>>
>>> Project Home: http://www.clusterlabs.org
>>> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>>> Bugs: http://bugs.clusterlabs.org
>>>
>>
>>
>
>
> _______________________________________________
> Users mailing list: Users at clusterlabs.org
> http://clusterlabs.org/mailman/listinfo/users
>
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org
>
>
>


-- 
NTT オープンソースソフトウェアセンタ
中平 和友
TEL: 03-5860-5135 FAX: 03-5463-6490
Mail: nakahira_kazutomo_b1 at lab.ntt.co.jp





More information about the Users mailing list