Go Premium for a chance to win a PS4. Enter to Win


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

Posted on 2008-10-15
Medium Priority
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
  • 2
LVL 19

Accepted Solution

grant300 earned 500 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

963 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