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
>>

Reply via email to