README.md 5.6 KB
Newer Older
1
# Apache Flink
2

3
Apache Flink is an open source stream processing framework with powerful stream- and batch-processing capabilities.
4

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Learn more about Flink at [http://flink.apache.org/](http://flink.apache.org/)


### Features

* A streaming-first runtime that supports both batch processing and data streaming programs

* Elegant and fluent APIs in Java and Scala

* A runtime that supports very high throughput and low event latency at the same time

* Support for *event time* and *out-of-order* processing in the DataStream API, based on the *Dataflow Model*

* Flexible windowing (time, count, sessions, custom triggers) accross different time semantics (event time, processing time)

* Fault-tolerance with *exactly-once* processing guarantees

22
* Natural back-pressure in streaming programs
23 24 25

* Libraries for Graph processing (batch), Machine Learning (batch), and Complex Event Processing (streaming)

26
* Built-in support for iterative programs (BSP) in the DataSet (batch) API
27

28
* Custom memory management for efficient and robust switching between in-memory and out-of-core data processing algorithms
29

30
* Compatibility layers for Apache Hadoop MapReduce and Apache Storm
31

32
* Integration with YARN, HDFS, HBase, and other components of the Apache Hadoop ecosystem
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50


### Streaming Example
```scala
case class WordWithCount(word: String, count: Long)

val text = env.socketTextStream(host, port, '\n')

val windowCounts = text.flatMap { w => w.split("\\s") }
  .map { w => WordWithCount(w, 1) }
  .keyBy("word")
  .timeWindow(Time.seconds(5))
  .sum("count")

windowCounts.print()
```

### Batch Example
51
```scala
52
case class WordWithCount(word: String, count: Long)
53

54
val text = env.readTextFile(path)
55

56 57
val counts = text.flatMap { w => w.split("\\s") }
  .map { w => WordWithCount(w, 1) }
58 59 60 61 62 63
  .groupBy("word")
  .sum("count")

counts.writeAsCsv(outputPath)
```

64 65


66
## Building Apache Flink from Source
67

68 69
Prerequisites for building Flink:

R
Robert Metzger 已提交
70
* Unix-like environment (We use Linux, Mac OS X, Cygwin)
71
* git
72
* Maven (we recommend version 3.0.4)
73
* Java 7 or 8
74

R
Robert Metzger 已提交
75
```
76 77
git clone https://github.com/apache/flink.git
cd flink
78
mvn clean package -DskipTests # this will take up to 10 minutes
R
Robert Metzger 已提交
79
```
80

81
Flink is now installed in `build-target`
82

83 84
*NOTE: Maven 3.3.x can build Flink, but will not properly shade away certain dependencies. Maven 3.0.3 creates the libraries properly.
To build unit tests with Java 8, use Java 8u51 or above to prevent failures in unit tests that use the PowerMock runner.*
85

86 87
## Developing Flink

88
The Flink committers use IntelliJ IDEA and Eclipse IDE to develop the Flink codebase.
89
We recommend IntelliJ IDEA for developing projects that involve Scala code.
90 91 92 93 94 95

Minimal requirements for an IDE are:
* Support for Java and Scala (also mixed projects)
* Support for Maven with Java and Scala


96
### IntelliJ IDEA
97 98 99 100 101 102

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

* IntelliJ download: [https://www.jetbrains.com/idea/](https://www.jetbrains.com/idea/)
* IntelliJ Scala Plugin: [http://plugins.jetbrains.com/plugin/?id=1347](http://plugins.jetbrains.com/plugin/?id=1347)

103
Check out our [Setting up IntelliJ](https://github.com/apache/flink/blob/master/docs/internals/ide_setup.md#intellij-idea) guide for details.
104

105 106
### Eclipse Scala IDE

107
For Eclipse users, we recommend using Scala IDE 3.0.3, based on Eclipse Kepler. While this is a slightly older version,
U
Ufuk Celebi 已提交
108
we found it to be the version that works most robustly for a complex project like Flink.
109 110

Further details, and a guide to newer Scala IDE versions can be found in the
111
[How to setup Eclipse](https://github.com/apache/flink/blob/master/docs/internals/ide_setup.md#eclipse) docs.
112 113

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

116
1. Download the Scala IDE (preferred) or install the plugin to Eclipse Kepler. See 
117
   [How to setup Eclipse](https://github.com/apache/flink/blob/master/docs/internals/ide_setup.md#eclipse) for download links and instructions.
118 119 120
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").
U
Ufuk Celebi 已提交
121
   Note: If you do not have the jar file, you probably did not run the command line build.
122 123 124 125
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.

126 127

## Support
128

129 130
Don’t hesitate to ask!

131
Contact the developers and community on the [mailing lists](http://flink.apache.org/community.html#mailing-lists) if you need any help.
132

133
[Open an issue](https://issues.apache.org/jira/browse/FLINK) if you found a bug in Flink.
134 135


136
## Documentation
137

138
The documentation of Apache Flink is located on the website: [http://flink.apache.org](http://flink.apache.org)
139
or in the `docs/` directory of the source code.
140

141 142 143 144

## 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. 
R
Robert Metzger 已提交
145
Contact us if you are looking for implementation tasks that fit your skills.
146
This article describes [how to contribute to Apache Flink](http://flink.apache.org/how-to-contribute.html).
147 148


R
Robert Metzger 已提交
149
## About
150

151
Apache Flink is an open source project of The Apache Software Foundation (ASF).
152
The Apache Flink project originated from the [Stratosphere](http://stratosphere.eu) research project.
153