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
11
votes
2 answers

Apache Flink vs Twitter Heron?

There are a lot of questions comparing Flink vs Spark Streaming, Flink vs Storm and Storm vs Heron. The origin of this question is from the fact that both Apache Flink and Twitter Heron are true stream processing frameworks (not micro-batch, like…
experimenter
  • 878
  • 1
  • 11
  • 27
11
votes
1 answer

How to count unique words in a stream?

Is there a way to count the number of unique words in a stream with Flink Streaming? The results would be a stream of number which keeps increasing.
Jun
  • 639
  • 10
  • 25
11
votes
3 answers

Flink cluster configuration issue - no slots available

I have deployed Flink cluster with configuration for parallelism as follows: jobmanager.heap.mb: 2048 taskmanager.heap.mb: 2048 taskmanager.numberOfTaskSlots: 5 parallelism.default: 2 But if I try to run any example or jar even with -p flag I…
Tomasz Sosiński
  • 849
  • 1
  • 10
  • 12
11
votes
2 answers

Kafka -> Flink DataStream -> MongoDB

I want to setup Flink so it would transform and redirect the data streams from Apache Kafka to MongoDB. For testing purposes I'm building on top of flink-streaming-connectors.kafka example (https://github.com/apache/flink). Kafka streams are being…
Michal
  • 113
  • 1
  • 8
11
votes
2 answers

Task distribution in Apache Flink

Consider a Flink cluster with some nodes where each node has a multi-core processor. If we configure the number of the slots based on the number of cores and equal share of memory, how does Apache Flink distribute the tasks between the nodes and the…
Ahmad.S
  • 779
  • 6
  • 25
11
votes
2 answers

flink - using dagger injections - not serializable?

Im using Flink (latest via git) to stream from kafka to cassandra. To ease unit testing Im adding dependency injection via Dagger. The ObjectGraph seems to be setting itself up properly but the 'inner objects' are being flagged as 'not…
ethrbunny
  • 10,379
  • 9
  • 69
  • 131
11
votes
1 answer

Flink: Sharing state in CoFlatMapFunction

Got stuck a bit with CoFlatMapFunction. It seems to work fine if I place it on the DataStream before window but fails if placed after window's “apply” function. I was testing two streams, main “Features” on flatMap1 constantly ingesting data and…
11
votes
2 answers

Run Apache Flink with Amazon S3

Does someone succeed to use Apache Flink 0.9 to process data stored on AWS S3? I found they are using own S3FileSystem instead of one from Hadoop... and it looks like it doesn't work. I put the following path s3://bucket.s3.amazonaws.com/folder it's…
11
votes
1 answer

How to See Log or Sysout in Flink Standalone

I run my application in Flink standalone, but can't find it's sysout in console or FLINK_HOME/log. Does anyone know where I can see my application debug log? And how to know which TMs my application run on?
zhangshengxiong
  • 383
  • 3
  • 12
11
votes
3 answers

How to Reference the External Jar in Flink

everyone. I tried to reference my company jar in Flink in the way of copying it to $FLINK/lib in all of taskmanagers, but failed. And I don't want to package a fat jar, which is too heavy and waste of time. I think the first method is also not a…
zhangshengxiong
  • 383
  • 3
  • 12
11
votes
1 answer

Flink Scala API "not enough arguments"

I'm having troubles using Apache Flink Scala API For example, even when I take the examples from the official documentation, the scala compiler gives me tons of compilation errors. Code: object TestFlink { def main(args: Array[String]) { …
Alexey Grigorev
  • 2,415
  • 28
  • 47
10
votes
3 answers

What is the difference between AWS Elastic MapReduce and AWS Kinesis Data Analytics?

I'm executing a Flink Job with this tools. I think both can do exactly the same with the proper configuration. Does Kinesis Data Analytics do something that EMR can not do or vice versa? Amazon Kinesis Data Analytics is the easiest way to analyze…
10
votes
1 answer

How to build and use flink-connector-kinesis?

I'm trying to use Apache Flink with AWS kinesis. The document says that I have to build the connector on my own. Therefore, I build the connector and added the jar file for my project and also, I put the dependency on my pom.xml file.
10
votes
1 answer

Apache Flink: How to apply multiple counting window functions?

I have a stream of data that is keyed and need to compute counts for tumbled of different time periods (1 minute, 5 minutes, 1 day, 1 week). Is it possible to compute all four window counts in a single application?
10
votes
5 answers

How to stop a flink streaming job from program

I am trying to create a JUnit test for a Flink streaming job which writes data to a kafka topic and read data from the same kafka topic using FlinkKafkaProducer09 and FlinkKafkaConsumer09 respectively. I am passing a test data in the…
Mike
  • 123
  • 1
  • 8