问题1 host问题
Error connecting to node node1:9092 (id: 2 rack: null) java.net.UnknownHostException
解决
找到项目所在服务器的host文件 (不是kafka服务器的host文件)
将 kafka服务器 的 ip 和 hostname配置进行
如下
192.168.164.128 node1
详细连接:
https://blog.csdn.net/qq_39141239/article/details/108508194
问题2 topic问题
Topic(s) [demo] is/are not present and missingTopicsFatal is true
解决
修改或添加 SpringBoot kafka配置
spring.kafka.listener.missing-topics-fatal=false