kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 김동경 <style9...@gmail.com>
Subject Re: can't connect to kafka from a java client.
Date Tue, 04 Mar 2014 02:15:45 GMT
Just for your information, I faced same issue.
For me, it was origin from the hostname of Kafka node.

Since the hostname of broker stored in Zookeeper was different with the
hostname what I configured in source,
it couldn`t fetch the meta data of brokers.

If you configure the log level as debug, and look into zookeeper or broker
log, you can easily find the hostname stored in zookeeper.

Thanks
Dongkyoung


2014-02-28 0:41 GMT+09:00 Jun Rao <junrao@gmail.com>:

> zk.connect is needed in Kafka 0.7. Since you are using Kafka 0.8, you need
> to set metadata.broker.list. ZK is no longer needed in the producer in 0.8.
> You can follow http://kafka.apache.org/documentation.html for 0.8
> documentation.
>
> The latest release in maven is 0.8.0. We publish different kafka jars for
> different versions of scala. That's why you see 2.8.0, 2.10.0, etc. Those
> refer to the scala versions. There is a problem with kafka_2.8.0-0.8.0 in
> maven (we will fix it in the next release). The rest of the scala versions
> are fine.
>
> Let us know if you see any other problems.
>
> Thanks,
>
> Jun
>
>
> On Thu, Feb 27, 2014 at 3:32 AM, rails <stammailbox@gmail.com> wrote:
>
> > Goal: I am trying to send messages to kafka from a java cleint.
> > And it has been a pain..
> > Let me describe in brief.
> >
> > 1. I have installed kafka on a centos VM.
> > 2. I ran the zookeeper that comes with it, the server , the producer and
> > the client with all of the default properties files.
> >     I sent and received messages successfully.
> > 3. I have a telnet connection from my computer to the zookeeper (2181)
> port
> > and the kafka server (9092) port at the VM.
> >
> > Now, I want write java code to send messages to the topic.
> > I use the example from the quick start at the site:
> >
> >     Properties props = new Properties();
> >     props.put("zk.connect", "http://XX.XX.XX.XX:2181"); // XX is the ip
> >     props.put("serializer.class", "kafka.serializer.StringEncoder");
> >     producer = new Producer<String, String>(new ProducerConfig(props));
> >
> > and it fails on the fourth line with the following excetptions :
> >
> > kafka.common.FailedToSendMessageException: Failed to send messages after
> 3
> > tries
> > and
> > rg.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to
> > zookeeper server within timeout: 400
> >
> >
> > Problems.
> > 1. The exception.
> > The bad parameters:
> > In the kafka quick start example I see that it needs only zk.connect,
> > serializer.class <http://kafka.apache.org/07/quickstart.html> . when I
> run
> > it it yells it needs metadata.broker.list in the constructor of the
> > Producer. Does it? So I feel the ip and port of the kafka server.
> > and btw - is it zk.connect or zookeeper connect?ZkTimeoutException:
> Unable
> > to connect to zookeeper server within timeout: 400
> >
> > 3. maven bad versions
> >
> >     I go to the site, i see that the latest version is
>  kafka_2.8.0-0.8.0.
> >     problem no 1 - I download it using intelij (I think it is maven
> > central) -
> >     I get all related jars - only that the kafka jars are empty (contain
> > only manifest<
> >
> http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.kafka%22%20AND%20a%3A%22kafka_2.8.0%22
> > >
> > ).
> >
> >     problem no 2 - there are later versions then the one in the site. Are
> > they official.
> >     any way, I downloaded org.apache.kafka:kafka_2.10:0.8.0
> > 4. Using wireshark I see three SYN & ACK (triple handshake) and than and
> > then FYN & ACK
> >      right after. in the logs of the zookeeper I see the following
> >       [2014-02-27 01:43:42,127] WARN EndOfStreamException: Unable to read
> > additional data from client sessionid 0x0, likely client has closed
> socket
> >
> >       (org.apache.zookeeper.server.NIOServerCnxn)
> >       Which means that I close the connection. Why?
> >
> > Oh, The horror. The horror. <
> > http://en.wikipedia.org/wiki/Heart_of_Darkness>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message