flink-example分析 batch/WordCount.jar 和streaming/SocketWindowWordCount.jar

flink-example分析 batch/WordCount.jar 和streaming/SocketWindowWordCount.jar

java版本環(huán)境

openjdk version "1.8.0_282" OpenJDK Runtime Environment (build 1.8.0_282-8u282-b08-0ubuntu1~20.10-b08) OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)

flink版本環(huán)境

Apache Flink 1.12.2 for Scala 2.12 (asc, sha512)

運(yùn)行一個示例

1.啟動flink集群

$ ./bin/start-cluster.sh

2.運(yùn)行WordCount實(shí)例,默認(rèn)使用內(nèi)置數(shù)據(jù)

$ ./bin/flink run ./examples/batch/WordCount.jar

運(yùn)行WordCount使用真實(shí)數(shù)據(jù)

$ ./bin/flink run ./examples/batch/WordCount.jar --input /path/to/some/text/data --output /path/to/result

image-20210318150209310.png

3.運(yùn)行socketwindowWordCount實(shí)例

模擬數(shù)據(jù)流入口

$nc -l 9000

$ ./bin/flink run ./examples/streaming/SocketWindowWordCount.jar --port 9000

image-20210318151544981.png
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容