Code Monkey home page Code Monkey logo

rekafka's Introduction

Rekafka

Simple relay for copying messages from one Kafka topic to another, across different brokers if need be. Rekafka gives you a controlled way of copying messages; running either as a daemon - copying messages as they arrive, or copying a batch of messages at a time.

Running

Step 1: build the Jar

This assumes you have cloned the repo and have JDK 8 installed.

./gradlew build

Step 2: create a config

A Rekafka config essentially describes a replication pipe with two ends - the source and the sink. Each end has a topic parameter and a set of properties controlling the Kafka consumer (source end) or the producer (sink end).

Use sample.yaml to get started, shown below for convenience. Provide your own values as appropriate.

source:
  topic: platform.push
  properties:
    zookeeper.connect: sitapzoo:2181
    group.id: relay
    auto.commit.enable: true
    auto.offset.reset: smallest
sink:
  topic: platform.push
  properties:
    metadata.broker.list: 10.141.64.100:9092,10.141.68.100:9092,10.141.72.100:9092

Step 3: run it

java -jar build/libs/rekafka-full-0.1.0-SNAPSHOT.jar --conf config.yaml

Replace rekafka-full-0.1.0-SNAPSHOT.jar with the appropriate version.

By default, the application runs as a daemon - starting from the earliest known offset and copying all messages until it reaches the end of the topic, at which point it will await new messages and copy them as they arrive.

To copy only a subset of messages, run the application with the --max-records option, passing in the number of records to copy. When the target number is reached, the application will terminate. This is useful for testing, when you might only need a handful of messages at a time, or if you don't want to expose the ultimate consumer application to a firehose of messages.

Logging

The logging configuration is currently in src/main/resources/log4j.properties; it's fine-grained by default and only prints to the console. To change this, either recompile the application with your log4j.properties file, or pass in an alternative Log4j configuration on startup, as so:

java -jar rekafka-full-0.1.0-SNAPSHOT.jar -Dlog4j.configuration=file:log4j-custom.properties

Compatibility

Rekafka has been briefly tested with combinations of Kafka brokers 0.8.x and 0.10.x on both source and sink ends.

rekafka's People

Contributors

ekoutanov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.