MySQL and Replication

Replication is one of those words that we don’t use in everyday life (unless we live aboard the Enterprise). And so, if you use MySQL as a database server, it’s easy to ignore what is arguably one of its coolest, and most powerful features: replication.

Replication, to make a long story short, is setting up a “slave” database server, on another machine, that automatically mirrors any changes on its “master” server (the one you’ve been running all along).

There’s a useful replication how-to that’s a good starting place for setting up replication.

One important thing to note: replication mirrors everything you do on the master server. So if you mistakenly run DELETE FROM ImportantTable, the slave will dutifully do exactly the same thing.

As such, replication is only 1/2 of a good database backup strategy: it protects you if your master’s hard drive fails with an up-to-the-minute version of your data. But it doesn’t protect you from “human error” problems on the master. For that, you need a good daily, weekly and/or monthly backup of the data files themselves.

Comments