I created a Kafka cluster at https://confluent.cloud/. I am trying to write a simple producer, with kafka-python.
Here is my producer code:
from kafka import KafkaProducer
producer = KafkaProducer(
bootstrap_servers='pkc-419q3.us-east4.gcp.confluent.cloud:9092',
security_protocol='SASL_SSL',
sasl_mechanism='PLAIN',
sasl_plain_username='CKQB...',
sasl_plain_password='7XKX...'
)
producer.send('my_topic', b'some_message_bytes')
producer.flush()
Running the above results in this error:
ssl.SSLCertVerificationError:
[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed:
certificate has expired (_ssl.c:1123)
I see that the KafkaProducer has options for ssl_cafile
, ssl_certfile
, etc. But I don't know which to use or where to get these files.
What do I need to do to diagnose or correct this on a Windows 10 machine?