python - 使用 Psycopg2 与 Redshift 的 SSL 连接

标签 python ssl ssl-certificate amazon-redshift psycopg2

我正在尝试通过 SSL 连接到 AWS Redshift 服务器。我在 python 中使用 psycopg2 库来建立连接,并使用 sslmode='require' 作为连接行中的参数。不幸的是我得到了这个错误:

sslmode value "require" invalid when SSL support is not compiled in

我读过许多其他类似的 PostgreSQL 案例,其中提到 PostgeSQL 版本存在问题,但我没有找到使用 Psycopg2 的 Redshift 的任何解决方案。我需要为 Redshift 安装任何特定的 SSL 证书吗?如果是,我如何使用 Psycopg2 进行操作?任何帮助将不胜感激。

最佳答案

这对我有用:https://stackoverflow.com/a/36489939/101266

had this same error, which turned out to be because I was using the Anaconda version of psycopg2. To fix it, I had adapt VictorF's solution from here and run:

conda uninstall psycopg2
sudo ln -s /Users/YOURUSERNAME/anaconda/lib/libssl.1.0.0.dylib /usr/local/lib
sudo ln -s /Users/YOURUSERNAME/anaconda/lib/libcrypto.1.0.0.dylib /usr/local/lib
pip install psycopg2

关于python - 使用 Psycopg2 与 Redshift 的 SSL 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37584629/

相关文章:

ssl - 在 GKE 的 Istio 入口网关中使用默认 SSL 证书

security - 关于 SSL 和 HTTPS 的好文章?

ssl - 如何在 Cloudfront 中使用 Amazon ACM 证书?

阿拉伯语的Python UTF8编码

python - Pygame 游戏加载时卡住

java - SSL Elasticsearch

node.js - Heroku SSL Websocket 通信

java - 我如何在 Java 中实现这个 Python 片段?

Python:运行外部命令时传递参数

ssl - 双语域通配符 SSL 证书?