Wednesday, November 28, 2007

Replication In MySQL

In some forums, i often saw a question asking about how to synchronize a database to some database servers (it could be local servers or even public servers via Internet). Using a dumped SQL is not very efficient if you want a real time access. Using mysqlhotcopy needs some resources, so it would rip off the performance of the system. The solution is by using Replication. Here's some information from MySQL's manual:

Replication enables data from one MySQL database server (called the master) to be replicated to one or more MySQL database servers (slaves). Replication is asynchronous - your replication slaves do not need to be connected permanently to receive updates from the master, which means that updates can occur over long-distance connections and even temporary solutions such as a dial-up service.
Today, at UGM, i got a material about replication (actually it was last week's material, but many of us had failed, so we had to restart it again. I was absent last week since i had to go to ILC 2007, so this is my first class actually). As always, Manual is the best place to start. I managed to set up one computer as a master and another computer as a slave in less than 10 minutes, so i guess it's pretty straightforward. By using this scheme, the slave would only have read-only access, meaning it only retrieve the updates from the server. Changing the slave wouldn't affect the server. In order to get a round robin model, we should use the daisy-chain model, which is like a P2P technology, where a computer became a server and also became a slave. To do this, it only requires some modifications and it won't take more than another ten minutes to configure it.

0 Comments:

Post a Comment

<< Home