0

Currently i'm running Rails 3 web application with MySQL on one first server and Rails API application on second server that connects to the MySQL database from first server.

I'm not happy that API depends on database from first server and decided to go with replication/clustering, but i'm not sure what is the best options for my case?

  • Master - slave replication, our api not read-only, it writes a lot of information too, so it doesn't look that bright.
  • Master - Master replication, too afraid of inconsistency in data, since it can get out of sync.
  • MySQL cluster - this seems like the best options for me, however i'm not sure if it's worth clustering with only 2 nodes?

What if one node goes down, does it means, that as soon as it goes live and will consume second node as donor, the whole cluster will be unavailable? How can i avoid this?

What do you think my best option here?

2
  • 1
    avoid master-master as it is flimsy - at best!
    – thanasisk
    Jan 28, 2015 at 11:59
  • MySQL Galera cluster is a solid multi-master database solution. It only requires you to use InnoDB database engine. Jan 28, 2015 at 12:30

1 Answer 1

2

So you can't cluster only 2 nodes.. You need a quorum or you could lose a server and have a split brain then you're not sure which one has what data.

You can have 2 data servers and a 3rd voting server that doesn't store data but just a cluster member to cast a vote.

What I generally do is have a mysql cluster and have all my clients connect locally to haproxy and haproxy decides where to send the connections and it sends all the writes to a single server 100% of the time until it dies and then it goes to the backup server.

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .