这篇文章主要用来记录一下Flink中的常见的报错以及解决方案(以后会持续更新)
1,Table is not an append-only table. Use the toRetractStream() in order to handle add and retract messages.
这个是因为动态表不是append-only模式的,需要用toRetractStream(回撤流)处理就好了.
tableEnv.toRetractStream[Person](result).print()
2.今天在启动Flink任务的时候报错Caused by: java.lang.RuntimeException: Couldn't deploy Yarn cluster,然后仔细看发现里面有这么一句话system times on machines may be out of sync,意思说是机器上的系统时间可能不同步.
(1)安装ntpdate工具
yum -y install ntp ntpdate
(2)设置系统时间与网络时间同步
ntpdate cn.pool.ntp.org
在三台机器上分别执行完这个,在启动任务,发现可以了.
3.Could not retrieve the redirect address of the current leader. Please try to refresh,Flink任务在运行了一段时间后,进程还在但是刷新UI界面提示报错,你把这个job杀掉,重新启动,还是会报这个错.
解决方法是把这个目录下的文件删除,重启就可以了
high-availability.zookeeper.path.root: /flink
ZooKeeper节点根目录,其下放置所有集群节点的namespace。
4.No data sinks have been created yet. A program needs at least one sink that consumes data. Examples are writing the data set or printing it.
这个错是因为没有sink,解决方法是execute执行前面加上Sink就好了,例如:writeAsText
如果有写的不对的地方,欢迎大家指正,如果有什么疑问,可以加QQ群:340297350,谢谢