· 9 years ago · Oct 07, 2016, 09:22 AM
1o MASTER
2mysql> DROP TABLE IF EXISTS `xatest`;
3 `id` int(11) NOT NULL AUTO_INCREMENT,
4Query OK, 0 rows affected (0.01 sec)
5
6mysql> CREATE TABLE `xatest` (
7 -> `id` int(11) NOT NULL AUTO_INCREMENT,
8 -> PRIMARY KEY (`id`)
9 -> ) ENGINE=InnoDB;
10XA START 'xatest';
11Query OK, 0 rows affected (0.02 sec)
12
13mysql> XA START 'xatest';
14Query OK, 0 rows affected (0.00 sec)
15
16mysql> DELETE FROM xatest where id=1;
17Query OK, 0 rows affected (0.00 sec)
18
19mysql> XA END 'xatest';
20Query OK, 0 rows affected (0.00 sec)
21
22mysql> XA COMMIT 'xatest' ONE PHASE;
23Query OK, 0 rows affected (0.00 sec)
24
25mysql> status;
26--------------
27mysql Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using EditLine wrapper
28
29Connection id: 4
30Current database: xatest
31Current user: root@localhost
32SSL: Not in use
33Current pager: stdout
34Using outfile: ''
35Using delimiter: ;
36Server version: 5.7.15-log MySQL Community Server (GPL)
37Protocol version: 10
38Connection: Localhost via UNIX socket
39Server characterset: latin1
40Db characterset: latin1
41Client characterset: utf8
42Conn. characterset: utf8
43UNIX socket: /var/lib/mysql/mysql.sock
44Uptime: 1 min 38 sec
45
46Threads: 2 Questions: 29 Slow queries: 0 Opens: 110 Flush tables: 1 Open tables: 102 Queries per second avg: 0.295
47--------------
48
49mysql>
50
51o SLAVE
52mysql> show slave status\G
53*************************** 1. row ***************************
54 Slave_IO_State: Waiting for master to send event
55 Master_Host: 127.0.0.1
56 Master_User: repl
57 Master_Port: 3306
58 Connect_Retry: 60
59 Master_Log_File: dev02-bin.000008
60 Read_Master_Log_Pos: 1135
61 Relay_Log_File: dev02-relay-bin.000024
62 Relay_Log_Pos: 993
63 Relay_Master_Log_File: dev02-bin.000008
64 Slave_IO_Running: Yes
65 Slave_SQL_Running: No
66 Replicate_Do_DB:
67 Replicate_Ignore_DB:
68 Replicate_Do_Table:
69 Replicate_Ignore_Table:
70 Replicate_Wild_Do_Table:
71 Replicate_Wild_Ignore_Table:
72 Last_Errno: 1399
73 Last_Error: Error 'XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state' on query. Default database: 'xatest'. Query: 'COMMIT'
74 Skip_Counter: 0
75 Exec_Master_Log_Pos: 780
76 Relay_Log_Space: 1721
77 Until_Condition: None
78 Until_Log_File:
79 Until_Log_Pos: 0
80 Master_SSL_Allowed: No
81 Master_SSL_CA_File:
82 Master_SSL_CA_Path:
83 Master_SSL_Cert:
84 Master_SSL_Cipher:
85 Master_SSL_Key:
86 Seconds_Behind_Master: NULL
87Master_SSL_Verify_Server_Cert: No
88 Last_IO_Errno: 0
89 Last_IO_Error:
90 Last_SQL_Errno: 1399
91 Last_SQL_Error: Error 'XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state' on query. Default database: 'xatest'. Query: 'COMMIT'
92 Replicate_Ignore_Server_Ids:
93 Master_Server_Id: 102
94 Master_UUID: 70912471-b40d-11e5-a918-525400d73999
95 Master_Info_File: /var/lib/mysql-slave/master.info
96 SQL_Delay: 0
97 SQL_Remaining_Delay: NULL
98 Slave_SQL_Running_State:
99 Master_Retry_Count: 86400
100 Master_Bind:
101 Last_IO_Error_Timestamp:
102 Last_SQL_Error_Timestamp: 161007 13:25:15
103 Master_SSL_Crl:
104 Master_SSL_Crlpath:
105 Retrieved_Gtid_Set:
106 Executed_Gtid_Set:
107 Auto_Position: 0
108 Replicate_Rewrite_DB:
109 Channel_Name:
110 Master_TLS_Version:
1111 row in set (0.00 sec)
112
113mysql> status;
114--------------
115mysql Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using EditLine wrapper
116
117Connection id: 4
118Current database: xatest
119Current user: root@localhost
120SSL: Not in use
121Current pager: stdout
122Using outfile: ''
123Using delimiter: ;
124Server version: 5.7.15-log MySQL Community Server (GPL)
125Protocol version: 10
126Connection: Localhost via UNIX socket
127Server characterset: latin1
128Db characterset: latin1
129Client characterset: utf8
130Conn. characterset: utf8
131UNIX socket: /var/lib/mysql-slave/mysql.sock
132Uptime: 1 min 37 sec
133
134Threads: 2 Questions: 37 Slow queries: 0 Opens: 115 Flush tables: 1 Open tables: 102 Queries per second avg: 0.381
135--------------
136
137mysql>