Configuring TCP KeepAlive settings

The failover design of the messaging engine relies upon the database connections that are broken when a messaging engine instance fails. In order for failover to occur in high availability environments, ensure that the system notices the broken connection in a timely manner and releases database locks. This task is done by configuring the TCP KeepAlive settings.

Before you begin

You must have DB2® database installed and configured on your system. Run the following commands on the computer that has your DB2 database server.

Procedure

For Windows operating system, perform the following steps:

  1. Log in as a system administrator.
  2. Select the following path in the left pane:

    My Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters

  3. Right click in the right pane and select New > DWORD Value
  4. Enter the name as KeepAliveInterval for the new parameter.
  5. Right click this new parameter and select Modify.
  6. Select Base as Decimal and enter the value as 30000 (30000 milliseconds = 30 seconds).
  7. Similarly, add another DWORD value with name KeepAliveTime and set the value equal to 30000.
  8. Restart the computer for changes to take effect.

For Linux operating system, perform the following steps:

  1. Log in as a system administrator.
  2. Edit the sysctl.conf file: # vi /etc/sysctl.conf
  3. Add the following parameter values:
    net.ipv4.tcp_keepalive_time = 600
    net.ipv4.tcp_keepalive_intvl = 60
    net.ipv4.tcp_keepalive_probes = 20
    
  4. Run the following commands to save your changes:
    echo "net.ipv4.tcp_keepalive_time = 600" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv4.tcp_keepalive_intvl = 60" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv4.tcp_keepalive_probes = 20" | sudo tee -a /etc/sysctl.conf
    
  5. Restart your computer for changes to take effect. shutdown -r now
  6. After the computer restarts, you can use the following command to view all the kernel parameters: sysctl -a