请教各位大佬,搭建了一套mysql主从,主库中建表,插入数据,主库中Position不增长,导致从库也同步不过去,这是什么情况?忘各位大佬不吝赐教!
mysql>  show master status\G 
*************************** 1. row ***************************
             File: mysql-bin.000005
         Position: 590
     Binlog_Do_DB: btbzb_zmhk,test
 Binlog_Ignore_DB: mysql,information_schema,performance_schema
Executed_Gtid_Set: 
1 row in set (0.00 sec)mysql> 
mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.06 sec)mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.04 sec)mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.09 sec)mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.02 sec)mysql> insert into test.employee (name,phone) values ('zm',18888888888);
Query OK, 1 row affected (0.03 sec)mysql>  show master status\G
*************************** 1. row ***************************
             File: mysql-bin.000005
         Position: 590
     Binlog_Do_DB: btbzb_zmhk,test
 Binlog_Ignore_DB: mysql,information_schema,performance_schema
Executed_Gtid_Set: 
1 row in set (0.00 sec)mysql> 

解决方案 »

  1.   

    从库状态正常,如下
    mysql> show slave status \G
    *************************** 1. row ***************************
                   Slave_IO_State: Waiting for master to send event
                      Master_Host: 192.168.16.144
                      Master_User: repl
                      Master_Port: 3306
                    Connect_Retry: 60
                  Master_Log_File: mysql-bin.000005
              Read_Master_Log_Pos: 590
                   Relay_Log_File: relay-log-bin.000002
                    Relay_Log_Pos: 320
            Relay_Master_Log_File: mysql-bin.000005
                 Slave_IO_Running: Yes
                Slave_SQL_Running: Yes
                  Replicate_Do_DB: 
              Replicate_Ignore_DB: 
               Replicate_Do_Table: 
           Replicate_Ignore_Table: 
          Replicate_Wild_Do_Table: 
      Replicate_Wild_Ignore_Table: 
                       Last_Errno: 0
                       Last_Error: 
                     Skip_Counter: 0
              Exec_Master_Log_Pos: 590
                  Relay_Log_Space: 525
                  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: 144
                      Master_UUID: 03756dc9-83fe-11e8-8572-107b44f32217
                 Master_Info_File: /www/server/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: 
                    Auto_Position: 0
             Replicate_Rewrite_DB: 
                     Channel_Name: 
               Master_TLS_Version: 
    1 row in set (0.00 sec)
      

  2.   

            Replicate_Do_DB: 
     Replicate_Wild_Do_Table: 
    为空,改下配置文件,设置库
      

  3.   

    主库不加,是你没开 log_bin 吧,看看这个查询的结果是什么
    show variables like '%log_bin';
      

  4.   

    主库肯定开了的,昨天后来把 binlog-do-db这个参数注释掉,重要增加了,然而不明白为什么会这样mysql> show variables like '%log_bin'; 
    +---------------+-------+
    | Variable_name | Value |
    +---------------+-------+
    | log_bin       | ON    |
    | sql_log_bin   | ON    |
    +---------------+-------+
    2 rows in set (0.01 sec)
      

  5.   

    那估计是你配置得有问题
    这个参数决定那些库要记录 binlog,如果配置错了,那没有配置上的库自然是不记录 binlog 的
    如果 所有库都要同步,那通常不设置这个,默认是所有库都要记录的(有需要可以考虑通过设置 Binlog_Ignore_DB  把系统库过滤掉)
    一般做主备就不做设置,这样系统库的也过去,这样保持两边完全一样,主库挂了就直接高性用从库就行
      

  6.   

    https://blog.csdn.net/fsdf8sad7/article/details/88844412