Re: cleaning wal files from postgres - Mailing list pgsql-general

From Kenichiro Tanaka
Subject Re: cleaning wal files from postgres
Date
Msg-id 4BFB4DA6.10205@ashisuto.co.jp
Whole thread Raw
In response to Re: cleaning wal files from postgres  (erobles <erobles@sensacd.com.mx>)
List pgsql-general
Hello.

When you execute pg_stop_backup,postgresql makes a special file, like this
000000010000000000000015.00000064.backup.

This means you can delete wal 000000010000000000000014 and before.

The PostgreSQL manual also says following.

http://www.postgresql.org/docs/8.4/interactive/continuous-archiving.html#BACKUP-ARCHIVING-WAL

24.3.2. Making a Base Backup

To make use of the backup, you will need to keep around all the WAL
segment files
  generated during and after the file system backup. To aid you in doing
this,
the pg_stop_backup function creates a backup history file that is
immediately
stored into the WAL archive area. This file is named after the first WAL
segment
file that you need to have to make use of the backup. For example, if
the starting
WAL file is 0000000100001234000055CD the backup history file will be
named something
like 0000000100001234000055CD.007C9330.backup. (The second part of the
file name
stands for an exact position within the WAL file, and can ordinarily be
ignored.)
Once you have safely archived the file system backup and the WAL segment
files used
during the backup (as specified in the backup history file), all
archived WAL segments
with names numerically less are no longer needed to recover the file
system backup and
  can be deleted. However, you should consider keeping several backup
sets to be
absolutely certain that you can recover your data.


Thank you.


> oops, sorry, my question was very ambiguous ...
> What I want to know is:
> The correct procedure to remove the wal files that have been used  in
> the recovery of a postgres server.
>
>
> Consider the following;
>
> 1.-  A main server in production.
> 2.- A  secondary server that is normally off.
> 3.-  By connecting the secondary server, the primary server must copy
> the  directory data as well as wal files generated during the copying
> process.
>
> 4.- start up  the postgres on the secondary server.
>
> 5o.Delete wal  files no longer will be used by postgres to save disk
> space.
>
>  how can i know which  wal file is not required by postgres and
> delete   wal files from  main and secondary server, to save space disk
> on the servers ? (after a succesfully start up on secondary server)
>
>
> regards eddie.
>
> On 05/21/2010 03:43 PM, Andreas Schmitz wrote:
>>
>> maybe I don't understand the problem. there is no need to clean WAL
>> files after recovery. where exactly is the problem ?
>>
>> regards
>>
>> andreas
>>
>>
>> erobles wrote:
>>>
>>>  PITR  recovery
>>>
>>> On 05/21/2010 03:04 PM, Andreas Schmitz wrote:
>>>> erobles wrote:
>>>>> which is the right procedure to clean wal files after a  recovery ??
>>>> what kind of recovery ?
>>>>
>>>> regards
>>>>
>>>> andreas
>>>>
>>>
>>
>>
>


--
================================================
Kenichiro Tanaka
K.K.Ashisuto
http://www.ashisuto.co.jp/english/index.html
================================================


pgsql-general by date:

Previous
From: Osvaldo Kussama
Date:
Subject: Re: timestamp configuration
Next
From: Dennis Gearon
Date:
Subject: Re: timestamp configuration