Giter VIP home page Giter VIP logo

flink-examples's Introduction

Flink-examples (for Flink 1.2.1)

Collection of common Flink usage and utilities. At the moment, there are only the following jobs:

  • Csv2RowExample: shows how to generate a Flink DataSet from a CSV file, using
  • ElastisearchHelper: shows how to create elasticsearch index templates and index mappings, allowing
  • KafkaFlinkAvroParquet: shows how to integrate kafka, flink, avro and parquet. In particular
    • AvroDeserializationSchema: deserialize a object to byte[]
    • AvroSerializationSchema: serialize the deserialized byte[] to a object
    • deserialized object are passed through a Kafka queue

Working with Kafka (version 2.11-0.10.2.0)

To set up the Kafka testing environment download the release and un-tar it:

> tar -xzf kafka_2.11-0.10.2.0.tgz
> cd kafka_2.11-0.10.2.0
Start ZooKeeper server

Kafka runs over ZooKeeper so first start the ZooKeeper server that is packaged with Kafka to run a single-node ZooKeeper instance. The .properties file is already configured in order to start the ZooKeeper server on port 2181:

> bin/zookeeper-server-start.sh config/zookeeper.properties
Start Kafka server

Now is possible to run the Kafka server (broker) that will start on port 9092:

> bin/kafka-server-start.sh config/server.properties
Create a topic

In order to start communicating a new topic have to be created:

> bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

The example works only with a topic named "test", ZooKeeper on port 2181 and Kafka on port 9092. If you want to change the the topic name or the ports, remember to modify also the java code:

static String topicId = "test";
static String kafkaPort = "localhost:9092";
static String zkPort = "localhost:2181";
Test it

The Producer and the Consumer are automatically managed by the example class that generates, sends and retrieves messages through the kafka queue. Just run the KafkaFlinkAvroParquet class.

flink-examples's People

Contributors

xseris avatar fpompermaier avatar ddolzan avatar

Watchers

DataFibers Admin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.