zoukankan      html  css  js  c++  java
  • 异常-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后,关闭资源或者将连接还给线程池。

  • 相关阅读:
    写在前面
    你应该知道的 RPC 原理
    虚函数 继承 多态
    指针 函数指针 指针数组
    Python使用RMF聚类分析客户价值
    数据挖掘关联分析中的支持度、置信度和提升度
    OpenCV2.4.4+Cmake2.8+Vs2010编译createsamples+traincascade程序用来训练样本
    UNITY + OpenCVSharp调节图像对比度
    使用单精度类型变量
    有符号基本整型
  • 原文地址:https://www.cnblogs.com/QuestionsZhang/p/11802355.html
Copyright © 2011-2022 走看看