如果javaapi长时间消费不到数据,需要在kafka集群中的server.properties配置如下代码:
# Hostname the broker will advertise to producers and consumers. If not set, i$ # value for "host.name" if configured. Otherwise, it will use the value retur$
# java.net.InetAddress.getCanonicalHostName().
advertised.host.name=192.168.146.104
# The port to publish to ZooKeeper for clients to use. If this is not set, # it will publish the same port that the broker binds to.
advertised.port=9092