What is Apache Flink?
Apache flink is a system that allows us to perform analysis based on Stream (or flows). When working on flows, its scalability is high and it gives us the possibility to integrate it directly with Apache Kafka using plugins.
Require
For Apache flink install, we need the follow components:
- Java jdk 11
- Apache Flink 1.17
Instalation
Apache Flink can be installed using two different ways, as embedded or like a server. At follow we show how to install as a server and used it.
Uncompressing
At first we need uncompress apache flink as follow:
$ tar xvfz flink-1.17.0-bin-scala_2.12.tgz
Starting
One Apache Flink were uncompressed, we need start flink server
$ ./start-cluster.sh
Starting cluster.
Starting standalonesession daemon on host ourhost.local.
Starting taskexecutor daemon on host ourhost.local.
Once the service starts we can access the administration screen, where you can add new services, see the status of existing services or delete them.
To access the administration console in our browser we put the following web address.
http://localhost:8081
Running an example
Once the console is installed we can add an example to see how it is executed and to be able to understand the use of the administrative console.
On the screen we go to the menu option and press Submit a New Job and go to the example/streamng folder and select the WordCount.jar jar (it is an example contained in apache flink), and we will see the following screen:
Once the example is loaded, we press the Submit button
Now that is what we can see. What we can see will be the following screen.
Example using Kafka
Now we will see an example of how to use kafka with Flink, following the line of counting the words. The example uses the following components.
Streams:
- countIn: in this stream the words to be counted are entered.
- countOut: in this stream the result is obtained.
Sending message to countIn stream.
And we got.