我使用 librdkafka 作为客户端消费者,并且我已经为代理配置了代理和客户端以支持 SSL:
listeners = PLAINTEXT://172.20.54.9:9092,SSL://172.20.54.9:9093
ssl.keystore.location=E:/project_files/Project/kafka_2.11-2.1.0/config/kafka.server.keystore.jks
ssl.keystore.password=ismail
ssl.key.password=ismail
ssl.truststore.location=E:/project_files/Project/kafka_2.11-2.1.0/config/kafka.server.truststore.jks
ssl.truststore.password=password
在客户端我使用这个配置:
rd_kafka_conf_set(conf, "metadata.broker.list", "172.20.54.9:9093",
NULL, 0);
rd_kafka_conf_set(conf, "security.protocol", "ssl",
NULL, 0);
rd_kafka_conf_set(conf, "ssl.ca.location", "/usr/bin/NetSens/CARoot.pem",
NULL, 0);
rd_kafka_conf_set(conf, "ssl.certificate.location", "/usr/bin/NetSens/certificate.pem",
NULL, 0);
rd_kafka_conf_set(conf, "ssl.key.location", "/usr/bin/NetSens/key.pem",
NULL, 0);
rd_kafka_conf_set(conf, "ssl.key.password", "password",
NULL, 0);
我收到了这个错误:
1559309856.897 RDKAFKA-3-ERROR: rdkafka#consumer-1: [thrd:ssl://172.20.54.9:9093/bootstrap]: ssl://172.20.54.9:9093/bootstrap: SSL handshake failed: ../ssl/record/ssl3_record.c:252: error:1408F10B:SSL routines:ssl3_get_record:wrong version number: (after 7ms in state CONNECT)
有关更多信息,我同时有另一个使用相同证书和密钥的 python kafka 客户端,它工作正常。我将非常感谢任何帮助。