The suggest url for my redshift server has a ?tcpKeepAlive=true
appended to it, so that it looks something like
jdbc:postgresql://myserver:myport/dbname?tcpKeepAlive=true
Now, the RPostgres::dbConnect
function has signature
dbConnect(dbname = NULL, host = NULL, port = NULL, password = NULL, user = NULL, ...)
and the man for dbConnect
says that
...
- Other name-value pairs that describe additional connection options as described at http://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS
However, the closest connection options I can see to what I'm looking for are
keepalives
:Controls whether client-side TCP keepalives are used. The default value is 1, meaning on, but you can change this to 0, meaning off, if keepalives are not wanted. This parameter is ignored for connections made via a Unix-domain socket.
keepalives_idle
:Controls the number of seconds of inactivity after which TCP should send a keepalive message to the server. A value of zero uses the system default. This parameter is ignored for connections made via a Unix-domain socket, or if keepalives are disabled. It is only supported on systems where the TCP_KEEPIDLE or TCP_KEEPALIVE socket option is available, and on Windows; on other systems, it has no effect.
keepalives_interval
:Controls the number of seconds after which a TCP keepalive message that is not acknowledged by the server should be retransmitted. A value of zero uses the system default. This parameter is ignored for connections made via a Unix-domain socket, or if keepalives are disabled. It is only supported on systems where the TCP_KEEPINTVL socket option is available, and on Windows; on other systems, it has no effect. keepalives_count
And I'm not sure how to use these to mimic the effect of ?tcpKeepAlive=true
...
I imagine I could do something like
myConn <- dbConnect(dbname = "dbname",
host = "myserver",
port = "myport",
user = "StevieP",
password = "faketown101",
keepalives = x,
keepalives_idle = y,
keepalives_interval = z)
But I'm wondering what values I need to choose for x
, y
, and z
?