Skip to content

Log a warning when bootstrap server is not in list of brokers returned by metadata request #159

Closed
@motherhubbard

Description

@motherhubbard

Kafka is configured so that it is bound to all network interfaces (ie the following line is commented out in server.properties):

host.name=localhost

and the advertised.host.name is not set.

I use the python client to connect to the Remote Kafka:
client = KafkaClient("remotehost:port")
producer = SimpleProducer(client, async=asynchronous)
producer.send_messages("topic", "test").

the following error is then seen:
snip...........
line 60, in init
[Fri Apr 11 08:43:19.328326 2014] [:error] [pid 81444:tid 4352339968] self.reinit()
[Fri Apr 11 08:43:19.328331 2014] [:error] [pid 81444:tid 4352339968] File kafka/conn.py", line 153, in reinit
[Fri Apr 11 08:43:19.328334 2014] [:error] [pid 81444:tid 4352339968] self._sock.connect((self.host, self.port))
[Fri Apr 11 08:43:19.328343 2014] [:error] [pid 81444:tid 4352339968] File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 224, in meth
[Fri Apr 11 08:43:19.328347 2014] [:error] [pid 81444:tid 4352339968] return getattr(self._sock,name)(*args)
[Fri Apr 11 08:43:19.328350 2014] [:error] [pid 81444:tid 4352339968] error: [Errno 61] Connection refused

After debugging the code it can be seen that the client is trying to connect to "localhost".

The "localhost" value has been obtained by decoding the metadata response back from Kafka.

If I set the host.name (or I guess the advertised.host.name) then all is well.

It is my belief that the name used in the response from Kafka should not be used by the client (it may not be reachable by the client) but rather the initial value used when querying Kafka.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions