docker安装kafka

Macbook pro下通过docker方式安装kafka

配置连接参数

spring:
  ##Kafka配置
  cloud:
    stream:
      bindings:
        log_input:
          destination: mate-log
        log_output:
          destination: mate-log
      kafka:
        binder:
          brokers: localhost:9092
          zk-nodes: localhost:2181
          auto-create-topics: true

报错信息

启动模块时,提示

Connection to xxx could not be established. Broker may not be available.

解决方案

进行docker命令行

docker exec -it kafka /bin/bash

进行kafka配置目录

cd /opt/kafka/config/

修改配置参数

vi server.properties

去掉注释,修改为如下内容:

#   FORMAT:
listeners = listener_name://0.0.0.0:9092
#   EXAMPLE:
listeners = PLAINTEXT://:9092
#listeners=PLAINTEXT://:9092

重新启动kafka

docker restart 6f3b9a599969

至此再次启动连接,连接正常

kafka应用案例

https://github.com/matevip/matecloud

Logo

一站式 AI 云服务平台

更多推荐