Mysql – Binary log backups in MySQL

MySQLmysqlbinlogreplication

I'm running a master-master replication with read-only second master. Now since my binary logs are not getting replicated in my passive master.

  1. Should I need to enable --log-slave-updates? If I enable this, will I be able to take binary log backups from my passive master? If I enable it in passive master, I should not enable the same on active master right?

If I enable –log-slave-updates in my active master also, consider the case of a disaster where in my primary master has a issue, then I will make my passive master the active one and point my application to my new master. Now my new master will be generating binary logs which will be waiting to replicate to my actual master (which is down now). SO what happens when my actual master comes up? Binary of my secondary master gets copied to my primary without any issues?

  1. While enabling –log-slave-updates, should I have attn on any other parameters as well.?

Thanks!

Best Answer

log-slave-updates=true

  1. should be true on both masters. Because if both masters are accepting updates then the other passive master has to be able to update itself.

  2. You can take backups of the bin logs whenever you want.

  3. As to other options, I use the MIXED option for the binglog_format to allow for ROW based or STATEMENT based updates

    binlog_format = MIXED

This is because STATEMENT based replication doesn't cover all updates. But STATEMENT based replication is faster. With MIXED MySQL can switch for you when appropriate.