zoukankan      html  css  js  c++  java
  • mysql5.7碰到的坑

    日志输出时区问题

    
    输出日志有这些信息
    2016-08-16T02:23:09.831827Z 112241 [Note] Aborted connection 112241 to db: 'test' user: 'admin_logs' host: 'ip' (Got an error reading communication packets)
    时区信息比系统时间晚八个小时
    mysql> show global variables like '%time%';
    +----------------------------------+-------------------+
    | Variable_name                    | Value             |
    +----------------------------------+-------------------+
    | binlog_max_flush_queue_time      | 0                 |
    | connect_timeout                  | 10                |
    | datetime_format                  | %Y-%m-%d %H:%i:%s |
    | default_password_lifetime        | 0                 |
    | delayed_insert_timeout           | 300               |
    | explicit_defaults_for_timestamp  | ON                |
    | flush_time                       | 0                 |
    | have_statement_timeout           | YES               |
    | innodb_flush_log_at_timeout      | 1                 |
    | innodb_lock_wait_timeout         | 3                 |
    | innodb_old_blocks_time           | 1000              |
    | innodb_rollback_on_timeout       | OFF               |
    | interactive_timeout              | 3600              |
    | lc_time_names                    | en_US             |
    | lock_wait_timeout                | 31536000          |
    | log_timestamps                   | UTC               |
    | long_query_time                  | 2.000000          |
    | max_execution_time               | 0                 |
    | net_read_timeout                 | 30                |
    | net_write_timeout                | 60                |
    | rpl_stop_slave_timeout           | 31536000          |
    | slave_net_timeout                | 60                |
    | slow_launch_time                 | 2                 |
    | slow_query_log_always_write_time | 10.000000         |
    | system_time_zone                 | CST               |
    | thread_pool_idle_timeout         | 60                |
    | time_format                      | %H:%i:%s          |
    | time_zone                        | SYSTEM            |
    | wait_timeout                     | 3600              |
    +----------------------------------+-------------------+
    从上面结果可以看到log_timestamps为UTC
    修改日志格式时区为system
    SET GLOBAL log_timestamps = SYSTEM;
    

    线程池idle超时问题

    现象

    
    2016-08-16T10:34:05.578546+08:00 112225 [Note] Aborted connection 112225 to db: 'admin_pandatv_logs' user: 'admin_logs' host: '10.110.19.72' (Got an error reading communication packets)
    2016-08-16T10:36:32.357267+08:00 112144 [Note] Aborted connection 112144 to db: 'admin_pandatv_logs' user: 'admin_logs' host: '10.110.19.73' (Got an error reading communication packets)
    2016-08-16T10:37:35.649574+08:00 112243 [Note] Aborted connection 112243 to db: 'admin_pandatv_logs' user: 'admin_logs' host: '10.110.19.72' (Got an error reading communication packets)
    2016-08-16T10:41:14.044258+08:00 112091 [Note] Aborted connection 112091 to db: 'admin_pandatv_logs' user: 'admin_logs' host: '10.110.19.72' (Got an error reading communication packets)
    2016-08-16T10:43:58.980932+08:00 112228 [Note] Aborted connection 112228 to db: 'admin_pandatv_logs' user: 'admin_logs' host: '10.110.19.73' (Got an error reading communication packets)
    

    原因

    
    thread_pool_idle_timeout 设置的是60S
    当有业务访问时,atlas会和mysql建立连接池,60S内如果持续有访问那么会复用该连接池,如果60S内无访问,那么mysql端就会进行回收空闲连接
    
    # 解决
    
    
    对于这种问题,个人觉得不用去刻意更改他,对于高并发业务这个错误不会出现,对于低并发业务重新建立一次连接本身也不会有多大性能损耗
    
  • 相关阅读:
    MS SQL Server版本的选择
    ANSI,ASCII,Unicode的区别与联系!
    解决MSSQL中插入中文数据显示乱码的问题!
    ASP.NET中website与webApplication有何区别?
    常用SQL语句总结.
    外键的具体应用和表连接!
    String和datetime在SQL中和在C#中相互转换方法总结
    外键的学习
    if(!IsPostBack)的使用?
    如何在模板的内容页中添加javascript代码?
  • 原文地址:https://www.cnblogs.com/gaoquan/p/5775457.html
Copyright © 2011-2022 走看看