How can I syncronise multiple mysql database, local to remote and viceversa?

Posted on 2008-10-15
Last Modified: 2012-08-14
I have developed a web app that runs locally via localhost, the record entered gets stored locally in the mysql database. My problem is that this application now is to be installed in multiple office locations and in each office location we need to be able to see the consolidated data from all the locations . I initially thought of connecting all the app to a consolidated  remote database and update the records to this db instead of the local mysql. But the problem is that this app has to run even when there is no internet connection, i.e when there is no net connection the records need to be stored locally and when there is internet it needs to syncronise with the consolidated db, this has to happen for at all office locations. Please suggest a solution or a tool.
Question by:shankcool
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 19

Accepted Solution

grant300 earned 125 total points
ID: 22722744
This, unfortunately, is an architectural issue.  The deployment scheme needs to be taken into account before tools are chosen and certainly before all the code was written.

Since you posted this in the Sybase area, I will go ahead an suggest you use Sybase SQL Anywhere (AKA iAnywhere, AKA Adaptive Server Anywhere, AKA ASA).

Sybase ASA has replication features specifically designed to support this kind of scenario.  It is robust, easy to use, and very cost effective.  True, it is not free but then, you are going to burn weeks or months trying to get some homebrewed solution to work.

No, replication is not the easiest way to make this all work; your gut instinct to use a centralized database is actually the right way to go.  Quite frankly, if an office is that critical, chances are loss of the internet is a bigger problem than just your app and a backup should probably be in place anyway.

That said, your unreliably connected remote offices can use ASA replication to get what you want to work.  You do definitely need a centralized consolidated server in the middle of all this as you will never succeed with an "everybody replicates to everybody" scheme.

There are issues in a scheme like this.  First and foremost is reconciling master data and IDs.  For instance, if you enter a new customers a mutliple sites, you have to have some way of assigning IDs so that there are no duplicates when they come to gether.  Like wise, if you edit the same customer at two different sites, who wins?  And of course, what happens when the same customer is entered at site A and site B?  Even if you have a mechanism to prevent duplicate IDs, you now have two versions of the same master data.

Not knowing what your application is, it is a little hard to be specific but I think it is safe to say that even switching to the best tool there is for this kind of thing, you are facing a non-trival task to fix up your database design and application code to make this a bullet-proof architecture.  If you try to short-cut things, you will forever be chained to this beast fixing data problems.

My own approach to this would be to take this in a couple of phases.  Phase 1 would be to switch to ASA.  Phase 2 would be to deploy this with one centralized database.  You can get to this point fairly quickly and with minimal expense.  You then have an opportunity to evaluate both the reliability and backup options for the Internet connections as well as time to really scope out what the database and application changes required are.  If your employer/client still insist on the distributed database architecture, then you are positioned to go forward.  If they decide they can live with the centralized database, you are already there and humming along nicely.


Author Closing Comment

ID: 31506255
Thanks Bill, perfect answer , i was thinking of using sybase mobilink with sql anywhere locally and consolidated mysql remotely, your solution further boosts my approach.. thanks again for the wondelful help.
LVL 19

Expert Comment

ID: 22731840
Glad I could help.

It sound as if you are headed in the right direction.  The only thing I would add is that keeping MySQL in the mix will only complicate things.  If you shift to ASA, go all the way.  It will greatly simplify your life and perhaps provide options not available in a mixed environment.


Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question