Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR:kafka.producer:Unable to send messages #3

Open
PanYifeng opened this issue May 27, 2017 · 1 comment
Open

ERROR:kafka.producer:Unable to send messages #3

PanYifeng opened this issue May 27, 2017 · 1 comment

Comments

@PanYifeng
Copy link

hi
I tried to emit druid metrics to Kafka by druid-metrics-to-kafka, but unfortunately faced some problems.
At first:
Traceback (most recent call last):
File "druid-metrics-collector.py", line 66, in
cherrypy.quickstart(KafkaMetrics(BROKER_LIST, TOPIC))
File "druid-metrics-collector.py", line 35, in init
client = KafkaClient(broker_list)
TypeError: init() takes exactly 1 argument (2 given)

Then I changed the import of KafkaClient from "from kafka.client import KafkaClient" to "from kafka import KafkaClient" and a new problem was encountered:
ERROR:kafka.producer:Unable to send messages
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/kafka/producer/base.py", line 424, in _send_messages
fail_on_error=self.sync_fail_on_error
File "/usr/lib/python2.7/site-packages/kafka/client.py", line 649, in send_produce_request
resps = self._send_broker_aware_request(payloads, encoder, decoder)
File "/usr/lib/python2.7/site-packages/kafka/client.py", line 253, in _send_broker_aware_request
conn = self._get_conn(host, broker.port, afi)
File "/usr/lib/python2.7/site-packages/kafka/client.py", line 74, in _get_conn
conn.connect()
File "/usr/lib/python2.7/site-packages/kafka/conn.py", line 283, in connect
ret = self._sock.connect_ex((self.host, self.port))
AttributeError: 'NoneType' object has no attribute 'connect_ex'

My python is "Python 2.7.5" and my pip is "pip 9.0.1".
@theduderog @arrawatia: Would you please help me solve these problems?

@liyafang
Copy link

changing the import of KafkaClient from "from kafka.client import KafkaClient" to "from kafka import KafkaClient" works for me.
My python is Python2.7.5 and my pip is also 9.0.1.
maybe your kafka servers have some problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants