Giter VIP home page Giter VIP logo

kafka-behind-a-proxy's Introduction

Testing kafka-proxy

We are simulating 2 networks

  • ccloud where Kafka resides
  • onpremise where are the clients

onpremise can't reach ccloud, and thus needs a proxy with can connect to both.

The problem relies in the medata protocol, and thus a simple haproxy would not suffice. We need to proxy at Level7 to change the ip announced by Kafka by the ip of the proxy (kafka-proxy approach), or trick the metadata sent to go through the proxy (ha-proxy approach).

Kafka-proxy

Enter https://github.com/grepplabs/kafka-proxy.

The main command is the following:

    command: server --bootstrap-server-mapping=broker-1:9092,0.0.0.0:9092,kafka-proxy:9092 --bootstrap-server-mapping=broker-2:9092,0.0.0.0:9093,kafka-proxy:9092 --bootstrap-server-mapping=broker-3:9092,0.0.0.0:9094,kafka-proxy:9092

Let's decompose the first argument

--bootstrap-server-mapping=broker-1:9092,0.0.0.0:9092,kafka-proxy:9092

  1. We are bootstraping the broker-1:9092 kafka server
  2. We are asking to proxy broker-1:9092 via 0.0.0.0:9092
  3. We are announcing this proxy to clients as kafka-proxy:9092

To test, run the stack with docker-compose up -d then write something into a topic

docker-compose exec kafka-client kafka-console-producer --broker-list kafka-proxy:9092 --topic example`

type a lovely hello world and a firm [Enter].

And then consume it back via

docker-compose exec kafka-client kafka-console-producer --bootstrap-server kafka-proxy:9092 --topic example --from-beginning

HAProxy

To test, run the stack with docker-compose up -d

in kafka-client enter docker

docker-compose exec kafka-client bash
echo `host haproxy-1 | awk '{print $4}'` broker-1 >> /etc/hosts
echo `host haproxy-2 | awk '{print $4}'` broker-2 >> /etc/hosts
echo `host haproxy-3 | awk '{print $4}'` broker-3 >> /etc/hosts
echo example | kafka-client kafka-console-producer --broker-list haproxy-1:9092 --topic example
kafka-client kafka-console-producer --bootstrap-server haproxy-1:9092 --topic example --from-beginning

kafka-behind-a-proxy'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.