Flink入门案例(Word Count)

Flink安装包下载【flink-1.9.0-bin-scala_2.11.tgz】

 

启动

[hadoop@hadoop flink-1.9.0]$ ./bin/start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host hadoop.
Starting taskexecutor daemon on host hadoop.

 

启动本地监听模式端口9000

nc -l 9000

 

启动作业

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

 

登录本机8081地址,可以看到已经提交了一个作业正在运行

 

本地监听模式发送数据

[hadoop@hadoop flink-1.9.0]$ nc -l 9000
a
b b  
c c c
a b c

 

查看输出结果

[hadoop@hadoop log]$ tail -f flink-hadoop-taskexecutor-0-hadoop.out
a : 1
b : 2
c : 3
a : 1
c : 1
b : 1

至此也简单对流式数据有了直观的认知!

发布了54 篇原创文章 · 获赞 19 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/DataIntel_XiAn/article/details/100421849