Home > Database > Mysql Tutorial > 事物隔离级别和行日志格式设置不当导致故障案例

事物隔离级别和行日志格式设置不当导致故障案例

WBOY
Release: 2016-06-07 17:41:55
Original
988 people have browsed it

最近刚接手个新项目的测试平台采用了spring的事务机制,在用户认证登录时总是提示认证超时,于时查看相应的各应用服务器日志,发现报了异常:Binaryloggingnotposs

最近刚接手个新项目的测试平台采用了spring的事务机制,在用户认证登录时总是提示认证超时,于时查看相应的各应用服务器日志,发现报了异常:

Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'...

......


前端某台应用服务器报如下错:

{"returnNo":0,"listField":[{"userCode":"admin","newPassword":"","sessionKey":"","password":"670b14728ad9902aecba32e22fa4f6bd","ip":"192.168.1.75"}],"returnObject":null,"commondId":"8000"}

java.io.IOException: Server returned HTTP response code: 500 for URL:

at sun.net.(HttpURLConnection.java:1313)


其实通过最上面那条错误可以判断问题出在哪了.由于innodb 和 binlog不兼容引起的...MySQL推荐:当设置隔离级别为READ-COMMITED必须设置行日志格式为ROW,网站空间,现在MySQL官方也明确说明STATEMENT 这个已经不建议用了!


当前系统的事务隔离级别是: READ-COMMITTED,行日志格式是:STATEMENT


这里可以有两种解决办法:

一种是提升事物隔离级别为 REPEATABLE-READ,这是MySQL默认的事务隔离级别;

mysql> set global transaction isolation level repeatable read;


一种是保持当前的事务隔离级别,香港服务器租用,修改行日志格式为 MIXED 或 ROW.

这里修改配置文件:

binlog_format = row

#binlog_format = MIXED

重启服务


有个特别要注意的问题,如果 binlog_format 为 MIXED,服务器空间,而且使用的是默认隔离级别REPEATABLE-READ,那么会导致主从数据不一致。


参考贺总博客:


本文出自 “->” 博客,请务必保留此出处

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template