MYSQL教程MySQL和连接相关的timeout 的详细整理
《MYSQL教程MySQL和连接相关的timeout 的详细整理》要点: MySQL和连接相关的timeout? ?前言:MYSQL实例 今天同事问为什么查询mysql库时,在数据量比较大时,会话总断.刚开始以为是mysql的和连接有关timeout的问题,结果是网络的不稳定的原因.? 下面总结下和连接有关的timeout? slave-net-timeout The number of seconds to wait for more data from the master before the slave considers the connection broken,aborts the read,and tries to reconnect. The first retry occurs immediately after the timeout. The interval between retries is controlled by the MASTER_CONNECT_RETRY option for the CHANGE MASTER TO statement,and the number of reconnection attempts is limited by the --master-retry-count option. The default is 3600 seconds (one hour). net_read_timeout : The number of seconds to wait for more data from a connection before aborting the read. When the server is reading from the client,net_read_timeout is the timeout value controlling when to abort net_write_timeout: The number of seconds to wait for a block to be written to a connection before aborting the write.When the server is writing to the client,net_write_timeout is the timeout value controlling when to abort. wait_timeout The number of seconds the server waits for activity on a noninteractive connection before closing it. interactive_timeout : The number of seconds the server waits for activity on an interactive connection before closing it. connect_timeout The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake. The default value is 10 seconds. 等待一个连接响应的时间? connect_timeout:在获取连接阶段(authenticate)起作用 interactive_timeout和wait_timeout:在连接空闲阶段(sleep)起作用 获取MySQL连接是多次握手的结果,除了用户名和密码的匹配校验外,还有IP->HOST->DNS->IP验证,任何一步都可能因为网络问题导致线程阻塞.为了防止线程浪费在不必要的校验等待上,超过connect_timeout的连接哀求将会被拒绝.? 即使没有网络问题,也不能允许客户端一直占用连接.对于保持sleep状态超过了wait_timeout(或interactive_timeout,取决于client_interactive标志)的客户端,MySQL会主动断开连接. 即使连接没有处于sleep状态,即客户端忙于计算或者存储数据,MySQL也选择了有条件的等待.在数据包的分发过程中,客户端可能来不及响应(发送、接收、或者处理数据包太慢).为了保证连接不被浪费在无尽的等待中,MySQL也会选择有条件(net_read_timeout和net_write_timeout)地主动断开连接.? 参考: http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.htmlMYSQL实例 ?以上就是MySQL和连接相关的timeout 的详细整理,如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能赞助到大家,谢谢大家对本站的支持!MYSQL实例 欢迎参与《MYSQL教程MySQL和连接相关的timeout 的详细整理》讨论,分享您的想法,编程之家PHP学院为您提供专业教程。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Mysql实例mysql常用命令大全 mysql常用命令总结
- Mysql入门解决 phpmyadmin #2002 无法登录 MySQL 服务器
- Mysql学习MAC下MYSQL5.7.17连接不上的问题及解决办法
- php – 如何在登录后访问用户信息?
- myqltransactionRollbackexception deadlock found when t
- php – 我可以使用SET选项使用ON DUPLICATE KEY UPDATE和I
- Mysql必读mysql locate与position函数用法举例
- SQL取时间部分
- MYSQL教程Mac下mysql 5.7.13 安装配置方法图文教程
- Mysql实例如何恢复Mysql数据库的详细介绍