1

i use kafka cluster using by docker container

  kafka-1:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper-1
      - zookeeper-2
      - zookeeper-3
    ports:
      - "29092:29092"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka-1:9092,PLAINTEXT_HOST://61.125.196.42:29092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_DEFAULT_REPLICATION_FACTOR: 2

and KAKFA_ADVERTISED_LISTENERS is host for external consumer,producer.

in this setting, what is difference PLAINTEXT and PLAINTEXT_HOST?

First only passed data on 61.125.196.42:29092 not kafka-1:9092.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Harzarics
  • 11
  • 3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 26 '22 at 19:41

1 Answers1

1

It's just a name.

The only requirement for the host one is that it needs to be a name in the security protocol mapping since it's not a builtin protocol.

The difference is that one is for external clients, as you said. The other is only within the Docker network where kafka-1 DNS name is actually resolvable, similar to your Zookeepers

Refer Connect to Kafka running in Docker

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245