我正在使用Spring Cloud Stream处理Kafka Streams代码。 Maven版本 - Spring Boot 2.0.2版本 Apache kafka-streams - 1.1.0 Apache kafka-client - 1.1.0。
配置 -
spring:
profiles: dev, test
cloud:
stream:
kafka:
binder:
autoCreateTopics: false
auto-add-partitions: false
brokers: ${KAFKA_BOOTSTRAP_SERVERS}
configuration:
security.protocol: SSL
ssl.truststore-location: ${SPRING_KAFKA_CONSUMER_SSL_TRUSTSTORE_LOCATION}
ssl.truststore-password: ${SPRING_KAFKA_CONSUMER_SSL_TRUSTSTORE_PASSWORD}
ssl.keystore-location: ${SPRING_KAFKA_CONSUMER_SSL_KEYSTORE_LOCATION}
ssl.keystore-password: ${SPRING_KAFKA_CONSUMER_SSL_KEYSTORE_PASSWORD}
ssl.key-password: ${SPRING_KAFKA_CONSUMER_SSL_KEY_PASSWORD}
kafka:
bootstrap-servers: ${KAFKA_BOOTSTRAP_SERVERS}
properties:
security.protocol: ${SPRING_KAFKA_PROPERTIES_SECURITY_PROTOCOL:SSL}
ssl:
truststore-location: ${SPRING_KAFKA_CONSUMER_SSL_TRUSTSTORE_LOCATION}
truststore-password: ${SPRING_KAFKA_CONSUMER_SSL_TRUSTSTORE_PASSWORD}
keystore-location: ${SPRING_KAFKA_CONSUMER_SSL_KEYSTORE_LOCATION}
keystore-password: ${SPRING_KAFKA_CONSUMER_SSL_KEYSTORE_PASSWORD}
key-password: ${SPRING_KAFKA_CONSUMER_SSL_KEY_PASSWORD}
例外 -
Removing node node1:9092 (id: -1 rack: null) from least loaded node selection: is-blacked-out: false, in-flight-requests: 1
Removing node node2:9092 (id: -2 rack: null) from least loaded node selection: is-blacked-out: false, in-flight-requests: 0
Removing node node3:9092 (id: -5 rack: null) from least loaded node selection: is-blacked-out: false, in-flight-requests: 0
Found least loaded node node3:9092 (id: -3 rack: null)
Connection with node3/<ipaddress> disconnected
java.io.EOFException: null
at org.apache.kafka.common.network.NetworkReceive.readFromReadableChannel(NetworkReceive.java:147) ~[kafka-clients-1.1.0.jar:na]
at org.apache.kafka.common.network.NetworkReceive.readFrom(NetworkReceive.java:93) ~[kafka-clients-1.1.0.jar:na]
at org.apache.kafka.common.network.KafkaChannel.receive(KafkaChannel.java:235) ~[kafka-clients-1.1.0.jar:na]
at org.apache.kafka.common.network.KafkaChannel.read(KafkaChannel.java:196) ~[kafka-clients-1.1.0.jar:na]
at org.apache.kafka.common.network.Selector.attemptRead(Selector.java:557) [kafka-clients-1.1.0.jar:na]
at org.apache.kafka.common.network.Selector.pollSelectionKeys(Selector.java:495) [kafka-clients-1.1.0.jar:na]
at org.apache.kafka.common.network.Selector.poll(Selector.java:424) [kafka-clients-1.1.0.jar:na]
at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:460) [kafka-clients-1.1.0.jar:na]
在为AdminCLientCOnfig填充时,似乎没有为ProducerConfig和ConsumerConfig设置ssl配置。这看起来像一个问题 -
2018-06-14 13:15:33.652 INFO 91844 --- [ main] o.a.k.clients.admin.AdminClientConfig : AdminClientConfig values:
security.protocol = SSL
ssl.key.password = [hidden]
ssl.keystore.location = //keystore.jks
ssl.keystore.password = [hidden]
ssl.truststore.location = //truststore.jks
ssl.truststore.password = [hidden]
2018-06-14 13:15:35.586 INFO 91844 --- [ main] o.a.k.clients.consumer.ConsumerConfig : ConsumerConfig values:
security.protocol = PLAINTEXT
ssl.keystore.location = null
ssl.keystore.password = null
ssl.truststore.location = null
ssl.truststore.password = null
2018-06-14 13:15:35.609 INFO 91844 --- [ main] o.a.k.clients.producer.ProducerConfig : ProducerConfig values:
security.protocol = PLAINTEXT
ssl.key.password = null
ssl.keystore.location = null
ssl.keystore.password = null
ssl.truststore.location = null
ssl.truststore.password = null