The recommended method of setting the keepalive parameters
on the client is to use the keepAliveTimeout parameter
in the db2dsdriver.cfg configuration file.
About this task
The values provided in these commands are suggested values,
but you should fine-tune these settings based on your specific network
and server capabilities.
Procedure
There are two methods to update the TCP/IP keepalive
parameters:
- Modify the db2dsdriver.cfg file.
To set this parameter, edit the
db2dsdriver.cfg file
and place the
keepAliveTimeout line outside of
the
<acr> section, but still within the
<databases> parent
section. For example:
<configuration>
<dsncollection>
<dsn alias="D3D" name="D3D" host="DB2PS-member0" port="5912" />
</dsncollection>
<databases>
<database name="D3D" host="DB2PS-member0" port="5912">
<parameter name="keepAliveTimeout" value="20"/>
<acr>
<parameter name="enableAcr" value="true"/>
<parameter name="enableSeamlessAcr" value="true"/>
<parameter name="affinityFailbackInterval" value="15"/>
</acr>
</database>
</databases>
...
</configuration>
This method is recommended because
it can be used for both instance-based clients and drivers without
an instance. In addition, by utilizing the db2dsdriver.cfg file,
each individual database can have a different keepAliveTimeout setting.
- Modify the DB2TCP_CLIENT_KEEPALIVE_TIMEOUT parameter
The second method for updating the keepalive parameters is
to set the DB2TCP_CLIENT_KEEPALIVE_TIMEOUT parameter
to detect failures in the TCP/IP communication layer.
To update
this parameter, from a command window or terminal on the client, issue
this command:
db2set DB2TCP_CLIENT_KEEPALIVE_TIMEOUT=20
This
value is specified in seconds.
Note: While TCP/IP timeout keepalive
is also supported for instance attachments, it can only be set using
this second method of specifying a value for the DB2TCP_CLIENT_KEEPALIVE_TIMEOUT parameter.
Note that automatic client reroute (acr) does not apply in the case
of instance attachments.
Setting the operating system level parameters can help with early
detection of a non-responsive socket at the remote end. For faster
client reroute, configure the TCP/IP keepalive parameter settings
at the operating system level.