异常-ERROR yarn.ApplicationMaster: User class threw exception: java.sql.SQLException: Communications l

1 详细异常信息java

ERROR yarn.ApplicationMaster: User class threw exception: java.sql.SQLException: Communications link failure
The last packet successfully received from the server was 18,973 milliseconds ago.  The last packet sent successfully to the server was 3 milliseconds ago. Query: select user_register_analyse_id as userRegisterAnalyseId,day_time as dayTime,city_code as cityCode,city,city_province as cityProvince,province,total_user_register_count as totalUserRegisterCount,day_user_register_count as dayUserRegisterCount,first_order_user_count as firstOrderUserCount,day_user_register_ordered_conversion_rate as dayUserRegisterOrderedConversionRate from t_user_register_analyse where day_time = ? and city_code = ?  limit 1 Parameters: [2019-09-01 00:00:00, 130900]
java.sql.SQLException: Communications link failure

  

2 检查一下本身的msyql链接是否关闭mysql

解决方案:sql

  第一步,先设置下mysql链接的过时时间,让mysql会自动释放链接api

    set  global wait_timeout=30线程

    set  global interactive_timeout=30code

    或者 修改my.cnf 重启mysqlserver

    [mysqld]
    wait_timeout=30
    interactive_timeout=30blog

  第二步,代码中手动关闭链接,根据本身用的代码api,本身检查下,是否把执行完sql后,关闭资源或者将链接还给线程池。ci

相关文章
相关标签/搜索