This is a code snippet of what I'm running:
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
broker := os.Getenv("BROKER")
topic := os.Getenv("TOPIC")
username := os.Getenv("USERNAME")
password := os.Getenv("PASSWORD")
calocation := os.Getenv("CALOCATION")
p, err := kafka.NewProducer(&kafka.ConfigMap{
"metadata.broker.list": broker,
"security.protocol": "sasl_ssl",
"sasl.username": username,
"sasl.password": password,
"sasl.mechanisms": "PLAIN",
"ssl.ca.location": calocation,
"api.version.request": true})
if err != nil {
fmt.Printf("Failed to create producer: %s\n", err)
os.Exit(1)
}
Basically, this runs successfully on one machine, but not another. The error that I'm receiving on the machine that isn't working is the following:
'SSL handshake failed: /SourceCache/OpenSSL098/OpenSSL098-52.40.1/src/ssl/s23_clnt.c:593: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version:'
Not sure if this issue could be linked to this issue: Why kafka-python fails to connect to Bluemix message hub service?... Don't think so as the exact code is running on one machine but not the other. Any help is appreciated!
Message Hub requires TLS v.1.2.
From your error message it may well be that the tls version used on the two machines differs.
librdkafka mentions the property
ssl.cipher.suites
https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md I never had to set it, for C or node clients.If you're using a Mac, make sure that librdkafka is using the openssl library that is installed with Homebrew and not the on from Apple. On my Mac I compile librdkafka after having exported
CPPFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib