症状:Producer连不上,提示没有可用Node。

 

解决:在安装kafka的目录中配置server.properties

 

1、listeners=PLAINTEXT://:9092或listeners=PLAINTEXT://内网ip:9092  注:千万不能写localhost,否则虽然在本地可以通信,一旦外网通过JavaAPI访问就会出错。当然也不能写公网ip,否则报can‘t bind错误。

2、advertised.listeners=PLAINTEXT://公网ip:9092

3、hostname advertised.hostname不用配置。

 

另:server中关于socket listen的原注释:

# The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.

默认配置应该是主机名,大概和内网ip等价,详细还需研究。

相关文章:

  • 2021-12-07
  • 2021-09-15
  • 2021-06-17
  • 2021-10-03
  • 2021-08-16
  • 2021-05-27
  • 2021-04-21
  • 2021-05-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案