pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A J <s5aly@yahoo.com>
To: PG Admin <pgsql-admin@postgresql.org>
Subject: Mechanics of streaming replication
Date: Tue, 26 Jul 2011 10:00:26 -0700 (PDT)
Message-ID: <1311699626.15557.YahooMailNeo@web120012.mail.ne1.yahoo.com> (raw)

Hello,
Trying to understand the mechanics of streaming replication.
I understand that the WAL SENDER on primary streams to WAL RECEIVER on standby. Also that depending on the settings, completed WAL files on the primary are sent to the archive directory. If needed, the standby will move the files from the archive directory to its wal directory (pg_xlog) and start applying them to its data files.

My questions are:
1. Is it that the restore command in the recovery.conf only controls when files get moved from archive to the WAL directory on the standby ? If so, when does the restore command get kicked in ? Only at failover or whenever the connection between the primary and the standby is terminated ?
2. The archive directory contents will always lag behind the current WAL on primary by 16MB (unless you tweak archive_timeout parameter at the expense of bloating your archive storage). So in a typical setup, you always risk loosing up-to 16MB of committed data at failover. Right ? And I assume there is no way to reconcile this 16MB automatically when the crashed ex-primary server comes up again. Right ?
3. I don't think 'wal_keep_segments' has too much of a practical use. It keeps the WALs in the pg_xlog directory of the primary which is local only to primary. So in case of primary going down, all those WALs will be lost to the standby. I guess most people primarily rely on 'archive_command' and not wal_keep_segments, and use  Right ?
Or is it that it is preferred to keep wal_keep_segments high enough so that standby need not go to archive directory every now and then ?
4. Does the standby switch-back from reading the archive to streaming once the connection between primary and secondary is restored ?

Thanks for any inputs.

Message-ID: <1311699626.15557.YahooMailNeo@web120012.mail.ne1.yahoo.com>
Permalink:  ../1311699626.15557.YahooMailNeo@web120012.mail.ne1.yahoo.com/
Also on:    postgresql.org/message-id/1311699626.15557.YahooMailNeo@web120012.mail.ne1.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: s5aly@yahoo.com
  Subject: Re: Mechanics of streaming replication
  In-Reply-To: <1311699626.15557.YahooMailNeo@web120012.mail.ne1.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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