使用 R 通过 SSL 连接到 Redshift [英] Connect to Redshift via SSL using R

查看:39
本文介绍了使用 R 通过 SSL 连接到 Redshift的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试连接到 R 中的 redshift 数据库.这需要通过 SSL 连接来完成,但我似乎找不到指定要在 dbConnect 中使用的证书文件路径的选项.令人惊讶的是,Google 并没有提供足够的帮助.

I'm currently trying to connect to a redshift database in R. This needs to be done over an SSL connection but I can't seem to find options to specify the path of the certificate file to use in dbConnect. Google hasn't been to helpful either surprisingly enough.

通过 R 建立到 redshift 的 postgres SSL 连接真的那么困难,还是我只是错过了一些基本的东西?

Is it really that difficult establish a postgres SSL connection to redshift via R or am I just missing out on something fundamental?

推荐答案

只需:

host = 'redshift-name.xxxxxxxxxxxx.eu-west-1.redshift.amazonaws.com'
dbname = 'your_db_name'
port = 3306
password = 'hunter2'
username = 'rs_user'
redshift_cert = paste0(FILE_PATH, 'redshift-ssl-ca-cert.pem')
pg_dsn = paste0(
    'dbname=', dbname, ' ',
    'sslrootcert=', redshift_cert, ' ',
    'sslmode=verify-full'
)
dbConnect(RPostgreSQL::PostgreSQL(), dbname=pg_dsn, host=host, port=port, password=password, user=username)

这篇关于使用 R 通过 SSL 连接到 Redshift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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