I am trying to deploy the Schema-Registry in a 3.1.0 Kafka cluster with 3 brokers that works well. I am using Docker 20.10.11 and Portainer 2.9.0. My problem is that the boostrap.server attribute in its configuration is wrong as it keeps printing the error of the title:

org.apache.kafka.common.config.ConfigException: No resolvable bootstrap urls given in bootstrap.servers

The actual value of that property is:

bootstrap.servers = [broker2:9092]

My brokers are named "kafka-brokerx" being x the number of the broker. How can I change that configuration so that it takes to correct names for my broker??

I have tried putting this in the enviroment section of my docker-compose, but it doesn't change it and keeps printing the error.

    - CONNECT_BOOTSTRAP_SERVERS= [kafka-broker1:9092, kafka-broker2:9092, kafka-broker3:9092]

My docker-compose:

version: "3.8"

networks:
    net:
        external: true

services:

  kafka-broker1:
    image: registry.gitlab.com/repo/kafka:2.13_3.1.0_v0.1
    hostname: broker1   
    volumes:
      - /var/volumes/kafka/config/server1.properties:/opt/kafka/config/server.properties
      - /var/volumes/kafka/broker1-logs:/var/kafka-logs
    environment:
      - TZ=Europe/Madrid
    networks:
      - net
        
  kafka-broker2:
    image: registry.gitlab.com/repo/kafka:2.13_3.1.0_v0.1
    hostname: broker2
    volumes:
      - /var/volumes/kafka/config/server2.properties:/opt/kafka/config/server.properties
      - /var/volumes/kafka/broker2-logs:/var/kafka-logs
    environment:
      - TZ=Europe/Madrid
    networks:
      - net
        
  kafka-broker3:
    image: registry.gitlab.com/repo/kafka:2.13_3.1.0_v0.1
    hostname: broker3
    volumes:
      - /var/volumes/kafka/config/server3.properties:/opt/kafka/config/server.properties
      - /var/volumes/kafka/broker3-logs:/var/kafka-logs
    environment:
      - TZ=Europe/Madrid
    networks:
      - net

  schema-registry:
    image: confluentinc/cp-schema-registry:3.1.0
    hostname: schema-registry
    depends_on:
    - broker
    environment:
    - SCHEMA_REGISTRY_HOST_NAME=schemaregistry
    - SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL= zookeeper_node
    - CONNECT_BOOTSTRAP_SERVERS= [kafka-broker1:9092, kafka-broker2:9092, kafka-broker3:9092]
    ports:
    - 8081:8081
1

There are 1 best solutions below

0
On

The problem was that I forgot to write the "network" tag so the brokers and the schema-registry were not in the same network, so it was impossible for it to resolve de DNS hostnames given to the services.