MySQL主从状态检查

1、查看A、B数据库同步状态
输入以下命令,会出来很多信息,但是主要看Slave_IO_Running与Slave_SQL_Running这两个字段都显示yes就行了。

MySQL> show slave status\G;

MySQL主从状态检查_第1张图片

2、查看A、B服务器的同步线程状态
输入以下命令,

MySQL > show processlist\G

若命令窗口有下图的三个线程,则证明配置成功,若缺少任何一个线程,请重启主、备两台机器的MySql服务,然后再在MySql命令窗口中输入上述命令查看是否有下图标注的三个线程。若没有这三个线程,请重新检查配置是否正确。

注意:主备服务器的MySql进程必须都有这三个线程才证明配置成功!

mysql> show processlist\G;
*************************** 1. row ***************************
***省略***
*************************** 2. row ***************************
     Id: 22
   User: system user
   Host: connecting host
     db: NULL
Command: Connect
   Time: 938775
  State: Waiting for master to send event
   Info: NULL
*************************** 3. row ***************************
     Id: 23
   User: system user
   Host: 
     db: NULL
Command: Query
   Time: 748608
  State: Slave has read all relay log; waiting for more updates
   Info: NULL
*************************** 4. row ***************************
     Id: 3691
   User: slave
   Host: 1.2.3.3:54244
     db: NULL
Command: Binlog Dump
   Time: 70515
  State: Master has sent all binlog to slave; waiting for more updates
   Info: NULL

你可能感兴趣的:(数据库,mysql)