異常-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

相關文章
相關標籤/搜索