Flink 安装
1.先装好 Hadoop、Scala
2.下载Flink
http://flink.apache.org/downloads.html
3.启动
./bin/start-local.sh
启动后,jps可以看到 JobManager的进程
4.控制台
端口是在 conf/flink-conf.yaml里定义的,jobmanager.web.port: 8081
5.运行 统计单词数量的例子
https://ci.apache.org/projects/flink/flink-docs-release-1.2/quickstart/setup_quickstart.html
首先往socket 9999端口输入单词,流处理程序会监听这个端口,并统计单词数量
nl -l 9999
./bin/flink run examples/streaming/SocketWindowWordCount.jar --port 9999
启动出错:
Caused by: org.apache.flink.runtime.jobmanager.scheduler.NoResourceAvailableException: Not enough free slots available to run the job. You can decrease the operator parallelism or increase the number of slots per TaskManager in the configuration. Task to schedule: < Attempt #0 (Source: Socket Stream -> Flat Map (1/1)) @ (unassigned) - [SCHEDULED] > with groupID < cbc357ccb763df2852fee8c4fc7d55f2 > in sharing group < SlotSharingGroup [90bea66de1c231edf33913ecd54406c1, cbc357ccb763df2852fee8c4fc7d55f2] >. Resources available to scheduler: Number of instances=1, total number of slots=1, available slots=0
没有足够的内存了。。
在nl -l 9999的shell窗口输入各种单词,回车
tail -f log/*.out 可以看到这些单词的统计情况
效果如图: