mysql slave 线程 简书_【MySQL】你真的读懂了slave status吗?

前言:大家平时在检查主从复制的时候基本上都会使用 show slave status来看主从复制的情况,那么你真的读懂每个指标项了吗?

一、status指标解读

root@localhost [(none)]>show slave status\G

ERROR 2006 (HY000): MySQL server has gone away

No connection. Trying to reconnect...

Connection id: 7

Current database: *** NONE ***

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

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.50.3

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000001

Read_Master_Log_Pos: 728

Relay_Log_File: relay-bin.000002

Relay_Log_Pos: 941

Relay_Master_Log_File: mysql-bin.000001

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

Relay_Log_Space: 1142

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

Master_UUID: dff47046-3ad5-11e8-86fe-080027de0e0e

Master_Info_File: /storage/mysql/data/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: dff47046-3ad5-11e8-86fe-080027de0e0e:1-3

Executed_Gtid_Set: dff47046-3ad5-11e8-86fe-080027de0e0e:1-3

Auto_Position: 1

Replicate_Rewrite_DB:

Channel_Name:

Master_TLS_Version:

1 row in set (0.00 sec)

指标

注释

Slave_IO_State: Waiting for master to send event

表示IO线程的状态

Master_Host: 192.168.50.3

Master的IP地址

Master_User: repl

主从复制的用户

Master_Port: 3306

Master的端口

Connect_Retry: 60

IO thread重连次数

Master_Log_File: mysql-bin.000001

IO thread正在读取的master上的binlog文件

Read_Master_Log_Pos: 728

正在读取的master上的binlog文件位置

Relay_Log_File: relay-bin.000002

存放的本地relay log文件名

Relay_Log_Pos: 941

存放的本地relay log位置

Relay_Master_Log_File: mysql-bin.000001

SQL线程正在执行的master binlog file

Slave_IO_Running: Yes

IO thread状态

Slave_SQL_Running: Yes

SQL thread状态

Replicate_Do_DB:

指定复制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: 728

执行masterbinlog的位置

Relay_Log_Space: 1142

所有relay log字节数总和

Until_Condition: None

指定复制条件

Until_Log_File:

指定复制到某个文件

Until_Log_Pos: 0

指定复制到某个位置

Seconds_Behind_Master: 0

从库落后主库时间,单位秒

Last_IO_Errno: 0

最近一次IO thread错误

Last_IO_Error

最近一次IO thread错误详细信息

Last_SQL_Errno: 0

最近一次sql thread错误

Last_SQL_Error:

最近一次sql thread错误详细信息

Replicate_Ignore_Server_Ids:

复制忽略server_id为xxx的实例

Master_Server_Id: 1003306

master server_id

Master_UUID: dff47046-3ad5-11e8-86fe-080027de0e0e

master uuid

Master_Info_File: /storage/mysql/data/master.info

记录master信息文件

SQL_Delay: 0

sql延迟多少时间,延迟复制会用到

SQL_Remaining_Delay: NULL

当sql thread状态为Waiting until MASTER_DELAY seconds after master executed event,那么该值表示剩下延迟多少时间

Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates

sql thread状态

Master_Retry_Count: 86400

主从复制断开时slave最多能尝试重新连接的次数

Master_Bind:

绑定网卡

Last_IO_Error_Timestamp:

io thread 最近一次的错误时间

Last_SQL_Error_Timestamp:

sql thread 最近一次的错误时间

Retrieved_Gtid_Set: dff47046-3ad5-11e8-86fe-080027de0e0e:1-3

IO thread获取到的GTID

Executed_Gtid_Set: dff47046-3ad5-11e8-86fe-080027de0e0e:1-3

SQL thread执行的GTID

Auto_Position: 1

使用auto_position,建议还是开启比较方便

Replicate_Rewrite_DB:

复制DB对应关系

Channel_Name:

多源复制的channel name

下面我们逐个来解读一下:

指标

注释

Slave_IO_State: Waiting for master to send event

表示IO线程的状态

Master_Host: 192.168.50.3

Master的IP地址

Master_User: repl

主从复制的用户

Master_Port: 3306

Master的端口

Connect_Retry: 60

IO thread重连次数

Master_Log_File: mysql-bin.000001

IO thread正在读取的master上的binlog文件

Read_Master_Log_Pos: 728

正在读取的master上的binlog文件位置

Relay_Log_File: relay-bin.000002

存放的本地relay log文件名

Relay_Log_Pos: 941

存放的本地relay log位置

Relay_Master_Log_File: mysql-bin.000001

SQL线程正在执行的master binlog file

Slave_IO_Running: Yes

IO thread状态

Slave_SQL_Running: Yes

SQL thread状态

Replicate_Do_DB:

指定复制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: 728

执行masterbinlog的位置

Relay_Log_Space: 1142

所有relay log字节数总和

Until_Condition: None

指定复制条件

Until_Log_File:

指定复制到某个文件

Until_Log_Pos: 0

指定复制到某个位置

Seconds_Behind_Master: 0

从库落后主库时间,单位秒

Last_IO_Errno: 0

最近一次IO thread错误

Last_IO_Error

最近一次IO thread错误详细信息

Last_SQL_Errno: 0

最近一次sql thread错误

Last_SQL_Error:

最近一次sql thread错误详细信息

Replicate_Ignore_Server_Ids:

复制忽略server_id为xxx的实例

Master_Server_Id: 1003306

master server_id

Master_UUID: dff47046-3ad5-11e8-86fe-080027de0e0e

master uuid

Master_Info_File: /storage/mysql/data/master.info

记录master信息文件

SQL_Delay: 0

sql延迟多少时间,延迟复制会用到

SQL_Remaining_Delay: NULL

当sql thread状态为Waiting until MASTER_DELAY seconds after master executed event,那么该值表示剩下延迟多少时间

Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates

sql thread状态

Master_Retry_Count: 86400

主从复制断开时slave最多能尝试重新连接的次数

Master_Bind:

绑定网卡

Last_IO_Error_Timestamp:

io thread 最近一次的错误时间

Last_SQL_Error_Timestamp:

sql thread 最近一次的错误时间

Retrieved_Gtid_Set: dff47046-3ad5-11e8-86fe-080027de0e0e:1-3

IO thread获取到的GTID

Executed_Gtid_Set: dff47046-3ad5-11e8-86fe-080027de0e0e:1-3

SQL thread执行的GTID

Auto_Position: 1

使用auto_position,建议还是开启比较方便

Replicate_Rewrite_DB:

复制DB对应关系

Channel_Name:

多源复制的channel name

二、日常运维注意点

在GTID环境下,主从同步延迟观察就非常简单了,我们只需要观察Retrieved_Gtid_Set表示的就是io thread读取到的位置,Executed_Gtid_Set表示的就是sql thread执行到的位置

在非GTID环境下,主从复制观察相对来说稍微麻烦一些,(Master_Log_file, Read_Master_Log_Pos): 表示io thread读取到的master binlog位置;

Relay_Master_Log_File, Exec_Master_Log_Pos): 表示sql thread已经执行到的位置;

(Relay_Log_File, Relay_Log_Pos): 表示sql thread执行到的relay log位置

Seconds_Behind_Master表示slave延迟master的时间数,并不是很准确,计算公式是:io_thread.timestamp-sql_thread.timestamp

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/262392.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Python中用input()和print()体现输入输出重定向

众所周知,在Python中, 语句:变量input() 的功能是:从键盘读取数据到内存变量,此过程为输入。此时,键盘为标准输入设备,对应的文件对象名为sys.stdin。 语句:input(变量) 的功能是&…

【DI专题】在 DI 脚本文件中调用存储过程

以前用过,但是隔很久不用,还是会有点忘记,还是记下来吧:) 1.在左侧datastore区域,选择数据库,选择 Function,单击右键,选择 import by name; 2.在弹出对话框中,输入待导入…

国外网站设计欣赏:30个优秀的国外咖啡网站设计

梦想天空博客向大家分享各种类型的优秀网站作品,有电子商务网站设计、旅游网站设计、餐馆网站设计、设计工作室网站设计、大学网站设计以及各种色系,各种风格的网站设计作品。今天这篇文章给大家带来30个优秀的国外咖啡网站设计作品,一起欣赏…

mysql查询连续3个月以上_MySQL查询显示连续的结果

#mysql中 对于查询结果只显示n条连续行的问题#在领扣上碰到的一个题目:求满足条件的连续3行结果的显示x city built a new stadium, each day many people visit it and the stats are saved as these columns: id, date, people;please write a query to display t…

对已有文件进行既读又写的操作时关于文件位置注意事项(适用于Python和C/C++)

当我们需要对现有文件进行读取数据并修改文件中的数据时,就需要用到对已有文件进行既读又写的操作。有多种可读且可写的文件打开方式:r,w,a,rb,wb,ab,具体含义见下表。 打开 方式 读写 特性 文件数据 特性 对文件存在性的处理方式 备注 …

[原]JS ajax类的三种封装形式及简单对比

三种形式:1 function(para1,para2,...)2 function()在里面定义prototype,每次调用前先new一下3 类似于JSON的方式JSON的形式,定义出来的相当于静态类,用for循环,做20次调用, 第一种形式 返回了20个结果。第…

Quaruts II 增量编译

http://bbs.ednchina.com/BLOG_ARTICLE_3007977.HTM http://quartushelp.altera.com/11.1/mergedProjects/msgs/msgs/esgn_tri_state_partition.htm 增量编译主要有两个工具:Design Partition和Logiclock Design Partition只是将设计进行“逻辑分区”,直…

python中变量名存储在哪里_python – 如何在内部存储和映射变量名称?

I think at a high level it can be done with a dict, where the key is the variable name (str?) and the value is the reference that it’s associated with.这也是它内部工作的方式.在CPython中,变量名和它们指向的对象通常存储在Python字典中;编写Python代码时可以使用…

【译】CodeIgniter HMVC模块扩展使用文档

CodeIgniter HMVC扩展说明 原文地址:Modular Extensions - HMVC 模块扩展——HMVC 模块扩展让CodeIgniter框架模块化。模块是一组独立的组件(通常有模型、控制器和视图),它们被分类在应用模块的子文件夹中,并且能够直接…

Python嵌套列表解析式(又称列表推导式)写法剖析与应用举例

#嵌套列表解析式又称嵌套列表推导式,功能非常强大,但是初学者难以摸清其书写规则。 #以下实例展示了嵌套列表解析的写法。 #嵌套列表解析表达是的书写规则是层层嵌套。 #嵌套层的一般形式为:for outter in inner。根据需要解析的嵌套层次深度…

C#中的委托和事件

using System; using System.Collections.Generic; using System.Linq; using System.Text;namespace Study_05_Observer设计模式 {// 计数器public class Counter{int x;int y;//声明委托public delegate void CountEventHandler(object sender, CountEventArgs e);public eve…

python函数参数类型及顺序_python函数参数类型及其顺序

根据inspect模块官文文档中关于函数参数类型的相关说明,python函数参数共有五种类型,按顺序分别为:POSITIONAL_ONLY、POSITIONAL_OR_KEYWORD、VAR_POSITIONAL、KEYWORD_ONLY、VAR_KEYWORD。如图:POSITIONAL_ONLY:参数值…

JS组件系列——Bootstrap Table 表格行拖拽(二:多行拖拽)

原文:JS组件系列——Bootstrap Table 表格行拖拽(二:多行拖拽)前言:前天刚写了篇JS组件系列——Bootstrap Table 表格行拖拽,今天接到新的需要,需要在之前表格行拖拽的基础上能够同时拖拽选中的多行。博主用…

Python利用matplotlib.animation和matplotlib.pyplot和ffmpeg录制动画并保存为MP4文件

因为需要将结果动画保存为MP4视频文件需要ffmepg软件的的支持。 一:安装ffmpeg软件: ffmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。采用LGPL或GPL许可证。它提供了录制、转换以及流化音视频的完整解决方…

Chapter 4 : 单行函数

SELECT LOWER(SQL: Structural Query Language)from dual;//dual 是一个虚表(伪表)。UPPER(列名|表达式)SELECT UPPER(sql is used exclusively in rdbmses)from dual;SELECT INITCAP(sql is an ENGLISH LIKE language)from dual;Output: Sql Is An English Like Languageselec…

黑马训练营自学笔记(03)

---------------------- Windows Phone 7手机开发、.Net培训、期待与您交流! ---------------------- 对ViewState的一些认识 因为Http协议是一总无状态记忆的协议,即服务器不会知道上次可客户端请求的内容。WebForm中许多服务端控件的实现依靠的就是Vie…

scrapy知乎爬虫mysql存储项目_Scrapy爬虫框架第八讲【项目实战篇:知乎用户信息抓取】--本文参考静觅博主所写...

思路分析:(1)选定起始人(即选择关注数和粉丝数较多的人--大V)(2)获取该大V的个人信息(3)获取关注列表用户信息(4)获取粉丝列表用户信息(5)重复(2)(3)(4)步实现全知乎用户爬取实战演练:(1)、创建项目:scrapy startproject zhijutest(2)、创建爬…

pyplot输出的绘图界面中文乱码的解决方案

解决办法很简单,明确设置并使用特定的中文字体即可。具体来说,分两步: 第一步:生成指定的字体属性对象。此对象名在下例中为fp。 import matplotlib.pyplot as plt from matplotlib.font_manager import FontProperties #注意路…

kali下生成web端后门

很多时候在***测试时选择web***害怕用的别人的马带有后门,这样自己的辛苦就要被别人不劳而获,很多时候我们都想拥有自己的马,那么这个时候你就应该使用kail来生成一个自己独特密码的web***了。Kali Linux自带有好几个web***生成工具&#xff…

童儿的故事(二)

回来的路上, 又看到昨天那个望桔的童儿。 “怎么,你还在胡思乱想?”我问他。 “我想,至少我可以望一望它。”顺势他把苹果搂的更紧。 得不到的时候也许会让一个人懂得珍惜, 即便他不懂得满足。 他喃喃道:“…