-- Setup gtid based Master->Slave replication cat docs/INFO_SRC commit: 0e7361b225055945d74cef67c838faa03d634137 date: 2018-06-08 15:28:05 +0530 build-date: 2018-06-08 11:56:42 +0200 short: 0e7361b branch: mysql-5.7.23-release MySQL source 5.7.23 rm -rf 92252_master bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/92252_master -v bin/mysqld --basedir=$PWD --datadir=$PWD/92252_master --core-file --socket=/tmp/mysql_master.sock --port=3333 --log-error=$PWD/92252_master/log.err --server-id=3333 --log-bin=master-bin --gtid_mode=ON --enforce-gtid-consistency=true 2>&1 & rm -rf 92252_slave bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/92252_slave -v bin/mysqld --basedir=$PWD --datadir=$PWD/92252_slave --core-file --socket=/tmp/mysql_slave.sock --port=3366 --log-error=$PWD/92252_slave/log.err --master-info-repository=TABLE --relay-log-info-repository=TABLE --server-id=3366 --log-bin=slave-bin --gtid_mode=ON --enforce-gtid-consistency=true --slave-skip-errors='1007,1008' 2>&1 & - master bin/mysql -uroot -S /tmp/mysql_master.sock --prompt='Master>' Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.23-log MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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. Master>SET sql_log_bin = OFF; Query OK, 0 rows affected (0.00 sec) Master>CREATE USER 'repl'@'localhost' IDENTIFIED BY 'slavepass'; Query OK, 0 rows affected (0.00 sec) Master>GRANT REPLICATION SLAVE ON *.* TO 'repl'@'localhost'; Query OK, 0 rows affected (0.00 sec) Master> Master>CREATE USER 'repl'@'127.0.0.1' IDENTIFIED BY 'slavepass'; Query OK, 0 rows affected (0.00 sec) Master>GRANT REPLICATION SLAVE ON *.* TO 'repl'@'127.0.0.1'; Query OK, 0 rows affected (0.00 sec) Master>FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) Master>SET sql_log_bin = ON; Query OK, 0 rows affected (0.00 sec) Master>show master status; +-------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +-------------------+----------+--------------+------------------+-------------------+ | master-bin.000001 | 154 | | | | +-------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec) - slave bin/mysql -uroot -S /tmp/mysql_slave.sock --prompt='Slave>' Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.23-log MySQL Community Server (GPL) Copyright (c) 2000, 2018, 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. Slave>CHANGE MASTER TO -> MASTER_HOST='127.0.0.1', -> MASTER_PORT=3333, -> MASTER_USER='repl', -> MASTER_PASSWORD='slavepass', -> MASTER_AUTO_POSITION = 1; Query OK, 0 rows affected, 2 warnings (0.01 sec) Slave>start slave; Query OK, 0 rows affected (0.01 sec) Slave>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_User: repl Master_Port: 3333 Connect_Retry: 60 Master_Log_File: master-bin.000001 Read_Master_Log_Pos: 154 Relay_Log_File: hod03-relay-bin.000002 Relay_Log_Pos: 369 Relay_Master_Log_File: master-bin.000001 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: 154 Relay_Log_Space: 576 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: 3333 Master_UUID: ed43e92f-ad1d-11e8-bd01-0010e05f3e06 Master_Info_File: mysql.slave_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: 1 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec) (1) Master>create database db1; Query OK, 1 row affected (0.00 sec) Master>use db1; Database changed Master>create table t1(id int); Query OK, 0 rows affected (0.01 sec) Master>insert into t1 values(1); Query OK, 1 row affected (0.01 sec) Master>show master status; +-------------------+----------+--------------+------------------+------------------------------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +-------------------+----------+--------------+------------------+------------------------------------------+ | master-bin.000001 | 721 | | | ed43e92f-ad1d-11e8-bd01-0010e05f3e06:1-3 | +-------------------+----------+--------------+------------------+------------------------------------------+ 1 row in set (0.00 sec) (2) Slave>create database db2; Query OK, 1 row affected (0.01 sec) Slave>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_User: repl Master_Port: 3333 Connect_Retry: 60 Master_Log_File: master-bin.000001 Read_Master_Log_Pos: 721 Relay_Log_File: hod03-relay-bin.000002 Relay_Log_Pos: 936 Relay_Master_Log_File: master-bin.000001 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: 721 Relay_Log_Space: 1143 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: 3333 Master_UUID: ed43e92f-ad1d-11e8-bd01-0010e05f3e06 Master_Info_File: mysql.slave_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: ed43e92f-ad1d-11e8-bd01-0010e05f3e06:1-3 Executed_Gtid_Set: ed43e92f-ad1d-11e8-bd01-0010e05f3e06:1-3, f2c66f8f-ad1d-11e8-80cf-0010e05f3e06:1 Auto_Position: 1 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec) (3) Master>create database db2; -- applied on salve, hit error 1007 Query OK, 1 row affected (0.00 sec) Master>insert into db1.t1 values(2); Query OK, 1 row affected (0.00 sec) Master>insert into db1.t1 values(3); Query OK, 1 row affected (0.00 sec) Master>show master status; +-------------------+----------+--------------+------------------+------------------------------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +-------------------+----------+--------------+------------------+------------------------------------------+ | master-bin.000001 | 1379 | | | ed43e92f-ad1d-11e8-bd01-0010e05f3e06:1-6 | +-------------------+----------+--------------+------------------+------------------------------------------+ 1 row in set (0.00 sec) (4) Slave>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_User: repl Master_Port: 3333 Connect_Retry: 60 Master_Log_File: master-bin.000001 Read_Master_Log_Pos: 1379 Relay_Log_File: hod03-relay-bin.000002 Relay_Log_Pos: 1594 Relay_Master_Log_File: master-bin.000001 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: 1379 Relay_Log_Space: 1801 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: 3333 Master_UUID: ed43e92f-ad1d-11e8-bd01-0010e05f3e06 Master_Info_File: mysql.slave_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: ed43e92f-ad1d-11e8-bd01-0010e05f3e06:1-6 Executed_Gtid_Set: ed43e92f-ad1d-11e8-bd01-0010e05f3e06:1-3:5-6, f2c66f8f-ad1d-11e8-80cf-0010e05f3e06:1 Auto_Position: 1 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec) Slave>stop slave; Query OK, 0 rows affected (0.00 sec) Slave>reset slave; Query OK, 0 rows affected (0.00 sec) Slave>start slave; Query OK, 0 rows affected (0.01 sec) Slave>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_User: repl Master_Port: 3333 Connect_Retry: 60 Master_Log_File: master-bin.000001 Read_Master_Log_Pos: 1379 Relay_Log_File: hod03-relay-bin.000003 Relay_Log_Pos: 621 Relay_Master_Log_File: master-bin.000001 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: 1379 Relay_Log_Space: 828 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: 3333 Master_UUID: ed43e92f-ad1d-11e8-bd01-0010e05f3e06 Master_Info_File: mysql.slave_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: ed43e92f-ad1d-11e8-bd01-0010e05f3e06:4 Executed_Gtid_Set: ed43e92f-ad1d-11e8-bd01-0010e05f3e06:1-3:5-6, f2c66f8f-ad1d-11e8-80cf-0010e05f3e06:1 Auto_Position: 1 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec) -- restarted slave, repeated stop/reset/start but still not seeing the issue