Got timeout reading communication packets

甲骨文技術支援發表於2017-11-28

環境:CentOS release 6.5 (Final),MySQL:5.7.12

在error.log日誌裡有如下的提示,太多了,容易讓人看不到重要的資訊,所以打算遮蔽掉。


  1. 11-28T19:20:55.658970+08:00 878538 [Note] Aborted connection 878538 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.169.125' (Got timeout reading communication packets)
  2. 2017-11-28T19:21:31.417245+08:00 878728 [Note] Aborted connection 878728 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  3. 2017-11-28T19:21:31.728802+08:00 878635 [Note] Aborted connection 878635 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  4. 2017-11-28T19:21:42.780035+08:00 878504 [Note] Aborted connection 878504 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  5. 2017-11-28T19:21:52.114134+08:00 878279 [Note] Aborted connection 878279 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  6. 2017-11-28T19:22:12.843467+08:00 878736 [Note] Aborted connection 878736 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  7. 2017-11-28T19:22:42.750175+08:00 879051 [Note] Aborted connection 879051 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  8. 2017-11-28T19:22:42.887395+08:00 878825 [Note] Aborted connection 878825 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.169.125' (Got timeout reading communication packets)
  9. 2017-11-28T19:23:21.989617+08:00 879318 [Note] Aborted connection 879318 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  10. 2017-11-28T19:23:42.769896+08:00 879407 [Note] Aborted connection 879407 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  11. 2017-11-28T19:23:42.870136+08:00 879454 [Note] Aborted connection 879454 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.169.125' (Got timeout reading communication packets)
  12. 2017-11-28T19:23:52.125260+08:00 879071 [Note] Aborted connection 879071 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.165.95' (Got timeout reading communication packets)
  13. 2017-11-28T19:23:55.656959+08:00 879511 [Note] Aborted connection 879511 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.56.98' (Got timeout reading communication packets)
  14. 2017-11-28T19:24:12.842803+08:00 879537 [Note] Aborted connection 879537 to db: 'xxxx' user: 'oms_rw' host: 'xxx.xx.169.125' (Got timeout reading communication packets)
從引數log_warnings入手

  1. mysql> show global variables like '%log_warning%';
  2. +---------------+-------+
  3. | Variable_name | Value |
  4. +---------------+-------+
  5. | log_warnings | 2 |
  6. +---------------+-------+
  7. 1 row in set (0.00 sec)
看下這個引數的官方解釋:

log_warnings is enabled by default (the default is 1 before MySQL 5.7.2, 2 as of 5.7.2). To disable it, set it to 0. If the value is greater than 0, the server logs messages about statements that are unsafe for statement-based logging. If the value is greater than 1, the server logs aborted connections and access-denied errors for new connection attempts. See Section B.5.2.10, “Communication Errors and Aborted Connections”.

恰恰我這邊設定的為2,把它修改為1:

  1. set global log_warnings=1;
修改後在error.log裡面這些提示消失了。

最後要注意的是log_warnings在未來的版本中會棄用,由另一個引數log_error_verbosity替代。








來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20893244/viewspace-2147893/,如需轉載,請註明出處,否則將追究法律責任。

相關文章