spring启动应用程序,错误为“无法建立到节点1的连接”经纪人可能不在”

arknldoa  于 2021-06-05  发布在  Kafka
关注(0)|答案(1)|浏览(578)
2020-02-26 18:08:54.925  WARN 4472 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient   : [AdminClient clientId=adminclient-1] Connection to node -1 could not be established. Broker may not be available.

以下是 application.yaml 文件

spring:
  cloud:
    stream:
      default:
        producer:
          useNativeEncoding: true
        consumer:
          useNativeEncoding: true
      bindings:
        input:
          destination: employee-details
          content-type: application/*+avro
          group: group-1
          concurrency: 3
        output:
          destination: employee-details
          content-type: application/*+avro
      kafka:
        binder:
          producer-properties:
            key.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
            value.serializer: io.confluent.kafka.serializers.KafkaAvroSerializer
            schema.registry.url: http://localhost:8081
          consumer-properties:
            key.deserializer: io.confluent.kafka.serializers.KafkaAvroDeserializer
            value.deserializer: io.confluent.kafka.serializers.KafkaAvroDeserializer
            schema.registry.url: http://localhost:8081
            specific.avro.reader: true

我试着跑 curl -X POST https://localhost:9092/employees/1001/Harry/Potter 在cmd上,但给出了curl错误:(7)未能连接到localhost端口9092:连接被拒绝

wlzqhblo

wlzqhblo1#

你似乎有一些基本的误解。 connect to localhost port 9092: Connection refused 端口9092通常是kafka端口,而不是http端口;考虑到你现在 Broker may not be available. 以及 Connection Refused 当你试图和curl联系时,意味着你没有Kafka localhost 你当然不能用http连接到它,即使它在那里运行。

相关问题