Thursday, February 3, 2011

MySQL Clustering and replication

I want to setup a MySQL cluster setup of two servers (M1-M2). I also want to setup MySQL replication between two servers (M1-M3).

Is it possible to setup both clustering and replication as above. Is it a good idea to have a setup like this ?

I want to have server M1 and M2 in the amazon cloud and other server M3 in our datacenter.

  • I've never done mySQL replication or clustering, so this post is just a "for what it's worth" post. If I were setting this up, and have clustering AND replication, then I would made the "cluster" master-master replicate and then the second "cluster" would be the slaves setup as master-master. So basically cluster CL1 has 2 mySQL servers, setup using master-master replication (so they both have the same data). Then for cluster #2, CL2, I'd setup as the "slave" servers that get replicated from CL1, but again, they would be setup as master-master replication so that all of THOSE in THAT cluster all have the same data, since it is a cluster.

    However, this might not be how mySQL replication and clustering works. Hopefully I don't get a downvote, since I'm just giving you my 2 cents about how I would do it. Again, I've never done this and I've thought about it, but no needed to, and most of our companies databases are Oracle.

    drewrockshard : Actually, after further research, maybe you shouldn't do replication AND clustering; again not sure, since I don't know what the "correct" thing to do here. However, there's a good writeup on mySQL clustering - http://dev.mysql.com/tech-resources/articles/mysql-cluster-for-two-servers.html
  • This should be quite possible. MySQL cluster uses the NDB (Network Database) engine to "replicate" changes between the two nodes. So it does not use the binary logs at all. You can therefore setup the other server M3 to do straight binary log replication.

    You could theoretically use whatever engine you wanted for M3, but beware that certain DML and most DDL will fail for certain engines (or at least behave differently). So the most robust would be to have M3 be a single node NDB instance. But you could set it up to use MyISAM or InnoDB, just realize that it could lead to issues down the road...

    As for if it is a good idea, that depends. As long as the M1 -> M3 replication is a Master-Slave relationship (with M3 being the slave), I don't see the harm in that...

    From ircmaxell

0 comments:

Post a Comment