Multi Master Mysql

I have an web application running on a single MySQL database.   The users are in remote communities where internet access is not available for hours at a time.  I would like to set up MySQL servers in each of the communities which sync with a centralized master when the internet is available.  The application is reading and writing.   Each community is mostly accessing its own data, so there would be little conflict.  I have looked a bit at Amazon database migration service and sharding.  Any ideas?
Matthew ConnellyAsked:
Who is Participating?
 
gr8gonzoConsultantCommented:
This could get complicated pretty quickly. MySQL's typical replication only supports dual-master scenarios, but it sounds like you would have more than that, and you'd likely need a separate process for each database.

The NDB (cluster) engine was designed for multiple nodes but not for the nodes to be remote. The node communication isn't encrypted and is generally expected to all be on the same network. You'd probably have some weird behavior if you tried to use NDB.

There are databases that would handle this scenario better, but if you're set on using MySQL, I think your best bet would be to try and do it through application / code logic, where a piece of code recognizes that an internet connection is available and it pushes the data back to the master. So the databases aren't running in true replication - the code is taking care of it.

I'm a little curious about the purpose of the master database in this scenario. Is it there as a backup in case the remote / community database fails?
1
 
Olatunde Francis OyeyemiCommented:
This expert suggested creating a Gigs project.
If I get you clearly you are trying to do clients-server application, but client will have their server when there is internet the server speak with the main central server to update itself like reading and writing back, right? If yes, I think you should ask yourself first if intranet application is better since internet is not stable. You can do clients-server intranet web application and make all the clients connect to the master central server at ease.

But if you insist doing it the way you explained above then you need something to check if their is internet connection in PHP, if there is, send data to interact with the central server else stay within client system.
0
 
Jim RiddlesPrepress/OMS SpecialistCommented:
Could this simply be handled as an offline capable app that syncs when it has internet access?  I'm not sure of the size of your database, but it may work for you.

Have a look at this article to get you started: http://apress.jensimmons.com/v5/pro-html5-programming/ch12.html
0
 
Matthew ConnellyAuthor Commented:
Thanks.  It seems the best way will be through the application or some kind of database scripts running at night.  The purpose of the master is to be able to see the whole system (users in every database).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.