91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

關于replicate_do_db和replicate_ignore_db的坑

發布時間:2020-07-14 02:35:03 來源:網絡 閱讀:11704 作者:蘇黎世1995 欄目:MySQL數據庫

介紹

MySQL5.7官方文檔關于相關參數的介紹:https://dev.mysql.com/doc/refman/5.7/en/change-replication-filter.html

在5.7版本支持動態修改,之前的版本需要重啟數據庫:

STOP SLAVE SQL_THREAD;

CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB=(demo);

START SLAVE SQL_THREAD;

問題描述

在主庫執行語句,如果不使用use db;
創建新表的語句不會在從庫執行,進而導致主從錯誤

場景復現

從庫配置:


replicate-ignore-db = test
replicate-do-db = abc

主庫操作:

22:29:04test>use test;
Database changed
22:30:26test>create table abc.t0417(id int,name varchar(20));
Query OK, 0 rows affected (0.08 sec)

22:31:37abc>use test;
Database changed
22:32:05test>insert into abc.t0417 values(1,'a');
Query OK, 1 row affected (0.02 sec)

從庫狀態,SQL線程出現報錯:

22:31:07abc>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.136.128
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000015
          Read_Master_Log_Pos: 8478
               Relay_Log_File: cptest-relay-bin.000007
                Relay_Log_Pos: 1292
        Relay_Master_Log_File: mysql-bin.000015
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: abc
          Replicate_Ignore_DB: test
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 1146
                   Last_Error: Error executing row event: 'Table 'abc.t0417' doesn't exist'
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 8235
              Relay_Log_Space: 1709
              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: 1146
               Last_SQL_Error: Error executing row event: 'Table 'abc.t0417' doesn't exist'
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1
                  Master_UUID: 4ac80f6d-8063-11e7-9d63-000c291d913c
             Master_Info_File: /data/mysql/mysql3309/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: 180416 22:32:20
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 4ac80f6d-8063-11e7-9d63-000c291d913c:3609-3630
            Executed_Gtid_Set: 4ac80f6d-8063-11e7-9d63-000c291d913c:1:3609-3629,
a1c747e9-4170-11e8-883f-000c29c6b279:1
                Auto_Position: 0
1 row in set (0.00 sec)
解決問題

更改從庫配置:

#replicate-ignore-db = test
#replicate-do-db = abc
replicate_wild_do_table = abc.%
replicate_wild_ignore_table = test.%

主庫操作:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 65
Server version: 5.6.35-log Source distribution

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

caopeng@192.168.136.128 00:39:16(none)>use test;
Database changed
caopeng@192.168.136.128 00:39:32test>create table abc.test0417(id int,name varchar(20));
Query OK, 0 rows affected (0.17 sec)

caopeng@192.168.136.128 00:40:25test>insert into abc.test0417 values(1,'b');
Query OK, 1 row affected (0.11 sec)

從庫狀態:

root@localhost 00:39:06(none)>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.136.128
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000015
          Read_Master_Log_Pos: 9644
               Relay_Log_File: cptest-relay-bin.000010
                Relay_Log_Pos: 771
        Relay_Master_Log_File: mysql-bin.000015
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: abc.%
  Replicate_Wild_Ignore_Table: test.%
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 9644
              Relay_Log_Space: 945
              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: 1
                  Master_UUID: 4ac80f6d-8063-11e7-9d63-000c291d913c
             Master_Info_File: /data/mysql/mysql3309/master.info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 4ac80f6d-8063-11e7-9d63-000c291d913c:3609-3635
            Executed_Gtid_Set: 4ac80f6d-8063-11e7-9d63-000c291d913c:1:3609-3635,
a1c747e9-4170-11e8-883f-000c29c6b279:1-6
                Auto_Position: 0
1 row in set (0.00 sec)

root@localhost 00:40:54(none)>select * from abc.test0417;
+------+------+
| id   | name |
+------+------+
|    1 | b    |
+------+------+
1 row in set (0.00 sec)
總結
  • 使用replicate_do_dbreplicate_ignore_db兩個參數時在主庫操作需要使用use db;然后再進行其他操作
  • 推薦使用replicate_wild_do_table,
    replicate_wild_ignore_table
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

张北县| 太康县| 汾阳市| 漾濞| 苗栗市| 团风县| 乐陵市| 阿坝| 榆社县| 汉川市| 武陟县| 普兰店市| 江孜县| 蕲春县| 和硕县| 萍乡市| 长子县| 美姑县| 河源市| 杂多县| 屏山县| 澜沧| 尚义县| 定安县| 湖南省| 称多县| 溧阳市| 高陵县| 沙坪坝区| 民勤县| 额尔古纳市| 天峻县| 上虞市| 湘潭市| 句容市| 通道| 开鲁县| 南通市| 车致| 若羌县| 溆浦县|