Обсуждение: Backing up the currently used wal segment

Поиск
Список
Период
Сортировка

Backing up the currently used wal segment

От
"Florian G. Pflug"
Дата:
Hi

I've implemented replication to a warm standby using wal
logshipping now. The only remaining problem is that there
is no way in 8.1 to force postgres to close the current
wal segment, and start using a new one.

Therefor, if there is little traffic, changes can take
a long time to actually replicate, increasing the time-window
of chances which might be lost in case of a crash.

I believe that people are solving this by periodically
copying the currently used wal to the backup server.

I'd like to implement that scheme, but am unsure how
to determine that segment reliably. I noticed that
there is an pg_xlog/archive_status directory, which
contains *.done files for some of the archived wal logs.

Can I safely assume that the wal with the smallest
serial number for which there is no corresponding
file in archive_status is the current used wal?

At the moment pg_xlog/archive_status contains:
00000001000000020000007E.00F95E0C.backup.done
000000010000000200000087.done
000000010000000200000088.don

while pg_xlog contains:
00000001000000020000007E.00F95E0C.backup
000000010000000200000087
000000010000000200000088
000000010000000200000089
00000001000000020000008A
00000001000000020000008B
00000001000000020000008C
00000001000000020000008D
00000001000000020000008E

My guess is that 000000010000000200000089 is currently used, and
that 00000001000000020000008A - 00000001000000020000008E where
created for future use (Why I wouldn't know). Is that assumption correct?

greetings, Florian Pflug

Re: Backing up the currently used wal segment

От
"Merlin Moncure"
Дата:
On 7/6/06, Florian G. Pflug <fgp@phlo.org> wrote:
> Hi
>
> I've implemented replication to a warm standby using wal
> logshipping now. The only remaining problem is that there

just how exactly does this work?  are you constantly firing up the
standby server?

merlin

Re: Backing up the currently used wal segment

От
Stephen Frost
Дата:
* Florian G. Pflug (fgp@phlo.org) wrote:
> I'd like to implement that scheme, but am unsure how
> to determine that segment reliably. I noticed that
> there is an pg_xlog/archive_status directory, which
> contains *.done files for some of the archived wal logs.

Personally, I was just lazy and rsync the whole dir off to a seperate
area on the backup server every 5 minutes. :)

    Enjoy,

        Stephen

Вложения

Re: Backing up the currently used wal segment

От
"Florian G. Pflug"
Дата:
Merlin Moncure wrote:
> On 7/6/06, Florian G. Pflug <fgp@phlo.org> wrote:
>> Hi
>>
>> I've implemented replication to a warm standby using wal
>> logshipping now. The only remaining problem is that there
>
> just how exactly does this work?  are you constantly firing up the
> standby server?

Postgres on the standby server is running constantly. The restore_command
is a shell script that waits indefinitely if a wal is requested that doesn't
exist yet. A periodic cron-jobs (every minute) syncs the archived wals over
to the standby maschine, where they are eventually picked by the restore_command.

greetings, Florian Pflug