Storing transaction and compensation logs in a relational database for high availability

You can, optionally, choose to store your WebSphere® Application Server transaction and compensation logs in a relational database rather than as operating system files. This feature provides high availability (HA) support without having to use a shared file system.

About this task

The WebSphere Application Server transaction service writes information to a transaction log for every global transaction that involves two or more resources, or that is distributed across multiple servers. These transactions are started or stopped either by applications or by the container in which they are deployed. The transaction service maintains transaction logs to ensure the integrity of transactions. Information is written to the transaction logs in the prepare phase of a distributed transaction, so that if a Websphere Application Server with active transactions restarts after a failure, the transaction service is able to use the logs to replay any in-doubt transactions. This allows the overall system to be brought back to a consistent state.

In previous releases of WebSphere Application Server, the transaction logs were stored as operating system files. In WebSphere Application Server Version 8.0 fix pack 7 and later, this remains the default configuration but you can, optionally, choose to store the transaction logs in a relational database. This configuration option is aimed at customers working in a high availability (HA) environment. In previous releases of WebSphere Application Server, HA transaction support required the use of a shared file system to host the transaction logs, such as an NFSv4-mounted network attached storage (NAS) or a storage area network (SAN). This new feature allows customers, particularly those with an investment in HA database technology, to use their HA database as a shared repository for the transaction logs, as an alternative to using a shared file system.

In WebSphere Application Server Version 8.0 fix pack 7 and later, you can use a similar facility, also aimed at customers working in a HA environment, to store the compensation recovery logs in a relational database. The WebSphere Application Server compensation service allows applications on disparate systems to coordinate activities that are more loosely coupled than atomic transactions. It stores information, in its own dedicated recovery logs, that is necessary to perform compensation after a system failure.

Procedure

    You must configure the transaction log location and the compensation log location for each server in the cluster before enabling high availability, by setting the TransactionLogDirectory and CompensationLogDirectory attributes for each server. Each server in a cluster must reference unique transaction log and compensation log directories, by specifying a distinct tablesuffix property, so that multiple servers do not contend for relational database management system (RDBMS) resources. Furthermore, each server in the cluster must reference the same datasource to allow peer recovery.Complete the following steps:
  1. Configure a non-transactional data source for transaction and compensation recovery log storage:
    1. Create a JDBC provider for your specific RDBMS implementation. Specify an implementation type of non-XA.
    2. Create a JAAS J2C authentication data alias. This defines the security credentials that are used to connect to the RDBMS. The credentials defined in the RDBMS must have sufficient authority to create tables in the database.
    3. Create a new data source by using the JDBC provider created in step a. Its component managed authentication alias must be set to the JAAS alias created in step b. Define the URL for your data source to specify a connection to the RDBMS.
    4. Configure the new data source to be non-transactional by completing the following steps:
      1. Open your newly created data source.
      2. Under Additional Properties, click WebSphere Application Server data source properties.
      3. Select the Non-transactional data source check box.
      4. Save your changes.
  2. Configure the transaction service to store transactions in a relational database:
    1. In the WebSphere Application Server administrative console, click Servers > Server Types > WebSphere application servers > server_name . The properties of the specified application server are displayed.
    2. In the Container Settings section, click Container Services > Transaction service. The transaction service settings page is displayed.
    3. Select the Configuration tab if it is not already displayed.
    4. In the Transaction log directory field, enter a custom string to indicate that you want your logs to be stored in a database. The string must have the following format:
      custom://com.ibm.rls.jdbc.SQLRecoveryLog?datasource=data_source_jndi_name,tablesuffix=suffix
      where data_source_jndi_name is the JNDI name of the non-transactional data source created previously, and suffix is a string that you must set to uniquely label each member of your HA cluster.
      Restriction: If you are using an Oracle database, the length of the suffix string must not exceed 15 characters.
  3. Configure the compensation service to store transactions in a relational database:
    1. In the WebSphere Application Server administrative console, click Servers > Server Types > WebSphere application servers > server_name . The properties of the specified application server are displayed.
    2. In the Container Settings section, click Container Services > Compensation service. The compensation service settings page is displayed.
    3. Select the Configuration tab if it is not already displayed.
    4. In the Recovery log directory field, enter a custom string to indicate that you want your logs to be stored in a database. The string must have the following format:
      custom://com.ibm.rls.jdbc.SQLRecoveryLog?datasource=data_source_jndi_name,tablesuffix=suffix
      where data_source_jndi_name is the JNDI name of the non-transactional data source created previously, and suffix is a string that you must set to uniquely label each member of your HA cluster.
      Restriction: If you are using an Oracle database, the length of the suffix string must not exceed 15 characters.
  4. (optional) Create the database tables.

    WebSphere Application Server attempts to create the necessary database tables when it first starts. When this is not possible, due to insufficient permission for example, the server fails to start. Under these circumstances, you must create the three required database tables manually.

    The following DDL structures show how to create the tables on DB2®:
    CREATE TABLE WAS_TRAN_LOG(
      SERVER_NAME VARCHAR(128),
      SERVICE_ID SMALLINT,
      RU_ID BIGINT,
      RUSECTION_ID BIGINT,
      RUSECTION_DATA_INDEX SMALLINT,
      DATA LONG VARCHAR FOR BIT DATA) 
    CREATE TABLE WAS_PARTNER_LOG(
      SERVER_NAME VARCHAR(128),
      SERVICE_ID SMALLINT,
      RU_ID BIGINT,
      RUSECTION_ID BIGINT,
      RUSECTION_DATA_INDEX SMALLINT,
      DATA LONG VARCHAR FOR BIT DATA) 
    CREATE TABLE WAS_COMP_LOG(
      SERVER_NAME VARCHAR(128),
      SERVICE_ID SMALLINT,
      RU_ID BIGINT,
      RUSECTION_ID BIGINT,
      RUSECTION_DATA_INDEX SMALLINT,
      DATA LONG VARCHAR FOR BIT DATA) 
    The following DDL structures shows how to create the database table on Oracle:
    CREATE TABLE WAS_TRAN_LOG(
      SERVER_NAME VARCHAR(128),
      SERVICE_ID SMALLINT,
      RU_ID NUMBER(19),
      RUSECTION_ID NUMBER(19),
      RUSECTION_DATA_INDEX SMALLINT,
      DATA BLOB)
    CREATE TABLE WAS_PARTNER_LOG(
      SERVER_NAME VARCHAR(128),
      SERVICE_ID SMALLINT,
      RU_ID NUMBER(19),
      RUSECTION_ID NUMBER(19),
      RUSECTION_DATA_INDEX SMALLINT,
      DATA BLOB)
    CREATE TABLE WAS_COMP_LOG(
      SERVER_NAME VARCHAR(128),
      SERVICE_ID SMALLINT,
      RU_ID NUMBER(19),
      RUSECTION_ID NUMBER(19),
      RUSECTION_DATA_INDEX SMALLINT,
      DATA BLOB)
Task topic Task topic    

Terms and conditions for information centers | Feedback

Last updatedLast updated: Jan 30, 2014 9:17:32 AM CST
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-iseries&topic=tjta_store_logs_in_rdb
File name: tjta_store_logs_in_rdb.html