Sign inSign up

mortezaprk/kmir

By mortezaprk

•Updated 23 days ago

Mirror Kafka topics for your dev environment

Image
Message queues
Developer tools
0

10K+

mortezaprk/kmir repository overview

⁠Kafka Mirror CLI

This application mirrors Kafka topics from a cluster to your local machine as part of your development environment.

Note: This app is only intended for development purposes and should not be used for any kind of serious work.

⁠Installation

You can download the CLI from the GitHub release page or Docker Hub (mortezaprk/kmir).

⁠Usage

Usage:
  kmir [OPTIONS] TOPICS...

Application Options:
      --client-id              Client ID [$CLIENT_ID]
      --kafka-version          Kafka version [$KAFKA_VERSION]

Source:
      --source-brokers         Comma-separated list of Kafka brokers [$SOURCE_BROKERS]
      --source-timeout         Timeout for Kafka (default: 10s) [$SOURCE_TIMEOUT]

    TLS:
        --source-tls-enabled     Enable TLS [$SOURCE_TLS_ENABLED]
        --source-tls-cert        TLS certificate [$SOURCE_TLS_CERT]
        --source-tls-insecure    Skip TLS verification [$SOURCE_TLS_INSECURE]

    SASL:
        --source-sasl-enabled    Enable SASL [$SOURCE_SASL_ENABLED]
        --source-sasl-username   SASL username [$SOURCE_SASL_USERNAME]
        --source-sasl-password   SASL password [$SOURCE_SASL_PASSWORD]
        --source-sasl-mechanism  SASL mechanism [$SOURCE_SASL_MECHANISM]

Sink:
      --sink-brokers           Comma-separated list of Kafka brokers [$SINK_BROKERS]
      --sink-timeout           Timeout for Kafka (default: 10s) [$SINK_TIMEOUT]

    TLS:
        --sink-tls-enabled       Enable TLS [$SINK_TLS_ENABLED]
        --sink-tls-cert          TLS certificate [$SINK_TLS_CERT]
        --sink-tls-insecure      Skip TLS verification [$SINK_TLS_INSECURE]

    SASL:
        --sink-sasl-enabled      Enable SASL [$SINK_SASL_ENABLED]
        --sink-sasl-username     SASL username [$SINK_SASL_USERNAME]
        --sink-sasl-password     SASL password [$SINK_SASL_PASSWORD]
        --sink-sasl-mechanism    SASL mechanism [$SINK_SASL_MECHANISM]

Help Options:
  -h, --help                   Show this help message
⁠Topics

The positional arguments, which specify the topic information, can be in any of the following forms:

  • topic_name: Mirrors the topic from the end.
  • topic_name@offset: Mirrors the topic and all partitions starting from the given offset.
  • topic_name@partition:offset,partition:offset: Only the mentioned partitions are mirrored from the given offset.

Since this app uses go-franz internally, two offset values have specific meanings:

  • -1: From the end.
  • -2 or lower: From the start.
⁠Example
kmir --source-brokers=localhost:9092 --sink-brokers=localhost:9093 --client-id=my-client --kafka-version=2.7.0 topic1 topic2@-1 topic3@0:100,1:200

⁠Development

⁠Prerequisites
  • Go 1.26 or later
  • golangci-lint v2.11.4 or later
⁠Setup
# Clone the repository
git clone https://mortz.dev/go/kmir.git
cd kmir

# Install dependencies
make deps
⁠Building
# Build the binary
make build
⁠Testing
# Run all tests
make test

# Run short tests only
make test-short

# Generate coverage report
make coverage

# Run all CI checks
make ci
⁠Available Make Commands
CommandDescription
make buildBuild the binary
make testRun tests with race detection
make test-shortRun short tests only
make lintRun linters (golangci-lint)
make fixAuto-fix formatting issues
make coverageGenerate coverage report
make cleanClean build artifacts
make ciRun full CI checks (lint, vulncheck, test)
make depsDownload dependencies
make deps-updateUpdate dependencies
make vulncheckCheck for security vulnerabilities

⁠License

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

Tag summary

Content type

Image

Digest

sha256:3b0a5ca9f…

Size

7.8 MB

Last updated

23 days ago

docker pull mortezaprk/kmir