GTID复制
GTID(global transaction identifier,全局事务ID)是5.6新特性,为每个事务分配一个唯一的ID。事务ID的格式
source_id:transaction_id
source_id通常用实例的server_uuid表示
transaction_id是事务的序列号,从1开始
GTID搭建
1、参数配置
主从节点都要配置
root@localhost [mysql]> select @@gtid_mode;
+-------------+
| @@gtid_mode |
+-------------+
| OFF |
+-------------+
1 row in set (0.01 sec)
root@localhost [mysql]> select @@enforce_gtid_consistency;
+----------------------------+
| @@enforce_gtid_consistency |
+----------------------------+
| OFF |
+----------------------------+
1 row in set (0.00 sec)
主从节点都要修改配置文件
gtid_mode=on
enforce_gtid_consistency=1
添加完参数后,重启服务
[root@node01 mysql]# systemctl restart mysqld
[root@node02 mysql]# systemctl restart mysqld
[root@node03 mysql]# systemctl restart mysqld
root@localhost [hr]> select @@enforce_gtid_consistency;
+----------------------------+
| @@enforce_gtid_consistency |
+----------------------------+
| ON |
+----------------------------+
1 row in set (0.00 sec)
root@localhost [hr]> select @@gtid_mode;
+-------------+
| @@gtid_mode |
+-------------+
| ON |
+-------------+
1 row in set (0.00 sec)
2、change master to
从库执行
gtid复制只需要设置master_auto_position=1,无需设置maser_log_file和master_log_pos参数
change master to
master_host='192.168.6.101',
master_port=3306,
master_user='repl',
master_password='oracle',
master_auto_position=1,
get_master_public_key=1;
从库node02执行
需要先关闭slave
root@localhost [(none)]> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
node03
root@localhost [(none)]> stop slave;
Query OK, 0 rows affected, 1 warning (0.02 sec)
root@localhost [(none)]>
root@localhost [(none)]> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
root@localhost [(none)]> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
root@localhost [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.6.101
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000010
Read_Master_Log_Pos: 157
Relay_Log_File: node02-relay-bin.000003
Relay_Log_Pos: 367
Relay_Master_Log_File: binlog.000010
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: 157
Relay_Log_Space: 758
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: 1001
Master_UUID: 8ba057c3-2d10-11ee-a0fa-000c29004cdf
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Replica 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:
Master_public_key_path:
Get_master_public_key: 1
Network_Namespace:
1 row in set, 1 warning (0.00 sec)
GTID复制切换成异步复制
1、关闭从库
root@node01 [(none)]> show master status;
+---------------+----------+--------------+------------------+------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+------------------------------------------+
| binlog.000010 | 2105 | | | 8ba057c3-2d10-11ee-a0fa-000c29004cdf:1-8 |
+---------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)
root@node02 [(none)]> stop slave;
Query OK, 0 rows affected, 1 warning (0.60 sec)
查看Relay_Master_Log_File和Relay_Master_Log_File的值
root@node02 [(none)]> show slave status\G
Relay_Master_Log_File: binlog.000010
Relay_Master_Log_File: 2105
root@node03 [(none)]> stop slave;
Query OK, 0 rows affected, 1 warning (0.52 sec)
root@node03 [(none)]> show slave status\G
Relay_Master_Log_File: binlog.000010
Exec_Master_Log_Pos: 2105
2、从库执行change master to命令
change master to
master_auto_position=0,
master_log_file='binlog.000010',
master_log_pos=2105,
get_master_public_key=1;
root@node02 [(none)]> change master to
-> master_auto_position=0,
-> master_log_file='binlog.000010',
-> master_log_pos=2105,
-> get_master_public_key=1;
Query OK, 0 rows affected, 5 warnings (0.30 sec)
root@node03 [(none)]> change master to
-> master_auto_position=0,
-> master_log_file='binlog.000010',
-> master_log_pos=2105,
-> get_master_public_key=1;
Query OK, 0 rows affected, 5 warnings (0.24 sec)
3、开启复制
root@node02 [(none)]> start slave;
Query OK, 0 rows affected, 1 warning (1.49 sec)
root@node03 [(none)]> start slave;
Query OK, 0 rows affected, 1 warning (1.66 sec)
从库状态正常
root@node02 [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.6.101
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000010
Read_Master_Log_Pos: 2105
Relay_Log_File: node02-relay-bin.000002
Relay_Log_Pos: 323
Relay_Master_Log_File: binlog.000010
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: 2105
Relay_Log_Space: 534
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: 1001
Master_UUID: 8ba057c3-2d10-11ee-a0fa-000c29004cdf
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Replica 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: 3ff16ad3-2d17-11ee-aab1-000c297a8cee:1-2,
8ba057c3-2d10-11ee-a0fa-000c29004cdf:1-8
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 1
Network_Namespace:
1 row in set, 1 warning (0.00 sec)
root@node03 [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.6.101
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000010
Read_Master_Log_Pos: 2105
Relay_Log_File: node03-relay-bin.000002
Relay_Log_Pos: 323
Relay_Master_Log_File: binlog.000010
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: 2105
Relay_Log_Space: 534
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: 1001
Master_UUID: 8ba057c3-2d10-11ee-a0fa-000c29004cdf
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Replica 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: 42cab633-2d17-11ee-a9e1-000c296e813f:1-2,
8ba057c3-2d10-11ee-a0fa-000c29004cdf:1-8
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 1
Network_Namespace:
1 row in set, 1 warning (0.02 sec)
4、设置主从参数gtid_mode为ON_PERMISSIVE
set global gtid_mode=ON_PERMISSIVE;
root@node01 [(none)]> set global gtid_mode=ON_PERMISSIVE;
Query OK, 0 rows affected (0.30 sec)
root@node02 [(none)]> set global gtid_mode=ON_PERMISSIVE;
Query OK, 0 rows affected (0.15 sec)
root@node03 [(none)]> set global gtid_mode=ON_PERMISSIVE;
Query OK, 0 rows affected (0.07 sec)
5、设置主从参数gtid_mode为OFF_PERMISSIVE
set global gtid_mode=OFF_PERMISSIVE;
root@node01 [(none)]> set global gtid_mode=OFF_PERMISSIVE;
Query OK, 0 rows affected (0.00 sec)
root@node02 [(none)]> set global gtid_mode=OFF_PERMISSIVE;
Query OK, 0 rows affected (0.00 sec)
root@node03 [(none)]> set global gtid_mode=OFF_PERMISSIVE;
Query OK, 0 rows affected (0.00 sec)
6、检查主从gtid_owned
select @@global.gtid_owned;
root@node01 [(none)]> select @@global.gtid_owned;
+---------------------+
| @@global.gtid_owned |
+---------------------+
| |
+---------------------+
1 row in set (0.00 sec)
root@node02 [(none)]> select @@global.gtid_owned;
+---------------------+
| @@global.gtid_owned |
+---------------------+
| |
+---------------------+
1 row in set (0.00 sec)
root@node03 [(none)]> select @@global.gtid_owned;
+---------------------+
| @@global.gtid_owned |
+---------------------+
| |
+---------------------+
1 row in set (0.00 sec)
如果值为空,再继续下一步
7、等待所有的GTID事务应用完毕
通过MASTER_POS_WAIT函数判断
root@node01 [(none)]> show master status;
+---------------+----------+--------------+------------------+------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+------------------------------------------+
| binlog.000012 | 197 | | | 8ba057c3-2d10-11ee-a0fa-000c29004cdf:1-8 |
+---------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)
从库执行
select MASTER_POS_WAIT('binlog.000012',197);
root@node02 [(none)]> select MASTER_POS_WAIT('binlog.000012',197);
+--------------------------------------+
| MASTER_POS_WAIT('binlog.000012',197) |
+--------------------------------------+
| 0 |
+--------------------------------------+
1 row in set, 1 warning (0.06 sec)
root@node03 [(none)]> select MASTER_POS_WAIT('binlog.000012',197);
+--------------------------------------+
| MASTER_POS_WAIT('binlog.000012',197) |
+--------------------------------------+
| 0 |
+--------------------------------------+
1 row in set, 1 warning (0.04 sec)
8、主从设置gtid_mode OFF
set global gtid_mode=OFF;
root@node01 [(none)]> set global gtid_mode=OFF;
Query OK, 0 rows affected (0.04 sec)
root@node02 [(none)]> set global gtid_mode=OFF;
Query OK, 0 rows affected (0.04 sec)
root@node03 [(none)]> set global gtid_mode=OFF;
Query OK, 0 rows affected (0.04 sec)
9、修改主从参数,将GTID相关参数值设为OFF
[root@node01 ~]# vim /etc/my.cnf
#gtid
gtid_mode=off
enforce_gtid_consistency=off
[root@node02 ~]# vim /etc/my.cnf
#gtid
gtid_mode=off
enforce_gtid_consistency=off
[root@node03 ~]# vim /etc/my.cnf
#gtid
gtid_mode=off
enforce_gtid_consistency=off
root@node01 [(none)]> show master status;
+---------------+----------+--------------+------------------+------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+------------------------------------------+
| binlog.000013 | 197 | | | 8ba057c3-2d10-11ee-a0fa-000c29004cdf:1-8 |
+---------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)
异步复制切换成GTID复制
root@node01 [(none)]> select @@gtid_mode;
+-------------+
| @@gtid_mode |
+-------------+
| OFF |
+-------------+
1 row in set (0.00 sec)
root@node02 [(none)]> select @@gtid_mode;
+-------------+
| @@gtid_mode |
+-------------+
| OFF |
+-------------+
1 row in set (0.00 sec)
root@node03 [(none)]> select @@gtid_mode;
+-------------+
| @@gtid_mode |
+-------------+
| OFF |
+-------------+
1 row in set (0.00 sec)
1、分别在主从将enforce_gtid_consistency设置为warn
root@node01 [(none)]> select @@enforce_gtid_consistency;
+----------------------------+
| @@enforce_gtid_consistency |
+----------------------------+
| OFF |
+----------------------------+
1 row in set (0.01 sec)
root@node01 [(none)]> set @@global.enforce_gtid_consistency=warn;
Query OK, 0 rows affected (0.13 sec)
root@node02 [(none)]> set @@global.enforce_gtid_consistency=warn;
Query OK, 0 rows affected (0.03 sec)
root@node03 [(none)]> set @@global.enforce_gtid_consistency=warn;
Query OK, 0 rows affected (0.03 sec)
2、分别在主从上将enforce_gtid_consistency设为on
root@node01 [(none)]> set @@global.enforce_gtid_consistency=on;
Query OK, 0 rows affected (0.00 sec)
root@node02 [(none)]> set @@global.enforce_gtid_consistency=on;
Query OK, 0 rows affected (0.00 sec)
root@node03 [(none)]> set @@global.enforce_gtid_consistency=on;
Query OK, 0 rows affected (0.00 sec)
3、分别在主从将gtid_mode设置off_permissive
root@node01 [(none)]> set @@global.gtid_mode=off_permissive;
Query OK, 0 rows affected (0.22 sec)
root@node02 [(none)]> set @@global.gtid_mode=off_permissive;
Query OK, 0 rows affected (0.00 sec)
root@node03 [(none)]> set @@global.gtid_mode=off_permissive;
Query OK, 0 rows affected (0.03 sec)
4、分别在主从将gtid_mode设置on_permissive
root@node01 [(none)]> set @@global.gtid_mode=on_permissive;
Query OK, 0 rows affected (0.02 sec)
root@node02 [(none)]> set @@global.gtid_mode=on_permissive;
Query OK, 0 rows affected (0.02 sec)
root@node03 [(none)]> set @@global.gtid_mode=on_permissive;
Query OK, 0 rows affected (0.01 sec)
5、分别在主从上检查状态变量Ongoing_anonymous_transaction_count
root@node01 [(none)]> show status like '%ongoing%';
+-------------------------------------+-------+
| Variable_name | Value |
+-------------------------------------+-------+
| Ongoing_anonymous_transaction_count | 0 |
+-------------------------------------+-------+
1 row in set (0.76 sec)
root@node02 [(none)]> show status like '%ongoing%';
+-------------------------------------+-------+
| Variable_name | Value |
+-------------------------------------+-------+
| Ongoing_anonymous_transaction_count | 0 |
+-------------------------------------+-------+
1 row in set (0.63 sec)
root@node03 [(none)]> show status like '%ongoing%';
+-------------------------------------+-------+
| Variable_name | Value |
+-------------------------------------+-------+
| Ongoing_anonymous_transaction_count | 0 |
+-------------------------------------+-------+
1 row in set (0.00 sec)
6、等待从库上匿名事务应用完毕
root@node01 [(none)]> show master status;
+---------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+-------------------+
| binlog.000016 | 157 | | | |
+---------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
在从上查看,返回0说明事务应用完毕
root@node02 [(none)]> select master_pos_wait('binlog.000016',157);
+--------------------------------------+
| master_pos_wait('binlog.000016',157) |
+--------------------------------------+
| 0 |
+--------------------------------------+
1 row in set, 1 warning (0.05 sec)
root@node03 [(none)]> select master_pos_wait('binlog.000016',157);
+--------------------------------------+
| master_pos_wait('binlog.000016',157) |
+--------------------------------------+
| 0 |
+--------------------------------------+
1 row in set, 1 warning (0.05 sec)
7、分别在从库上将gtid_mode设为on
root@node01 [(none)]> set @@global.gtid_mode=on;
Query OK, 0 rows affected (0.02 sec)
root@node02 [(none)]> set @@global.gtid_mode=on;
Query OK, 0 rows affected (0.02 sec)
root@node03 [(none)]> set @@global.gtid_mode=on;
Query OK, 0 rows affected (0.02 sec)
8、修改主从参数文件
[root@node01 ~]# vim /etc/my.cnf
#gtid
gtid_mode=on
enforce_gtid_consistency=on
[root@node02 ~]# vim /etc/my.cnf
#gtid
gtid_mode=on
enforce_gtid_consistency=on
[root@node03 ~]# vim /etc/my.cnf
#gtid
gtid_mode=on
enforce_gtid_consistency=on
9、将基于binlog位置点的复制改为gtid复制
root@node02 [(none)]> stop slave;
Query OK, 0 rows affected, 1 warning (0.12 sec)
root@node02 [(none)]> stop slave;
Query OK, 0 rows affected, 1 warning (0.12 sec)
root@node02 [(none)]> change master to
-> master_host='192.168.6.101',
-> master_port=3306,
-> master_user='repl',
-> master_password='oracle',
-> master_auto_position=1,
-> get_master_public_key=1;
Query OK, 0 rows affected, 8 warnings (0.02 sec)
root@node02 [(none)]> start slave;
Query OK, 0 rows affected, 1 warning (0.06 sec)
root@node02 [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.6.101
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000017
Read_Master_Log_Pos: 157
Relay_Log_File: node02-relay-bin.000002
Relay_Log_Pos: 367
Relay_Master_Log_File: binlog.000017
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: 157
Relay_Log_Space: 578
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: 1001
Master_UUID: b0ae4cca-32af-11ee-8ff1-000c29004cdf
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Replica 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:
Master_public_key_path:
Get_master_public_key: 1
Network_Namespace:
1 row in set, 1 warning (0.00 sec)
root@node03 [(none)]> stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
root@node03 [(none)]> change master to
-> master_host='192.168.6.101',
-> master_port=3306,
-> master_user='repl',
-> master_password='oracle',
-> master_auto_position=1,
-> get_master_public_key=1;
Query OK, 0 rows affected, 8 warnings (0.01 sec)
root@node03 [(none)]> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)
root@node03 [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.6.101
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000017
Read_Master_Log_Pos: 157
Relay_Log_File: node03-relay-bin.000002
Relay_Log_Pos: 367
Relay_Master_Log_File: binlog.000017
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: 157
Relay_Log_Space: 578
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: 1001
Master_UUID: b0ae4cca-32af-11ee-8ff1-000c29004cdf
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Replica 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:
Master_public_key_path:
Get_master_public_key: 1
Network_Namespace:
1 row in set, 1 warning (0.00 sec)
root@node01 [(none)]> show master status;
+---------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+-------------------+
| binlog.000017 | 157 | | | |
+---------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
root@node01 [(none)]> select * from sh.customer;
+------+
| id |
+------+
| 1001 |
| 1002 |
| 1003 |
| 1004 |
| 1005 |
+------+
5 rows in set (0.34 sec)
root@node01 [(none)]> insert into sh.customer values(1006);
Query OK, 1 row affected (0.28 sec)
root@node01 [(none)]> show master status;
+---------------+----------+--------------+------------------+----------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+----------------------------------------+
| binlog.000017 | 430 | | | b0ae4cca-32af-11ee-8ff1-000c29004cdf:1 |
+---------------+----------+--------------+------------------+----------------------------------------+
1 row in set (0.00 sec)