Connection to node 1001 (/127.0.0.1:9092) could not be established. Broker may not be available.
이라는 오류 발생 시 해결법
/opt/kafka/config/server.properties 의 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://:9092 **주석 제거**
and
advertise.listenrs=PLAINTEXT://:~ip:9092 **주석 제거**
이후 재시작
docker stop [kafka]
docker start [kafka]