问题
I've set up the example project and built it. I'm able to run the WordCount program as expected. But when I run the SocketTextWordCount, I'm not getting any results printed out.
- I send data in through nc (localhost:9999 on both sides)
- In the web console for the running job, I can see that there are messages being sent/received
But I never see the counts.print() output printed out anywhere, even after killing the nc session.
EDIT - when I change it around to print results to a text file, no problem. So the issue seems to be that counts.print() isn't properly writing to the stdout of the console I'm running the example in.
回答1:
DataStreams are printed to the standard-out of the TaskManager process. When starting a Flink instance (local or cluster), the standard-out of a TaskManager is directed into an .out
file in the ./log/
directory of the Flink root directory. So you should check if the output is written into these files.
This behavior is different from DataSet.print()
, where the results are collected on the JobManager, shipped to the client, and printed by the client.
来源:https://stackoverflow.com/questions/37264697/why-doesnt-the-flink-sockettextstreamwordcount-work