要点总结:
1.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://: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://192.168.40.128:9092
2.对应java程序中的ip及端口配置信息有
props.put("bootstrap.servers", "192.168.40.128:9092");
参考文章:
https://blog.csdn.net/xlgen157387/article/details/77312569
连接超时,无法链接kafka时,请参考下面的链接