Search code examples
spring-bootapache-kafkaspring-kafkaapache-kafka-connectkafka-cluster

Remote Kafka Consumer


I have a 3-node Kafka cluster on another machine in which I cant connect and consume messages with Spring boot application remotely. I have changed my config file like this:

advertised.listeners=PLAINTEXT://<myActual IP address>:9092

and here is my application.yml:

spring:
  kafka:
    consumer:
      bootstrap-servers: :9092,:9093,:9094
      group-id: test-consumer-group
      auto-offset-reset: earliest
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer

when I run the application, I got this error:

2020-10-26 12:47:52.524 WARN 4524 --- [| adminclient-1] 
org.apache.kafka.clients.NetworkClient : [AdminClient clientId=adminclient-1] 
Connection to node -1 (localhost/127.0.0.1:9092) could not be established. 
Broker may not be available.

Solution

  • bootstrap-servers: :9092,:9093,:9094

    You need to specify the host name or ip address.

    bootstrap-servers: some.host:9092,some.host:9093,some.host:9094