kafka-python does not work on Windows
See original GitHub issueOS: Windows 8 kafka-python version: 0.97.0-dev
Trying to run:
producer = KafkaProducer(bootstrap_servers=[KAFKA_ADDRESS])
Getting an error:
2016-01-26 18:10:08,252 kafka.producer.kafka DEBUG Starting the Kafka producer
2016-01-26 18:10:08,252 kafka.client DEBUG Attempting to bootstrap via node at 10.250.181.19:9092
2016-01-26 18:10:08,253 kafka.conn ERROR Connect attempt to <BrokerConnection host=10.250.181.19 port=9092> returned error 10035. Disconnecting.
2016-01-26 18:10:08,253 kafka.client ERROR Unable to bootstrap from [('10.250.181.19', 9092)]
2016-01-26 18:10:08,253 kafka.client DEBUG No connected nodes found. Trying disconnected nodes.
2016-01-26 18:10:08,253 kafka.client DEBUG No luck. Trying all broker metadata
2016-01-26 18:10:08,253 kafka.client ERROR No nodes found in metadata -- retrying bootstrap
2016-01-26 18:10:08,254 kafka.client DEBUG Sleeping 0.0980 before bootstrapping again
2016-01-26 18:10:08,352 kafka.client DEBUG Attempting to bootstrap via node at 10.250.181.19:9092
2016-01-26 18:10:08,352 kafka.conn ERROR Connect attempt to <BrokerConnection host=10.250.181.19 port=9092> returned error 10035. Disconnecting.
2016-01-26 18:10:08,352 kafka.client ERROR Unable to bootstrap from [('10.250.181.19', 9092)]
Traceback (most recent call last):
File "sample.py", line 5, in <module>
producer = KafkaProducer(bootstrap_servers=[KAFKA_ADDRESS])
File "C:\Program Files\Python35\lib\site-packages\kafka_python-0.97.0.dev0-py3.5.egg\kafka\producer\kafka.py", line 245, in __init__
File "C:\Program Files\Python35\lib\site-packages\kafka_python-0.97.0.dev0-py3.5.egg\kafka\client_async.py", line 607, in check_version
File "C:\Program Files\Python35\lib\site-packages\kafka_python-0.97.0.dev0-py3.5.egg\kafka\client_async.py", line 575, in connect
kafka.common.NodeNotReadyError: None
Found this code in the conn.py
:
self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF,
self.config['receive_buffer_bytes'])
self._sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF,
self.config['send_buffer_bytes'])
self._sock.setblocking(False)
ret = self._sock.connect_ex((self.host, self.port))
self.last_attempt = time.time()
if not ret or ret is errno.EISCONN:
self.state = ConnectionStates.CONNECTED
elif ret in (errno.EINPROGRESS, errno.EALREADY):
self.state = ConnectionStates.CONNECTING
else:
log.error('Connect attempt to %s returned error %s.'
' Disconnecting.', self, ret)
self.close()
self.last_failure = time.time()
On my machine, ret
contains EWOULDBLOCK
, and this seems to be normal. Do you need to handle EWOULDBLOCK
in this case or my machine is merely glitchy and should not return EWOULDBLOCK
on socket opening?
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
kafka-python: producer is not able to connect - Stack Overflow
I solved the problem with hint of user3503929. The kafka server was installed on windows. server.properties ... host.name = 0.0.0 ...
Read more >kafka-python — kafka-python 2.0.2-dev documentation
Python client for the Apache Kafka distributed stream processing system. kafka-python is designed to function much like the official java client, ...
Read more >Kafka with kafka-python on Windows - YouTube
Your browser can't play this video. ... Kafka with kafka - python on Windows ... Four Different Ways of Working with Kafka on...
Read more >Install and run Apache Kafka & integration with Python using ...
Download Kafka : https:// kafka.apache.org/downloadsSet-up kafka in ... try restarting your device. Your browser can't play this video.
Read more >Why Can't I Connect to Kafka? | Troubleshoot Connectivity
My Python/Java/Spring/Go/Whatever Client Won't Connect to My Apache Kafka ... Now let's check the connection to a Kafka broker running on another machine....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
if I construct the producer with bootstrap_servers=‘host:port’, it fails. If I parse bootstrap_servers=‘host’, it works. Tested master in both windows and linux, same result.
Please open a new issue w/ specific code to reproduce. thanks!