【问题标题】:kafka-python: Connection reset during recv when using SASL_SSL + SCRAM-SHA-512kafka-python:使用 SASL_SSL + SCRAM-SHA-512 时在接收期间重置连接
【发布时间】:2023-04-07 18:04:01
【问题描述】:

我正在使用 kafka-python 通过 SASL 连接到 Kafka 集群

consumer = KafkaConsumer(bootstrap_servers=['fooserver1:9092', 'fooserver2:9092'], client_id='foo', api_version=(2,2,1), security_protocol='SASL_SSL', sasl_mechanism='SCRAM-SHA-512', sasl_plain_username='myusername', sasl_plain_password='password123')

但是连接时出现以下错误:

<BrokerConnection node_id=bootstrap-0 host=fooserver1:9092 <authenticating> [IPv4 ('my.ip.ad.dress', 9092)]>: Error receiving reply from server
Traceback (most recent call last):    
File "/opt/python/kafka/conn.py", line 692, in _try_authenticate_scram(data_len,) = struct.unpack('>i', self._recv_bytes_blocking(4))
File "/opt/python/kafka/conn.py", line 616, in _recv_bytes_blocking raise ConnectionError('Connection reset during recv')
ConnectionError: Connection reset during recv

我已确保为建立连接打开了适当的端口。
我需要帮助来解决此错误。

【问题讨论】:

    标签:
    apache-kafka
    connection
    kafka-consumer-api
    sasl
    kafka-python