Solved

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

Posted on 2008-10-15
3
263 Views
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.
0
Comment
Question by:shankcool
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
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.

Regards,
Bill
0
 
LVL 1

Author Closing Comment

by:shankcool
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.
0
 
LVL 19

Expert Comment

by:grant300
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.

Regards
Bill
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Creating and Managing Databases with phpMyAdmin in cPanel.
Read about achieving the basic levels of HRIS security in the workplace.
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now