異常-ERROR yarn.ApplicationMaster: User class threw exception: java.sql.SQLException: Communications link failure


1 詳細異常信息

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連接的過期時間,讓mysql會自動釋放連接

    set  global wait_timeout=30

    set  global interactive_timeout=30

    或者 修改my.cnf 重啟mysql

    [mysqld]
    wait_timeout=30
    interactive_timeout=30

  第二步,代碼中手動關閉連接,根據自己用的代碼api,自己檢查下,是否把執行完sql后,關閉資源或者將連接還給線程池。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM