Question

I need to make an everyday backup of a mysql database that is very big on a remote server and I only want to get the difference since the last backup. I also need to exclude some tables from being backed up. I've setup the mysql server as a master, here is the important part of my.cnf i've changed :

log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 10 max_binlog_size = 100M binlog_do_db = my_database

Then on the backup server i've setup mysql my.cnf like this :

replicate-ignore-table = my_db_name.my_table_name

To test that everything is ok, I do the following:

On Master:

$ mysql -u root -p MariaDB [my_database]> insert into my_table (param1, param2, ...) values(1, 1, ...) MariaDB [my_database]> exit $ scp /var/log/mysql/mysql-bin.00000X vagrant@backupserver:/tmp/

On Slave:

$ mysqlbinlog mysql-bin.00000X | mysql -u root -p

When I check the slave database I always see the new entry in the table, but that's not the expected result....

I must miss something, any idea ?

Was it helpful?

Solution

The replicate-ignore-table filter applies only the streaming over replication protocol (specifically in this case the SQL thread Slave), it doesn't affect if you apply log changes manually as you are doing. The detailed information about replication filtering can be complemented with the replication rule application if you want to understand fully the mechanisms for replication filtering.

A very easy step-by-step tutorial will allow you to setup a standard replica using no other tools than the ones included in the official distribution.

Although you don't want to replicate the table, I recommend you to create the table structure but using BLACKHOLE engine for avoiding some scenarios issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top