This documentation is for an unreleased version of Apache Flink. We recommend you use the latest stable version.
First Steps #
Welcome to Apache Flink! This guide will help you get a Flink cluster up and running so you can start exploring Flink’s capabilities.
Prerequisites #
Choose one of the following installation methods:
- Docker: No Java installation needed, includes SQL Client
- Local Installation: Requires Java 11, 17, or 21
- PyFlink: Requires Java and Python 3.9+
Option A: Docker Installation #
The fastest way to get started with Flink. No Java installation required.
Step 1: Get the docker-compose.yml file #
Download docker-compose.yml or create a file named docker-compose.yml with the following content:
services:
jobmanager:
image: flink:latest
ports:
- "8081:8081"
command: jobmanager
environment:
- |
FLINK_PROPERTIES=
jobmanager.rpc.address: jobmanager
taskmanager:
image: flink:latest
depends_on:
- jobmanager
command: taskmanager
scale: 1
environment:
- |
FLINK_PROPERTIES=
jobmanager.rpc.address: jobmanager
taskmanager.numberOfTaskSlots: 2
sql-client:
image: flink:latest
depends_on:
- jobmanager
command: bin/sql-client.sh
environment:
- |
FLINK_PROPERTIES=
jobmanager.rpc.address: jobmanager
rest.address: jobmanager
Step 2: Start the Cluster #
$ docker compose up -d
Step 3: Verify the Cluster is Running #
Open the Flink Web UI at http://localhost:8081 to verify the cluster is running.
Using the SQL Client #
To start an interactive SQL session:
$ docker compose run sql-client
To exit the SQL Client, type exit; and press Enter.
Stopping the Cluster #
$ docker compose down
For more Docker options (scaling, Application Mode), see the Docker deployment guide.
Option B: Local Installation #
If you prefer to run Flink directly on your machine without Docker.
Step 1: Download Flink #
Flink runs on all UNIX-like environments, including Linux, Mac OS X, and Cygwin (for Windows).
First, verify your Java version:
$ java -version
You need Java 11, 17, or 21 installed. Then, download the latest binary release and extract the archive:
$ tar -xzf flink-*.tgz
$ cd flink-*
Step 2: Start the Cluster #
Start a local Flink cluster:
$ ./bin/start-cluster.sh
Step 3: Verify the Cluster is Running #
Open the Flink Web UI at http://localhost:8081 to verify the cluster is running. You should see the Flink dashboard showing one TaskManager with available task slots.
Using the SQL Client #
To start an interactive SQL session:
$ ./bin/sql-client.sh
To exit the SQL Client, type exit; and press Enter.
Stopping the Cluster #
When you’re done, stop the cluster with:
$ ./bin/stop-cluster.sh
Option C: PyFlink Installation #
For Python development with the Table API or DataStream API. No Flink cluster is required—PyFlink runs in local mode during development.
Step 1: Verify Prerequisites #
PyFlink requires Java and Python:
$ java -version
# Java 11, 17, or 21
$ python --version
# Python 3.9, 3.10, 3.11, or 3.12
Step 2: Install PyFlink #
$ python -m pip install apache-flink
Tip: We recommend installing PyFlink in a virtual environment to keep your project dependencies isolated.
Step 3: Verify Installation #
$ python -c "import pyflink; print(pyflink.__version__)"
You’re now ready to follow the Table API Tutorial or DataStream API Tutorial using the Python tabs.
Next Steps #
Choose a tutorial to start learning:
| Tutorial | Description | Setup Required |
|---|---|---|
| Flink SQL Tutorial | Query data interactively using SQL. No coding required. | Option A or B (cluster) |
| Table API Tutorial | Build streaming pipelines with Java or Python. | Maven (Java) or Option C (Python) |
| DataStream API Tutorial | Build stateful streaming applications with Java or Python. | Maven (Java) or Option C (Python) |
| Flink Operations Playground | Learn to operate Flink: scaling, failure recovery, and upgrades. | Docker |
To learn more about Flink’s core concepts, visit the Concepts section.