Обсуждение: Problem with Streaming Replication

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

Problem with Streaming Replication

От
abraao895
Дата:
Hi,

I have a doubt about the WAL-based replication. Suppose this situation:

- The PC1(master) write the WAL file in the shared folder in her HD.

- The HD of the PC1(master) dead. The WAL file don't have replicated because
it is a asynchronous proccess and suppose that this already didn't have
happened.

- The PC2(slave) doesn't have the last record.

Is it possible of happen? There is a manner of resolve this thread? Can i
force to replicate a WAL file in a determinate time?

Thanks very much!


--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Problem-with-Streaming-Replication-tp4538638p4538638.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.

Re: Problem with Streaming Replication

От
Kerem Can Karakaş
Дата:
On Thu, 2011-06-30 at 05:21 -0700, abraao895 wrote:
> Hi,
>
> I have a doubt about the WAL-based replication. Suppose this situation:
>
> - The PC1(master) write the WAL file in the shared folder in her HD.
>
> - The HD of the PC1(master) dead. The WAL file don't have replicated because
> it is a asynchronous proccess and suppose that this already didn't have
> happened.
This is unlikely to happen when you share the folder of the slave server
to the master as the WAL backup folder.
>
> - The PC2(slave) doesn't have the last record.
Streaming replication occurs on transaction basis. As taken form the
documentation on
http://www.postgresql.org/docs/9.0/static/warm-standby.html

"Streaming replication allows a standby server to stay more up-to-date
than is possible with file-based log shipping. The standby connects to
the primary, which streams WAL records to the standby as they're
generated, without waiting for the WAL file to be filled. "

So as soon as it is written on WAL on the master server it is written
also on the slave node. The shared WAL folder is there in case the slave
cannot keep up with the master server. Usually on such a situation it
should not use immediately the WAL logs to keep up. If it happens to use
wal at a particular time, it is on the disk of the slave server anyway.



Re: Problem with Streaming Replication

От
Abraão Ferreira
Дата:
Hi Kerem,
     Thanks to your answer. I think that the correct way is:

1) The master write in her hard drive the WAL files.

2) After this in some moment(asynchronous method), the slave node connect in the shared folder(master) and copy to it all the WAL files.

3) After the slave execute the copy, this execute the instructions inside the WAL files to her database.

    My doubt is if the master hd is dead after write some transactions in her WAL before the (2) step happen. In this case i think that the data goig to be lost. And i would like to know if there is a mode of 'force' replicate the WAL file to the slave using some command.

Abraão

>Subject: Re: [ADMIN] Problem with Streaming Replication
> From: blokdiyagram@gmail.com
> To: abraao895@hotmail.com
> CC: pgsql-admin@postgresql.org
> Date: Thu, 30 Jun 2011 15:50:03 +0300
>
> On Thu, 2011-06-30 at 05:21 -0700, abraao895 wrote:
> > Hi,
> >
> > I have a doubt about the WAL-based replication. Suppose this situation:
> >
> > - The PC1(master) write the WAL file in the shared folder in her HD.
> >
> > - The HD of the PC1(master) dead. The WAL file don't have replicated because
> > it is a asynchronous proccess and suppose that this already didn't have
> > happened.
> This is unlikely to happen when you share the folder of the slave server
> to the master as the WAL backup folder.
> >
> > - The PC2(slave) doesn't have the last record.
> Streaming replication occurs on transaction basis. As taken form the
> documentation on
> http://www.postgresql.org/docs/9.0/static/warm-standby.html
>
> "Streaming replication allows a standby server to stay more up-to-date
> than is possible with file-based log shipping. The standby connects to
> the primary, which streams WAL records to the standby as they're
> generated, without waiting for the WAL file to be filled. "
>
> So as soon as it is written on WAL on the master server it is written
> also on the slave node. The shared WAL folder is there in case the slave
> cannot keep up with the master server. Usually on such a situation it
> should not use immediately the WAL logs to keep up. If it happens to use
> wal at a particular time, it is on the disk of the slave server anyway.
>
>

Re: Problem with Streaming Replication

От
Greg Smith
Дата:
On 06/30/2011 08:21 AM, abraao895 wrote:
> - The HD of the PC1(master) dead. The WAL file don't have replicated because
> it is a asynchronous proccess and suppose that this already didn't have
> happened.
>
> - The PC2(slave) doesn't have the last record.
>

That's exactly how some transaction loss can happen in this situation.
Some software worried about this problem maintains a small transaction
log outside of the database, so that it's possible to reconstruct really
critical information after such a disaster.

In PostgreSQL 9.1, due to be released later this year, synchronous
replication is available on a per-transaction basis.  That resolves the
concern you have--important transactions can be confirmed on one of the
slaves as a requirement before they commit.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
Comprehensive and Customized PostgreSQL Training Classes:
http://www.2ndquadrant.us/postgresql-training/