将Google CloudSQL Postgres数据库连接到Data Studio [英] Connect a Google CloudSQL Postgres database to Data Studio

查看:129
本文介绍了将Google CloudSQL Postgres数据库连接到Data Studio的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Google Cloud Sql实例中托管的Postgres数据库连接到Data Studio。
我已按照说明进行操作(在此处找到
当我按身份验证时,我收到一条错误消息:

Pl轻松确保私钥为PKCS8格式。



我尝试通过运行以下命令更改客户端密钥文件的格式:

openssl pkcs8 -topk8-通知PEM-更新DER-输入client-key.pem -out client-key.pkcs8 -nocrypt



,但随后出现错误:

无法访问主机。请仔细检查您的连接参数。在此处了解有关数据库连接器的更多信息。



最后必须注意,如果我尝试使用ssl从本地计算机连接到数据库,并且完全相同密钥,但客户端密钥为 pem 格式,则我可以成功连接。



我应该将证书转换为其他格式呢?
我觉得通过SSL将Postgres db连接到Data Studio并不难,难道我缺少明显的东西吗?



任何帮助都会



谢谢。

解决方案

最终只需更改客户端密钥的格式即可。
上面的命令不起作用的原因是更改格式的命令错误。



应为:

openssl pkcs8 -topk8 -inform PEM -outform PEM -in client-key.pem -out client-key.key -nocrypt

(注意PEM,而不是问题中张贴的DER参数。)



因此Data Studio连接有效!快乐的日子!


I am trying to connect a Postgres database hosted in a google Cloud Sql instance to Data Studio. I have followed the instructions (found here https://support.google.com/datastudio/answer/7288010) but to my disappointment, I still cannot connect to the database from Data Studio.

I think the problem lies with the SSL connection, as if I enable "non-secure connections" in the options in CloudSql I can successfully connect from Data Studio.

I have created the 3 files required for the ssl connection to work:

  • Client certificate
  • Client key
  • Server certificate

I have uploaded them in the relevant fields in the Data Studio connection page: When I press authenticate I get an error saying: Please make sure that the private key is in PKCS8 format.

I tried changing the format of the client key file by running: openssl pkcs8 -topk8 -inform PEM -outform DER -in client-key.pem -out client-key.pkcs8 -nocrypt

but then I get an error: Can't reach the host. Please double check your connection parameters. Learn more about database connectors here.

Finally it must be noted that if I try to connect to the database from my local machine using ssl and the exact same keys, but the client key in the pem format, I can connect successfully.

Should I convert the certificate to other formats too? I feel like connecting a Postgres db to Data Studio over SSL is something that shouldn't be that difficult, am I missing something obvious?

Any help would be greatly appreciated.

Thanks.

解决方案

Eventually it turns out that just changing the format of the client key works. The reason the above didn't work was that the command to change the format was wrong.

It should be: openssl pkcs8 -topk8 -inform PEM -outform PEM -in client-key.pem -out client-key.key -nocrypt (notice the PEM instead of DER parameter that is posted in the question).

So Data Studio connection works! Happy days!

这篇关于将Google CloudSQL Postgres数据库连接到Data Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆