本文记录学习使用flink系列(一).
昨天在按照某篇博客的demo程序,在自己的电脑上也尝试把flink程序运行起来,可是出现了在报错,当初在网上也简单找了下答案,没有搜索到相关的解决方案.
参考学习博客:https://ververica.cn/developers/build-from-zero/
可是步骤都是一样的,在我的电脑上没有启动成功,当时一下子没排查出原因.
报错简要描述如下:
0:15:08,342 INFO org.apache.flink.runtime.blob.BlobServer - Stopped BLOB server at 0.0.0.0:43927
Exception in thread "main" 00:15:08,342 INFO org.apache.flink.runtime.rpc.akka.AkkaRpcService - Stopped Akka RPC service.
org.apache.flink.runtime.client.JobExecutionException: java.net.ConnectException: Connection refused (Connection refused)
at org.apache.flink.runtime.minicluster.MiniCluster.executeJobBlocking(MiniCluster.java:623)
at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:123)
at myflink.SocketWindowWordCount.main(SocketWindowWordCount.java:31)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.flink.streaming.api.functions.source.SocketTextStreamFunction.run(SocketTextStreamFunction.java:96)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:87)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:56)
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask.run(SourceStreamTask.java:99)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:300)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:711)
at java.lang.Thread.run(Thread.java:748)
今天晚上我尝试换了别的关键词:org.apache.flink.runtime.client.JobExecutionException: java.net.ConnectException: Connection refused (Connection refused)
进行搜索,找到解决的答案,哈哈!
解决方法:使用nc -l -p 9000
代替了命令 nc -lk 9000
.
https://stackoverflow.com/questions/53784757/unable-to-run-flink-example-program-connection-refused
解决了昨晚我郁闷了好久的问题.
有时候还是需要换个关键词,就可以找到对应的答案.