简体   繁体   中英

SSL connection to Redshift using Psycopg2

I am trying to connect to a AWS Redshift server via SSL. I am using psycopg2 library in python to establish the connection and used sslmode='require' as a parameter in the connect line. Unfortunately i got this error:

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

I read many other similar cases for PostgreSQL which mention the problem exists with the PostgeSQL version, but i didn't find any solutions for Redshift using Psycopg2. Do i need to install any specific SSL certificate for Redshift? If yes, how do i do it with Psycopg2? Any help will be appreciated.

This worked for me: 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

Is your cluster enabled for SSL connections? Your URL itself will have the SSL info. and you can use the same in your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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