pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
archive folder housekeeping
4+ messages / 4 participants
[nested] [flat]

* archive folder housekeeping
@ 2013-08-09 09:38  ascot.moss@gmail.com <ascot.moss@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: ascot.moss@gmail.com @ 2013-08-09 09:38 UTC (permalink / raw)
  To: PostgreSQL general <pgsql-general@postgresql.org>; +Cc: ascot.moss@gmail.com

Hi,

I have enabled archive in PG (v 9.2.4):

archive_mode = on
archive_command = 'test ! -f /usr/local/pgsql/data/archive/%f && cp %p /usr/local/pgsql/data/archive/%f'

I know that pg_xlog folder is maintained by PostgreSQL automatically,  when the pg_xlog folder hits to certain limit  (pg_xlog is full), it will automatically archive old log files into the archive folder.  Is the parameter wal_keep_segments used to control this limit?

On the other hand, will PostgreSQL also automatically maintain the archive folder by itself or I need to do some housekeeping job to maintain it from time to time?  Is there any PG manual command available to remove archived files by (archive) date/time? 

Can you  please advise?

regards 




-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: archive folder housekeeping
@ 2013-08-09 09:52  Albe Laurenz <laurenz.albe@wien.gv.at>
  parent: ascot.moss@gmail.com <ascot.moss@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Albe Laurenz @ 2013-08-09 09:52 UTC (permalink / raw)
  To: ascot.moss@gmail.com *EXTERN* <ascot.moss@gmail.com>; PostgreSQL general <pgsql-general@postgresql.org>

ascot.moss@gmail.com wrote:
> I have enabled archive in PG (v 9.2.4):
> 
> archive_mode = on
> archive_command = 'test ! -f /usr/local/pgsql/data/archive/%f && cp %p
> /usr/local/pgsql/data/archive/%f'
> 
> I know that pg_xlog folder is maintained by PostgreSQL automatically,  when the pg_xlog folder hits to
> certain limit  (pg_xlog is full), it will automatically archive old log files into the archive folder.
> Is the parameter wal_keep_segments used to control this limit?

WAL files will be archived immediately after the switch to
the next WAL file.

pg_xlog is cleaned up, but that has nothing to do with how
full it is.  It is controlled by wal_keep_segments.
WAL files are not always cleaned up immediately when they
qualify, cleanup may lag behind a little.

> On the other hand, will PostgreSQL also automatically maintain the archive folder by itself or I need
> to do some housekeeping job to maintain it from time to time?  Is there any PG manual command
> available to remove archived files by (archive) date/time?
> 
> Can you  please advise?

PostgreSQL will not maintain the archives.
You have to do housekeeping yourself.
PostgreSQL does not know about your backup strategy
(archived WAL files should not just be deleted, but backed up).

Yours,
Laurenz Albe

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: archive folder housekeeping
@ 2013-08-09 12:12  Ian Lawrence Barwick <barwick@gmail.com>
  parent: ascot.moss@gmail.com <ascot.moss@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Ian Lawrence Barwick @ 2013-08-09 12:12 UTC (permalink / raw)
  To: ascot.moss@gmail.com <ascot.moss@gmail.com>; +Cc: PostgreSQL general <pgsql-general@postgresql.org>

2013/8/9 ascot.moss@gmail.com <ascot.moss@gmail.com>:
> Is there any PG manual command available to remove archived files by (archive) date/time?

pg_archivecleanup might be of use to you:

  http://www.postgresql.org/docs/current/static/pgarchivecleanup.html

Regards

Ian Barwick


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: archive folder housekeeping
@ 2013-08-09 13:11  Michael Paquier <michael.paquier@gmail.com>
  parent: Ian Lawrence Barwick <barwick@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Paquier @ 2013-08-09 13:11 UTC (permalink / raw)
  To: Ian Lawrence Barwick <barwick@gmail.com>; +Cc: ascot.moss@gmail.com <ascot.moss@gmail.com>; PostgreSQL general <pgsql-general@postgresql.org>

On Fri, Aug 9, 2013 at 9:12 PM, Ian Lawrence Barwick <barwick@gmail.com> wrote:
> 2013/8/9 ascot.moss@gmail.com <ascot.moss@gmail.com>:
>> Is there any PG manual command available to remove archived files by (archive) date/time?
>
> pg_archivecleanup might be of use to you:
>
>   http://www.postgresql.org/docs/current/static/pgarchivecleanup.html
Yes, this is particularly useful and easy to maintain when enabled
with archive_cleanup_command in the recovery.conf file of a slave
fetching the archives.
-- 
Michael


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2013-08-09 13:11 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-08-09 09:38 archive folder housekeeping ascot.moss@gmail.com <ascot.moss@gmail.com>
2013-08-09 09:52 ` Albe Laurenz <laurenz.albe@wien.gv.at>
2013-08-09 12:12 ` Ian Lawrence Barwick <barwick@gmail.com>
2013-08-09 13:11   ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox