kafka客户端连接失败

流风回雪pj 发布于 2018/08/15 14:13
阅读 1K+
收藏 0

1、远程服务器安装的zookeeper和kafka,在服务器上启动生产者和消费者之间是正常的可以通信

2、使用java写kafka的客户端,一直连接不上远程kafka服务器

2018-08-15 13:14:57,471 (kafka-producer-network-thread | producer-1) [DEBUG - org.apache.kafka.common.network.Selector.poll(Selector.java:307)] Connection with /ip地址 disconnected
java.net.ConnectException: Connection refused: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.kafka.common.network.PlaintextTransportLayer.finishConnect(PlaintextTransportLayer.java:54)
    at org.apache.kafka.common.network.KafkaChannel.finishConnect(KafkaChannel.java:72)
    at org.apache.kafka.common.network.Selector.poll(Selector.java:274)
    at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:256)
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:216)
    at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:128)
    at java.lang.Thread.run(Thread.java:748)

3、修改了server.properties文件,增加了 host.name=服务器ip 配置,启动kafka报错

[2018-08-15 14:01:14,781] ERROR [KafkaServer id=0] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
org.apache.kafka.common.KafkaException: Socket server failed to bind to 服务器ip:9092: Cannot assign requested address.
        at kafka.network.Acceptor.openServerSocket(SocketServer.scala:442)
        at kafka.network.Acceptor.<init>(SocketServer.scala:332)
        at kafka.network.SocketServer.$anonfun$createAcceptorAndProcessors$1(SocketServer.scala:149)
        at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:59)
        at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:52)
        at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
        at kafka.network.SocketServer.createAcceptorAndProcessors(SocketServer.scala:145)
        at kafka.network.SocketServer.startup(SocketServer.scala:94)
        at kafka.server.KafkaServer.startup(KafkaServer.scala:250)
        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
        at kafka.Kafka$.main(Kafka.scala:75)
        at kafka.Kafka.main(Kafka.scala)
Caused by: java.net.BindException: Cannot assign requested address
        at sun.nio.ch.Net.bind0(Native Method)
        at sun.nio.ch.Net.bind(Net.java:433)
        at sun.nio.ch.Net.bind(Net.java:425)
        at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
        at kafka.network.Acceptor.openServerSocket(SocketServer.scala:438)
        ... 11 more

配置文件再没有其他的改动了,求大神指点迷津~~~

加载中
0
流风回雪pj
流风回雪pj

怎么没有人回答呢。。。。。。。。。。。。。

返回顶部
顶部