Thread: Postgresql Replication

Postgresql Replication

From
"Nareen S"
Date:
Current Setup
I am having a Mailserver running on Postfix.For the same I had configured  a High Availability Solution using Heartbeat and DRBD for replication.The setup is like Primary/Secondary Node Servers and all mails are replicated to secondary using DRBD.If primary server fails secondary will be up with mails ..
The total number of users is 600 users,and Hardware used is Two Compaq servers with SCSI HDD,1 GB RAM each,
Network-100Mbps

New Planned Setup
Now I am planning for Postgresql server in the same setup.I want to know will it work in the same setup.ie if I configure
a new device in drbd can I get HA for postgresql also.If I use DRBD for postgresql also ,will it affects the existing setups.Finally  if it is not possible what is the next option for this.

Thanks for any Help

Regards
John

Re: Postgresql Replication

From
Richard Huxton
Date:
Nareen S wrote:
> Current Setup
> I am having a Mailserver running on Postfix.For the same I had configured  a
> High Availability Solution using Heartbeat and DRBD for
> replication.Thesetup is like Primary/Secondary Node Servers and all
> mails are replicated to
> secondary using DRBD.If primary server fails secondary will be up with mails
> ..
> The total number of users is 600 users,and Hardware used is Two Compaq
> servers with SCSI HDD,1 GB RAM each,
> Network-100Mbps
>
> New Planned Setup
> Now I am planning for Postgresql server in the same setup.I want to know
> will it work in the same setup.ie if I configure
> a new device in drbd can I get HA for postgresql also.If I use DRBD for
> postgresql also ,will it affects the existing setups.Finally  if it is not
> possible what is the next option for this.

It *should* work as long as you don't start the PostgreSQL server on the
second machine until you are sure that the first has failed. It will
then think it is recovering from having crashed.

This is assuming that drbd doesn't mess with how fsync() works, and I
seem to remember it doesn't last time I looked.

The alternative (assuming you're using the database for user
details/routing etc) would be replication (slony/dbmirror/etc) or
perhaps even PITR depending on the rate of change of the database.

--
   Richard Huxton
   Archonet Ltd

Re: Postgresql Replication

From
Alexander Schreiber
Date:
Richard Huxton <dev@archonet.com> wrote:
> Nareen S wrote:
>> Current Setup
>> I am having a Mailserver running on Postfix.For the same I had configured  a
>> High Availability Solution using Heartbeat and DRBD for
>> replication.Thesetup is like Primary/Secondary Node Servers and all
>> mails are replicated to
>> secondary using DRBD.If primary server fails secondary will be up with mails
>> ..
>> The total number of users is 600 users,and Hardware used is Two Compaq
>> servers with SCSI HDD,1 GB RAM each,
>> Network-100Mbps
>>
>> New Planned Setup
>> Now I am planning for Postgresql server in the same setup.I want to know
>> will it work in the same setup.ie if I configure
>> a new device in drbd can I get HA for postgresql also.If I use DRBD for
>> postgresql also ,will it affects the existing setups.Finally  if it is not
>> possible what is the next option for this.
>
> It *should* work as long as you don't start the PostgreSQL server on the
> second machine until you are sure that the first has failed. It will
> then think it is recovering from having crashed.

This is simply not possible. DRBD allows access to the replicated device
only on the primary node and rejects any device access on the secondary
node. So the second machine doesn't even have access to the filesystem
with the PostgreSQL data files. Unless, of course, one accesses the
physical devices below the DRBD layer directly - but when you cheat on
your replication system you're bound to get what you deserve ;-)

Regards,
       Alex.
--
"Opportunity is missed by most people because it is dressed in overalls and
 looks like work."                                      -- Thomas A. Edison