admin管理员组文章数量:1024615
Working with confluent_kafka
, for some reasons i want to switch sometimes sasl_protocol
from SASL_SSL
to SASL_PLAINTEXT
.
The questions is should i code another KAFKA_CONFLUENT_SASL_AUTH
variation or i can just change sasl_protocol
and all ssl params (enable.ssl.certificate.verification
, ssl.certificate.location
, ssl.key.location
) will be ignored by confluent_kafka
?
simple code example:
from confluent_kafka import DeserializingConsumer
sasl_protocol = "SASL_SSL"
KAFKA_CONFLUENT_SASL_AUTH = {
"enable.ssl.certificate.verification": False,
"security.protocol": sasl_protocol,
"sasl.mechanism": "SCRAM-SHA-512",
"sasl.username": "insaneuser",
"sasl.password": "insanepassword",
"bootstrap.servers": "addr1:9093,addr2:9093",
"ssl.certificate.location": settings.NEW_KAFKA_SSL_CERT_LOCATION,
"ssl.key.location": settings.NEW_KAFKA_SSL_KEY_LOCATION,
}
consumer = DeserializingConsumer(
{
"group.id": "mygroup",
"reconnect.backoff.ms": 5000,
"auto.offset.reset": "earliest",
"enable.automit": True,
"session.timeout.ms": 20000,
**KAFKA_CONFLUENT_SASL_AUTH,
}
)
print(consumer.list_topics().topics)
Working with confluent_kafka
, for some reasons i want to switch sometimes sasl_protocol
from SASL_SSL
to SASL_PLAINTEXT
.
The questions is should i code another KAFKA_CONFLUENT_SASL_AUTH
variation or i can just change sasl_protocol
and all ssl params (enable.ssl.certificate.verification
, ssl.certificate.location
, ssl.key.location
) will be ignored by confluent_kafka
?
simple code example:
from confluent_kafka import DeserializingConsumer
sasl_protocol = "SASL_SSL"
KAFKA_CONFLUENT_SASL_AUTH = {
"enable.ssl.certificate.verification": False,
"security.protocol": sasl_protocol,
"sasl.mechanism": "SCRAM-SHA-512",
"sasl.username": "insaneuser",
"sasl.password": "insanepassword",
"bootstrap.servers": "addr1:9093,addr2:9093",
"ssl.certificate.location": settings.NEW_KAFKA_SSL_CERT_LOCATION,
"ssl.key.location": settings.NEW_KAFKA_SSL_KEY_LOCATION,
}
consumer = DeserializingConsumer(
{
"group.id": "mygroup",
"reconnect.backoff.ms": 5000,
"auto.offset.reset": "earliest",
"enable.automit": True,
"session.timeout.ms": 20000,
**KAFKA_CONFLUENT_SASL_AUTH,
}
)
print(consumer.list_topics().topics)
本文标签: pythonconfluentkafka ignore ssl params in configStack Overflow
版权声明:本文标题:python - confluent_kafka ignore ssl params in config - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745564922a2156390.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论