使用aws证书通过Databricks访问RDS

问题描述 投票:0回答:1

我尝试使用 Spark jdbc 访问 rds 实例(mySql),但出现以下错误:

SQLNonTransientConnectionException: Could not connect to address=(host=<rds-host>)(port=3306)(type=master) : Could not connect to <rds-host> : PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: SQLNonTransientConnectionException: Could not connect to <rds-host> : PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: SunCertPathBuilderException: unable to find valid certification path to requested target

店主告诉我他们使用的证书是global-bundle,所以我将其转换为jsk并上传到databricks dbfs。

我正在尝试再次访问:

val reader = spark.read
      .format("jdbc")
      .option("url", "<jdbc-url>/<database>?useSsl=true&verifyServerCertificate=true&trustCertificateKeyStoreUrl=dbfs:/FileStore/tables/rds_ca.jks&trustCertificateKeyStorePassword=<password>")
      .option("user", "<username>")
      .option("dbtable","<table>")
      .option("password", "<password>")
      .load()

      reader.show()

我遇到了与上面相同的错误。

amazon-web-services ssl-certificate databricks amazon-rds
1个回答
0
投票

当您编写

dbfs:/FileStore...
时,JDBC 驱动程序不知道如何访问 DBFS 文件系统。

然而,DBFS 安装在驱动程序和所有执行程序上,所以这应该可以工作:

/dbfs

© www.soinside.com 2019 - 2024. All rights reserved.