Configuring the HADR primary server

On the primary server, configure the high availability disaster recovery (HADR) variables and verify your settings.

Before you begin

Complete the installation of IBM® InfoSphere® Information Server. The installation must be operational before you complete the HADR configuration.

Complete HADR configuration as soon as the InfoSphere Information Server installation is operational.

Procedure

  1. Log in to the primary server as an administrator.
  2. Run the following commands to specify the HADR primary server and standby server:
    db2 update db cfg for database using hadr_local_host primary_IP
    db2 update db cfg for database using hadr_remote_host standby_IP
    The primary_IP address and the secondary_IP address can be an IPv4 address or an IPv6 address. For example:
    db2 update db cfg for xmeta using hadr_local_host 192.0.2.6  | ::ffff:192.0.2.6
    db2 update db cfg for xmeta using hadr_remote_host 192.0.2.7 | ::ffff:192.0.2.7
  3. Run the following commands to specify the HADR primary and standby service names:
    db2 update db cfg for database using hadr_local_svc primary_svc_name
    db2 update db cfg for database using hadr_remote_svc standby_svc_name

    In the commands, the service names must match the HADR port names that are used in the services file.

    For example:
    db2 update db cfg for xmeta using hadr_local_svc ha_myhadr
    db2 update db cfg for xmeta using hadr_remote_svc ha_myhadr_int
  4. Run the following command to specify the DB2® instance name on the standby server:
    db2 update db cfg for database using hadr_remote_inst DB2_standby_instance
    For example:
    db2 update db cfg for xmeta using hadr_remote_inst db2inst1
  5. Run the following command to specify the time (in seconds) that the HADR process waits before considering a communication attempt to have failed:
    db2 update db cfg for database using hadr_timeout timeout
    For example:
    db2 update db cfg for xmeta using hadr_timeout 120
  6. Run the following command to specify the HADR synchronization mode:
    db2 update db cfg for database using hadr_syncmode mode
    For example:
    db2 update db cfg for xmeta using hadr_syncmode SYNC

    When configuring the synchronization mode, choose synchronous mode (SYNC) or near synchronous mode (NEARSYNC). Either mode typically provides adequate response time for InfoSphere Information Server. Avoid choosing asynchronous mode (ASYNC) because ASYNC mode has the highest chance of transaction loss if the primary server fails.

  7. Run the following command to specify the time (in seconds) that the HADR process waits before considering a communication attempt to have failed:
    db2 update db cfg for database using hadr_timeout timeout
    For example:
    db2 update db cfg for xmeta using hadr_timeout 120
  8. Run the following command to activate the "log index pages created" feature. When logindexbuild is on, index creation, recreation, and reorganization operations are logged. This logging allows indexes to be reconstructed during DB2 roll-forward operations or HADR log replay procedures.
    db2 update db cfg for xmeta using logindexbuild on
  9. Run the following command to specify that active log files be retained and become online archive log files for use in rollforward recovery.
    db2 update db cfg for xmeta using logarchmeth1 logretain immediate
  10. Run the following command to set up automatic client reroute:
    db2 update alternate server for database database using hostname standby_IP 
       port port
    For example:
    db2 update alternate server for database xmeta using hostname
      192.0.2.7 | ::ffff:192.0.2.7 
      port 60000
  11. Run the following command to verify your configuration values:
    db2 get db cfg for database | grep HADR
    For example:
    db2 get db cfg for xmeta | grep HADR
    The command displays a report:
    HADR database role                                 = STANDARD
    HADR local host name             (HADR_LOCAL_HOST) = myprimary.example.com
    HADR local service name           (HADR_LOCAL_SVC) = ha_myhadr
    HADR remote host name           (HADR_REMOTE_HOST) = mystandby.example.com
    HADR remote service name         (HADR_REMOTE_SVC) = ha_myhadr_int
    HADR instance name of remote server  (HADR_REMOTE_INST) = db2inst1
    HADR timeout value                       (HADR_TIMEOUT) = 120
    HADR log write synchronization mode     (HADR_SYNCMODE) = SYNC