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后,关闭资源或者将连接还给线程池。

  • 相关阅读:
    shell 函数
    使用Alpine镜像构建镜像
    macos修改vmware Fusion的NAT网络
    K8s Pod与宿主机时区不同步
    nginx热升级
    awk分析web日志
    k8s 新建用户远程连接集群和context切换
    查询出口公网ip
    微服务之服务网格 Istio
    Systemd 、systemctl进程管理工具
  • 原文地址:https://www.cnblogs.com/QuestionsZhang/p/11802355.html
Copyright © 2011-2022 走看看