zoukankan      html  css  js  c++  java
  • kafka调试中遇到could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)


    启动生产者命令:

    kafka-console-producer.bat --broker-list localhost:9092 --topic haha


    启动消费者:

    kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic haha --from-beginning

    kafka 配置文件:

    ############################# Socket Server Settings #############################
    
    # The address the socket server listens on. It will get the value returned from 
    # java.net.InetAddress.getCanonicalHostName() if not configured.
    #   FORMAT:
    #     listeners = listener_name://host_name:port
    #   EXAMPLE:
    #     listeners = PLAINTEXT://your.host.name:9092
    # 允许外部端口连接   
    listeners=PLAINTEXT://localhost:9092
    
    # Hostname and port the broker will advertise to producers and consumers. If not set, 
    # it uses the value for "listeners" if configured.  Otherwise, it will use the value
    # returned from java.net.InetAddress.getCanonicalHostName().
    #advertised.listeners=PLAINTEXT://your.host.name:9092
                                             
    # 外部代理地址                                                
    advertised.listeners=PLAINTEXT://localhost:9092
    # Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details
    #listener.security.protocol.map=PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL

    解决办法:

    消费者代码:

    kafka-console-consumer.bat --bootstrap-server PLAINTEXT://localhost:9092 --topic haha --from-beginning

    疑问:?

    这里比较奇怪; 生产者没有加PLAINTEXT:// 能够正常启动 在消费者居然能够报错? 诡异

    kafka 版本:"

    kafka_2.13-2.4.0kafka-logs"

  • 相关阅读:
    年度回忆录(?——2011.01)
    我在学英语
    技能冷却
    抗锯齿
    在cocos2dx 2.x FPS 等参数
    手指效果
    cocos2dx 简单OpenGL 画图
    cocos2dx tile map瓦片地图的黑线及地图抖动解决方案
    C++操作SQLite数据库
    精灵点击移动
  • 原文地址:https://www.cnblogs.com/dgwblog/p/12343375.html
Copyright © 2011-2022 走看看