? tcpKeepAlive = true and RPostgres

In the suggested url for my server, redshift is added ?tcpKeepAlive=true

so it looks something like this:

jdbc:postgresql://myserver:myport/dbname?tcpKeepAlive=true

      

The function RPostgres::dbConnect

is now signed

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 parameters, as described at http://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS

However, the closest connection parameters I can see to what I'm looking for is

  • keepalives

    :

    Controls the use of client TCP keepalives. The default is 1, which is the value, but you can change that to 0, which is to turn it off if keepalives are not needed. This parameter is ignored for connections made over 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 over 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, this has no effect.

  • keepalives_interval

    :

    Controls the number of seconds after which a TCP recheck message that is not acknowledged by the server must be retransmitted. A value of zero uses the system default. This parameter is ignored for connections made over 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, this has no effect. keepalives_count

And I'm not sure how to use them to simulate the effect ?tcpKeepAlive=true

...

I am guessing I can 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 am wondering what values ​​do I need to select for x

, y

and z

?

+3


source to share





All Articles