Reputation: 430
I am going to launch my Android app soon and I was wondering if anyone can give me a hint on how to manage the database it is using. Here's the situation:
I have an Android app that connects to a HTTPS server stored in Amazons EC2. I've set up a load balancer which distributes the load among two instances, so essentially the app connects to the balancer. The problem is that the two instances have their own copy of the database and it is not synchronized in any way. I basically want both servers to handle READ requests from the database and whichever one receives a WRITE, that write to be sent to all other instances. I am not sure if this is the best solution so if anyone has a better one, I'm open to suggestions.
Now I know about replication and I've checked stackoverflow for topics on that subject but unfortunately couldn't find anything that might help. The idea is not to have a single point of failure :) BTW, I am using mysql as a database with the JDBC driver for Java and the servers are written in Java.
Thanks :)
Upvotes: 2
Views: 495
Reputation: 3202
I would not care about what database your application reaches with the insert or the read.
I reccomend using a replication setup (master <-> master replication has some disadvantages, like PK violation could easily occur) like galera cluster.
If one database could handle every write loadwise, I would go for a simple master->slaves replication. (write goes to master all the time, master writes that data to all slaves that are used for read)
Upvotes: 1