我正在尝试设置一个支持ssl的kafka代理,但是当我尝试在主题上放置消息时,它会超时。以下是我遵循的步骤:
openssl req -new -newkey rsa:4096 -days 365 -x509 -subj "/CN=Kafka-Security-CA" -keyout ca-key -out ca-cert -nodes
keytool -genkey -keystore kafka.server.keystore.jks -validity 365 -storepass xxx-keypass xxx -dname "CN=kafka_broker.net" -storetype pkcs12
keytool -keystore kafka.server.keystore.jks -certreq -file cert-file -storepass xxx -keypass xxx
openssl x509 -req -CA ca-cert -CAkey ca-key -in cert-file -out cert-signed -days 365 -CAcreateserial -passin pass:xxx
keytool -keystore kafka.server.truststore.jks -alias CARoot -import -file ca-cert -storepass xxx -keypass xxx -noprompt
keytool -keystore kafka.server.keystore.jks -import -file cert-signed -storepass xxx -keypass xxx -noprompt
keytool -keystore kafka.client.truststore.jks -alias CARoot -import -file ca-cert -storepass xxx -keypass xxx -noprompt
我知道ssl连接失败是因为:
/kafka_2.11-1.1.0/bin/kafka-console-producer.sh --broker-list kafka_broker:9092 --topic test --producer.config client.properties
>ewqeq
[2018-07-04 14:53:18,022] ERROR Error when sending message to topic test with key: null, value: 5 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Failed to update metadata after 60000 ms.
其中client.properties是配置文件,其内容为:
security.protocol=SSL
ssl.truststore.location=./kafka.server.truststore.jks
ssl.truststore.password=xxx
我试了很多次,但都没用。我尝试连接的客户端位于docker容器中,也是kafka。它们在同一个网络下,kafka主机名是kafka\u代理,我在创建密钥库时也向cn提供了这个代理。
暂无答案!
目前还没有任何答案,快来回答吧!