How to prevent replication of certain records using mysql

I have a master-master-replication that works successfully, it works fine, and all the changes that I make will be reflected by subordinates.

But I do not want this slave to reflect all the changes - only those records that I want should reflect on subordinates. How can I do that?

+3
source share
4 answers

You can do

SET sql_log_bin=0;

before the statement (s) that you DO NOT want to replicate. They will not be sent to a slave.

Alternatively, you can configure each connection on the application side to set this value, then do

SET sql_log_bin=1;

. , MySQL: SQL-, ?.

+2

, - , - . slave .

, .

+1

, , - VIEW , , , VIEW. "VIEW" MYISAM/InnoDB VIEW. , (.. InnoDB- > MyISAM), View.

+1

, , .

(, , mysql. *, GRANTs) ( )

If you want to prevent replication of certain types of statements (for example, DELETE queries), you can use MySQL proxies to overwrite these queries before they are replicated.

If you intend to outline the database on slave devices (for example: records that run AM on one server and NZ on another), then the MySQL proxy can help you again.

+1
source

Source: https://habr.com/ru/post/1760724/


All Articles