DB2® for Linux, UNIX, and Windows servers
provide high availability for client applications, through workload
balancing and automatic client reroute. This support is available
for applications that use non-Java clients (ODBC, CLI,
.NET, OLE DB, PHP, Ruby, or embedded SQL), as well as Java™ clients (JDBC, SQLJ, or pureQuery).
For non-Java clients, you must use one of the listed clients or
client packages to take advantage of high availability support:
- IBM® Data
Server Client
- IBM Data Server Runtime Client
- IBM Data
Server Driver Package
- IBM Data
Server Driver for ODBC and CLI
High availability support for connections to
DB2 for Linux, UNIX, and Windows servers
includes:
- Automatic client reroute
- This support enables a client to recover from a failure by attempting
to reconnect to the database through an alternate server. Reconnection
to another server is called failover. Client support
for automatic client reroute is enabled by default for non-Java clients
that connect to DB2 for Linux, UNIX, and Windows.
Servers
can provide automatic client reroute capability in any of the succeeding
ways:
- Several servers are configured in a DB2 pureScale® instance.
A connection to a database is a connection to a member of that DB2 pureScale instance.
Failover involves reconnection to another member of the DB2 pureScale instance.
This environment requires that clients use TCP/IP to connect to the DB2 pureScale instance.
- A DB2 pureScale instance and
an alternate server that is defined for a database. Failover first
involves reconnection to another member of the DB2 pureScale instance.
Failover to the server is attempted only if no member of the DB2 pureScale instance is
available.
- A DB2 pureScale instance is
defined for the primary server, and another DB2 pureScale instance is
defined for the server. Failover first involves reconnection to another
member of the primary DB2 pureScale instance.
Failover to the alternate DB2 pureScale instance is
attempted only if no member of the primary DB2 pureScale instance is
available.
- A database is defined on a single server. The configuration for
that database includes specification of an alternate server. Failover
involves reconnection to the alternate server.
In Version 9.7 Fix Pack 5 and later
fix packs, alternate groups are an additional failover mechanism for
automatic client rerouting when connectivity to the current group
cannot be re-established. A group is a database that is created
in a DB2 instance. In DB2 pureScale or
partitioned database environments, all the participant database servers
for a database are also considered a group. The database to which
your application explicitly connects to is called the primary group.
For CLI or
.NET client applications, failover for automatic client reroute can
be seamless or non-seamless. With non-seamless
failover, when the client application reconnects to another server
an error is always returned to the application to indicate that failover
(connection to the alternate server) occurred. With seamless failover,
the client does not return an error if a connection failure and successful
reconnection to an alternate server or alternate
group occurs during the execution of the first SQL statement
in a transaction.
In a DB2 pureScale instance,
you can use automatic client reroute support without workload balancing
or with workload balancing.
- Workload balancing
- Workload balancing can improve the availability of a DB2 pureScale instance.
With
workload balancing, a DB2 pureScale instance ensures
that work is distributed efficiently among members.
Non-Java clients on any operating system support workload
balancing. The connection from the client to the DB2 pureScale instance must
use TCP/IP.
When workload balancing is enabled, the client gets
frequent status information about the members of the DB2 pureScale instance through
a server list. The client caches the server list and uses the information
in it to determine the member to which the next transaction should
be routed.
For non-Java clients, the server list is cached in
the application process. It is shared for workload balancing only
by connections in that process.
DB2 for Linux, UNIX, and Windows supports
two types of workload balancing:
- Connection-level workload balancing
- Connection-level workload balancing is performed at connection
boundaries. It is supported only by non-Java clients. Client support
for connection-level workload balancing is enabled by default for
non-Java clients that connect to DB2 for Linux, UNIX, and Windows.
Connection-level
load balancing is most effective for connections whose duration is
short.
- Transaction-level workload balancing
- Transaction-level workload balancing is performed at transaction
boundaries. Client support for transaction-level workload balancing
is disabled by default for clients that connect to DB2 for Linux, UNIX, and Windows.
Transaction-level
load balancing is most effective for connections whose duration is
long.
- Client affinities
- Client affinities is an automatic client reroute solution that
is controlled completely by the client. It is intended for situations
in which you must connect to a particular primary server. If an outage
occurs during the connection to the primary server, you use client
affinities to enforce a specific order for failover to alternate servers.