WARN [Controller id=0, targetBrokerId=0] Connection to node 0 (/49.232.162.235:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
解决方案:
1.修改 vi server.properties
2.把listeners注释掉,不需要暴露。
# 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://localhost:9092
3.advertised.listeners 修改为ip或者localhost都可以。修改为ip的话,IDEA中的java-client也可以访问。
# 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://49.232.162.235:9092
结束,散会。