You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 酷酷的浑蛋 <ap...@163.com> on 2020/11/02 02:28:04 UTC

Re:回复:flink1.11连接mysql问题

没有解决,隔一段时间就会报这个超时错误

















在 2020-10-14 17:33:30,"superainbower" <su...@163.com> 写道:
>HI
>链接超时的问题,你后来解决了吗?能告诉下怎么解决的吗?
>| |
>superainbower
>|
>|
>superainbower@163.com
>|
>签名由网易邮箱大师定制
>
>
>在2020年08月31日 15:57,酷酷的浑蛋<ap...@163.com> 写道:
>关键是在sql中怎么设置,connector=jdbc
>
>
>
>
>在2020年08月31日 15:06,13580506953<13...@163.com> 写道:
>这个问题本质是连接活性问题,
>连接数据库超时设置autoReconnect=true(mysql5以上的,设置autoReconnect=true 是无效的 只有4.x版本,起作用)
>
>
>建议使用连接池druid进行连接活性保持
>
>
>原始邮件
>发件人: 酷酷的浑蛋<ap...@163.com>
>收件人: user-zh<us...@flink.apache.org>
>发送时间: 2020年8月28日(周五) 15:02
>主题: flink1.11连接mysql问题
>
>
>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 52,445,041 milliseconds ago. The last packet sent successfully to the server was 52,445,045 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, orusing the Connector/J connection property 'autoReconnect=true' to avoid this problem. flink连接mysql,在过了一定时间后,就断开连接了,设置'autoReconnect=true’也不管用

Re:回复: 回复: flink1.11连接mysql问题

Posted by hailongwang <18...@163.com>.
Hi,
   应该是长时间没有传输数据导致 Connection invalid,具体修复 issue 可见:https://issues.apache.org/jira/browse/FLINK-16681
   看这个 Fix 应该是在1.12 和 即将发布的 1.11.3 上。
  Best,
Hailong Wang

在 2020-11-02 13:20:54,"史 正超" <sh...@outlook.com> 写道:
>是这样的,因为重试的时候 flink-jdbc-connector会把错误的堆栈打印出来的,然后再重连的,对任务没有影响,你的任务失败了吗?我的任务其实也有这个错误,但是任务没有失败,重新连接上mysql了。
>你仔细 看下你的日志里有没有下面的日志:
>JDBC executeBatch error, retry times = 1
>________________________________
>发件人: 酷酷的浑蛋 <ap...@163.com>
>发送时间: 2020年11月2日 3:33
>收件人: user-zh@flink.apache.org <us...@flink.apache.org>
>主题: 回复: flink1.11连接mysql问题
>
>标题上写的就是flink1.11啊
>
>
>
>
>在2020年11月2日 11:33,酷酷的浑蛋<ap...@163.com> 写道:
>你看历史的回复,用的就是flink1.11,最新的flink-1.11.2也试过了还是有这个问题,而且我是在flink sql中使用
>
>
>
>
>在2020年11月2日 11:30,史 正超<sh...@outlook.com> 写道:
>你用的flink哪个版本,flink-1.11已经加了连接失效重连的功能了,应该没有这个问题了。如果不是flink-1.11.x版本的,也可以参考flink-1.11的jdbc-connector的实现,或者用SELECT 1 语句保活连接。
>________________________________
>发件人: 酷酷的浑蛋 <ap...@163.com>
>发送时间: 2020年11月2日 2:28
>收件人: user-zh@flink.apache.org <us...@flink.apache.org>
>主题: Re:回复:flink1.11连接mysql问题
>
>没有解决,隔一段时间就会报这个超时错误
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>在 2020-10-14 17:33:30,"superainbower" <su...@163.com> 写道:
>HI
>链接超时的问题,你后来解决了吗?能告诉下怎么解决的吗?
>| |
>superainbower
>|
>|
>superainbower@163.com
>|
>签名由网易邮箱大师定制
>
>
>在2020年08月31日 15:57,酷酷的浑蛋<ap...@163.com> 写道:
>关键是在sql中怎么设置,connector=jdbc
>
>
>
>
>在2020年08月31日 15:06,13580506953<13...@163.com> 写道:
>这个问题本质是连接活性问题,
>连接数据库超时设置autoReconnect=true(mysql5以上的,设置autoReconnect=true 是无效的 只有4.x版本,起作用)
>
>
>建议使用连接池druid进行连接活性保持
>
>
>原始邮件
>发件人: 酷酷的浑蛋<ap...@163.com>
>收件人: user-zh<us...@flink.apache.org>
>发送时间: 2020年8月28日(周五) 15:02
>主题: flink1.11连接mysql问题
>
>
>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 52,445,041 milliseconds ago. The last packet sent successfully to the server was 52,445,045 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, orusing the Connector/J connection property 'autoReconnect=true' to avoid this problem. flink连接mysql,在过了一定时间后,就断开连接了,设置'autoReconnect=true’也不管用

回复: 回复: flink1.11连接mysql问题

Posted by 史 正超 <sh...@outlook.com>.
是这样的,因为重试的时候 flink-jdbc-connector会把错误的堆栈打印出来的,然后再重连的,对任务没有影响,你的任务失败了吗?我的任务其实也有这个错误,但是任务没有失败,重新连接上mysql了。
你仔细 看下你的日志里有没有下面的日志:
JDBC executeBatch error, retry times = 1
________________________________
发件人: 酷酷的浑蛋 <ap...@163.com>
发送时间: 2020年11月2日 3:33
收件人: user-zh@flink.apache.org <us...@flink.apache.org>
主题: 回复: flink1.11连接mysql问题

标题上写的就是flink1.11啊




在2020年11月2日 11:33,酷酷的浑蛋<ap...@163.com> 写道:
你看历史的回复,用的就是flink1.11,最新的flink-1.11.2也试过了还是有这个问题,而且我是在flink sql中使用




在2020年11月2日 11:30,史 正超<sh...@outlook.com> 写道:
你用的flink哪个版本,flink-1.11已经加了连接失效重连的功能了,应该没有这个问题了。如果不是flink-1.11.x版本的,也可以参考flink-1.11的jdbc-connector的实现,或者用SELECT 1 语句保活连接。
________________________________
发件人: 酷酷的浑蛋 <ap...@163.com>
发送时间: 2020年11月2日 2:28
收件人: user-zh@flink.apache.org <us...@flink.apache.org>
主题: Re:回复:flink1.11连接mysql问题

没有解决,隔一段时间就会报这个超时错误

















在 2020-10-14 17:33:30,"superainbower" <su...@163.com> 写道:
HI
链接超时的问题,你后来解决了吗?能告诉下怎么解决的吗?
| |
superainbower
|
|
superainbower@163.com
|
签名由网易邮箱大师定制


在2020年08月31日 15:57,酷酷的浑蛋<ap...@163.com> 写道:
关键是在sql中怎么设置,connector=jdbc




在2020年08月31日 15:06,13580506953<13...@163.com> 写道:
这个问题本质是连接活性问题,
连接数据库超时设置autoReconnect=true(mysql5以上的,设置autoReconnect=true 是无效的 只有4.x版本,起作用)


建议使用连接池druid进行连接活性保持


原始邮件
发件人: 酷酷的浑蛋<ap...@163.com>
收件人: user-zh<us...@flink.apache.org>
发送时间: 2020年8月28日(周五) 15:02
主题: flink1.11连接mysql问题


com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 52,445,041 milliseconds ago. The last packet sent successfully to the server was 52,445,045 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, orusing the Connector/J connection property 'autoReconnect=true' to avoid this problem. flink连接mysql,在过了一定时间后,就断开连接了,设置'autoReconnect=true’也不管用

回复: flink1.11连接mysql问题

Posted by 酷酷的浑蛋 <ap...@163.com>.
标题上写的就是flink1.11啊




在2020年11月2日 11:33,酷酷的浑蛋<ap...@163.com> 写道:
你看历史的回复,用的就是flink1.11,最新的flink-1.11.2也试过了还是有这个问题,而且我是在flink sql中使用




在2020年11月2日 11:30,史 正超<sh...@outlook.com> 写道:
你用的flink哪个版本,flink-1.11已经加了连接失效重连的功能了,应该没有这个问题了。如果不是flink-1.11.x版本的,也可以参考flink-1.11的jdbc-connector的实现,或者用SELECT 1 语句保活连接。
________________________________
发件人: 酷酷的浑蛋 <ap...@163.com>
发送时间: 2020年11月2日 2:28
收件人: user-zh@flink.apache.org <us...@flink.apache.org>
主题: Re:回复:flink1.11连接mysql问题

没有解决,隔一段时间就会报这个超时错误

















在 2020-10-14 17:33:30,"superainbower" <su...@163.com> 写道:
HI
链接超时的问题,你后来解决了吗?能告诉下怎么解决的吗?
| |
superainbower
|
|
superainbower@163.com
|
签名由网易邮箱大师定制


在2020年08月31日 15:57,酷酷的浑蛋<ap...@163.com> 写道:
关键是在sql中怎么设置,connector=jdbc




在2020年08月31日 15:06,13580506953<13...@163.com> 写道:
这个问题本质是连接活性问题,
连接数据库超时设置autoReconnect=true(mysql5以上的,设置autoReconnect=true 是无效的 只有4.x版本,起作用)


建议使用连接池druid进行连接活性保持


原始邮件
发件人: 酷酷的浑蛋<ap...@163.com>
收件人: user-zh<us...@flink.apache.org>
发送时间: 2020年8月28日(周五) 15:02
主题: flink1.11连接mysql问题


com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 52,445,041 milliseconds ago. The last packet sent successfully to the server was 52,445,045 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, orusing the Connector/J connection property 'autoReconnect=true' to avoid this problem. flink连接mysql,在过了一定时间后,就断开连接了,设置'autoReconnect=true’也不管用

回复: flink1.11连接mysql问题

Posted by 酷酷的浑蛋 <ap...@163.com>.
你看历史的回复,用的就是flink1.11,最新的flink-1.11.2也试过了还是有这个问题,而且我是在flink sql中使用




在2020年11月2日 11:30,史 正超<sh...@outlook.com> 写道:
你用的flink哪个版本,flink-1.11已经加了连接失效重连的功能了,应该没有这个问题了。如果不是flink-1.11.x版本的,也可以参考flink-1.11的jdbc-connector的实现,或者用SELECT 1 语句保活连接。
________________________________
发件人: 酷酷的浑蛋 <ap...@163.com>
发送时间: 2020年11月2日 2:28
收件人: user-zh@flink.apache.org <us...@flink.apache.org>
主题: Re:回复:flink1.11连接mysql问题

没有解决,隔一段时间就会报这个超时错误

















在 2020-10-14 17:33:30,"superainbower" <su...@163.com> 写道:
HI
链接超时的问题,你后来解决了吗?能告诉下怎么解决的吗?
| |
superainbower
|
|
superainbower@163.com
|
签名由网易邮箱大师定制


在2020年08月31日 15:57,酷酷的浑蛋<ap...@163.com> 写道:
关键是在sql中怎么设置,connector=jdbc




在2020年08月31日 15:06,13580506953<13...@163.com> 写道:
这个问题本质是连接活性问题,
连接数据库超时设置autoReconnect=true(mysql5以上的,设置autoReconnect=true 是无效的 只有4.x版本,起作用)


建议使用连接池druid进行连接活性保持


原始邮件
发件人: 酷酷的浑蛋<ap...@163.com>
收件人: user-zh<us...@flink.apache.org>
发送时间: 2020年8月28日(周五) 15:02
主题: flink1.11连接mysql问题


com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 52,445,041 milliseconds ago. The last packet sent successfully to the server was 52,445,045 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, orusing the Connector/J connection property 'autoReconnect=true' to avoid this problem. flink连接mysql,在过了一定时间后,就断开连接了,设置'autoReconnect=true’也不管用

回复: Re:回复:flink1.11连接mysql问题

Posted by 史 正超 <sh...@outlook.com>.
你用的flink哪个版本,flink-1.11已经加了连接失效重连的功能了,应该没有这个问题了。如果不是flink-1.11.x版本的,也可以参考flink-1.11的jdbc-connector的实现,或者用SELECT 1 语句保活连接。
________________________________
发件人: 酷酷的浑蛋 <ap...@163.com>
发送时间: 2020年11月2日 2:28
收件人: user-zh@flink.apache.org <us...@flink.apache.org>
主题: Re:回复:flink1.11连接mysql问题

没有解决,隔一段时间就会报这个超时错误

















在 2020-10-14 17:33:30,"superainbower" <su...@163.com> 写道:
>HI
>链接超时的问题,你后来解决了吗?能告诉下怎么解决的吗?
>| |
>superainbower
>|
>|
>superainbower@163.com
>|
>签名由网易邮箱大师定制
>
>
>在2020年08月31日 15:57,酷酷的浑蛋<ap...@163.com> 写道:
>关键是在sql中怎么设置,connector=jdbc
>
>
>
>
>在2020年08月31日 15:06,13580506953<13...@163.com> 写道:
>这个问题本质是连接活性问题,
>连接数据库超时设置autoReconnect=true(mysql5以上的,设置autoReconnect=true 是无效的 只有4.x版本,起作用)
>
>
>建议使用连接池druid进行连接活性保持
>
>
>原始邮件
>发件人: 酷酷的浑蛋<ap...@163.com>
>收件人: user-zh<us...@flink.apache.org>
>发送时间: 2020年8月28日(周五) 15:02
>主题: flink1.11连接mysql问题
>
>
>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 52,445,041 milliseconds ago. The last packet sent successfully to the server was 52,445,045 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, orusing the Connector/J connection property 'autoReconnect=true' to avoid this problem. flink连接mysql,在过了一定时间后,就断开连接了,设置'autoReconnect=true’也不管用