rm -rf master/ bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/master -v bin/mysqld --basedir=$PWD --datadir=$PWD/master --log-bin --server_id=1 --socket=/tmp/mysql_master.sock --port=3306 --log-error=$PWD/master/log.err 2>&1 & rm -rf slave/ bin/mysqld --initialize-insecure --basedir=$PWD --datadir=$PWD/slave -v bin/mysqld --basedir=$PWD --datadir=$PWD/slave --log-bin --server_id=2 --socket=/tmp/mysql_slave.sock --port=3307 --log-error=$PWD/slave/log.err 2>&1 & -- master [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.7.20: 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 4 Server version: 5.7.20-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, 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>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>show master status; +------------------+----------+--------------+------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +------------------+----------+--------------+------------------+-------------------+ | hod03-bin.000001 | 1220 | | | | +------------------+----------+--------------+------------------+-------------------+ 1 row in set (0.00 sec) -- slave [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.7.20: 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 3 Server version: 5.7.20-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, 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='localhost', -> MASTER_PORT=3306, -> MASTER_USER='repl', -> MASTER_PASSWORD='slavepass', -> MASTER_LOG_FILE='hod03-bin.000001', -> MASTER_LOG_POS=1220; Query OK, 0 rows affected, 2 warnings (0.00 sec) Slave>start slave; Query OK, 0 rows affected (0.00 sec) Slave>show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: localhost Master_User: repl Master_Port: 3306 Connect_Retry: 60 Master_Log_File: hod03-bin.000001 Read_Master_Log_Pos: 1220 Relay_Log_File: hod03-relay-bin.000002 Relay_Log_Pos: 320 Relay_Master_Log_File: hod03-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: 1220 Relay_Log_Space: 527 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: 4f718455-c12d-11e7-b80f-0010e05f3e06 Master_Info_File: /export/umesh/server/binaries/GABuilds/mysql-5.7.20/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: 0 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.01 sec) -- Master Master>create database test; Query OK, 1 row affected (0.00 sec) Master>use test Database changed Master>create table t1 (t1_pk int primary key, t1_blob blob null); Query OK, 0 rows affected (0.00 sec) Master> xa start '2'; Query OK, 0 rows affected (0.00 sec) Master>INSERT INTO t1 VALUES (85000, null); Query OK, 1 row affected (0.01 sec) Master>xa end '2'; Query OK, 0 rows affected (0.00 sec) Master> xa prepare '2'; Query OK, 0 rows affected (0.00 sec) Master>xa rollback '1'; ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state Master>xa rollback '2'; Query OK, 0 rows affected (0.00 sec) -- slave Last_SQL_Errno: 1397 Last_SQL_Error: Error 'XAER_NOTA: Unknown XID' on query. Default database: 'test'. Query: 'XA ROLLBACK X'32',X'',1' Replicate_Ignore_Server_Ids: -- Master Master>show binlog events\G *************************** 1. row *************************** Log_name: hod03-bin.000001 Pos: 4 Event_type: Format_desc Server_id: 1 End_log_pos: 123 Info: Server ver: 5.7.20-log, Binlog ver: 4 *************************** 2. row *************************** Log_name: hod03-bin.000001 Pos: 123 Event_type: Previous_gtids Server_id: 1 End_log_pos: 154 Info: *************************** 3. row *************************** Log_name: hod03-bin.000001 Pos: 154 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 219 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 4. row *************************** Log_name: hod03-bin.000001 Pos: 219 Event_type: Query Server_id: 1 End_log_pos: 407 Info: CREATE USER 'repl'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*809534247D21AC735802078139D8A854F45C31F3' *************************** 5. row *************************** Log_name: hod03-bin.000001 Pos: 407 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 472 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 6. row *************************** Log_name: hod03-bin.000001 Pos: 472 Event_type: Query Server_id: 1 End_log_pos: 611 Info: GRANT REPLICATION SLAVE ON *.* TO 'repl'@'localhost' *************************** 7. row *************************** Log_name: hod03-bin.000001 Pos: 611 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 676 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 8. row *************************** Log_name: hod03-bin.000001 Pos: 676 Event_type: Query Server_id: 1 End_log_pos: 864 Info: CREATE USER 'repl'@'127.0.0.1' IDENTIFIED WITH 'mysql_native_password' AS '*809534247D21AC735802078139D8A854F45C31F3' *************************** 9. row *************************** Log_name: hod03-bin.000001 Pos: 864 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 929 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 10. row *************************** Log_name: hod03-bin.000001 Pos: 929 Event_type: Query Server_id: 1 End_log_pos: 1068 Info: GRANT REPLICATION SLAVE ON *.* TO 'repl'@'127.0.0.1' *************************** 11. row *************************** Log_name: hod03-bin.000001 Pos: 1068 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 1133 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 12. row *************************** Log_name: hod03-bin.000001 Pos: 1133 Event_type: Query Server_id: 1 End_log_pos: 1220 Info: FLUSH PRIVILEGES *************************** 13. row *************************** Log_name: hod03-bin.000001 Pos: 1220 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 1285 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 14. row *************************** Log_name: hod03-bin.000001 Pos: 1285 Event_type: Query Server_id: 1 End_log_pos: 1379 Info: create database test *************************** 15. row *************************** Log_name: hod03-bin.000001 Pos: 1379 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 1444 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 16. row *************************** Log_name: hod03-bin.000001 Pos: 1444 Event_type: Query Server_id: 1 End_log_pos: 1576 Info: use `test`; create table t1 (t1_pk int primary key, t1_blob blob null) *************************** 17. row *************************** Log_name: hod03-bin.000001 Pos: 1576 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 1641 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 18. row *************************** Log_name: hod03-bin.000001 Pos: 1641 Event_type: Query Server_id: 1 End_log_pos: 1728 Info: XA START X'32',X'',1 *************************** 19. row *************************** Log_name: hod03-bin.000001 Pos: 1728 Event_type: Table_map Server_id: 1 End_log_pos: 1775 Info: table_id: 219 (test.t1) *************************** 20. row *************************** Log_name: hod03-bin.000001 Pos: 1775 Event_type: Write_rows Server_id: 1 End_log_pos: 1815 Info: table_id: 219 flags: STMT_END_F *************************** 21. row *************************** Log_name: hod03-bin.000001 Pos: 1815 Event_type: Query Server_id: 1 End_log_pos: 1900 Info: XA END X'32',X'',1 *************************** 22. row *************************** Log_name: hod03-bin.000001 Pos: 1900 Event_type: XA_prepare Server_id: 1 End_log_pos: 1937 Info: XA PREPARE X'32',X'',1 *************************** 23. row *************************** Log_name: hod03-bin.000001 Pos: 1937 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 2002 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 24. row *************************** Log_name: hod03-bin.000001 Pos: 2002 Event_type: Query Server_id: 1 End_log_pos: 2092 Info: XA ROLLBACK X'32',X'',1 *************************** 25. row *************************** Log_name: hod03-bin.000001 Pos: 2092 Event_type: Anonymous_Gtid Server_id: 1 End_log_pos: 2157 Info: SET @@SESSION.GTID_NEXT= 'ANONYMOUS' *************************** 26. row *************************** Log_name: hod03-bin.000001 Pos: 2157 Event_type: Query Server_id: 1 End_log_pos: 2247 Info: XA ROLLBACK X'32',X'',1 26 rows in set (0.00 sec)