Kafka服务器未连接

hgc7kmma  于 2022-12-28  发布在  Apache
关注(0)|答案(1)|浏览(214)

我尝试在Mac上启动我Kafka服务器,但每次我运行命令“bin/Kafka-server-start.sh config/server.properties“时,我都会收到一条错误消息“java .NET.ConnectException:连接被拒绝”任何人都可以请帮助我这个问题,因为这是我第一次使用Kafka为我的项目。请找到下面的错误信息

java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.Net.pollConnect(Native Method)
    at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
    at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:344)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1290)
[2022-12-27 18:00:17,703] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
[2022-12-27 18:00:18,571] INFO Opening socket connection to server localhost/[0:0:0:0:0:0:0:1]:2181. (org.apache.zookeeper.ClientCnxn)
[2022-12-27 18:00:18,574] WARN An exception was thrown while closing send thread for session 0x0. (org.apache.zookeeper.ClientCnxn)
java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.Net.pollConnect(Native Method)
    at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
    at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:344)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1290)
[2022-12-27 18:00:18,688] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
[2022-12-27 18:00:18,689] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
[2022-12-27 18:00:18,691] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
[2022-12-27 18:00:18,696] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
    at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:254)
    at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:108)
    at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1980)
    at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:503)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:203)
    at kafka.Kafka$.main(Kafka.scala:109)
    at kafka.Kafka.main(Kafka.scala)
[2022-12-27 18:00:18,697] INFO shutting down (kafka.server.KafkaServer)
[2022-12-27 18:00:18,704] INFO App info kafka.server for 0 unregistered (org.apache.kafka.common.utils.AppInfoParser)
[2022-12-27 18:00:18,704] INFO shut down completed (kafka.server.KafkaServer)
[2022-12-27 18:00:18,705] ERROR Exiting Kafka due to fatal exception during startup. (kafka.Kafka$)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
    at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:254)
    at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:108)
    at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1980)
    at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:503)
    at kafka.server.KafkaServer.startup(KafkaServer.scala:203)
    at kafka.Kafka$.main(Kafka.scala:109)
    at kafka.Kafka.main(Kafka.scala)
[2022-12-27 18:00:18,706] INFO shutting down (kafka.server.KafkaServer)

学习Kafka,走出这一误区

xam8gpfp

xam8gpfp1#

您需要先启动Zookeeper,或者使用不同的属性文件作为Kraft模式
https://kafka.apache.org/quickstart

相关问题