【问题标题】:Connect to Redshift via SSL using R使用 R 通过 SSL 连接到 Redshift
【发布时间】:2015-04-13 12:14:24
【问题描述】:

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

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

【问题讨论】:

    标签: r amazon-redshift


    【解决方案1】:

    简单地做:

    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)
    

    【讨论】:

    • 这里的 cacert 变量是什么意思?是一个字符串,它给出了 redshift-ssl-ca-cert.pem 的位置?是 redshift-ssl-ca-cert.pem 的内容吗?输了!!
    • @hibernado 检查我的新编辑。是的,它必须是您的 redshift-ssl-ca-cert.pem 文件副本的文件名
    • 第一行不应该是host = 'redshift-name.xxxxxxxxxxxx.eu-west-1.redshift.amazonaws.com'吗?否则你的主机没有定义。
    • @Boxuan 是的 [padding]
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-01
    • 1970-01-01
    • 2014-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多