[ 
https://issues.apache.org/jira/browse/KAFKA-1615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14323353#comment-14323353
 ] 

Gwen Shapira commented on KAFKA-1615:
-------------------------------------

Hi [~jrafalski],

Thanks for jumping in on this!

The main reason we use hostnames in the ZK consumer connector is to help 
identify the consumer, usually while troubleshooting.
I'm thinking using IP instead of hostname (when hostname is not available) will 
be the easiest way to keep some information and avoid the error. 

And yeah, I agree it is a good idea log a warning if the hostname doesn't 
resolve.

> Generating group ID in ZookeeperConsumerConnector shouldn't require local 
> hostname to resolve
> ---------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-1615
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1615
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 0.8.1.1
>            Reporter: Gwen Shapira
>            Assignee: Gwen Shapira
>            Priority: Minor
>              Labels: newbie, usability
>
> ZookeeperConsumerConnector generates group ID by taking the local hostname:
> consumerUuid = "%s-%d-%s".format(
>         InetAddress.getLocalHost.getHostName, System.currentTimeMillis,
>         uuid.getMostSignificantBits().toHexString.substring(0,8))
> If localhost doesn't resolve (something that happens occasionally), this will 
> fail with following error:
> Exception in thread "main" java.net.UnknownHostException: Billc-cent70x64: 
> Billc-cent70x64: Name or service not known
>       at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
>       at 
> kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:119)
>       at 
> kafka.consumer.ZookeeperConsumerConnector.<init>(ZookeeperConsumerConnector.scala:142)
>       at kafka.consumer.Consumer$.create(ConsumerConnector.scala:89)
>       at kafka.tools.ConsoleConsumer$.main(ConsoleConsumer.scala:149)
>       at kafka.tools.ConsoleConsumer.main(ConsoleConsumer.scala)
> Caused by: java.net.UnknownHostException: Billc-cent70x64: Name or service 
> not known
>       at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
>       at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
>       at 
> java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
>       at java.net.InetAddress.getLocalHost(InetAddress.java:1469)
>       ... 5 more
> Normally requiring a resolving localhost is not a problem, but here is seems 
> a bit frivolous - its just for generating an ID, nothing network related.
> I think we can catch the exception and generate an ID without the hostname.
> This is low priority since the issue can be easily worked around (add the 
> hostname to /etc/hosts) and since this API is going away anyway with the new 
> consumer API.  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to