添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

1.问题现象:

 使用flink sql程序消费kafka数据写入mysql时,使用TVF表值函数,START_ENENT_TIME和END_ENENT_TIME 始终比消费时间小大约13小时。
在写入mysql 的sink表时 在connector.url加上参数 “&serverTimezone=Asia/Shanghai” 。

2.问题现象:

com.MySQL.jdbc.CommunicationsException: The last packet successfully received from the server was58129 seconds ago.The last packet sent successfully to the server was 58129 seconds ago, which 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. 
如果连接闲置1小时 (1小时内没有进行数据库操作), mysql就会自动断开连接, 要重启flink sql  task 任务导致数据异常报错. 则需要 connection url加上参数: “&autoReconnect=true”

常用 connector.url

'connector.url' = 'jdbc:mysql://192.168.10.101:3600/dbname?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai',