3

我正在尝试为 Cassandra Spark 连接器配置 SSL,但我找不到如何执行此操作的示例。

我正在尝试像这样配置它:

SparkConf conf = new SparkConf().setAppName("someApp")
        .set("spark.cassandra.connection.host", "111.111.111.111")
        .set("spark.cassandra.connection.ssl.enabled", "true")
        .set("spark.cassandra.connection.ssl.trustStore.path", "/some/tfile.jks")
        .set("spark.cassandra.connection.ssl.trustStore.password", "apassword")
        .set("spark.cassandra.connection.ssl.trustStore.type", "JKS")
        .set("spark.cassandra.connection.ssl.enabledAlgorithms", "TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA")
        .set("spark.cassandra.connection.ssl.keyStore.path", "/some/kfile.jks")
        .set("spark.cassandra.connection.ssl.keyStore.password", "anotherpassword")
        .set("spark.cassandra.connection.ssl.keyStore.type", "JKS")
        .set("spark.cassandra.connection.ssl.protocol", "TLS");

当我尝试提交 spark 作业时,出现以下错误:

Exception in thread "main" com.datastax.spark.connector.util.ConfigCheck$ConnectorConfigurationException: Invalid Config Variables
Only known spark.cassandra.* variables are allowed when using the Spark Cassandra Connector.
spark.cassandra.connection.ssl.keyStore.password is not a valid Spark Cassandra Connector variable.
No likely matches found.
spark.cassandra.connection.ssl.enabled is not a valid Spark Cassandra Connector variable.
No likely matches found.
spark.cassandra.connection.ssl.protocol is not a valid Spark Cassandra Connector variable.
No likely matches found.
spark.cassandra.connection.ssl.keyStore.type is not a valid Spark Cassandra Connector variable.
No likely matches found.
spark.cassandra.connection.ssl.trustStore.path is not a valid Spark Cassandra Connector variable.
No likely matches found.
spark.cassandra.connection.ssl.enabledAlgorithms is not a valid Spark Cassandra Connector variable.
No likely matches found.
spark.cassandra.connection.ssl.keyStore.path is not a valid Spark Cassandra Connector variable.
No likely matches found.
spark.cassandra.connection.ssl.trustStore.password is not a valid Spark Cassandra Connector variable.
No likely matches found.
spark.cassandra.connection.ssl.trustStore.type is not a valid Spark Cassandra Connector variable.
No likely matches found.

所以我不确定这是否受支持,或者我只是使用了错误的属性名称。

我看到了连接器 1.2.3 版的这张,但我找不到如何使用它的示例,而且听起来它可能不支持密钥库。我使用的是 1.4.0-M1 版本的连接器。

谁能告诉我如何为 Spark Cassandra 连接器配置 SSL 的示例?谢谢。

4

1 回答 1

3

虽然我没有看到任何密钥库配置,但我可以看到下面的配置变量,它们对我来说工作正常。

注意:我使用的是 1.5.0-M1 版本。不确定您使用的版本中是否还有其他错误。

sparkConf.set("spark.cassandra.connection.ssl.enabled", "true");
sparkConf.set("spark.cassandra.connection.ssl.trustStore.password", "password");
sparkConf.set("spark.cassandra.connection.ssl.trustStore.path", "jks file path");
于 2016-03-21T23:03:28.347 回答