开发者社区 > 大数据与机器学习 > 实时计算 Flink > 正文

你们用flink插入mysql 出现过这个异常吗?另外自动连接的参数已加

com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 7,604,146 milliseconds ago. The last packet sent successfully to the server was 7,604,157 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
你们用flink插入mysql 出现过这个异常吗?另外自动连接的参数已加

展开
收起
圆葱猪肉包 2023-03-21 14:31:40 248 0
2 条回答
写回答
取消 提交回答
  • 发表文章、提出问题、分享经验、结交志同道合的朋友

    由于 MySQL 数据库的 wait_timeout 参数配置过小,导致连接在空闲一段时间后被服务器关闭,而客户端在使用这个连接时发现连接已经被关闭,从而抛出 CommunicationsException 异常。

    2023-03-21 18:12:32
    赞同 展开评论 打赏
  • 可以试试去加个druid连接池,用连接池每秒刷一次,select 1 就行,你的sink里面open需要去掉这个mysql connection,只不过通过的是druid去链接然后invoke 里面具体来操作。此回答整理自钉群“【③群】Apache Flink China社区”

    2023-03-21 15:56:26
    赞同 展开评论 打赏

实时计算Flink版是阿里云提供的全托管Serverless Flink云服务,基于 Apache Flink 构建的企业级、高性能实时大数据处理系统。提供全托管版 Flink 集群和引擎,提高作业开发运维效率。

相关产品

  • 实时计算 Flink版
  • 相关电子书

    更多
    搭建电商项目架构连接MySQL 立即下载
    搭建4层电商项目架构,实战连接MySQL 立即下载
    PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

    相关镜像