AbsaOSS / ABRiS

Avro SerDe for Apache Spark structured APIs.
Apache License 2.0
230 stars 75 forks source link

Question :Unable to connect to Kafka Brokers with SSL security #204

Closed rameshbhargavsekhar-rogers closed 3 years ago

rameshbhargavsekhar-rogers commented 3 years ago

I have been trying for a while connecting Kafka Brokers with SSL securities, My cluster is Azure Databrick and written code on azure note books. I tried so many possible options, but non of them helped. After resolving many error write now I am at "Caused by: NoSuchFileException:/<>/tmp/keystore<>.jks" .

These are the properties which I am implemented :

def writeAvro(dataFrame: DataFrame, schemaRegistryConfig: Map[String, String]) = {

    val allColumns = struct(dataFrame.columns.head, dataFrame.columns.tail: _*)
    dataFrame.select(to_confluent_avro(allColumns, schemaRegistryConfig) as 'value).write
      .format("kafka")
      .option("kafka.bootstrap.servers","<>:9095")
      .option("topic",topicName)
      .option("key.serializer", keySerializer)
      .option("value.serializer", valueSerializer)
      .option(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer")
      .option(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer")
      .option("kafka.security.protocol","SSL")
      .option("kafka.ssl.truststore.location",sslTrustStore_location.getAbsolutePath())
      .option("kafka.ssl.truststore.password",sslTrustStorePwd)
      .option("kafka.ssl.keystore.location", sslKeyStore_location.getAbsolutePath())
      .option("kafka.ssl.keystore.password",sslKeyPwd)
      .option("kafka.ssl.key.password",sslKeyPwd)
      .save()
  }

this method will help me to write the data from Datavrame and connect to the topic and publish.

note: with our ssl this method working seamlessly.

Need help to understand what is it I am missing.

cerveada commented 3 years ago

Sorry, but this doesn't seem to be an Abris issue. Unless you believe your problems are somehow caused by Abris you should probably ask on some Kafka forum or maybe Stack Overflow.