| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+---------------------------------------------------------------------------------------+
| mysql-bin.000003 | 3042 | | | 15aa5540-31fc-11ea-9d2d-84139f30d4bd:13-14,
4a871e1c-31eb-11ea-81b2-84139f30d4f5:1-15 |
+------------------+----------+--------------+------------------+---------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
MySQL [(none)]>
master_log_file和master_log_pos参数来自7.4.2记录的File和Position 。
登录.81.49MySQL数据库之后执行“change master to master_host='.4.81.50',master_user='repl',master_password='repl',master_log_file='mysql-bin.000003',master_log_pos=3042;” 。
使用命令
执行顺序
命令
说明
1
cd /usr/local/mysql/bin
进入MySQL安装目录的bin目录下
2
./mysql -uroot -p
启动MySQL客户端
3
password
输入root账号密码,进入MySQL命令行客户端 。
4
change master to master_host='81.50',master_user='repl',master_password='repl',master_log_file='mysql-bin.000003',master_log_pos=194;
查看Master状态
5
start slave;
启动主从同步
执行示意
MySQL [(none)]> change master to master_host='.81.50',master_user='repl',master_password='repl',master_log_file='mysql-bin.000003',master_log_pos=3042;
MySQL [(none)]>start slave;
登录.81.50MySQL数据库之后执行“change master to master_host='.81.49',master_user='repl',master_password='repl',master_log_file='mysql-bin.000002',master_log_pos=3842;” 。
使用命令
执行顺序
命令
说明
1
cd /usr/local/mysql/bin
进入MySQL安装目录的bin目录下
2
./mysql -uroot -p
启动MySQL客户端
3
password
输入root账号密码,进入MySQL命令行客户端 。
4
change master to master_host='.81.49',master_user='repl',master_password='repl',master_log_file='mysql-bin.000003',master_log_pos=194;
查看Master状态
5
start slave;
启动主从同步
执行示意
MySQL [(none)]> change master to master_host='.81.49',master_user='repl',master_password='repl',master_log_file='mysql-bin.000002',master_log_pos=3842;
MySQL [(none)]>start slave;
登录.81.49MySQL数据库执行命令show slave status G;,查看Slave_IO_Running、Slave_SQL_Running是否为Yes,为Yes表示主从正常执行 。
执行命令:
show slave status G;
MySQL [(none)]>show slave status G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: .81.50
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 3842
Relay_Log_File: mysql-relay.000002
Relay_Log_Pos: 764
Relay_Master_Log_File: mysql-bin.000002
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: 3842
Relay_Log_Space: 967
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: 10
Master_UUID: 15aa5540-31fc-11ea-9d2d-84139f30d4bd
Master_Info_File: mysql.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: 15aa5540-31fc-11ea-9d2d-84139f30d4bd:13-14
Executed_Gtid_Set: 15aa5540-31fc-11ea-9d2d-84139f30d4bd:13-14,
4a871e1c-31eb-11ea-81b2-84139f30d4f5:1-15
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1 row in set (0.00 sec)
ERROR: No query specified
MySQL [(none)]>
登录.81.50MySQL数据库执行命令show slave status G;,查看Slave_IO_Running、Slave_SQL_Running是否为Yes,为Yes表示主从正常执行 。
推荐阅读
- Mysql主从模式搭建
- 可是国内的永乐大钟,却无法复制 永乐大钟
- DNA的复制是你想象不到的更精彩 dna复制特点
- 空白代码复制粘贴?空白昵称代码如何复制
- 附:解决办法 电脑复制后不能粘贴是什么原因
- 冒险岛怪盗幻影偷什么技能啊?拒绝复制的 怪盗幻影女郎
- 奥黛丽·赫本|奥黛丽赫本:一代女神,无法复制的经典
- 文玩|文玩圈中珍贵的复制品,不但不是仿品,还具有收藏价值
- 王志文|王志文带儿子拍亲子照,爷俩就像复制粘贴一样,这孩子有点像邓伦
- iphone如何导出通讯录,苹果通讯录复制到sim卡教程