> Hi Django users,
>
> So I have two servers behind a vip. I currently have it setup so if
> one server goes down it uses the other http server which works great.
> However I tried to set up mysql master - master and I keep getting
> duplicate key errors and grind the process to a hault and causes a
> real headache.
>
> My only requirment is that if one server goes down the system will
> still work, either physical or software server. So what would your
> advice be? This isnt a high volumn system but it needs high
> availability due ot the fact I use this as a tools mainsite and
> configuration system.
>
Hi Colin
I run a django web-app in a similar configuration to this, like you we
do this for HA, not scalability. I have a target of four 9s
availability (roughly less than a minute per week downtime).
We have multiple DCs, with a pair of app servers in each DC. Each DC
has 2 DB servers, one master, one slave, and both app servers in the
DC are configured to use both DB servers, with writes going to the
masters, obviously. The master DB servers in each DC slave the other.
If anything goes wrong with any part of the stack in one DC, we
failover to the other and repair it.
We don't have issues with duplicate keys, because we configure each
master to use a different auto_increment_offset. This means that
inserting a new tuple cannot result in a key collision on the other
master.
Here is the stock my.cnf that we use:
# Multi Master Replication settings
server-id = 1
log-bin = /var/db/mysql/bin-log
log-slave-updates
log-bin-index = /var/db/mysql/bin-log.index
log-error = /var/db/mysql/error.log
relay-log = /var/db/mysql/relay-log
relay-log-info-file = /var/db/mysql/relay-log.info
relay-log-index = /var/db/mysql/relay-log.index
expire-logs-days = 14
auto_increment_increment = 2
auto_increment_offset = 1
master-host = <redacted>
master-user = <redacted>
master-password = <redacted>
replicate-do-db = <redacted>
On this server, offset is 1 and increment is 2, so the auto increment
keys are all odd numbers. On the other master, offset is 2 and
increment is 2, so the auto increment keys are all even numbers.
Hope that helps
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment