Giter Club home page Giter Club logo

kafka-mix-match-dc's Introduction

Please do not do this

You want to have replication on a specific DC, but not on another

That's okay, but you need to have the same KAFKA_INTER_BROKER_LISTENER_NAME on all brokers.

If not, you'll hit https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/cluster/Broker.scala#L80

kafka.common.BrokerEndPointNotAvailableException: End point with listener name REPLICATION not found for broker 3
kafka-2         | 	at kafka.cluster.Broker.$anonfun$node$1(Broker.scala:53)

Here are a few commands to test this

docker-compose up -d

docker-compose ps

Please note that I am forcing min.insync.replicas=3 to make sure wait for all replication to happen.

docker-compose exec kafka-client kafka-topics --zookeeper zookeeper:2181 --create --topic demo --partitions 3 --replication-factor 3 --config min.insync.replicas=3

docker-compose exec kafka-client kafka-topics --zookeeper zookeeper:2181 --topic demo --describe

docker-compose exec kafka-client kafka-producer-perf-test \
        --topic demo \
        --num-records 1000 \
        --record-size 100 \
        --throughput -1 \
        --producer-props \
            ack=all \
            linger.ms=0 \
            bootstrap.servers=kafka-1:9092,kafka-2:9092,kafka-3:9092 \
            compression.type=zstd

for id in 1 2 3; do
    echo Broker $id
    docker-compose exec zookeeper zookeeper-shell localhost:2181 get /brokers/ids/$id | grep endpoint | jq .
done

Please DO NOT DO THIS. Please simplify as much as you can your deployment.

(Be nice to your fellow support team)

This is a strange dc2

My guess, is that this dc2 is of lower quality than your dc1, so you probably want to have all leaders on dc1.

Let's do that by creating a topic with specific replica assignment.

docker-compose exec kafka-client kafka-topics --zookeeper zookeeper:2181 --create --topic demo-no-leader-on-dc2 --replica-assignment "1:2:3,2:1:3,1:2:3"
docker-compose exec kafka-client kafka-topics --zookeeper zookeeper:2181 --topic demo-no-leader-on-dc2 --describe

See it live

asciicast

kafka-mix-match-dc's People

Contributors

framiere avatar

Watchers

 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.