Re: wal copies for high availability - Mailing list pgsql-general

From Philippe Ferreira
Subject Re: wal copies for high availability
Date
Msg-id 43EA42A5.1040901@worldonline.fr
Whole thread Raw
In response to wal copies for high availability  (Heinrich Streit <heinrichstreit@yahoo.com.br>)
Responses Re: wal copies for high availability  (Heinrich Streit <heinrichstreit@yahoo.com.br>)
List pgsql-general
Hi,

> Another cheap alternative is diarly (00:00) stop the master database
> and make a copy of the $PGDATA directory to the slave and during the
> day make regularly (5 x 5 minutes) copies of the current wal file to
> the slave too.
>
> To recover the system we need only to apply all the logs created
> during the day to the slave and sta rt it up.
>
> Will it work?

It will work, but :
You must *not* stop any database or service diarly (00:00), but instead
activate
the "hot backup mode" to be able to copy your $PGDATA directory "on the
fly" to
the slave. If you do this way, you will get a recoverable copy of your
server.
To activate the slave, you will only have to start it in "recovery
mode", and all your
WAL files of the day will be replayed in a second !

> Is there any risk to make it in this way?

If you take care of your WAL files, everything should be ok !

>
> What will happen if during the wal copy operation the database writes
> something in too?

This is a good question ! I don't know the exact consequences...
Maybe the best solution is to put your pg_xlog directory on a "snapshot
capable" file system,
and send a snapshot of the current WAL every 5 minutes...

> Will the wal file copied usefull in those situations?

Of course, yes !
The filled WAL files (WAL archives) are automatically copied by the
postmaster process,
but you need to copy yourself the current one to be able to recover the
last stuff !

> What other alternatives do we have?

Slony ?

Philippe Ferreira.

pgsql-general by date:

Previous
From: Joachim Wieland
Date:
Subject: Re: Sequences/defaults and pg_dump
Next
From: Heinrich Streit
Date:
Subject: Re: wal copies for high availability