Hey, Tea Lovers! In this post, we will be talking about how to install the Apache Flink on the local Windows machine. It will be a very quick guide We will be installing the latest version of Apache Flink 1.2.1, though it applies to all the versions and possibly any newer one too.
For other OS installation I have written following posts.
For Mac OS refer to How to Install Apache Flink On Mac OS
And Ubuntu Flink Installation can be found on How to Install Apache Flink On Ubuntu.
Requirements to Install Apache Flink on Windows
To install and run Apache Flink on a local Windows machine require the following things.
We need Windows 10 with the Windows Subsystem for Linux (WSL). But if your version of Flink binary has
.bat file, then you don’t need these and can use another Windows version and run with
cmd. But for the version I am using only has the
The second requirement is Java. Java version 8 or 11 is recommended. It doesn’t matter if you use OpenJDK or Oracle-provided Java on the machine.
Verify your java with
java -version. Also, make sure you set up your Environment Variable of
JAVA_HOME otherwise, the Flink won’t create any Job.
To install and set up the Java in WSL with Ubuntu, you can check the following post.
For the Java installation and setup on Windows only, you can check the following post.
Make sure your JAVA_HOME path doesn’t contain any space or it won’t start.Issue with JVM when starting Flink Cluster
You can follow me on social @coderstea on Twitter, Linkedin, Facebook, or Instagram. We also share the high-quality videos about programming on our Youtube channel. You can also publish your own post on CodersTea.com, just share your thought on Contact Us.
Download Latest Apache Flink on Local Windows
Now that the requirement is fulfilled, let’s jump to the next part. As I said earlier I will be installing Apache Flink version 1.2.1 for this post. To get the list of all Flink binaries available to download, head over to this link. Select the version you want to choose and download.
You may be redirected to another page and in the 1st paragraph you can see the mirror download link.
Download Old Stable Apache Flink on Local Windows
For the latest release, we can just look in the first paragraph for the link. But for the old release like Flink Version 1.7.1, you need to select from the old stable release list present on the same page. From the list select the binaries in front of the desired version and then download a binary file that contains the
-bin-scala_ in the name.
I will be selecting the Flink Version 1.7.1 for download. and then select the
-bin-scala_ file (without Hadoop as I don’t need it)
Start and Stop Apache Flink Cluster on Local Windows
Now that we have downloaded the Apache Flink binaries, let’s extract the tar file and copy it to a more appropriate location, any location would be fine, I will be putting it on
D:\programs\apache-flink\flink-1.12.1. But in WSL the path will be,
In the terminal, WSL, run the cluster with following command.
If it is successful then you will see a cluster started message and the cluster will run in the background.
Then simply go to the localhost:8081 to access the Flink UI Dashboard.
To stop the cluster use the following command.
Run a Flink Job on Cluster
There are 2 ways you can run a Flink Job on the cluster. UI and via command.
Run Flink Job via Flink Dashboard
The simplest way is to use the UI. First, in the dashboard, go to the Submit New Job page and upload the Jar. Next, select the Jar from the list, and pass the Main class, the argument of the program. Then, submit the job and it will redirect you to the running job page, where you will see the pipelines and their status.
Run a Flink Job via Terminal
The second way is to run it via Terminal or Command-Line. You can use the following command to run the Flink Job.
./bin/flink run \ --detached \ /path/to/jar/SampleFlinkJob.jar
This will run the Flink job in the background. You can then check the status in the Flink Dashboard, on localhost, if it runs successfully.
That’s it for this post. This post is focused on Flink Version 1.12.1 and running it onWindows Subsystem for Linux (WSL). But As I said, if your required Flink Version can be run directly on the WIndows, it is great. Keep in mind to set up the JAVA_HOME properly and make sure the JAVA_HOME path doesn’t contain any space in it. You can also check out my other post “How to Select Specific Folders or Files As Input in Flink” and the code is on GitHub.
See you in the next post.