mysql configuration parameters sql_log_bin
If you want to perform some operation on the main library, but not copied to the slave libraries can be accomplished by modifying the parameters sql_log_bin. For example, where an analog synchronous replication master from abnormalities.
Another scenario is when you import or delete a large amount of data, respectively, and executed from the library at the main library, without the need to reach consensus through replication.
- performing a database from MySQL > SET SQL_LOG_BIN = 0 ; Set # 0, statements executed on the Master Database records are not the binlog MySQL > Delete from T1 WHERE ID = . 3 ; # For example, the deletion will not will be recorded in the binlog MySQL > the SET SQL_LOG_BIN = 1 ; - be careful to use the global modifier (set global sql_log_bin = 0), this will lead to the implementation of all the statements in the Master database is not recorded in the binlog, this is certainly not what you want the result of
- performed on primary database MySQL > Delete from T1 WHERE ID = . 3 ;
-- 在从库上执行 mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 10.192.30.53 Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000002 Read_Master_Log_Pos: 703173 Relay_Log_File: fudao_db_cluster_003-relay-bin.000002 Relay_Log_Pos: 2656 Relay_Master_Log_File: mysql-bin.000002 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: test.%,information_schema.% Last_Errno: 1032 Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction '46760eb0-bcb3-11e9-a352-24a9c4e7e87e:73' at master log mysql-bin.000002, end_log_pos 703142. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any. Skip_Counter: 0 Exec_Master_Log_Pos: 702860 Relay_Log_Space: 3192 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 1032 Last_SQL_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction '46760eb0-bcb3-11e9-a352-24a9c4e7e87e:73' at master log mysql-bin.000002, end_log_pos 703142. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any. Replicate_Ignore_Server_Ids: Master_Server_Id: 3306 Master_UUID: 46760eb0-bcb3-11e9-a352-24a9c4e7e87e Master_Info_File: mysql.slave_master_info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: 190813 11:22:24 Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 46760eb0-bcb3-11e9-a352-24a9c4e7e87e:66-73 Executed_Gtid_Set: 46760eb0-bcb3-11e9-a352-24a9c4e7e87e:1-72 Auto_Position: 1 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0 Network_Namespace: 1 row in set (0.00 sec) ERROR: No query specified mysql>