Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

connection can not be established between schema registry docker and kafka broker

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

question from:https://stackoverflow.com/questions/65926721/connection-can-not-be-established-between-schema-registry-docker-and-kafka-broke

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...