Install and Run Apache Flink on Windows
In this Apache Flink installation on windows tutorial, we will learn how to install Apache Flink on Windows. Apache Flink can be run on Windows as well as Linux. Here in this blog, we will see how to install Apache Flink on Windows on single node cluster mode and how can we run wordcount program. You can also refer how to install Apache Flink on ubuntu.
2. Apache Flink Installation on Windows
I. Platform Requirements
- Operating system: Windows 7 or higher
- Java 7.x or higher
2.2. Install Java
Apache Flink requires Java to be installed as it runs on JVM. So, let’s begin by installing Java. In order to install Java, firstly we need to download it and then we will be able to install the Java. You can download java from this link
To check whether installation procedure gets successfully completed and a completely working Java is installed or not and to know the version of Java installed we have to use the below command:
C:\Users\dataflair\ java -version
2.3. Install Apache Flink
I. Download the latest version of Flink from official website
II. Untar the downloaded file
In order to extract all the contents of compressed Apache Flink file package, right click on the file flink-0.8-incubating-SNAPSHOT-bin-hadoop2.tgz and select extract here or alternatively you can use other tools also like: 7-zip or tar tool. For ease rename file to flink.
III. Change the working directory to Flink Home
To access the commands and to run the example jar change directory to flink by using this command.
C:\Users\dataflair\ cd flink
C:\Users\dataflair\flink cd bin
IV. Start Flink
To Start Apache Flink in a local mode use this command.
After that you will see this message on screen: Starting Flink job manager. Web interface by default on http://localhost:8081/. Don't close this batch window. Stop job manager by pressing Ctrl+C.
To run any job open another terminal. You can run job by flink.bat.
V. Check status
To check the status of running services simply change the path where your bin directory exist in JDK.
C:\Users\dataflair\flink\bin cd C:\Program Files\Java\jdk1.7.0_79\bin
C:\Program Files\Java\jdk1.7.0_79\bin jps
Output will be-
VI. Apache Flink Web UI
To start Web UI use the following Url:
2.4. Run Wordcount example on Flink
To run Wordcount example on Local system use the following command.
Before that make an input file in a home directory, for example, C:\Users\dataflair\input.txt with some data as a sample and save it as input.txt or by any name of your choice (replace input.txt with your file name )
C:\Users\dataflair\flink\bin flink.bat run C:\Users\dataflair\flink\examples\batch\WordCount.jar -input C:\Users\dataflair\input.txt -output C:\Users\dataflair\output.txt
use -input or -output to highlight the input and output path same as above example.
To learn more about Flink operations follow this Flink Shell commands guide.