Mysql主从同步show slave status\g;说明

下面再来说下show slave status命令显示的参数具体含义。

1)基于二进制日志复制的显示格式
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Queueing master event to the relay log
Master_Host: 172.18.16.22
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.010362
Read_Master_Log_Pos: 555176471
Relay_Log_File: mysqld-relay-bin.004136
Relay_Log_Pos: 502564
Relay_Master_Log_File: mysql-bin.010327
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB: blog
Replicate_Ignore_DB:
Replicate_Do_Table: blog.archives
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 555176471
Relay_Log_Space: 3642164873
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: 1042
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: 1622
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
参数具体含义解释:

Slave_IO_State

这个是指Slave连接到Master的状态,就是当前IO线程的状态,MySQL主从复制线程状态转变。

Master_User

这个是Master上面的一个用户,用来负责主从复制的用户 ,创建主从复制的时候建立的(具有reolication slave权限)。

Master_Port

Master服务器的端口,一般是3306。

Connect_Retry

连接尝试次数,使用change master时可以使用master-connect-retry选项指定当前值。

Master_Log_File

显示当前I/O线程当前正在读取的主服务器二进制日志文件的名称,上面显示是mysql-bin.010362。

Read_Master_Log_Pos

显示当前同步到主服务器上二进制日志的偏移量,I/O线程已经读取的位置,单位是字节,上述的示例显示当前同步到mysql-bin.010362的555176471偏移量位置,即已经同步了mysql-bin.010362这个二进制日志中529MB(555176471/1024/1024)的内容。

Relay_Log_File

显示Slave的SQL线程当前正在读取和执行的中继日志文件的名称。

Relay_Log_Pos

显示在当前的中继日志中,Slave的SQL线程已读取和执行的中继日志的偏移量。

Relay_Master_Log_File

显示Slave中继日志同步到Master的二进制日志文件,本示例中为mysql-bin.010327。

Slave_IO_Running

显示I/O线程是否被启动并成功地连接到主服务器上,成功为Yes,否则为No。

Slave_SQL_Running

显示SQL线程是否被启动,启动为Yes,否则为No。

Replicate_Do_DB

Replicate_Ignore_DB

Replicate_Do_Table

Replicate_Ignore_Table

Replicate_Wild_Do_Table

Replicate_Wild_Ignore_Table

这些参数都是为了用来指明哪些库或者表在复制的时候不要同步到备库,但是这些参数用的时候要小心,因为当跨库使用的时候可能会出现问题。另外当仅忽略或仅允许多个库或表时,要多次使用忽略语句才可以。

Last_Errno,Last_Error

显示Slave的SQL线程读取日志参数的的错误数量和错误消息,错误数量为0并且消息为空字符串表示没有错误;如果Last_Error值不是空值,它也会在从属服务器的错误日志中作为消息显示。

Skip_Counter

显示最近被使用的用于SQL_SLAVE_SKIP_COUNTER的值,就是用于跳过Slave错误的。

Exec_Master_Log_Pos

表示SQL线程已经执行的Relay log相对于主库二进制日志偏移量的位置。

Relay_Log_Space

表示所有原有的中继日志结合起来的总大小,在START SLAVE语句的UNTIL子句中指定的值,Until_Condition具有以下值:Until_Condition、Until_Log_File、Until_Log_Pos。

Until_Condition

如果没有指定UNTIL子句,则没有值。如果从属服务器正在读取,直到达到主服务器的二进制日志的给定位置为止,则值为Master,如果从属服务器正在读取,直到达到其中继日志的给定位置为止,则值为Relay。

Until_Log_File

Until_Log_Pos

Until_Log_File和Until_Log_Pos用于指示日志文件名和位置值,日志文件名和位置值定义了SQL线程在哪个点中止执行。

Master_SSL_Allowed

显示了从服务器是否使用SSL连接到主服务器。如果允许对主服务器进行SSL连接,则值为Yes;如果不允许对主服务器进行SSL连接,则值为No;如果允许SSL连接,但是从服务器没有让SSL支持被启用,则值为Ignored。

Master_SSL_CA_File

Master_SSL_CA_Path

Master_SSL_Cert

Master_SSL_Cipher

Master_SSL_Key

如果Slave使用SSL连接Master服务器,这里就会显示对应的证书和私钥信息。使用CHANGE MASTER与SSL相关的选项有:–master-ca,–master-capath,–master-cert,–master-cipher和–master-key等。

Seconds_Behind_Master

表示主从之间延迟的时间,单位是秒。就是SQL线程当前执行的binlog(实际上是relay log)中的timestamp和IO线程最新的timestamp的差值。

实质上,此字段计算Slave SQL线程和Slave i/o线程之间的时间差 (以秒为单位)。如果主节点和从服务器之间的网络连接速度较快,则Slave i/o线程非常接近主服务器,因此此字段是对从SQL线程与主服务器进行比较的后的一个很好的近似值。如果网络很慢,这不是一个好的近似;从SQL线程可能经常被从i/o线程所捕获,因此Seconds_Behind_Master通常显示值为0,即使i/o线程比主服务器慢很多。换言之,此列仅适用于快速网络。

Master_SSL_Verify_Server_Cert

显示是否认证Master证书。

Master_Server_Id

显示主服务器的Server_id。

Using_Gtid

表示是否开启了基于Gtid的复制,开启为Yes,否则为No。

Gtid_IO_Pos

如果开启了基于Gtid的复制,这里会显示当前执行到的事物ID。

2)基于GTIDs复制的显示格式

mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.0.30.65
Master_User: mysql_slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 790
Relay_Log_File: relay-log.000008
Relay_Log_Pos: 1003
Relay_Master_Log_File: mysql-bin.000003
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: 790
Relay_Log_Space: 2591
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: 1
Master_UUID: 5f0b7791-a499-11e6-901c-44a84227448b
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: 5f0b7791-a499-11e6-901c-44a84227448b:2-11
Executed_Gtid_Set: 3ec6f284-a4a8-11e6-a3fe-44a84220797c:1-4,5f0b7791-a499-11e6-901c-44a84227448b:1-11
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.0.30.65
Master_User: mysql_slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 790
Relay_Log_File: relay-log.000008
Relay_Log_Pos: 1003
Relay_Master_Log_File: mysql-bin.000003
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: 790
Relay_Log_Space: 2591
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: 1
Master_UUID: 5f0b7791-a499-11e6-901c-44a84227448b
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: 5f0b7791-a499-11e6-901c-44a84227448b:2-11
Executed_Gtid_Set: 3ec6f284-a4a8-11e6-a3fe-44a84220797c:1-4,5f0b7791-a499-11e6-901c-44a84227448b:1-11
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_UUID

记录Master的UUID。

Master_Info_File

记录Master info信息的存储位置。

SQL_Delay

记录Slave设置延迟复制的时间,0表示无延迟。

SQL_Remaining_Delay

Slave_SQL_Running_State

记录SQL线程的状态。

Last_IO_Error_Timestamp

记录最近IO线程错误的时间戳。

Last_SQL_Error_Timestamp

记录最近SQL线程错误的时间戳。

Retrieved_Gtid_Set

接收的二进制日志集合,对应IO线程。

execute_Gtid_Set

执行的二进制日志集合,对应SQL线程。

Auto_Position

记录在GTID模式下是否开启了自动事务校验。

Channel_Name

在多源复制下(5.7支持),复制通道的名称,可以有多个。

转载于:http://www.ywnds.com/?p=3826&viewuser=39

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值