当前位置:Gxlcms > 数据库问题 > MySQL 主从复制

MySQL 主从复制

时间:2021-07-01 10:21:17 帮助过:3人阅读

repl@% identified by password;


查看master状态:

show master status\G;

查看Binlog Dump:

show processlist\G;

  Command: Binlog Dump
  State: Master has sent all binlog to slave; waiting for more updates

 

slave配置:
禁用GTID:gtid_mode=OFF
server_id:113306 (建议IP后两位加数据库端口号)
log_bin:log_bin=ON
log_slave_updates:log_slave_updates=ON
连接主库:

CHANGE MASTER TO
 MASTER_HOST=192.168.100.10,
 MASTER_USER=repl,
 MASTER_PASSWORD=password,
 MASTER_PORT=3306,
 MASTER_LOG_FILE=mysql-bin.000002,
 MASTER_LOG_POS=3141

开启同步:

start slave;

其他命令:

stop slave:关闭同步
start slave io_thread:开启IO线程,stop 关闭
start slave sql_thread:开始SQL线程,stop 关闭

查看slave状态:

show slave status\G;

  Slave_IO_Running: Yes
  Slave_SQL_Running: Yes
IO thead 和 SQL thead线程:

show processlist\G;

  Command: Connect
  State: Waiting for master to send event
  Command: Connect
  State: Slave has read all relay log; waiting for more updates

MySQL 主从复制

标签:ica   语句   password   hang   status   ssl   server   date   backup   

人气教程排行