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
2
votes
1 answer

FLINK Stream API socketTextStream(hostname, port) acts as Client

FLINK Stream API socketTextStream(hostname, port) method acts as Client. that is we need to send the continuous stream on the port and " socketTextStream (hostname, port)" method will read the incoming stream. But my requirement is like, I want to…
Eriko
  • 31
  • 4
2
votes
1 answer

Writing Data in form of JSON from Flink to a file

When we were trying to write the processed JSON data from Flink into file using the method writeAsCsv(path, writemode), the data as written into the file but we need to insert comma after every JSON which is not happening. We are using Apache Kafka…
Arch
  • 73
  • 1
  • 8
2
votes
1 answer

Does Flink guarantee tasks fault-tolerance in all cases?

I'm seeking a fault-tolerant stream-processing engine. For this reason I test Flink with a simple Job: SocketTextStreamWordCount example that reads words from a text-socket! I ran it on a stand-alone cluster with 3 task manager, and I found the the…
Reza Same'ei
  • 819
  • 8
  • 22
2
votes
1 answer

How to filter Apache flink stream on the basis of other?

I have two stream one is of Int and other is of json .In The json Schema there is one key which is some int .So i need to filter the json stream via key comparison with the other integer stream so Is it possible in Flink?
Anubhav Jain
  • 331
  • 1
  • 5
  • 19
2
votes
0 answers

Python websocket for real time processing

I've create a python script that opens a websocket to get trade orders and upload them to the elasticsearch cluster so that I can perform near real time analytics. I wanted to get some response on my code below or if there is a better way to do this…
codeBarer
  • 2,238
  • 7
  • 44
  • 75
2
votes
3 answers

Disable Apache Flink Logging

I'm using an old version of Apache Flink, with Runtime 2.11 and Flink Core 1.1.2. I cannot upgrade it to the newer Apache Flink due to compatibility issues to other libraries. I'm trying to disable the node logging on the Runtime in order to…
jackb
  • 695
  • 8
  • 26
2
votes
0 answers

Apache Flink 1.2 - Timestamp and Watermarks assignment for window aggregation

I'm trying to build a data stream processing system and I want to aggregate the data sent in the last minute from my sensors. The sensors send data to a Kafka server in the sensor topic and it is consumed by Flink. I'm using a Python generator with…
TheNobleSix
  • 101
  • 10
2
votes
2 answers

Where to check logs for flink streaming job?

I have a flink streaming job continuously running on YARN. I am not able to see any application logs for running job . I only get logs when running as standalone java program.
Sohi
  • 424
  • 1
  • 10
  • 21
2
votes
1 answer

flink apache : What is the most efficient : read file and split text to tuple or read csv

I did this small code to put files from a folder in a data stream: public class TextFromDirStream { // // Program // public static void main(String[] args) throws Exception { // set up the execution environment final…
2
votes
2 answers

How to specify TypeInformation in readHadoopFile in flink?

I am unable to understand how the type information is specified in Flink while taking input file from Hadoop. I am trying to do this: DataSet> data = env.readHadoopFile(new TextInputFormat(),…
Sagar Ghai
  • 71
  • 1
  • 6
2
votes
1 answer

Class 'SessionTrigger' must either be declared abstract or implement abstract member

I am building a tutorial on Flink 1.2 and I want to run some simple windowing examples. One of them is Session Windows. The code I want to run is the following: import .Session import org.apache.flink.streaming.api.scala._ import…
Christos Hadjinikolis
  • 2,099
  • 3
  • 20
  • 46
2
votes
2 answers

Flick WordCount example failing with java.lang.NoSuchMethodError Exception

I am trying to execute the basic WordCount example in Flink which is present in the below link - Link When I run it from eclipse, its failing with the below exception - Exception in thread "main" java.lang.NoSuchMethodError:…
Hemant Kumar
  • 91
  • 1
  • 3
2
votes
2 answers

How to develop a REST API using an ML model trained on Apache Spark?

Assume this scenario: We analyze the data, train some machine learning models using whatever tool we have at hand, and save those models. This is done in Python, using Apache Spark python shell and API. We know Apache Spark is good at batch…
adrin
  • 4,511
  • 3
  • 34
  • 50
2
votes
0 answers

Flink can't access leader jobmanager and failed to start job

Our Flink cluster has two jobmanagers. Recently the job often goes down whenever jobmanager leader switches, and flink can't recovery the previous job after the switch. Also the job can not automatically start when I restart the flink cluster. So I…
Nico
  • 21
  • 4
2
votes
1 answer

Flink with zookeeper: Service temporarily unavailable due to an ongoing leader election. Please refresh

I want to run the flink cluster with High-availability mode. Hence I have made the setting as per JobManager High Availability into flink configuration files. When I start the zookeeper quorum by using start-zookeeper-quorum.sh, I am able to start…
kadsank
  • 311
  • 7
  • 20