Re: WAL archive cleanup om master

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: WAL archive cleanup om master
Дата
Msg-id 20140106164551.GC23118@svana.org
обсуждение исходный текст
Ответ на Re: WAL archive cleanup om master  (Adrian Klaver <adrian.klaver@gmail.com>)
Ответы Re: WAL archive cleanup om master
Список pgsql-general
On Mon, Jan 06, 2014 at 08:17:37AM -0800, Adrian Klaver wrote:
> On 01/06/2014 07:35 AM, Martijn van Oosterhout wrote:
> >On Mon, Jan 06, 2014 at 07:16:25AM -0800, Adrian Klaver wrote:
> >>On 01/06/2014 03:18 AM, Martijn van Oosterhout wrote:
> >>>Hoi,
> >>>
> >>>
> >
> >I'm not sure what you mean, isn't this the recommended way of doing
> >things? The configuration comes from here:
> >
> >http://wiki.postgresql.org/wiki/Hot_Standby
> >
> >The master saves the archives to a directory, rsync copies them to
> >the slave, where there restore_command can find them.
>
> Well this is the above is where is could be redundant. In your
> original post it would seem the archive_command and restore_command
> are pointing at the same directory. I realize they are just
> placeholder names, so is that the case?  If so I am not sure what
> the rsync accomplishes. If not why not just make it so?

Well, they're the same directory on different machines. The directory
is actually /var/lib/postgresql/9.2/xlogs on both, but that's not
really relevent.

There's a cronjob on the master that says:

rsync -avz /var/lib/postgresql/9.2/xlogs/* slave:/var/lib/postgresql/9.2/xlogs/

The question is: what is it that prevents the WAL files in
/var/lib/postgresql/9.2/xlogs from filling the disk on the master?

> The minimal cover your bases setup is usually given as:
>
>
> Primary(Machine1) --> Archive --> Archive Directory(Machine2)
>     |                 |
>     |  Streaming        Restore     |
>     ->    Standby(Machine3) < -
>
> Excuse the ASCII art.

The ascii art is fine, but you have the same problem: on the Machine1
the WAL files are stored prior to copying to Machine2.  How do you know
when you can delete files safely on Machine1?

Anyway, I found this page on the wiki:

http://wiki.postgresql.org/wiki/Binary_Replication_Tutorial

which says that:

archive_command = 'rsync -a %p 192.168.0.2:/var/lib/pgsql/data/archive/%f'

is acceptable and also avoids the problem. I'll just test what happens
with network failure (hopefully it doesn't kill the master).

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.
   -- Arthur Schopenhauer

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Stephen Woodbridge
Дата:
Сообщение: Re: How to check for pending CancelRequest from C/C++ function
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: WAL archive cleanup om master