User guide
Your client connection to the database appears to hang or timeout when running long queries, such as
a COPY command. In this case, you might observe that the Amazon Redshift console displays that the
query has completed, but the client tool itself still appears to be running the query. The results of the
query might be missing or incomplete depending on when the connection stopped.
Possible solutions:
This happens when you connect to Amazon Redshift from a computer other than an Amazon EC2 instance,
and idle connections are terminated by an intermediate network component, such as a firewall, after a
period of inactivity. This behavior is typical when you log in from a Virtual Private Network (VPN) or your
local network.
To avoid these timeouts, we recommend the following changes:
• Increase client system values that deal with TCP/IP timeouts.You should make these changes on the
computer you are using to connect to your cluster.The timeout period should be adjusted for your client
and network. See To change TCP/IP timeout settings (p. 174).
• Optionally, set keep-alive behavior at the DSN level. See To change DSN timeout settings (p. 175).
To change TCP/IP timeout settings
• Configure the timeout settings according to the operating system that you use to connect to your
cluster.
a. Linux — If your client is running on Linux, run the following command as the root user.
/sbin/sysctl -w net.ipv4.tcp_keepalive_time=200
net.ipv4.tcp_keepalive_intvl=200 net.ipv4.tcp_keepalive_probes=5
b. Windows — If your client runs on Windows, edit the values for the following registry settings
under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\:
• KeepAliveTime: 30000
• KeepAliveInterval: 1000
• TcpMaxDataRetransmissions: 10
These settings use the DWORD data type. If they do not exist under the registry path, you can
create the settings and specify these recommended values. For more information about editing
the Windows registry, refer to Windows documentation.
After you set these values, restart your computer for the changes to take effect.
c. Mac — If your client is running on a Mac, create or modify the /etc/sysctl.conf file with the following
values:
net.inet.tcp.keepidle=20000
net.inet.tcp.keepintvl=20000
net.inet.tcp.keepinit=20000
net.inet.tcp.always_keepalive=1
Restart your computer, and then run the following commands to verify the values are set:
API Version 2012-12-01
174
Amazon Redshift Management Guide
Troubleshooting Connection Issues in Amazon Redshift