前言
前幾天對 Flink 做了基本的介紹,還不清楚 Flink 是什麼的人可以先去看看:
Day21 - Flink 介紹 (1):簡介、架構、數據處理
Day22 - Flink 介紹 (2):Flink Ecosystem
Flink runs on all UNIX-like environments, i.e. Linux, Mac OS X, and Cygwin (for Windows). You need to have Java 11 installed.
哪尼?!竟然要用 Java 11!我們前面都是用 Java 8 欸,偏偏 Hadoop 跟 Hive 還在 Java 版本的過渡期,實在是有點尷尬,該怎麼辦呢? 🤔🤔🤔
這邊給大家的建議就是「擺爛」,沒錯,就是不要管他繼續用 Java 8 就好,我找到了一個說法:
That Flink does build with Java 8 was hidden from the docs since the deprecation of Java 8 support, so that new developers start developing with Java 11 from the get go.
所以 Java 8 還是可以用,只是官方建議用 Java 11。
不廢話,到官方載點下載最新的穩定版,我這次下載的是 1.17.1,大家自己載下來解壓縮,或是參考下面指令下載。
$ mkdir flink
$ cd flink
$ wget https://dlcdn.apache.org/flink/flink-1.17.1/flink-1.17.1-bin-scala_2.12.tgz
$ tar zxvf flink-1.17.1-bin-scala_2.12.tgz
$ rm flink-1.17.1-bin-scala_2.12.tgz
~/.bashrc
$ vim ~/.bashrc
~/.bashrc
export FLINK_HOME=~/flink/flink-1.17.1
export PATH=$PATH:$FLINK_HOME/bin
conf/flink-conf.yaml
才能正常進入 UI
# before
rest.bind-address: localhost
# after
rest.bind-address: 0.0.0.0
$ flink --version
$ $FLINK_HOME/bin/start-cluster.sh
啟動群集後,我們可以從 localhost:8081 進到 Flink 的 UI$ flink run $FLINK_HOME/examples/streaming/WordCount.jar
$ tail $FLINK_HOME/log/flink-*-taskexecutor-*.out
$ $FLINK_HOME/bin/stop-cluster.sh
Flink 的安裝與設置跟 Hadoop、Spark 比起來根本是天使吧😇,明天會開始介紹 Flink in Python - PyFlink。
Apache Flink Documentation
Update Flink build instruction to deprecate Java 8 instead of requiring Java 11
How to access the flink web UI when running inside a container (wsl2)