Flink 1.6.0 安装与配置

本地单机安装

1. 下载安装

1.1. Mac OS

使用brew安装

$ brew install apache-flink
...
$ flink –version

1.2. 使用安装包

官网下载地址 https://flink.apache.org/downloads.html
下载对应hadoop,scala版本号一致的flink

Flink 1.6.0 安装与配置_第1张图片
version

下载解压缩到指定目录

2. 启动本地模式

$ cd /usr/local/Cellar/apache-flink/1.6.0/libexec/bin
## Start a Local Flink Cluster
$ ./bin/start-cluster.sh

浏览器访问
http://localhost:8081/#/overview
可以看到Flink WebUI

Flink 1.6.0 安装与配置_第2张图片
WebUI

查看启动日志

$ tail log/flink-*-standalonesession-*.log
2018-08-19 16:58:12,169 INFO  org.apache.flink.runtime.dispatcher.DispatcherRestEndpoint    - Rest endpoint listening at localhost:8081
2018-08-19 16:58:12,169 INFO  org.apache.flink.runtime.dispatcher.DispatcherRestEndpoint    - http://localhost:8081 was granted leadership with leaderSessionID=00000000-0000-0000-0000-000000000000
2018-08-19 16:58:12,169 INFO  org.apache.flink.runtime.dispatcher.DispatcherRestEndpoint    - Web frontend listening at http://localhost:8081.
2018-08-19 16:58:12,183 INFO  org.apache.flink.runtime.rpc.akka.AkkaRpcService              - Starting RPC endpoint for org.apache.flink.runtime.resourcemanager.StandaloneResourceManager at akka://flink/user/resourcemanager .
2018-08-19 16:58:12,281 INFO  org.apache.flink.runtime.rpc.akka.AkkaRpcService              - Starting RPC endpoint for org.apache.flink.runtime.dispatcher.StandaloneDispatcher at akka://flink/user/dispatcher .
2018-08-19 16:58:12,300 INFO  org.apache.flink.runtime.resourcemanager.StandaloneResourceManager  - ResourceManager akka.tcp://flink@localhost:6123/user/resourcemanager was granted leadership with fencing token 00000000000000000000000000000000
2018-08-19 16:58:12,301 INFO  org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager  - Starting the SlotManager.
2018-08-19 16:58:12,316 INFO  org.apache.flink.runtime.dispatcher.StandaloneDispatcher      - Dispatcher akka.tcp://flink@localhost:6123/user/dispatcher was granted leadership with fencing token 00000000-0000-0000-0000-000000000000
2018-08-19 16:58:12,317 INFO  org.apache.flink.runtime.dispatcher.StandaloneDispatcher      - Recovering all persisted jobs.
2018-08-19 16:58:12,790 INFO  org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager  - Registering TaskManager 36b9ebefa932445f13fe25c96cdf1cfd under 619ab62c4f32e88c4a3e61a138b9f68c at the SlotManager.

3. 运行Demo

官方例子,会从一个socket中读一段文本,并且每隔5秒打印每个单词出现的数量

# start a socket client
$ nc -l 9000
# run flink examples
$ ./bin/flink run examples/streaming/SocketWindowWordCount.jar --port 9000

查看输出日志

$ tail -f log/flink-*-taskexecutor-*-localhost.out
WordWithCount(hello, 1)
WordWithCount(word, 2)

4. 停止Flink

$ bin/stop-cluster.sh

集群安装

TODO

你可能感兴趣的:(Flink 1.6.0 安装与配置)