I have a Kafka docker set up that I was able to run properly with the following docker-compose.yml.
> version: '2'
>
> services:
> zookeeper:
> image: bitnami/zookeeper:3.8
> ports:
> - 2181:2181
> environment:
> - ALLOW_ANONYMOUS_LOGIN=yes
> #- ZOO_ENABLE_AUTH=yes
> kafka:
> image: bitnami/kafka:2.5.0
> ports:
> - 9092:9092
> - 9091:9091
> links:
> - zookeeper
> environment:
> - ALLOW_PLAINTEXT_LISTENER=true
> - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
> - KAFKA_LISTENERS=INTERNAL://kafka:9091,EXTERNAL://localhost:9092
> - KAFKA_ADVERTISED_LISTENERS=EXTERNAL://localhost:9092,INTERNAL://kafka:9091
> - KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL
> - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=EXTERNAL:PLAINTEXT,INTERNAL:PLAINTEXT
I am trying to connect using conflient-kafka and my producer code looks as below
from confluent_kafka import Producer
import socket
conf = {'bootstrap.servers': "127.0.0.1:9092",
"enable.ssl.certificate.verification": False,
'client.id': socket.gethostname()}
producer = Producer(conf)
producer.produce('my_topic', key="key", value="value")
producer.flush()
I am having the following error when I run it
Disconnected while requesting ApiVersion: might be caused by incorrect security.protocol configuration (connecting to a SSL listener?) or broker version is < 0.10 (see api.version.request) (after 2ms in state APIVERSION_QUERY)
I noticed the following
- Kafka broker version is 2.5.
- docker-compose log shows ssl.client.auth = none ssl.enabled.protocols = [TLSv1.2]
Can anyone suggest how to resolve this issue?