Coder Social home page Coder Social logo

lispython / kafka-replicator Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 2.0 86 KB

Application for replication data between kafka clusters.

License: MIT License

Dockerfile 0.66% Makefile 1.17% Rust 98.18%
kafka kafka-replicator replication rust monitoring prometheus-exporter prometheus-metrics

kafka-replicator's Introduction

Kafka replicator

Kafka Replicator is an easy to use tool for copying data between two Apache Kafka clusters with configurable re-partitionning strategy.

Data will be read from topics in the origin cluster and written to a topic/topics in the destination cluster according config rules.

Features

Lets start with an overview of features that exist in kafka-replicator:

  • Data replication: Real-time event streaming between Kafka clusters and data centers;
  • Schema replication: Copy schema from source cluster to destination;
  • Flexible topic selection: Select topics with configurable config;
  • Auto-create topics: Destination topics are automatically created for strict_p2p strategy;
  • Stats: The tool shows replication status;
  • Monitoring: Kafka replicator exports stats via prometheus.
  • Cycle detection

Use cases

  • Replicate data between Kafka clusters;
  • Aggregate record from several topics and put them into one;
  • Extend bandwidth for exist topic via repartitioning strategy.

Installation

System dependencies

libsasl2-dev
libssl-dev

Install from crates.io

If you have the Rust toolchain already installed on your local system.

rustup update stable
cargo install kafka-replicator

Compile and run it from sources

Clone the repository and change it to your working directory.

git clone https://github.com/lispython/kafka-replicator.git
cd kafka-replicator

rustup override set stable
rustup update stable
cargo install

Usage

RUST_LOG=info kafka-replicator /path/to/config.yml

Run it using Docker

sudo docker run -it -v /replication/:/replication/ -e RUST_LOG=info lispython/kafka_replicator:latest kafka-replicator /replication/config.yml

Example config

clusters:
  - name: cluster_1
    hosts:
      - replicator-kafka-1:9092
      - replicator-kafka-1:9092
  - name: cluster_2
    hosts:
      - replicator-kafka-2:9092

clients:
  - client: cl_1_client_1
    cluster: cluster_1
    config: # optional
       message.timeout.ms: 5000
       auto.offset.reset: earliest
  - client: cl_2_client_1
    cluster: cluster_2

routes:
  - upstream_client: cl_1_client_1
    downstream_client: cl_1_client_1
    upstream_topics:
      - 'topic1'
    downstream_topic: 'topic2'
    repartitioning_strategy: random # strict_p2p | random
    upstream_group_id: group_22
    show_progress_interval_secs: 10
    limits:
      messages_per_sec: 10000
      number_of_messages:

  - upstream_client: cl_1_client_1
    downstream_client: cl_2_client_1
    upstream_topics:
      - 'topic2'
    downstream_topic: 'topic2'
    repartitioning_strategy: strict_p2p
    upstream_group_id: group_22
    show_progress_interval_secs: 10

  - upstream_client: cl_2_client_1
    downstream_client: cl_1_client_1
    upstream_topics:
      - 'topic2'
    downstream_topic: 'topic3'
    repartitioning_strategy: strict_p2p # strict_p2p | random
    default_begin_offset: earliest # optional
    upstream_group_id: group_2
    show_progress_interval_secs: 10


observers:
  - client: cl_1_client_1
    name: "my name"
    group_id: group_name # used for remaining metrics
    topics: # filter by topics
      - 'topic1'
      - 'topic2'
    fetch_timeout_secs: 5 # default: 5
    fetch_interval_secs: 5 # default: 60
    show_progress_interval_secs: 10 # default: 60

  - client: cl_2_client_1
    topic: 'topic3'
    topics:
      - 'topic2'
    show_progress_interval_secs: 5


  - client: cl_1_client_1
    topic: 'topic1'
    topics: [] # fetch all topics

Options describing

Root config options:

  • clusters - are a list of Kafka Clusters
  • clients - are a list of configurations for consumers
  • routes - are a list of replication rules
  • observers - are a list of observers

Contributing

Any suggestion, feedback or contributing is highly appreciated. Thank you for your support!

kafka-replicator's People

Contributors

lispython avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

savinov blisabda

kafka-replicator's Issues

Remove expect in config

Then timeout reach observer process crash with message:

thread '<unnamed>' panicked at 'Failed to fetch metadata: KafkaError (Metadata fetch error: OperationTimedOut (Local: Timed out))', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/kafka-replicator-0.5.0/src/config.rs:508:34

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.