This guide helps you quickly set up and run an Apache Flink streaming application on your local machine.
-
Java 11 or higher
Install with Homebrew:brew install openjdk@11 echo 'export PATH="/usr/local/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc echo 'export JAVA_HOME="/usr/local/opt/openjdk@11"' >> ~/.zshrc source ~/.zshrc
-
Python3 (if using PyFlink)
-
Docker (this is optional for running flink inside containers)
- Downloading Flink
wget https://dlcdn.apache.org/flink/flink-2.1.0/flink-2.1.0-bin-scala_2.12.tgz
tar -xzf flink-2.1.0-bin-scala_2.12.tgz
cd flink-2.1.0- Starting Flink locally
./bin/start-cluster.sh- Running a sample job
./bin/flink run examples/streaming/WordCount.jar- Verifying the output logs
tail log/flink-*-taskexecutor-*.out- Viewing activity in the Flink UI
http://localhost:8081/- Install PyFlink
pip install apache-flink- Run a PyFlink job
python examples/python/word_count.py- Stopping Flink cluster
./bin/stop-cluster.sh