Chinaunix首页 | 论坛 | 博客
  • 博客访问: 872631
  • 博文数量: 354
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3730
  • 用 户 组: 普通用户
  • 注册时间: 2017-08-21 18:43
文章分类

全部博文(354)

文章存档

2019年(126)

2018年(223)

2017年(5)

我的朋友

分类: Mysql/postgreSQL

2018-05-28 14:21:35

通过在slave上执行show slave status来检查复制是否正常工作

mysql> SHOW SLAVE STATUS\G

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: master1

Master_User: root

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000004

Read_Master_Log_Pos: 931

Relay_Log_File: slave1-relay-bin.000056

Relay_Log_Pos: 950

Relay_Master_Log_File: mysql-bin.000004

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: 931

Relay_Log_Space: 1365

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: 0

 

Slave_IO_State:代表当前slave的状态

Slave_IO_Running:代表负责读取主库bin log的IO线程是否是运行状态,正常情况下应

该是YES

Slave_SQL_Running:代表负责执行备库relay log的SQL线程是否是运行状态,正常情

况下应该是YES

Last_IO_Error, Last_SQL_Error: 分别代表最后一次IO线程和SQL线程所发生的错误,

正常情况下应该是空代表没有错误

Seconds_Behind_Master:代表备库的SQL线程比主库的bin log晚多少秒。0代表目前

没有复制延迟

(Master_Log_file, Read_Master_Log_Pos):表示IO线程在主库bin log中的坐标位置

(Relay_Master_Log_File, Exec_Master_Log_Pos):表示SQL线程在主库bin log中的坐

标位置

(Relay_Log_File, Relay_Log_Pos):表示SQL线程在备库relay log中的坐标位置

 

在主库可以通过执行show processlist命令查看主库的bin log日志生成进程

mysql> SHOW PROCESSLIST \G;

*************************** 4. row ***************************

Id: 10

User: root

Host: slave1:58371

db: NULL

Command: Binlog Dump

Time: 777

State: Has sent all binlog to slave; waiting for binlog to be updated

Info: NULL

互联网企业大多用的数据库是MySQL的,想要众多的IT工作者中脱颖而出,就需要拥有高深的技术,学习增值是必不可少的。学习之路,是贵在坚持的。

阅读(1043) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~