-- wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz -- Build details [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: cat docs/INFO_SRC commit: 1f0fdfb6cce6027214de394484c3ab16841bb7cc date: 2015-06-25 15:06:45 +0200 build-date: 2015-07-14 23:27:56 +0200 short: 1f0fdfb branch: mysql-5.6.26-release MySQL source 5.6.26 #Master [mysqld] pid-file = /export/umesh/server/binaries/mysql-5.6.26/run/master.pid socket = /export/umesh/server/binaries/mysql-5.6.26/run/master.sock log-error=/export/umesh/server/binaries/mysql-5.6.26/log/master.log slow_query_log_file=/export/umesh/server/binaries/mysql-5.6.26/log/slow.log general_log_file=/export/umesh/server/binaries/mysql-5.6.26/log/general.log port = 15000 server-id = 1 basedir = /export/umesh/server/binaries/mysql-5.6.26 datadir = /export/umesh/server/binaries/mysql-5.6.26/master tmpdir = /tmp log-bin = /export/umesh/server/binaries/mysql-5.6.26/log/master-bin log-bin-index = /export/umesh/server/binaries/mysql-5.6.26/log/master-bin.index binlog_format=STATEMENT #Slave [mysqld] pid-file = /export/umesh/server/binaries/mysql-5.6.26/run/slave.pid socket = /export/umesh/server/binaries/mysql-5.6.26/run/slave.sock log-error=/export/umesh/server/binaries/mysql-5.6.26/log/slave.log port = 15001 server-id = 2 basedir = /export/umesh/server/binaries/mysql-5.6.26 datadir = /export/umesh/server/binaries/mysql-5.6.26/slave tmpdir = /tmp relay-log-index = /export/umesh/server/binaries/mysql-5.6.26/log/slave-relay-bin.index relay-log = /export/umesh/server/binaries/mysql-5.6.26/log/slave-relay-bin binlog_format=STATEMENT log_slow_slave_statements=ON slow_query_log=ON long_query_time=0 relay_log_info_repository = TABLE ## Init and bring up 2 nodes [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: scripts/mysql_install_db --defaults-file=./master.cnf [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: scripts/mysql_install_db --defaults-file=./slave.cnf [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysqld_safe --defaults-file=./master.cnf & [1] 1554 [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: 150728 14:14:04 mysqld_safe Logging to '/export/umesh/server/binaries/mysql-5.6.26/log/master.log'. 150728 14:14:04 mysqld_safe Starting mysqld daemon with databases from /export/umesh/server/binaries/mysql-5.6.26/master [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysqld_safe --defaults-file=./slave.cnf & [2] 1800 [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: 150728 14:14:11 mysqld_safe Logging to '/export/umesh/server/binaries/mysql-5.6.26/log/slave.log'. 150728 14:14:11 mysqld_safe Starting mysqld daemon with databases from /export/umesh/server/binaries/mysql-5.6.26/slave [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: ps aux|grep mysqld|grep -v grep umshastr 1554 0.1 0.0 113236 1604 pts/0 S 14:14 0:00 /bin/sh bin/mysqld_safe --defaults-file=./master.cnf umshastr 1777 2.5 0.1 1010344 449852 pts/0 Sl 14:14 0:00 /export/umesh/server/binaries/mysql-5.6.26/bin/mysqld --defaults-file=./master.cnf --basedir=/export/umesh/server/binaries/mysql-5.6.26 --datadir=/export/umesh/server/binaries/mysql-5.6.26/master --plugin-dir=/export/umesh/server/binaries/mysql-5.6.26/lib/plugin --log-error=/export/umesh/server/binaries/mysql-5.6.26/log/master.log --pid-file=/export/umesh/server/binaries/mysql-5.6.26/run/master.pid --socket=/export/umesh/server/binaries/mysql-5.6.26/run/master.sock --port=15000 umshastr 1800 0.1 0.0 113236 1604 pts/0 S 14:14 0:00 /bin/sh bin/mysqld_safe --defaults-file=./slave.cnf umshastr 2047 3.7 0.1 1010328 449792 pts/0 Sl 14:14 0:00 /export/umesh/server/binaries/mysql-5.6.26/bin/mysqld --defaults-file=./slave.cnf --basedir=/export/umesh/server/binaries/mysql-5.6.26 --datadir=/export/umesh/server/binaries/mysql-5.6.26/slave --plugin-dir=/export/umesh/server/binaries/mysql-5.6.26/lib/plugin --log-error=/export/umesh/server/binaries/mysql-5.6.26/log/slave.log --pid-file=/export/umesh/server/binaries/mysql-5.6.26/run/slave.pid --socket=/export/umesh/server/binaries/mysql-5.6.26/run/slave.sock --port=15001 [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: ## Setup Master/Slave replication -- master [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysql -uroot -S /export/umesh/server/binaries/mysql-5.6.26/run/master.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.26-log MySQL Community Server (GPL) Copyright (c) 2000, 2015, 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. mysql> CREATE USER 'repl'@'localhost' IDENTIFIED BY 'slavepass'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'localhost'; Query OK, 0 rows affected (0.00 sec) mysql> mysql> CREATE USER 'repl'@'127.0.0.1' IDENTIFIED BY 'slavepass'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'127.0.0.1'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> show master status; +-------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +-------------------+----------+--------------+------------------+-------------------+ | master-bin.000003 | 813 | | | | +-------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec) -- slave [umshastr@hod03]/export/umesh/server/binaries/mysql-5.6.26: bin/mysql -uroot -S /export/umesh/server/binaries/mysql-5.6.26/run/slave.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.26-log MySQL Community Server (GPL) Copyright (c) 2000, 2015, 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. mysql> CHANGE MASTER TO -> MASTER_HOST='localhost', -> MASTER_PORT=15000, -> MASTER_USER='repl', -> MASTER_PASSWORD='slavepass', -> MASTER_LOG_FILE='master-bin.000003', -> MASTER_LOG_POS=813; Query OK, 0 rows affected, 2 warnings (0.00 sec) mysql> start slave; Query OK, 0 rows affected (0.00 sec) mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: repl Master_Port: 15000 Connect_Retry: 60 Master_Log_File: master-bin.000003 Read_Master_Log_Pos: 813 Relay_Log_File: slave-relay-bin.000002 Relay_Log_Pos: 284 Relay_Master_Log_File: master-bin.000003 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: 813 Relay_Log_Space: 457 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: 23ab9634-3522-11e5-a7ff-0010e05f3e06 Master_Info_File: /export/umesh/server/binaries/mysql-5.6.26/slave/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: Executed_Gtid_Set: Auto_Position: 0 1 row in set (0.00 sec) mysql> ### Run statements provide din bug report -- master use test create table t1 (id int auto_increment primary key, a varchar(50)); create table t2 (id int auto_increment primary key, a varchar(50)); insert into t1 values (null,"aa"),(null,"bb"),(null,"cc"); insert into t2 values (null,"AA"),(null,"BB"),(null,"CC"); -- slave mysql> use test mysql> begin; select * from t2 for update; Query OK, 0 rows affected (0.00 sec) +----+------+ | id | a | +----+------+ | 1 | AA | | 2 | BB | | 3 | CC | +----+------+ 3 rows in set (0.00 sec) // Check slave staus after >60 seconds mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: repl Master_Port: 15000 Connect_Retry: 60 Master_Log_File: master-bin.000003 Read_Master_Log_Pos: 1959 Relay_Log_File: slave-relay-bin.000002 Relay_Log_Pos: 1110 Relay_Master_Log_File: master-bin.000003 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: Last_Errno: 1062 Last_Error: Error 'Duplicate entry '10' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'insert into t1 values (10,"dd")' Skip_Counter: 0 Exec_Master_Log_Pos: 1639 Relay_Log_Space: 1603 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: 1062 Last_SQL_Error: Error 'Duplicate entry '10' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'insert into t1 values (10,"dd")' Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: 23ab9634-3522-11e5-a7ff-0010e05f3e06 Master_Info_File: /export/umesh/server/binaries/mysql-5.6.26/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: 150728 14:19:17 Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 1 row in set (0.00 sec) ### Check rows -- master mysql> select * from t1; select * from t2; +----+------+ | id | a | +----+------+ | 1 | aa | | 2 | bb | | 3 | cc | | 10 | dd | +----+------+ 4 rows in set (0.00 sec) +----+------+ | id | a | +----+------+ | 1 | AA | | 2 | BB | | 3 | CC | | 10 | DD | +----+------+ 4 rows in set (0.00 sec) -- slave mysql> select * from t1; select * from t2; +----+------+ | id | a | +----+------+ | 1 | aa | | 2 | bb | | 3 | cc | | 10 | dd | +----+------+ 4 rows in set (0.00 sec) +----+------+ | id | a | +----+------+ | 1 | AA | | 2 | BB | | 3 | CC | +----+------+ 3 rows in set (0.00 sec) // Extract from error log Version: '5.6.26-log' socket: '/export/umesh/server/binaries/mysql-5.6.26/run/slave.sock' port: 15001 MySQL Community Server (GPL) 2015-07-28 14:16:47 2047 [Note] 'CHANGE MASTER TO executed'. Previous state master_host='', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='local host', master_port= 15000, master_log_file='master-bin.000003', master_log_pos= 813, master_bind=''. 2015-07-28 14:16:51 2047 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER an d PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. 2015-07-28 14:16:51 2047 [Note] Slave SQL thread initialized, starting replication in log 'master-bin.000003' at position 813, relay log '/export/umesh/server/binaries/mysql-5.6.26/log/slave-rel ay-bin.000001' position: 4 2015-07-28 14:16:51 2047 [Note] Slave I/O thread: connected to master 'repl@localhost:15000',replication started in log 'master-bin.000003' at position 813 2015-07-28 14:19:17 2047 [Warning] Slave SQL: Error 'Lock wait timeout exceeded; try restarting transaction' on query. Default database: 'test'. Query: 'insert into t2 values (10,"DD")', Error_c ode: 1205 2015-07-28 14:19:17 2047 [ERROR] Slave SQL: Error 'Duplicate entry '10' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'insert into t1 values (10,"dd")', Error_code: 1062 2015-07-28 14:19:17 2047 [Warning] Slave: Duplicate entry '10' for key 'PRIMARY' Error_code: 1062 2015-07-28 14:19:17 2047 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'master-bin.000003' positi on 1639