Comparing MySQL and Postgres 9.0 Replication (TheServerSide)
As demonstrated above, there are both feature and functional differences between how MySQL and PostgreSQL implement replication. However, for many general application use cases, either MySQL or PostgreSQL replication will serve just fine; technically speaking, from a functional and performance perspective, it won't matter which solution is chosen. That said, there still are some considerations to keep in mind in deciding between the different offerings."
Posted Nov 19, 2010 11:36 UTC (Fri)
by Richard_J_Neill (subscriber, #23093)
[Link] (7 responses)
We have two servers, located side-by-side, and a dedicated gigabit-ethernet link between them. Each server contains a RAID-1 (mirrored) array of X-25E SSDs. Using SSDs, we can disable the write-cache, and still get decent performance. We then form a DRBD array of these pairs. This is where we mount /var/lib/pgsql.
The result is extremely fast, and very robust. A transaction for Postgresql will commit when:
Posted Nov 19, 2010 18:03 UTC (Fri)
by kjp (guest, #39639)
[Link] (6 responses)
Posted Nov 19, 2010 20:39 UTC (Fri)
by DG (subscriber, #16978)
[Link]
Posted Nov 21, 2010 0:47 UTC (Sun)
by butlerm (subscriber, #13312)
[Link] (2 responses)
Posted Nov 21, 2010 10:41 UTC (Sun)
by dlang (guest, #313)
[Link]
however the server doesn't keep the WAL log around forever, so I would expect that if you get so far behind that the master no longer has a copy of things you have to do a backup.
note that this is speculation, I'm not an expert here
Posted Nov 21, 2010 18:39 UTC (Sun)
by ewan (guest, #5533)
[Link]
I think.
Posted Nov 22, 2010 0:31 UTC (Mon)
by Richard_J_Neill (subscriber, #23093)
[Link] (1 responses)
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
and the converse.
Posted Nov 22, 2010 6:58 UTC (Mon)
by jjs (guest, #10315)
[Link]
Posted Nov 27, 2010 1:36 UTC (Sat)
by vivo (subscriber, #48315)
[Link]
Found this confusing, anyway, speaking of Mysql 5.1:
DRBD
- it has been flushed to physical disk on the primary.
- it has reached the memory of the secondary.
DRBD
DRBD
DRBD
DRBD
DRBD
DRBD
mount /var/lib/postgresql
service postgresql start
DRBD
Comparing MySQL and Postgres 9.0 Replication (TheServerSide)
- "replicate-ignore-db=mydb" + "USE mydb; /*query*/"
will NOT send the log to the slaves
- "replicate-wild-ignore-table = mydb.t1" + "USE mydb; INSERT INTO t1"
WILL send the log to the slaves and there it will be fltered