I have created a POS system for our corporation, in the HQ we have a wamp server with the main database, we also have more than 25 branches across the country.
I will setup a wamp server on each branch, so I can access its database directly when putting wamp online.
I want to make MySQL replication with all branches, so every query on any branch will affect the main database on HQ.
I tried to test but found no one to explain how to do it using wamp on different PCs.
Best Answer
For something like this, you may want to think about a unique architecture known as a Star Topology.
Picture the following:
branch002
branch025
Setup Data for HQDB
branch001
throughbranch025
Setup each Branch
branch001
intobranch001
on ServerBranchDB001
branch001
on ServerBranchDB001
Setup Replication
Here is the tricky part. You want to make the HQDB the Slave of Every Branch. Unfortunately, MySQL Replication is inherently designed to be a Slave reading from one Master. (NOTE: MultiMaster (MultiSource) Replication is being implemented in the soon-to-be-released MariaDB 10.0. Since I am a MySQL DBA, I leave that to more adventurous DBAs. I need to more free time to learn MariaDB.)
Getting on with MySQL Replication, the idea is
RESET MASTER
onBranchDB001
(Clears Binary Logs)branch01
)branch001
into HQDB'sbranch001
RESET MASTER
onBranchDB002
branch02
)branch002
into HQDB'sbranch002
RESET MASTER
onBranchDB025
branch25
)branch025
into HQDB'sbranch025
If you have common tables to ship to every branch, simply mysqldump each branch's copy of that table and load into each branch.
All these things could be done in a maintenance cycle to update HQDB's copy of every branch
I have discussed this wild idea before
Apr 25, 2011
: MySQL in star topology in StackOverflow (My 1st answer)Apr 25, 2011
: MySQL in star topology in StackOverflow (My 2nd answer)Apr 28, 2011
: MySQL in star topology in ServerFaultCAVEAT