DB2: Enabling support for high availability data replication | HCL Digital Experience
Optional: To prevent data loss on DB2, modify the JCR schema to support high availability
data replication (HADR).
Before you begin
Before you enable the HADR, use the Database Transfer option in the
Configuration Wizard to transfer your data from Apache Derby to DB2®.
About this task
Tip: Read the following tips before you enable support for high availability data replication:
Do NOT set the custom property enableClientAffinitiesList to
true. It is not necessary with newer DB2® versions. Setting this value to
true in DB2® 10.1 means that
ONLY servers that are listed in the alternative server names list are used for connecting to the
database.
The db2inst1 and lcuser values need to be the same
passwords on both DB2® servers.
Procedure
Stop the portal server. Depending on your environment,
you might have multiple portal servers to stop.
Back up the JCR database. The reconfigure-jcr-for-hadr task permanently
changes the JCR schema.
Open a command prompt and change to the wp_profile_root\ConfigEngine directory.
Run the reconfigure-jcr-for-hadr task to convert columns in ICMUTMWIDE0
table from NOT LOGGED BLOB (Binary Large Object) TO LOGGED BLOB.
Note: For clustered environments, run this task only from one node.
DB2_HADR_DB_1 represents a database on the primary server.
DB2_HADR_DB_2 represents a database on the standby server.
Run the following command, for each portal database, to enable log archiving in the
databases:
db2 update db cfg for DBNAME using LOGARCHMETH1 LOGRETAIN
The archive logs are stored in the log directory. The databases are placed into the backup
pending state, which is required for the standby server.
Run the following command for each portal database to take an offline backup:
db2 "backup database DBNAME"
Enter the following commands to configure the HADR parameters:
db2 update db cfg for DBNAME using HADR_LOCAL_HOST IP_ADDRESS_OF_PRIMARY
db2 update db cfg for DBNAME using HADR_LOCAL_SVC PORT_NUMBER_OF_PRIMARY
db2 update db cfg for DBNAME using HADR_REMOTE_HOST IP_ADDRESS_OF_STNDBY
db2 update db cfg for DBNAME using HADR_REMOTE_SVC PORT_NUMBER_OF_STNDBY
db2 update db cfg for DBNAME using HADR_REMOTE_INST INSTNAME_OF_STNDBY
db2 update db cfg for DBNAME using HADR_TIMEOUT 120
db2 update db cfg for DBNAME using HADR_SYNCMODE NEARSYNC
db2 update db cfg for DBNAME using HADR_SPOOL_LIMIT 0
db2 update db cfg for DBNAME using HADR_REPLAY_DELAY 0
db2 update db cfg for DBNAME using HADR_PEER_WINDOW 0
db2 update db cfg for DBNAME using LOGINDEXBUILD ON
For
example:
db2 update db cfg for COM85DB using HADR_LOCAL_HOST psvtclc08.rtp.raleigh.ibm.com
db2 update db cfg for COM85DB using HADR_LOCAL_SVC 50003
db2 update db cfg for COM85DB using HADR_REMOTE_HOST 9.37.17.237
db2 update db cfg for COM85DB using HADR_REMOTE_SVC 50004
db2 update db cfg for COM85DB using HADR_REMOTE_INST db2inst1
db2 update db cfg for COM85DB using HADR_TIMEOUT 120
db2 update db cfg for COM85DB using HADR_SYNCMODE NEARSYNC
db2 update db cfg for COM85DB using HADR_SPOOL_LIMIT 0
db2 update db cfg for COM85DB using HADR_REPLAY_DELAY 0
db2 update db cfg for COM85DB using HADR_PEER_WINDOW 0
db2 update db cfg for COM85DB using LOGINDEXBUILD ON
Enter the following command to update the database catalog with alternative server
information:
UPDATE ALTERNATE SERVER FOR DATABASE database USING HOSTNAME hostname PORT instance_portnumber
For
example:
db2 UPDATE ALTERNATE SERVER FOR DATABASE COM85DB USING HOSTNAME 9.37.17.237 PORT 50000
Run the following command for each portal database to take an offline backup:
db2 "backup database DBNAME"
Complete the following steps on the standby databases:
Ensure that both the primary and standby servers are on the same DB2® level so that a mismatch situation does not occur.
Run the db2level command on both servers to check whether they are on the same
DB2® version and fix pack.
Add ports for each portal database and for both database servers in the
/etc/services file:
DB2_HADR_DB_1 represents a database on the primary server.
DB2_HADR_DB_2 represents a database on the standby server.
Copy the backup images from the primary server to the standby server.
Run the following command to restore the database:
db2 "restore database DBNAME"
Enter the following commands to configure the HADR parameters:
db2 update db cfg for DBNAME using HADR_LOCAL_HOST IP_ADDRESS_OF_STNDBY
db2 update db cfg for DBNAME using HADR_LOCAL_SVC PORT_NUMBER_OF_STNDBY
db2 update db cfg for DBNAME using HADR_REMOTE_HOST IP_ADDRESS_OF_PRIMARY
db2 update db cfg for DBNAME using HADR_REMOTE_SVC PORT_NUMBER_OF_PRIMARY
db2 update db cfg for DBNAME using HADR_REMOTE_INST INSTNAME_OF_PRIMARY
db2 update db cfg for DBNAME using HADR_TIMEOUT 120
db2 update db cfg for DBNAME using HADR_SYNCMODE NEARSYNC
db2 update db cfg for DBNAME using HADR_SPOOL_LIMIT 0
db2 update db cfg for DBNAME using HADR_REPLAY_DELAY 0
db2 update db cfg for DBNAME using HADR_PEER_WINDOW 0
db2 update db cfg for DBNAME using LOGINDEXBUILD ON
For
example:
db2 update db cfg for COM85DB using HADR_LOCAL_HOST 9.37.17.237
db2 update db cfg for COM85DB using HADR_LOCAL_SVC 50004
db2 update db cfg for COM85DB using HADR_REMOTE_HOST psvtclc08.rtp.raleigh.ibm.com
db2 update db cfg for COM85DB using HADR_REMOTE_SVC 50003
db2 update db cfg for COM85DB using HADR_REMOTE_INST db2inst1
db2 update db cfg for COM85DB using HADR_TIMEOUT 120
db2 update db cfg for COM85DB using HADR_SYNCMODE NEARSYNC
db2 update db cfg for COM85DB using HADR_SPOOL_LIMIT 0
db2 update db cfg for COM85DB using HADR_REPLAY_DELAY 0
db2 update db cfg for COM85DB using HADR_PEER_WINDOW 0
db2 update db cfg for COM85DB using LOGINDEXBUILD ON
Enter the following command to update the database catalog with alternative server
information:
UPDATE ALTERNATE SERVER FOR DATABASE database USING HOSTNAME hostname PORT instance_portnumber
For
example:
db2 UPDATE ALTERNATE SERVER FOR DATABASE COM85DB USING HOSTNAME psvtclc08.rtp.raleigh.ibm.com PORT 50000
Run the following command to start the HADR on the standby server for each portal
database:
db2 start hadr on database DBNAME as standby
Complete the following steps on the primary server:
Run the following command to activate the database:
db2 activate database DBNAME
Run the following command for each portal database to start the HADR:
db2 start hadr on database DBNAME as primary
Run the following command to verify that the HADR is running:
db2pd -db DBNAME -hadr
Complete the following steps to set up the IBM®WebSphere® Application Server
JDBC connections:
Log in to the WebSphere® Integrated Solutions Console.
Go to Resources > JDBC > JDBC providers > wpdbJDBC_db2 > Data sources > JCR85DBLADS > WebSphere Application Server data source properties.
Go to the Advanced DB2 features section.
Ensure that the following information is set:
Retry interval for client reroute: Enter a minimum of 5 seconds.
Maximum retries for client reroute: Enter a minimum of 3 retries.
Alternate server names: Enter an alternative server.
Alternate port numbers: For example, enter 50000.
Save your changes.
Restart the WebSphere® Application Server application servers.
Validate the connection by testing it for each data source.
Have feedback? Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.