관리 메뉴

솜씨좋은장씨

[Kafka] could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) 해결 방법 본문

Programming/Kafka

[Kafka] could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) 해결 방법

솜씨좋은장씨 2021. 9. 1. 14:34
728x90
반응형

zookeeper와 kafka를 실행하고 이제 topic을 생성해봐야지! 하며

$ bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server localhost:9092

위의 명령어를 통해 시도하였는데!

[2021-09-01 13:54:26,904] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:27,025] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:27,128] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:27,432] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:27,838] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:28,549] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:29,558] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:30,774] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:31,685] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:32,900] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:33,910] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:35,021] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:36,235] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2021-09-01 13:54:37,348] WARN [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

위와 같은 오류를 뿜으며.... 제대로 생성이 진행되지 않았습니다.

👨🏻‍💻 해결 방법

config 폴더(디렉토리) 안에 있는 server.properties 파일에 주석처리 되어있는 부분을 해제하고

zookeeper와 Kafka를 다시 실행해주면 됩니다.

$ vi config/server.properties
... 생략
############################# Socket Server Settings #############################

# 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
... 생략

처음 들어가면 listeners=PLAINTEXT://:9092 부분이 # 으로 주석처리가 되어있는데 이를 해제하고

다시 topic 생성을 시도하면!

Created topic quickstart-events.

이번에는 제대로 동작하는 것을 확인할 수 있습니다.

 

읽어주셔서 감사합니다.

'Programming > Kafka' 카테고리의 다른 글

[Kafka] Mac에 카프카 설치하고 실행해보기!  (3) 2021.09.01
Comments