Questions tagged [apache-flink]

Apache Flink is an open source platform for scalable batch and stream data processing. Flink supports batch and streaming analytics, in one system. Analytical programs can be written in concise and elegant APIs in Java and Scala.

Apache Flink

Apache Flink is an open source platform for scalable batch and stream data processing. Flink supports batch and streaming analytics, in one system. Analytical programs can be written in concise and elegant APIs in Java and Scala.

case class WordWithCount(word: String, count: Int)

val text = env.readTextFile(path)

val counts = text.flatMap { _.split("\\W+") }
  .map { WordWithCount(_, 1) }
  .groupBy("word")
  .sum("count")

counts.writeAsCsv(outputPath)

These are some of the unique features of Flink:

  • Hybrid batch/streaming runtime that supports batch processing and data streaming programs.
  • Custom memory management to guarantee efficient, adaptive, and highly robust switching between in-memory and out-of-core data processing algorithms.
  • Flexible and expressive windowing semantics for data stream programs.
  • Built-in program optimizer that chooses the proper runtime operations for each program.
  • Custom type analysis and serialization stack for high performance.

Learn more about Flink here.

Building Apache Flink from Source

Prerequisites for building Flink:

  • Unix-like environment (We use Linux, Mac OS X, Cygwin)
  • git
  • Maven (at least version 3.0.4)
  • Java 6, 7 or 8 (Note that Oracle's JDK 6 library will fail to build Flink, but is able to run a pre-compiled package without problem)

Commands:

git clone https://github.com/apache/flink.git
cd flink
mvn clean package -DskipTests

Flink is now installed in build-target

Developing Flink

The Flink committers use IntelliJ IDEA and Eclipse IDE to develop the Flink codebase.

Minimal requirements for an IDE are:

  • Support for Java and Scala (also mixed projects)
  • Support for Maven with Java and Scala

IntelliJ IDEA

The IntelliJ IDE supports Maven out of the box and offers a plugin for Scala development.

Check out our Setting up IntelliJ guide for details.

Eclipse Scala IDE

For Eclipse users, we recommend using Scala IDE 3.0.3, based on Eclipse Kepler. While this is a slightly older version, we found it to be the version that works most robustly for a complex project like Flink.

Further details, and a guide to newer Scala IDE versions can be found in the How to setup Eclipse docs.

Note: Before following this setup, make sure to run the build from the command line once (mvn clean install -DskipTests, see above)

  1. Download the Scala IDE (preferred) or install the plugin to Eclipse Kepler. See How to setup Eclipse for download links and instructions.
  2. Add the "macroparadise" compiler plugin to the Scala compiler. Open "Window" -> "Preferences" -> "Scala" -> "Compiler" -> "Advanced" and put into the "Xplugin" field the path to the macroparadise jar file (typically "/home/-your-user-/.m2/repository/org/scalamacros/paradise_2.10.4/2.0.1/paradise_2.10.4-2.0.1.jar"). Note: If you do not have the jar file, you probably did not run the command line build.
  3. Import the Flink Maven projects ("File" -> "Import" -> "Maven" -> "Existing Maven Projects")
  4. During the import, Eclipse will ask to automatically install additional Maven build helper plugins.
  5. Close the "flink-java8" project. Since Eclipse Kepler does not support Java 8, you cannot develop this project.

Support

Don’t hesitate to ask!

Contact the developers and community on the mailing lists if you need any help.

Open an issue if you found a bug in Flink.

Documentation

The documentation of Apache Flink is located on the website: http://flink.apache.org or in the docs/ directory of the source code.

Fork and Contribute

This is an active open-source project. We are always open to people who want to use the system or contribute to it. Contact us if you are looking for implementation tasks that fit your skills. This article describes how to contribute to Apache Flink.

About

Apache Flink is an open source project of The Apache Software Foundation (ASF). The Apache Flink project originated from the Stratosphere research project.

7452 questions
14
votes
1 answer

Flink, how to set parallelism properly when using multiple Kafka source?

I still cannot get a clear idea of parallelism, let's say we have a flink cluster which has enough slots. In our flink job, we consume 3 kafka topics from 3 different kafka clusters, each topic has 10 partitions. If we want to consume the message as…
gfytd
  • 1,747
  • 2
  • 24
  • 47
14
votes
1 answer

Apache Spark Structured Streaming vs Apache Flink: what is the difference?

We have discussed the questions below: What is the difference between Apache Spark and Apache Flink? [closed] What does “streaming” mean in Apache Spark and Apache Flink? What is the difference between mini-batch vs real time streaming in practice…
14
votes
1 answer

How to look up and update the state of a record from a database in Apache Flink?

I am working on a data streaming application and I am investigating the possibility of using Apache Flink for this project. The main reason for this is that it supports nice high-level streaming constructs, very similar to Java 8's Stream API. I…
jbx
  • 21,365
  • 18
  • 90
  • 144
14
votes
1 answer

Spark vs Flink low memory available

I have build a Spark and Flink k-means application. My test case is a clustering on 1 million points on a 3 node cluster. When in-memory bottlenecks begin, Flink starts to outsource to disk and work slowly but works. However, Spark lose executers if…
Pa Rö
  • 449
  • 1
  • 6
  • 18
14
votes
2 answers

How does Apache Flink compare to Mapreduce on Hadoop?

How does Apache Flink compare to Mapreduce on Hadoop? In what ways it's better and why?
Shu
  • 153
  • 1
  • 7
13
votes
1 answer

How to combine streaming data with large history data set in Dataflow/Beam

I am investigating processing logs from web user sessions via Google Dataflow/Apache Beam and need to combine the user's logs as they come in (streaming) with the history of a user's session from the last month. I have looked at the following…
Florian
  • 133
  • 1
  • 5
12
votes
1 answer

Flink: No operators defined in streaming topology. Cannot execute

I am trying to setup a very basic flink job. When I try to run, get the following error: Caused by: java.lang.IllegalStateException: No operators defined in streaming topology. Cannot execute. at…
Luciano
  • 1,119
  • 12
  • 18
12
votes
3 answers

Apache Beam Counter/Metrics not available in Flink WebUI

I'm using Flink 1.4.1 and Beam 2.3.0, and would like to know is it possible to have metrics available in Flink WebUI (or anywhere at all), as in Dataflow WebUI ? I've used counter like: import org.apache.beam.sdk.metrics.Counter; import…
robosoul
  • 757
  • 7
  • 17
12
votes
3 answers

How can I start the Flink job manager web interface when running Flink from an IDE

I would like to access the Flink Web interface when starting it locally from the IDE. I need this because I'd like to access the counters (accumulators) of Flink.
Robert Metzger
  • 4,452
  • 23
  • 50
11
votes
1 answer

How to use Scala XML with Apache Flink?

I am trying to use Scala XML library in Flink to parse an XML and I am not able to make it work. Please note that I need to use both the serialized and unserialized (string) version on my code in the same processing function. I tried already…
Jac
  • 531
  • 1
  • 4
  • 19
11
votes
2 answers

Apache Flink: Using filter() or split() to split a stream?

I have a DataStream from Kafka which has 2 possible value for a field in MyModel. MyModel is a pojo with domain-specific fields parsed from a message from Kafka. DataStream stream = env.addSource(myKafkaConsumer); I want to apply window…
Son
  • 877
  • 1
  • 12
  • 22
11
votes
2 answers

Apache Flink - Send event if no data was received for x minutes

How can I implement an operator with Flink's DataStream API that sends an event when no data was received from a stream for a certain amount of time?
madhairsilence
  • 3,787
  • 2
  • 35
  • 76
11
votes
2 answers

What are the differences between Hazelcast Jet and Apache Flink

More specifically, what usecases does Hazelcast Jet solve that Flink does not solve (equally well) and vice versa?
Atle
  • 428
  • 3
  • 11
11
votes
2 answers

Apache Flume vs Apache Flink difference

I need to read a stream of data from some source (in my case it's UDP stream, but it shouldn't matter), transform the each record and write it to the HDFS. Is there any difference between using Flume or Flink for this purpose? I know I can use…
Kateryna Khotkevych
  • 1,248
  • 1
  • 12
  • 22
11
votes
1 answer

Flink: How to handle external app configuration changes in flink

My requirement is to stream millions of records in a day and it has huge dependency on external configuration parameters. For example, a user can go and change the required setting anytime in the web application and after the change is made, the…
Neoster
  • 195
  • 2
  • 11