On 21/06/10 00:34, Elior Soliman wrote:
> Hello,
>
> My company looking for some solution for High availability with Postgres.
>
> Our optional solution is as follows :
> Two DB servers will be using a common external storage (with raid). Both
> servers are going to use the same DB files on the storage (as
> active/passive)
Why do you want that configuration?
For PostgreSQL, a warm standby setup using WAL-based replication (PITR,
or "point in time replication") is usually the preferred approach.
There are also add-on replication solutions like bucardo and slony-I.
> Now I'm trying to understand how Postgres can work with thi
> configuration. I.e :
>
> DB_server1 crashed, so we want to start DB_server2 using same files.
> Is it possible ?
Depending on why and how db_server1 crashed, it may be. If the DB server
crashed in such a way as that it didn't stomp all over the shared
storage, then you can unplug db_server1 from the shared storage or
otherwise render that shared storage completely inaccessible by
db_server1, then start the database on db_server2.
If you fail to render it inaccessible by db_server1 or make sure
db_server1 is stone dead (powered off) first, you may land up with two
postmasters trying to work with the same data. This *will* cause
corruption if you override/bypass Pg's attempts to detect and prevent
this fault condition.
The only time you can really use shared storage is if you have a
heartbeat setup with STONITH. Even then, I'd personally prefer to use
network replication if at all possible, since it removes the shared
storage as a central point of failure. It also lets you use much, much
faster locally attached storage where disks are dedicated to PostgreSQL.
--
Craig Ringer