【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo
1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be consistent
【环境的叙述性说明】
msyql5.6.14
【报错信息】
mysql的slave启动时,error.log中出现Warning警告:
[Warning] Slave SQL: If a crash happensthis configuration does not guarantee that the relay log info will beconsistent, Error_code: 0
这条Warning信息对Mysql和MySQL复制功能没有不论什么影响。
【报错原因】
MySQL5.6版本号開始支持把master.info和relay-log.info的内容写入到mysql库的表中。
master.info--> mysql.slave_master_info
relay-log.info--> mysql. slave_relay_log_info
同一时候在MySQL5.6版本号中,添加了 Slave crash-safe replication功能,为了保证mysql的replication可以crash-safe。slave_master_info和slave_relay_log_info表必须使用事务型的存储引擎(InnoDB),不要尝试去手动改动这两张表的内容。
同一时候,Slave还要开启relay_log_recovery功能。
【解决方法】
设置master_info_repository和relay_log_info_repository的值为TABLE。同一时候开启relay_log_recovery功能。
改动/etc/my.cnf配置文件,加入下面3项:
master-info-repository=table # 能够使用set global 动态改动
relay-log-info-repository=table # 能够使用setglobal 动态改动
relay-log-recovery=1 # 仅仅读參数,必须改动my.cnf重新启动mysql
然后重新启动mysql实例。
【參考资料】
l master.info和relay-log.info日志
在复制的Slave节点上会创建两个日志,各自是master.infor和relay-log.info,位于datadir文件夹中。在MySQL5.6和兴许的版本号中,能够通过设置master-info-file和relay-log-info-file參数来指定写入到mysql的表中或者写入文件。
这两个文件里包括一些类似showslave status输出的信息,当slave启动的时候会读取master.info和relay-log.info文件来确定从master读取binary log和读取relay log的信息。
Slave的I/O线程负责更新维护master.info文件,
|
master.info |
mysql.slave_master_info |
SHOW SLAVE STATUS Column |
Description |
|
1 |
Number_of_lines |
[None] |
Number of lines in the file |
|
2 |
Master_log_name |
Master_Log_File |
The name of the master binary log currently being read from the master |
|
3 |
Master_log_pos |
Read_Master_Log_Pos |
The current position within the master binary log that have been read from the master |
|
4 |
Host |
Master_Host |
The host name of the master |
|
5 |
User |
Master_User |
The user name used to connect to the master |
|
6 |
User_password |
Password (not shown by SHOW SLAVE STATUS) |
The password used to connect to the master |
|
7 |
Port |
Master_Port |
The network port used to connect to the master |
|
8 |
Connect_retry |
Connect_Retry |
The period (in seconds) that the slave will wait before trying to reconnect to the master |
|
9 |
Enabled_ssl |
Master_SSL_Allowed |
Indicates whether the server supports SSL connections |
|
10 |
Ssl_ca |
Master_SSL_CA_File |
The file used for the Certificate Authority (CA) certificate |
|
11 |
Ssl_capath |
Master_SSL_CA_Path |
The path to the Certificate Authority (CA) certificates |
|
12 |
Ssl_cert |
Master_SSL_Cert |
The name of the SSL certificate file |
|
13 |
Ssl_cipher |
Master_SSL_Cipher |
The list of possible ciphers used in the handshake for the SSL connection |
|
14 |
Ssl_key |
Master_SSL_Key |
The name of the SSL key file |
|
15 |
Ssl_verify_server_cert |
Master_SSL_Verify_Server_Cert |
Whether to verify the server certificate |
|
16 |
Heartbeat |
[None] |
Interval between replication heartbeats, in seconds |
|
17 |
Bind |
Master_Bind |
Which of the slave's network interfaces should be used for connecting to the master |
|
18 |
Ignored_server_ids |
Replicate_Ignore_Server_Ids |
The number of server IDs to be ignored, followed by the actual server IDs |
|
19 |
Uuid |
Master_UUID |
The master's unique ID |
|
20 |
Retry_count |
Master_Retry_Count |
Maximum number of reconnection attempts permitted Added in MySQL 5.6.1) |
Slave的SQL线程负责维护relay-log.info文件,在MySQL5.6中relay-log.info包括文件里的记录数和复制延迟的秒数。
|
relaylog.info |
slave_relay_log_info |
SHOW SLAVE STATUS |
Description |
|
1 |
Number_of_lines |
[None] |
Number of lines in the file or rows in the table |
|
2 |
Relay_log_name |
Relay_Log_File |
The name of the current relay log file |
|
3 |
Relay_log_pos |
Relay_Log_Pos |
The current position within the relay log file; events up to this position have been executed on the slave database |
|
4 |
Master_log_name |
Relay_Master_Log_File |
The name of the master binary log file from which the events in the relay log file were read |
|
5 |
Master_log_pos |
Exec_Master_Log_Pos |
The equivalent position within the master's binary log file of events that have already been executed |
|
6 |
Sql_delay |
SQL_Delay |
The number of seconds that the slave must lag the master |
设置master_info_repository和relay_log_info_repository參数:
SQL> stop slave;
SQL> set global master_info_repository=table;
SQL> set global relay_log_info_repository=table;
SQL> show variables like '%repository';
+--------------------------------------+---------+
| Variable_name | Value |
+--------------------------------------+---------+
| master_info_repository | TABLE |
| relay_log_info_repository | TABLE |
+--------------------------------------+----------+
查看向Master读取日志的情况:
SQL> select * from slave_master_info;
查看Slave的Relay日志应用情况:
SQL> select * from slave_relay_log_info;
注意:
master.info和relay-log.info内的数据会有一定的延迟,取决于mysql把slave信息刷到硬盘的时间,假设要获得slave的实时信息,能够查询slave_master_info和slave_relay_log_info表,或者运行show slave status查看。
l master-info-repository
master-info-repository={ FILE | TABLE },默认值是FILE。这个參数用于设置Slave节点上把master的信息写入到物理文件里还是写入到mysql. slave_master_info表中。
假设设置为FILE。也是mysql的默认设置,Slave会在datadir/master.info文件里记录master的信息,从MySQL5.6版本号開始,建议使用TABLE模式。
l relay-log-info-reposity
relay-log-info-reposity=file|table。默认值是FILE。这个參数用于设置slave节点上把relay-log.info的信息写入到datadir/relay-log.info文件或者mysql. slave_relay_log_info表。
假设设置为FILE,也是mysql的默认设置,Slave会在datadir/master.info文件里记录master的信息,从MySQL5.6版本号開始,建议使用TABLE模式。
l relay-log-recovery
relay-log-recover=0|1,默认值是0不开启。该參数用于设置是否开启relay log的自己主动恢复功能。
当开启relay_log_recovery功能,slave数据库在启动的时候,会忽略未被运行的relay log。它会又一次连接master获取relay log来进行恢复。
当slave发生宕机的时候。建议开启该功能,能够有效避免slave运行了relay log里面的讹误记录。
假设开启relay_log_recovery功能,我们有相同的时间到relay_log_info_reposity至TABLE状态。
版权声明:本文博主原创文章。博客,未经同意不得转载。
【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo的更多相关文章
- 【MySQL案例】error.log的Warning:If a crash happens thisconfiguration does not guarantee that the relay lo(转)
标签: 1.1.1. If a crash happens thisconfiguration does not guarantee that the relay log info will be c ...
- Sort aborted Error in MySQL Error Log
现象 [ERROR] lines containing "Sort aborted" are present in the MySQL error log file. [Warni ...
- 谁记录了mysql error log中的超长信息
[问题] 最近查看MySQL的error log文件时,发现有很多服务器的文件中有大量的如下日志,内容很长(大小在200K左右),从记录的内容看,并没有明显的异常信息. 有一台测试服务器也有类似的问题 ...
- 谁记录了mysql error log中的超长信息(记pt-stalk一个bug的定位过程)
[问题] 最近查看MySQL的error log文件时,发现有很多服务器的文件中有大量的如下日志,内容很长(大小在200K左右),从记录的内容看,并没有明显的异常信息. 有一台测试服务器也有类似的问题 ...
- nginx error.log 提示 [error] 887#887: *58 FastCGI sent in stderr: "PHP message: PHP Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50556 Library:50637
0. 1.问题 1.1现象: nginx error.log 提示 [error] 887#887: *58 FastCGI sent in stderr: "PHP message: PH ...
- MYSQL 5.7 无法启动(Could not open error log file errno 2)
前两天电脑中毒, 病毒好像把mysql的 log.err 文件给删掉了.然后服务一直启动不了:Could not open error log file errno 2. 然后疯狂百度,搜索的结果大多 ...
- MySQL四种类型日志:Error Log、General Query Log、Binary Log、Slow Query Log
MySQL Server 有四种类型的日志——Error Log.General Query Log.Binary Log 和 Slow Query Log. 第一个是错误日志,记录mysqld的一些 ...
- MySQL错误日志(Error Log)
错误日志是一个文本文件,记录了 MySQL Server 每次启动和关闭的详细信息以及运行过程中所有较为严重的警告和错误信息.在遇到问题时,应该首先查看这个文件. 如何开启 使用命令 SHOW VAR ...
- 【mysql案例】mysql5.6.14配置my.cnf多实例,mysql_install_db初始化不读取my.cnf配置文件
1.1.1. mysql5.6.14多实例my.cnf时,初始化不读取my.cnf配置文件 [环境描写叙述] 在多实例配置的/etc/my.cnf环境中,运行mysql_install_db后.启动M ...
随机推荐
- c#.net公共帮助类
c#.net公共帮助类 比较全面的c#帮助类 比较全面的c#帮助类,日常工作收集,包括前面几家公司用到的,各式各样的几乎都能找到,所有功能性代码都是独立的类,类与类之间没有联系,可以单独引用至项目,分 ...
- Net知识
Net知识图谱 对于Web系统开发来说,Net其实也是有好多知识点需要学的,虽然目前JAVA是主流,就业市场比较大,但Net也在积极的拥抱开源,大Net Core 2 出来了,这无疑给Net开发者 ...
- aspcms产品详情页调取相关产品
产品详情页调用相关产品最常见的应用就是装饰公司网站,设计师页面要求调取设计师做过的案例.aspcms本身有这个功能,但不能完全符合要求,看代码 {aspcms:content sort={aspcms ...
- 一位90后程序员的自述:如何从年薪3w到30w!
初入职场之时,大多数人都应该考虑过这样的一个问题,如何找到一种实用,简化web流程的方法,在工作之中能有所提升和突破. 学好哪些?基础必须精通! 九层之塔,起于垒土;千里之行,始于足下.入门之前,这些 ...
- idea+springboot+freemarker热部署(转)
今天在学习springboot集成freemarker模板引擎修改代码时,发现每次修改一次freemarker文件时,都必须重启下应用,浏览器刷新才能显示修改后的内容,这样效率太低,每次启动一次应用都 ...
- mysql触发器语法的一个实例
我要实现的功能是:在更新一个表时.从三个表中查询记录并插入到另外一个表中.以下是我写触发器的过程: 第一次写的触发器例如以下: CREATE TRIGGER istmingxi AFTER UPDA ...
- [Docker] Run, Stop and Remove Docker Containers
In this lesson, we'll find out the basics of running Docker containers. We'll go over how to downloa ...
- apche commons项目简介 分类: B1_JAVA 2014-06-26 11:27 487人阅读 评论(0) 收藏
1.apche commons项目封装了日常开发中经常使用的功能,如io, String等. http://commons.apache.org/ Apache Commons项目的由三部分组成: T ...
- mysql分区功能(三个文件储存一张表)(分区作用)(分区方式)
mysql分区功能(三个文件储存一张表)(分区作用)(分区方式) 一.总结 1.mysql数据表的存储方式(三个文件储存一张表): 一张表主要对应着三个文件,一个是frm存放表结构的,一个是myd存放 ...
- 在Excel中粘贴时怎样跳过隐藏行
http://www.excel123.cn/Article/exceljichu/201203/932.html 有时在筛选后需要将其他区域中的连续行数据复制粘贴到筛选区域,以替换筛选后的数据.由于 ...