重新配置kafka的配置文件/config/server.properties
listeners 为监听端口
advertised.listeners: 对外的代理地址
# 允许外部端口链接
listeners=PLAINTEXT://0.0.0.0:9092
#外部代理地址
advertised.listeners=PLAINTEXT://192.168.133.128:9092
配置好后重启kafka服务
bin/kafka-server-start.sh config/server.properties &
查看是否启动成功:
重新启动生产者,恢复正常
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic six