Home Forums Kamanja Forums Problems & Solutions Problem starting Kafka : Socket server failed to bind | Address already in use

This topic contains 0 replies, has 1 voice, and was last updated by  Shilpa Udgata 1 year, 3 months ago.

  • Author
    Posts
  • #17504 Reply

    Shilpa Udgata
    Participant

    ERROR MESSAGE:

    .

    .

    .

    kafka.common.KafkaException: Socket server failed to bind to 0.0.0.0:9092: Address already in use.

    at kafka.network.Acceptor.openServerSocket(SocketServer.scala:313)

    at kafka.network.Acceptor.<init>(SocketServer.scala:241)

    at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:95)

    at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:88)

    at scala.collection.Iterator$class.foreach(Iterator.scala:893)

    at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)

    at scala.collection.MapLike$DefaultValuesIterable.foreach(MapLike.scala:206)

    at kafka.network.SocketServer.startup(SocketServer.scala:88)

    at kafka.server.KafkaServer.startup(KafkaServer.scala:191)

    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)

    at kafka.Kafka$.main(Kafka.scala:67)

    at kafka.Kafka.main(Kafka.scala)

    Caused by: java.net.BindException: Address already in use

    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:309)

    … 11 more

    SOLUTION:

    Find the PID of the port which is running and kill it. Then restart kafka:

    lsof -i :9092

    kill -9 <PID>

    SAMPLE OUTPUT:

    $ lsof -i :9092

    COMMAND   PID   USER   FD   TYPE   DEVICE                        SIZE/OFF       NODE NAME

    java             14184 Udgata  82u  IPv6     0x7ff330a46040b27f      0t0  TCP localhost:XmlIpcRegSvc->localhost:55690 (CLOSE_WAIT)

    java             14184 Udgata  83u  IPv6     0x7ff330a4626de29f      0t0  TCP localhost:XmlIpcRegSvc->localhost:55692 (CLOSE_WAIT)

    .

    .

    .

    .

    $ kill -9 14184

     

    $ kafka-server-start.sh   $KAFKA_HOME/config/server.properties

Reply To: Problem starting Kafka : Socket server failed to bind | Address already in use
Your information: