简体   繁体   English

Dataproc:未找到连接到外部 PostgreSQL 的 Sqoop 作业的 SSL 证书

[英]Dataproc: SSL certificate not found for Sqoop job connecting to external PostgreSQL

I need to connect to PostgreSQL db via SSL.我需要通过 SSL 连接到 PostgreSQL 数据库。 I received 2 certificates and 1 key -> sslrootcert=root.crt sslcert=postgresql.crt and sslkey=postgresql.key.der我收到了 2 个证书和 1 个密钥 -> sslrootcert=root.crt sslcert=postgresql.crt 和 sslkey=postgresql.key.der

Here is my import config from Dataproc:这是我从 Dataproc 导入的配置:

import
-Dmapreduce.job.user.classpath.first=true
-Dhadoop.security.credential.provider.path=jceks://hdfs/secrets/prod/db.jceks
--connect=jdbc:postgresql://xxx.x.x/DBNAME?sslrootcert=root.crt&sslcert=postgresql.crt&sslkey=postgresql.key.der
--username=user1
--table=db1
--target-dir=gs://bucket
--delete-target-dir
--as-avrodatafile
--password-alias=password

The Dataproc coundn't find my SSL certificates: Error: java.lang.RuntimeException: java.lang.RuntimeException: org.postgresql.util.PSQLException: Could not open SSL certificate file postgresql.crt Dataproc 找不到我的 SSL 证书: Error: java.lang.RuntimeException: java.lang.RuntimeException: org.postgresql.util.PSQLException: Could not open SSL certificate file postgresql.crt

How I could add certificates and key to dataproc to be sure that these certs be accessible in connection config.我如何将证书和密钥添加到 dataproc 以确保这些证书可以在连接配置中访问。

Where I should store SSL certificates to use them in import config during run job :我应该在哪里存储 SSL 证书以在运行作业期间在导入配置中使用它们:

--connect=jdbc:postgresql://xxx.x.x/DBNAME?sslrootcert=/???/??/root.crt&sslcert=/???/??/postgresql.crt&sslkey=/???/??/postgresql.key.der

I think you can add the server certificate or its root CA certificate to Dataproc VMs at ${JAVA_HOME}/jre/lib/security/cacerts , for Dataproc it is /usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/jre/lib/security/cacerts .我认为您可以将服务器证书或其根 CA 证书添加到${JAVA_HOME}/jre/lib/security/cacerts Dataproc VM,对于 Dataproc,它是/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/jre/lib/security/cacerts You can use an init action or create a custom image to get the cert in the dir.您可以使用 init 操作或创建自定义图像来获取目录中的证书。

See this doc and this question for more details.有关更多详细信息,请参阅此 文档和此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM