elodina / scala-kafka

Quick up and running using Scala for Apache Kafka
Apache License 2.0
331 stars 134 forks source link

Connection refused errors after halting #7

Closed debugging closed 10 years ago

debugging commented 10 years ago

Thanks for this setup.

What is the correct way to start/stop the vagrant box without breaking things?

I guess the scripts aren't meant to survive a server restart. If that is the case, how should we go about stating and stoping it so things work afterwards. I also tried to reload and that didn't work either.

I did a vagrant halt and then vagrant up and then I get errors when running the tests:

[2014-06-13 22:36:19,131] INFO Fetching metadata from broker id:0,host:192.168.86.10,port:9092 with correlation id 0 for 1 topic(s) Set(a9fe6211-b488-44c3-9fb8-36b2c8a935d9) (kafka.client.ClientUtils$)
[2014-06-13 22:36:19,136] INFO Fetching metadata from broker id:0,host:192.168.86.10,port:9092 with correlation id 0 for 1 topic(s) Set(c609293b-d1b6-4d41-b0a2-f76b79b6998a) (kafka.client.ClientUtils$)
[2014-06-13 22:36:19,150] ERROR Producer connection to 192.168.86.10:9092 unsuccessful (kafka.producer.SyncProducer)
java.net.ConnectException: Connection refused
    at sun.nio.ch.Net.connect0(Native Method)
    at sun.nio.ch.Net.connect(Net.java:465)
    at sun.nio.ch.Net.connect(Net.java:457)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:670)
    at kafka.network.BlockingChannel.connect(BlockingChannel.scala:57)
    at kafka.producer.SyncProducer.connect(SyncProducer.scala:141)
    at kafka.producer.SyncProducer.getOrMakeConnection(SyncProducer.scala:156)
    at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(SyncProducer.scala:68)
    at kafka.producer.SyncProducer.send(SyncProducer.scala:112)
    at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:53)
    at kafka.producer.BrokerPartitionInfo.updateInfo(BrokerPartitionInfo.scala:82)
    at kafka.producer.async.DefaultEventHandler$$anonfun$handle$1.apply$mcV$sp(DefaultEventHandler.scala:67)
    at kafka.utils.Utils$.swallow(Utils.scala:167)
    at kafka.utils.Logging$class.swallowError(Logging.scala:106)
    at kafka.utils.Utils$.swallowError(Utils.scala:46)
    at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:67)
    at kafka.producer.Producer.send(Producer.scala:76)
    at kafka.producer.KafkaProducer.send(KafkaProducer.scala:108)
    at kafka.producer.KafkaProducer.send(KafkaProducer.scala:104)
    at ly.stealth.testing.KafkaSpec$$anonfun$1$$anonfun$apply$5.apply(KafkaSpec.scala:42)
    at ly.stealth.testing.KafkaSpec$$anonfun$1$$anonfun$apply$5.apply(KafkaSpec.scala:33)
joestein commented 10 years ago

vagrant destroy vagrant up

debugging commented 10 years ago

It should ideally be more resilient to start/stop as destroying and re-up'ing takes a long time. Any suggestions?

debugging commented 10 years ago

If you halt the or reboot you can simple do:

/opt/apache/kafka/bin/zookeeper-server-start.sh /opt/apache/kafka/config/zookeeper.properties 1>> /tmp/zk.log 2>> /tmp/zk.log &

/opt/apache/kafka/bin/kafka-server-start.sh /opt/server.properties 1>> /tmp/broker.log 2>> /tmp/broker.log &

Hope that helps, thanks for your work!