[Linux-cluster] postgres cluster without shared storage (ESGLinux)

C. Handel christoph at macht-blau.org
Fri Jul 2 13:59:00 UTC 2010


> I need to mount a two nodes cluster with postgres as service. I have mounted
> it in the past but with a shared storage and using GFS but now I don?t have
> this element.
>
> The idea is to have a master node with all the data in its own disk and have
> a mechanism to replicate this data to the slave node in its own disk. If the
> master goes down the slave begin to give the service and the flow of data
> will go from this node to the other one. (the slave node becomes the master
> one)
>
> Is it possible to do something like this?

To get a good HA solution it is always necessary to know all edge
cases of the clients. If you can modify the clients/application it is
much easier to get a working HA solution.

Also you need to define what is HA? Failover in seconds? minutes?
seamless? Client reconnect?

With postgresql 8.3+ (i think it started with 8.3) you can do
logshipping. That results in an active server accepting connections
and a standby. The standby does not accept connections. It follows the
original data pretty close but can lag behind (same lag goes for mysql
replication, except mysql allows readonly on the slave). You need to
script the failover. That is, detect that the master missbehaves,
shoot it (important!) and switch the standby from replication to
service. You can't have a switchback to the master. Clients need to
detect that they lost connection and reconnect. This solution is
straight forward, easy to understand and holds no surprises (so why
did it do this? How did i loose this transaction?). Failover time
depends on timeouts (how long do you wait before you decide that the
master is dead?) but can be done sub-five-minutes.

Starting with postgesql 9 you can have hot-standby that accepts
read-only connections. And the standby can upgrade the connections to
read-write without a reconnect. You still need to work your way
through the ip failover. Haven't used this (and 9 is still beta).


Greetings
   Christoph




More information about the Linux-cluster mailing list