percona xtrabackup incremental backup vs replication

549 Views Asked by At

I was playing with percona xtrabackup innobackupex for incremental backups. It is a cool tool and very efficient and effective for incremental backups. However, i could not help but wonder why doing incremental backups would be any better than just doing a regular mysql master-slave replication, and whenever needed to retrieve point-in-time data, just use the binary log?

What advantages would doing incremental backups have over doing master-slave replication? When should you choose to use over the other?

2

There are 2 best solutions below

1
On

One disadvantage to using master-slave replication as a backup is that accidentally running data damaging commands like

DROP TABLE users;

would replicate to the slave.

0
On

They are solutions to two different problems; master-slave is redundancy and backup is resilience.

The MySQL JDBC driver has the ability to connect to many servers. If you look at the driver options (https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-url-format.html) you will notice that the host option is not only host, but hosts. If you specify the URL to both the master and the slave and something happens to the master the driver will automatically connect to the slave instead.

Backup, on the other hand, is, as was mentioned earlier, a way to recover from either a catastrophic crash (having your backups stored off-site is a must) or recover from a catastrophic mistake -- neither of which is served by a master-slave setup. (Well, technically you could have the slave at a different site but that still does not cover the mistake scenario)