Basically, the issue (or at least one of very many possible network issues...) is that the server has "localhost" hardcoded as its canonical name in /etc/hosts:
[root@Billc-cent70x64 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 Billc-cent70x64 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 Unfortunately a very common default for RedHat and Centos machines. As the blog mentions, a good solution (other than instructing Kafka on the right name to advertise) is to add the correct IP and hostname to /etc/hosts. We may want to add this option to the FAQ. Gwen On Fri, Oct 17, 2014 at 7:56 PM, Gwen Shapira <gshap...@cloudera.com> wrote: > It looks like we are using canonical hostname: > > def register() { > val advertisedHostName = > if(advertisedHost == null || advertisedHost.trim.isEmpty) > InetAddress.getLocalHost.getCanonicalHostName > else > advertisedHost > val jmxPort = > System.getProperty("com.sun.management.jmxremote.port", "-1").toInt > ZkUtils.registerBrokerInZk(zkClient, brokerId, advertisedHostName, > advertisedPort, zkSessionTimeoutMs, jmxPort) > } > > So never mind :) > > > On Fri, Oct 17, 2014 at 6:36 PM, Jay Kreps <jay.kr...@gmail.com> wrote: >> Hmm, yes, actually I don't think I actually understand the issue. Basically >> as I understand it we do InetAddress.getLocalHost.getHostAddress which on >> AWS picks the wrong hostname/ip and then the producer can't connect. People >> eventually find this FAQ, but I was hoping there was a more automatic way >> since everyone is on AWS these days. Maybe getCanonicalHostName would fix >> it? >> >> https://cwiki.apache.org/confluence/display/KAFKA/FAQ#FAQ-Whycan'tmyconsumers/producersconnecttothebrokers >> ? >> >> -Jay >> >> On Fri, Oct 17, 2014 at 3:19 PM, Gwen Shapira <gshap...@cloudera.com> wrote: >> >>> In #2, do you refer to advertising the "internal" hostname instead of >>> the external one? >>> In this case, will it be enough to use getCanonicalHostName (which >>> uses a name service)? >>> >>> Note that I think the problem the blog reported (wrong name >>> advertised) is somewhat orthogonal to the question of which interface >>> we bind to (which should probably be the default interface). >>> >>> Gwen >>> >>> On Fri, Oct 17, 2014 at 5:28 PM, Jay Kreps <jay.kr...@gmail.com> wrote: >>> > This guy documented a few struggles getting going with Kafka. Not sure if >>> > there is anything we can do to make it better? >>> > http://ispyker.blogspot.com/2014/10/kafka-part-1.html >>> > >>> > 1. Would be great to figure out the apache/gradle thing. >>> > 2. The problem of having Kafka advertise localhost on AWS is really >>> common. >>> > I was thinking one possible solution for this would be to get all the >>> > interfaces and prefer non-localhost interfaces if they exist. >>> > >>> > -Jay >>>