0
votes

I am running a schema registry server using the following code:

version: "2.2"
services:
    schema-registry:
        container_name: schema-registry
        image: confluentinc/cp-schema-registry:5.5.0
        restart: always
        volumes:
          - ./config:/tmp/conf
        ports:
          - "8081:8081"
        environment:
          - SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS=localhost:9092
          - SCHEMA_REGISTRY_KAFKASTORE_TOPIC=_schemas
          - SCHEMA_REGISTRY_HOST_NAME=schema-registry
          - SCHEMA_REGISTRY_LISTENERS=http://0.0.0.0:8081
          - SCHEMA_REGISTRY_DEBUG=true
        ulimits:
          nproc: 65535
          nofile:
            soft: 65535
            hard: 65535
        logging:
            driver: json-file
            options:
              max-size: "100m"
              max-file: "3"

After deploying it with a docker compose up I get the following error :

[kafka-admin-client-thread | adminclient-1] WARN 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.

Kafka is running locally (it is not running in docker), by the way , the kafka server properties has the following conf:

broker.id=0

listeners=PLAINTEXT://localhost:9092

listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL

1
Seems you'll need to do more research about how docker networking works. localhost is the container itself, not another service, and especially not the host machineOneCricketeer

1 Answers

0
votes

As Chris says, you need to connect your Schema Registry Docker container to the local machine. Either that, or run Kafka in Docker too (or run Schema Registry locally as well e.g. from the tarbar available as part of Confluent Platform)