yml中配置了bootstrap-servers: 服務器地址:9092,但是連接時卻報了
Connection to node -1 (localhost/127.0.0.1:9092) could not be established.
17:23:08.731 [kafka-admin-client-thread | adminclient-1] WARN o.a.k.c.NetworkClient - [processDisconnection,782] - [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
17:23:11.738 [kafka-admin-client-thread | adminclient-1] WARN o.a.k.c.NetworkClient - [processDisconnection,782] - [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
17:23:14.889 [kafka-admin-client-thread | adminclient-1] WARN o.a.k.c.NetworkClient - [processDisconnection,782] - [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
17:23:18.115 [kafka-admin-client-thread | adminclient-1] WARN o.a.k.c.NetworkClient - [processDisconnection,782] - [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
17:23:21.010 [kafka-admin-client-thread | adminclient-1] WARN o.a.k.c.NetworkClient - [processDisconnection,782] - [AdminClient clientId=adminclient-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.
17:23:21.355 [kafka-admin-client-thread | adminclient-1] INFO o.a.k.c.a.i.AdminMetadataManager - [updateFailed,235] - [AdminClient clientId=adminclient-1] Metadata update failed
org.apache.kafka.common.errors.TimeoutException: Call(callName=fetchMetadata, deadlineMs=1687685001348, tries=1, nextAllowedTryMs=1687685001449) timed out at 1687685001349 after 1 attempt(s)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: fetchMetadata
17:23:21.369 [restartedMain] ERROR o.s.k.c.KafkaAdmin - [error,149] - Could not configure topics
org.springframework.kafka.KafkaException: Timed out waiting to get existing topics; nested exception is java.util.concurrent.TimeoutException
chat給我的回復如下,通過一些列檢查我確定了在服務器上,kafka沒有問題
最后還是從一篇博客中的第一句話得到了答案,博客鏈接放在最下方
我是docker安裝的kafka,因此修改配置文件的步驟如下:
docker exec -it ${CONTAINER ID} /bin/bash
vi /opt/kafka/config/server.properties
advertised.listeners=PLAINTEXT://112.126.74.249:9092
文章來源:http://www.zghlxwxcb.cn/news/detail-796404.html
鏈接: https://www.cnblogs.com/shenyixin/p/17445164.html文章來源地址http://www.zghlxwxcb.cn/news/detail-796404.html
到了這里,關(guān)于記一次 springboot集成kafka-本地連接服務器的kafka,連接不上的問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!