-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Log a warning when bootstrap server is not in list of brokers returned by metadata request #159
Comments
I don't understand what you mean by "the initial value used when querying Kafka". Are you suggesting that we look for localhost as a specific response code and inline replace it with the original connection information? |
I meant the value used here: I was not suggesting a find and replace on response value but to always use the value "known" to the client |
I thought you said that the Kafka server was returning "localhost" inside the metadata response? I would imagine the correct response would be to connect to whatever the Kafka server says is the correct location to connect to. |
It is - Kafka is returning localhost in the response. The client then breaks as it uses "localhost" for the send_message request. |
But that fundamentally breaks connecting to a multiple node kafka cluster.
|
I didnt have these issues using the node.js client. Are you saying thats fundamentally broken? I've not tried these clients so I dont know what the result will be. Should be an easy enough test though. |
PS. I dont mean to sound confrontational here and I understand what you are saying. I'm just walking through the implications |
From the Kafka documentation:
|
Which node client are you using? It's possible they special cased a size=1 cluster returning "localhost" to connect to the original host. |
|
PS i'm happy with your explanation and this can be closed if you like. I wanted to leave a note so that others wont be caught out by this also ;-) |
I'm not a collaborator on the project, just a very interested party. I'm maintaining the kafka-python fork here at KIXEYE. ;-)
|
I would add this to the WARNING that is being prompted, as I had to spend quite a lot of time searching for that ;) Host returned by kafka was equal to computer name, which was quite disturbing |
I don't really understand what you're saying. Are you asking for a warning to be emitted? What's the criteria when this warning would be logged? |
Basically the motivation for this warning is that it seems that simplest kafka version might not work out of the box, which is quite bad for beginners (like me for instance). So you could add warning if host advertised from kafka server we have connected to is different than host that we were connecting to. Or simply you could mention this problem in appropriate wiki page, or README.md. |
It might be reasonable to issue a warning if the host you are connected to is not in the list of brokers received from the metadata request. However, that's still a legitimate thing. Would a logging.warn be good enough?
|
Yes of course :) Thanks for quick answer |
The root cause here is a misconfigured kafka cluster. Currently we will log a warning if the advertised host name does not resolve via dns. That may not help for 'localhost' but I'm not inclined to do much more since it seems very likely to hit edge cases and annoy a lot of working usages, for example, where the "bootstrap" name is a simple dns round robin but the metadata names are specific hosts. |
…terations for Kafka 0.8.2 and Python 3.12 (dpkp#159) * skip failing tests for PyPy since they work locally * Reconfigure tests for PyPy and 3.12 * Skip partitioner tests in test_partitioner.py if 3.12 and 0.8.2 * Update test_partitioner.py * Update test_producer.py * Timeout tests after ten minutes * Set 0.8.2.2 to be experimental from hereon * Formally support PyPy 3.9
…terations for Kafka 0.8.2 and Python 3.12 (dpkp#159) * skip failing tests for PyPy since they work locally * Reconfigure tests for PyPy and 3.12 * Skip partitioner tests in test_partitioner.py if 3.12 and 0.8.2 * Update test_partitioner.py * Update test_producer.py * Timeout tests after ten minutes * Set 0.8.2.2 to be experimental from hereon * Formally support PyPy 3.9
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?
The text was updated successfully, but these errors were encountered: