1.kafka在远程服务器安装,成功启动,正常测试消息发布,消费。
配置:
listeners=PLAINTEXT://localhost:9092
zookeeper.connect=localhost:2181
2.使用springboot进行kafka整合,此时使用外网ip连接,报错:
Connection to node 0 could not be established. Broker may not be available.
3.修改kafka的配置文件
#listeners=PLAINTEXT://:9092 需要将本地连接注释掉
advertised.listeners=PLAINTEXT://服务器IP:9092
zookeeper.connect=localhost:2181
重启kafka即可。
spring整合kafka的demo:源码下载