Jroland / kafka-net

Native C# client for Kafka queue servers.
Apache License 2.0
483 stars 232 forks source link

IP Address Resolves to FQDN #78

Open nsankaranarayanan opened 8 years ago

nsankaranarayanan commented 8 years ago

Hi,

When I try to use your client to sent a message, the IP address is resolved to a FQDN. Unfortunately the FQDN is not working for us.

Please see below code.

We are getting the error Could not resolve the following hostname: XXX.yyy.zzz.aaaa

Thanks

    public void KafkaNetProducer()
    {
        var options = new KafkaOptions(new Uri("http://10.49.18.211:9092"));

        var router = new BrokerRouter(options);
        var client = new Producer(router);

        client.SendMessageAsync("test", new[] { new Message("hello world 1 from .Net client") }).Wait();

        using (client) { }

        return;
    }
lockwobr commented 8 years ago

A work around might be to add something to the host file like:

10.49.18.211  XXX.yyy.zzz.aaaa 
nsankaranarayanan commented 8 years ago

I have already done that. Though this workaround seems to work in this POC, I will not be able to suggest or employ this in production.

Jroland commented 8 years ago

The driver contacts the kafka server and asks it what the address is for the other servers. You have to setup your kafka server to advertise the correct address for all the other servers. When the driver is requesting the address from the other servers, kafka is probably telling it to contact XXX.yyy.zzz.aaaa which does not exist.

See: http://kafka.apache.org/documentation.html And: advertised.host.name

This should go into your server.properties file.

ashishdhyani commented 8 years ago

@Jroland, I am also getting the same issue {"Could not resolve the following hostname: 0.0.0.0"}. I have provided the advertised.host.name (FQDN name) in server.properties file.

My kafka server/consumer is running in Unix box. And Producer in a windows box.

Do I need to setup something else as well ? Please help.