|
|
Subscribe / Log in / New account

DRBD

DRBD

Posted Nov 22, 2010 0:31 UTC (Mon) by Richard_J_Neill (subscriber, #23093)
In reply to: DRBD by kjp
Parent article: Comparing MySQL and Postgres 9.0 Replication (TheServerSide)

To answer a few of the questions here:

DRBD has 3 protocols for synchronisation. The middle one (B) is good enough for us: even if the primary server is completely obliterated, our data still survives, unless the secondary suffers a simultaneous UPS failure.

We could do auto-switchover, but in this case, we'd rather have an actual failure and manual change. If the warehouse stops for 5 minutes, it's inconvenient, but the risk of a switchover happening automatically and possible split-brain is worse. Also, perfect failover can sometimes lead to nobody noticing...and then you think your system has redundancy when it no longer does. (I had this happen once with a RAID5 system: one disk failed, and we didn't notice; since that experience, I tend to prefer systems that fail noisily.)

In terms of switchover, there are 2 parts: DRBD and postgres.

1. DRBD can operate with either system as master; if the link goes down and then comes back up, it will resynchronise quite quickly. Likewise, switching master and slave is fast. What you NEVER EVER want is "split brain" - where both halves of the system think they are primary, and they diverge, without it being obvious which one can be discarded.

2. We just switch postgres by mounting and unmounting /var/lib/pgsql on the drbd device. So only one server has the postgresql process running.

It's simply a case of:

drbdadm primary r0
mount /var/lib/postgresql
service postgresql start

and the converse.


to post comments

DRBD

Posted Nov 22, 2010 6:58 UTC (Mon) by jjs (guest, #10315) [Link]

Way to solve split brain (and I believe Linux-HA has this, certainly RHAS does) is STONITH - Shoot the Other Node in the Head. Basically each system has a connection to the other's power strip. Before takeover it turns off (normally restarts) the power. So the other system is guaranteed dead on takeover, and comes back up as the slave.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds