README.md 5.5 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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
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

* Natural back-pressure in streaming programs.

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

* Built-in support for iterative programs (BSP) and in the DataSet (batch) API.

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

* Compatibility layers for Apache Hadoop MapReduce and Apache Storm.

* Integration with YARN, HDFS, HBase, and other components of the Apache Hadoop ecosystem.


### 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 58 59 60 61 62 63
val counts = text.flatMap { _.split("\\W+") }
  .map { WordWithCount(_, 1) }
  .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
*NOTE: Maven 3.3.x can build Flink, but will not properly shade away certain dependencies. Maven 3.0.3 creates the libraries properly.*
84

85 86
## Developing Flink

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

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


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

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)

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

104 105
### Eclipse Scala IDE

106
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 已提交
107
we found it to be the version that works most robustly for a complex project like Flink.
108 109

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

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

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

125 126

## Support
127

128 129
Don’t hesitate to ask!

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

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


135
## Documentation
136

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

140 141 142 143

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


R
Robert Metzger 已提交
148
## About
149

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