Multiple master Mysql replication with Moodle?

Multiple master Mysql replication with Moodle?

by Moritz von Schweintiz -
Number of replies: 9
Hello,

can anybody confirm or deny whether Moodle runs on mysql server configured to do multiple-master replication? I would like to set up 2 servers that constantly replicate each other, and i have had very good results with mysql's multiple master replication for doing exactly that.
AFAIK, as long as an application uses AUTO_INCREMENT columns, and unique keys that are guaranteed to be unique across hosts, this should Just Work (R), but I am a complete Moodle newbie, so I'd be grateful for any information on whether Moodle works with this.

Thanks,

-schweini
Average of ratings: -
In reply to Moritz von Schweintiz

Re: Multiple master Mysql replication with Moodle?

by Dan Poltawski -
Yep, I use this and it works ok.

Dan
In reply to Dan Poltawski

Re: Multiple master Mysql replication with Moodle?

by Moritz von Schweintiz -
Thanks for the heads-up!

anything special i have to watch out for? And how did keep the relevant directories on the filesystem in sync? I'm thinking about an rsync-cronjob every couple of minutes, even though that doesn't seem like the most elegant solution to me....

Thanks for any help,

M.
In reply to Moritz von Schweintiz

Re: Multiple master Mysql replication with Moodle?

by dibesh shrestha -

My question is also the same. In addition how do i sync. the moodle data folder?

In reply to Moritz von Schweintiz

Re: Multiple master Mysql replication with Moodle?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Don't do it. Multi-master replication is hard and can corrupt your data.

Just buy a big DB server with lots of RAM, then tune the database to use it. If you can use Postgres.

Get memcache(d) for caching, and use NFS for moodledata on a shared file-store.

In reply to Tim Hunt

Re: Multiple master Mysql replication with Moodle?

by dibesh shrestha -

Thnak you Tim for your reply. What may be the option to synchronize moodle database and data beside multi master replication?

I want to use moodle which works as the principal of Dropbox. i.e  I want to use the moodle in Network down state. Lets suppose we have two moodle servers running at two ends which are disconnected during the day time and will get connect at night. So, If master-master replication is not a good idea, how do i synchronize the database and when the networks is ON at night? I look forward for your advice.

In reply to dibesh shrestha

Re: Multiple master Mysql replication with Moodle?

by Guillermo Madero -
In reply to Tim Hunt

Re: Multiple master Mysql replication with Moodle?

by Noat Tran -

Hi Tim,

So you meant the Postgres has better performance than mysql?

Because Im considering to change to Postgres from mysql for my moodle database server.

 

Thanks,

Toan

In reply to Noat Tran

Re: Multiple master Mysql replication with Moodle?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

To be honest I don't konw.

There are actually two separate measures that are important:

  1. performance - how fast it isexecuting one particular query
  2. scalability - how much is slows down as the number of simultaneous users goes up, or the amount of data in the tables gets bigger.

Postgres is very good for scalability, which is why we have used it at the OU for the last 8 years.

There are other important properties you want from a database, like

  • Store all your data safely, and never, ever corrupt it.

Posgres is one of the best databse by that measure, which is good for your peace of mind. MySQL is notorious for data integrity issues. Of course, many people use MySQL successfully, so it is possible, but some people have had bad experiences.

In reply to Tim Hunt

Re: Multiple master Mysql replication with Moodle?

by Andrew Lyons -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

I'll second Tim's sentiments here. MySQL has been notorious for being fast, but this is usually at the expense of data integrity. As I recall (and I try to avoid MySQL wherever possible), MySQL is fastest when you disable much of it's ACID compliant functionality so many of the comparisons which people make are not apples for apples comparisons.

Nigel McNie (former Mahara lead developer) wrote a pretty informative post on why he dislikes MySQL (http://nigel.mcnie.name/blog/how-bad-is-mysql). It's an old post, but still largely true.

Postgres currently does not support multi-master replication, but it does support streaming replication and you can use connection poolers such as pgpool which allow you to direct some of your read-only queries (E.g. COUNT, SELECT, etc.) to the slave.

Best wishes,

Andrew