MySQL 5.7線上設定忽略表複製方法
MySQL5.7版本後增加了線上設定忽略表複製方法,舉例如下:
先停止SQL執行緒:
mysql> STOP SLAVE SQL_THREAD;
Query OK, 0 rows affected (0.01 sec)
mysql> CHANGE REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE =('credit.%');
Query OK, 0 rows affected (0.00 sec)
mysql> start SLAVE SQL_THREAD;
Query OK, 0 rows affected (0.01 sec)
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.16.70
Master_User: slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000022
Read_Master_Log_Pos: 460682
Relay_Log_File: nginx-relay-bin.000004
Relay_Log_Pos: 4201
Relay_Master_Log_File: mysql-bin.000022
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: credit
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table: credit.% --此處表示上面的命令線上設定成功
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 460682
Relay_Log_Space: 4408
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: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 70
Master_UUID: f1366940-266c-11e7-92c2-525400f39f79
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 32197cd9-2957-11e7-a5c4-525400e493a4:1-3,
f1366940-266c-11e7-92c2-525400f39f79:1-6956
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
備註:全部同步所有庫的命令就是:
CHANGE REPLICATION FILTER REPLICATE_DO_DB = ();
只同步部分庫:
CHANGE REPLICATION FILTER REPLICATE_DO_DB = (db1, db2);
先停止SQL執行緒:
mysql> STOP SLAVE SQL_THREAD;
Query OK, 0 rows affected (0.01 sec)
mysql> CHANGE REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE =('credit.%');
Query OK, 0 rows affected (0.00 sec)
mysql> start SLAVE SQL_THREAD;
Query OK, 0 rows affected (0.01 sec)
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.16.70
Master_User: slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000022
Read_Master_Log_Pos: 460682
Relay_Log_File: nginx-relay-bin.000004
Relay_Log_Pos: 4201
Relay_Master_Log_File: mysql-bin.000022
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: credit
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table: credit.% --此處表示上面的命令線上設定成功
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 460682
Relay_Log_Space: 4408
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: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 70
Master_UUID: f1366940-266c-11e7-92c2-525400f39f79
Master_Info_File: /usr/local/mysql/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 32197cd9-2957-11e7-a5c4-525400e493a4:1-3,
f1366940-266c-11e7-92c2-525400f39f79:1-6956
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
備註:全部同步所有庫的命令就是:
CHANGE REPLICATION FILTER REPLICATE_DO_DB = ();
只同步部分庫:
CHANGE REPLICATION FILTER REPLICATE_DO_DB = (db1, db2);
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2144266/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL 5.7並行複製MySql並行
- mysql 5.7半同步複製MySql
- mysql 5.7多源複製MySql
- MySQL 5.7 並行複製MySql並行
- [Mysql]Mysql5.7並行複製MySql並行
- 【Mysql】mysql5.7無損複製MySql
- mysql5.7主從複製,主主複製MySql
- Mysql5.7半同步複製MySql
- MySQL 5.7搭建多源複製MySql
- MySQL 5.7 延遲複製配置MySql
- MySQL5.7主從複製-半同步複製搭建MySql
- MySQL5.7主從複製教程MySql
- mysql 5.7開啟並行複製MySql並行
- 【Mysql】Mysql5.7的多源複製搭建MySql
- mysql半同步複製的設定MySql
- MySQL 5.7傳統複製到GTID線上切換(一主一從)MySql
- mysql 5.7 主從複製搭建及原理MySql
- MySQL 5.7 複製的過濾引數MySql
- 【Mysql】mysql公開課之-mysql5.7複製特性MySql
- MySQL Case-MySQL5.7無效的並行複製MySql並行
- #MySQL# mysql5.7新特性之半同步複製MySql
- MySQL案例07:MySQL5.7併發複製隱式bugMySql
- MySQL 5.7 基於GTID搭建主從複製MySql
- MySQL5.7半同步複製報錯案例分析MySql
- MySQL 5.7基於GTID的主從複製MySql
- MySQL 5.7組複製(group replication)的要求和限制MySql
- MySQL 5.7 使用GTID方式搭建複製環境MySql
- MySQL5.7 使用者設定密碼解決方法MySql密碼
- Mysql 5.7 基於組複製(MySQL Group Replication) - 運維小結MySql運維
- MySQL 5.7 多主一從(多源複製)同步配置MySql
- mysql 5.7 多主一從的多源複製搭建MySql
- mysql線上建立半同步複製的從庫MySql
- MySQL 5.5使用Xtrabackup線上搭建複製環境MySql
- MySQL 5.7的安裝及主從複製(主從同步)MySql主從同步
- Ubuntu MySQL5.7設定root密碼UbuntuMySql密碼
- MySQL5.6 -> MySQL5.7 跨版本多源複製(Multi-Source Replication)MySql
- MySQL5.7 InnoDB線上DDL操作MySql
- MySQL 8 忽略表名大小寫MySql