http://bluemix.netの Bluemix Message Hub インスタンスに接続しようとしています。この単純なスクリプト
#!/usr/bin/env python
from kafka import KafkaProducer
from kafka.errors import KafkaError
kafka_brokers_sasl = [
"kafka01-prod01.messagehub.services.us-south.bluemix.net:9093",
"kafka02-prod01.messagehub.services.us-south.bluemix.net:9093",
"kafka03-prod01.messagehub.services.us-south.bluemix.net:9093",
"kafka04-prod01.messagehub.services.us-south.bluemix.net:9093",
"kafka05-prod01.messagehub.services.us-south.bluemix.net:9093" ]
sasl_plain_username = "xxxxxxxxxxxxxxx"
sasl_plain_password = "xxxxxxxxxxxxxxxxxxxxxxxxx"
sasl_mechanism = 'SASL_PLAINTEXT'
producer = KafkaProducer(bootstrap_servers = kafka_brokers_sasl,
sasl_plain_username = sasl_plain_username,
sasl_plain_password = sasl_plain_password,
sasl_mechanism = sasl_mechanism )
以下の例外で終了します。
Traceback (most recent call last):
File "./test-mh.py", line 12, in <module>
producer = KafkaProducer(bootstrap_servers = kafka_brokers_sasl, sasl_plain_username = sasl_plain_username, sasl_plain_password = sasl_plain_password, sasl_mechanism = sasl_mechanism )
File "/usr/local/lib/python2.7/dist-packages/kafka/producer/kafka.py", line 328, in __init__
**self.config)
File "/usr/local/lib/python2.7/dist-packages/kafka/client_async.py", line 202, in __init__
self.config['api_version'] = self.check_version(timeout=check_timeout)
File "/usr/local/lib/python2.7/dist-packages/kafka/client_async.py", line 791, in check_version
raise Errors.NoBrokersAvailable()
kafka.errors.NoBrokersAvailable: NoBrokersAvailable
messagehub サービス資格情報オブジェクトから kafka_brokers_sasl、sasl_plain_username、および sasl_plain_password を取得しました。SASL認証メカニズムをサポートしているように見えるkafka-python 1.3.1を使用しています。私が間違っていることについて何か考えはありますか?ありがとう。