Wednesday, 17 January 2024

kafka import routing configs for connection issues when using docker

 

  • KAFKA_LISTENERS is a comma-separated list of listeners, and the host/ip and port to which Kafka binds to on which to listen. For more complex networking this might be an IP address associated with a given network interface on a machine. The default is 0.0.0.0, which means listening on all interfaces.
    • listeners
  • KAFKA_ADVERTISED_LISTENERS is a comma-separated list of listeners with their the host/ip and port. This is the metadata that’s passed back to clients.
    • advertised.listeners
  • KAFKA_LISTENER_SECURITY_PROTOCOL_MAP defines key/value pairs for the security protocol to use, per listener name.
    • listener.security.protocol.map
https://rmoff.net/2018/08/02/kafka-listeners-explained/
https://stackoverflow.com/questions/50152801/connect-to-a-kafka-container-from-localhost


It might not answer directly to your question, but this is my docker-compose file

version: '3.4'

services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
  kafka:
    image: wurstmeister/kafka
    hostname: kafka
    ports:
      - "29092:29092"
      - "9092:9092"
    links: 
     - zookeeper
    environment:
      KAFKA_LISTENERS: INSIDE://0.0.0.0:29092,OUTSIDE://0.0.0.0:9092
      KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka:29092,OUTSIDE://192.168.x.x:9092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  apollo:
    image: ${DOCKER_REGISTRY-}myapp
    build:
      context: .
      dockerfile: MyAppServer/Dockerfile
    ports:
      - "5000:80"
    volumes:
      - "./:/var/www"


No comments:

Post a Comment