· 9 years ago · Oct 07, 2016, 09:20 AM
1$ make_replication_sandbox 5.7.15
2installing and starting master
3installing slave 1
4installing slave 2
5starting slave 1
6. sandbox server started
7starting slave 2
8. sandbox server started
9initializing slave 1
10initializing slave 2
11replication directory installed in $HOME/sandboxes/rsandbox_5_7_15
12
13$ cd rsandbox_5_7_15/
14$ ./m
15
16master [localhost] {msandbox} ((none)) > CREATE DATABASE /*! IF NOT EXISTS*/ xatest;
17Query OK, 1 row affected (0.00 sec)
18
19master [localhost] {msandbox} ((none)) > USE xatest;
20Database changed
21
22master [localhost] {msandbox} (xatest) > DROP TABLE IF EXISTS `xatest`;
23Query OK, 0 rows affected, 1 warning (0.00 sec)
24
25master [localhost] {msandbox} (xatest) > CREATE TABLE `xatest` (
26 -> `id` int(11) NOT NULL AUTO_INCREMENT,
27 -> PRIMARY KEY (`id`)
28 -> ) ENGINE=InnoDB;
29Query OK, 0 rows affected (0.02 sec)
30
31master [localhost] {msandbox} (xatest) > XA START 'xatest';
32Query OK, 0 rows affected (0.00 sec)
33
34master [localhost] {msandbox} (xatest) > DELETE FROM xatest where id=1;
35Query OK, 0 rows affected (0.02 sec)
36
37master [localhost] {msandbox} (xatest) > XA END 'xatest';
38Query OK, 0 rows affected (0.00 sec)
39
40master [localhost] {msandbox} (xatest) > XA COMMIT 'xatest' ONE PHASE;
41Query OK, 0 rows affected (0.00 sec)
42
43
44$ ./check_slaves
45master
46port: 19790
47 File: mysql-bin.000001
48 Position: 4872
49Executed_Gtid_Set:
50slave # 1
51port: 19791
52 Master_Log_File: mysql-bin.000001
53 Read_Master_Log_Pos: 4872
54 Slave_IO_Running: Yes
55 Slave_SQL_Running: Yes
56 Exec_Master_Log_Pos: 4872
57 Retrieved_Gtid_Set:
58 Executed_Gtid_Set:
59slave # 2
60port: 19792
61 Master_Log_File: mysql-bin.000001
62 Read_Master_Log_Pos: 4872
63 Slave_IO_Running: Yes
64 Slave_SQL_Running: Yes
65 Exec_Master_Log_Pos: 4872
66 Retrieved_Gtid_Set:
67 Executed_Gtid_Set:
68
69master [localhost] {msandbox} ((none)) > show binlog events;
70+------------------+------+----------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
71| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
72+------------------+------+----------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
73| mysql-bin.000001 | 4 | Format_desc | 1 | 123 | Server ver: 5.7.15-log, Binlog ver: 4 |
74..
75| mysql-bin.000001 | 4311 | Query | 1 | 4431 | CREATE DATABASE /*! IF NOT EXISTS*/ xatest |
76| mysql-bin.000001 | 4431 | Anonymous_Gtid | 1 | 4496 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
77| mysql-bin.000001 | 4496 | Query | 1 | 4629 | use `xatest`; DROP TABLE IF EXISTS `xatest` /* generated by server */ |
78| mysql-bin.000001 | 4629 | Anonymous_Gtid | 1 | 4694 | SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
79| mysql-bin.000001 | 4694 | Query | 1 | 4872 | use `xatest`; CREATE TABLE `xatest` (
80 `id` int(11) NOT NULL AUTO_INCREMENT,
81 PRIMARY KEY (`id`)
82) ENGINE=InnoDB |
83+------------------+------+----------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
8442 rows in set (0.00 sec)