你们用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 304 分享 版权
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 版(Alibaba Cloud Realtime Compute for Apache Flink,Powered by Ververica)是阿里云基于 Apache Flink 构建的企业级、高性能实时大数据处理系统,由 Apache Flink 创始团队官方出品,拥有全球统一商业化品牌,完全兼容开源 Flink API,提供丰富的企业级增值功能。
还有其他疑问?
咨询AI助理