Can I stop replication of create/drop index statement on one slave of Mysql 5.6?

Posted on

Question :

I have this cluster where master and slave uses same indexes but one of the slaves has some extra indexes (large machine which runs some analytics queries).

So I have to maintain two sets of indexes. But this usually creates a problem when I want to recreate an index on master that was already present on the analytics slave.

Can I stop replication of create/drop index statements on one of the slaves so that I can manage them manually?

Answer :

I don’t believe there is a way to ignore specific DDL (or any DDL?). If creating an existing index, it should throw an error, which you should be able to ignore on your analytics-slave.

Alternatively, don’t replicate Index Creations.

set log_bin=0; 
create index name on table;
set log_bin=1; 

Create a wrapper script to apply to master and slave as needed.

Leave a Reply

Your email address will not be published. Required fields are marked *