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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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:
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).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.