This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tsm:tsm_hadr [2021/01/01 21:25] 127.0.0.1 external edit |
tsm:tsm_hadr [2022/07/22 14:28] (current) manu |
||
---|---|---|---|
Line 11: | Line 11: | ||
The following example shows HADR ports specified within the services file: | The following example shows HADR ports specified within the services file: | ||
+ | <cli> | ||
# HADR ports assigned by user | # HADR ports assigned by user | ||
ha_myhadr 51012/tcp | ha_myhadr 51012/tcp | ||
ha_myhadr_int 51013/tcp | ha_myhadr_int 51013/tcp | ||
+ | </cli> | ||
=== Configuring the HADR primary server === | === Configuring the HADR primary server === | ||
Line 29: | Line 29: | ||
1. Log in to the primary server as an administrator.\\ | 1. Log in to the primary server as an administrator.\\ | ||
2. Run the following commands to specify the HADR primary server and standby server: | 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_local_host primary_IP | + | db2 update db cfg for database using hadr_remote_host standby_IP |
- | db2 update db cfg for database using hadr_remote_host standby_IP | + | |
For example: | For example: | ||
+ | <cli> | ||
db2 update db cfg for xmeta using hadr_local_host 192.0.2.6 | db2 update db cfg for xmeta using hadr_local_host 192.0.2.6 | ||
db2 update db cfg for xmeta using hadr_remote_host 192.0.2.7 | db2 update db cfg for xmeta using hadr_remote_host 192.0.2.7 | ||
+ | </cli> | ||
3. Run the following commands to specify the HADR primary and standby service names: | 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_local_svc primary_svc_name | + | db2 update db cfg for database using hadr_remote_svc standby_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 appear in the services file. | In the commands, the service names must match the HADR port names that appear in the services file. | ||
For example: | For example: | ||
+ | <cli> | ||
db2 update db cfg for xmeta using hadr_local_svc ha_myhadr | 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 | db2 update db cfg for xmeta using hadr_remote_svc ha_myhadr_int | ||
+ | </cli> | ||
4. Run the following command to specify the DB2® instance name on the standby server: | 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 | |
- | db2 update db cfg for database using hadr_remote_inst DB2_standby_instance | + | |
For example: | For example: | ||
+ | <cli> | ||
db2 update db cfg for xmeta using hadr_remote_inst db2inst1 | db2 update db cfg for xmeta using hadr_remote_inst db2inst1 | ||
+ | </cli> | ||
5. Run the following command to specify the time (in seconds) that the HADR process waits before considering a communication attempt to have failed: | 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 | |
- | db2 update db cfg for database using hadr_timeout timeout | + | |
For example: | For example: | ||
+ | <cli> | ||
db2 update db cfg for xmeta using hadr_timeout 120 | db2 update db cfg for xmeta using hadr_timeout 120 | ||
+ | </cli> | ||
6. Run the following command to specify the HADR synchronization mode: | 6. Run the following command to specify the HADR synchronization mode: | ||
- | db2 update db cfg for database using syncmode mode | + | db2 update db cfg for database using syncmode mode |
For example: | For example: | ||
+ | <cli> | ||
db2 update db cfg for xmeta using syncmode SYNC | db2 update db cfg for xmeta using syncmode SYNC | ||
+ | </cli> | ||
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. | 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: | 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 | + | db2 update db cfg for database using hadr_timeout timeout |
For example: | For example: | ||
+ | <cli> | ||
db2 update db cfg for xmeta using hadr_timeout 120 | db2 update db cfg for xmeta using hadr_timeout 120 | ||
+ | </cli> | ||
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. | 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 | + | db2 update db cfg for xmeta using logindexbuild on |
9. Run the following command to set up automatic client reroute: | 9. Run the following command to set up automatic client reroute: | ||
- | db2 update alternate server for database database using hostname standby_IP | + | db2 update alternate server for database database using hostname standby_IP port port |
- | port port | + | |
For example: | For example: | ||
- | + | <cli> | |
- | db2 update alternate server for database xmeta using hostname 192.0.2.7 | + | db2 update alternate server for database xmeta using hostname 192.0.2.7 port 60000 |
- | port 60000 | + | </cli> |
10. Run the following command to verify your configuration values: | 10. Run the following command to verify your configuration values: | ||
- | db2 get db cfg for database | grep HADR | + | db2 get db cfg for database | grep HADR |
For example: | For example: | ||
+ | <cli> | ||
db2 get db cfg for xmeta | grep HADR | db2 get db cfg for xmeta | grep HADR | ||
+ | </cli> | ||
The command displays a report: | The command displays a report: | ||
Line 122: | Line 119: | ||
Procedure | Procedure | ||
- | Log in to the primary server as an administrator. | + | Log in to the primary server as an administrator. \\ |
- | Run these commands to back up the database on the primary server: | + | Run these commands to back up the database on the primary server: |
- | mkdir temp_backup_directory | + | mkdir temp_backup_directory |
- | cd temp_backup_directory | + | cd temp_backup_directory |
- | db2 backup db database | + | db2 backup db database |
For example: | For example: | ||
+ | <cli> | ||
mkdir mytempbackup | mkdir mytempbackup | ||
cd mytempbackup | cd mytempbackup | ||
db2 backup db xmeta | db2 backup db xmeta | ||
+ | </cli> | ||
Note: You can store more than one database backup in the same temporary directory. | Note: You can store more than one database backup in the same temporary directory. | ||
Line 144: | Line 142: | ||
Run this command to restore the database on the standby server: | Run this command to restore the database on the standby server: | ||
- | db2 restore db database from database_backup_directory replace history file | + | db2 restore db database from database_backup_directory replace history file |
- | + | ||
- | For example: | + | |
+ | For example: | ||
+ | <cli> | ||
db2 restore db xmeta from mytemprestore replace history file | db2 restore db xmeta from mytemprestore replace history file | ||
+ | </cli> | ||
On the standby server, run the following commands to specify the HADR primary server and standby server. In the command, specify the standby server for hadr_local_host. Specify the primary server for hadr_remote_host (the opposite of the settings on the primary server). | On the standby server, run the following commands to specify the HADR primary server and standby server. In the command, specify the standby server for hadr_local_host. Specify the primary server for hadr_remote_host (the opposite of the settings on the primary server). | ||
Line 156: | Line 154: | ||
For example: | For example: | ||
+ | <cli> | ||
db2 update db cfg for xmeta using hadr_local_host 192.0.2.7 | db2 update db cfg for xmeta using hadr_local_host 192.0.2.7 | ||
db2 update db cfg for xmeta using hadr_remote_host 192.0.2.6 | db2 update db cfg for xmeta using hadr_remote_host 192.0.2.6 | ||
+ | </cli> | ||
On the standby server, run the following commands to specify the HADR primary and standby service names. In the command, specify the standby server port name for hadr_local_svc. Specify the primary server port name for hadr_remote_svc (the opposite of the settings on the primary server). | On the standby server, run the following commands to specify the HADR primary and standby service names. In the command, specify the standby server port name for hadr_local_svc. Specify the primary server port name for hadr_remote_svc (the opposite of the settings on the primary server). | ||
Line 166: | Line 164: | ||
For example: | For example: | ||
+ | <cli> | ||
db2 update db cfg for xmeta using hadr_local_svc ha_myhadr_int | db2 update db cfg for xmeta using hadr_local_svc ha_myhadr_int | ||
db2 update db cfg for xmeta using hadr_remote_svc ha_myhadr | db2 update db cfg for xmeta using hadr_remote_svc ha_myhadr | ||
+ | </cli> | ||
On the standby server, run the following command to set up automatic client reroute. Specify the primary server IP address and port number in the command: | On the standby server, run the following command to set up automatic client reroute. Specify the primary server IP address and port number in the command: | ||
Line 176: | Line 174: | ||
For example: | For example: | ||
- | + | <cli> | |
- | db2 update alternate server for database xmeta using hostname 192.0.2.6 | + | db2 update alternate server for database xmeta using hostname 192.0.2.6 port 60000 |
- | port 60000 | + | </cli> |
On the standby server, run the following command to verify your configuration values: | On the standby server, run the following command to verify your configuration values: | ||
Line 185: | Line 182: | ||
For example: | For example: | ||
- | + | <cli> | |
- | db2 get db cfg for xmeta | grep HADR | + | # db2 get db cfg for xmeta | grep HADR |
- | + | ||
- | The command displays a report: | + | |
HADR database role = STANDARD | HADR database role = STANDARD | ||
Line 198: | Line 193: | ||
HADR timeout value (HADR_TIMEOUT) = 120 | HADR timeout value (HADR_TIMEOUT) = 120 | ||
HADR log write synchronization mode (HADR_SYNCMODE) = SYNC | HADR log write synchronization mode (HADR_SYNCMODE) = SYNC | ||
+ | </cli> | ||
Line 213: | Line 208: | ||
For example: | For example: | ||
+ | <cli> | ||
db2 deactivate db xmeta | db2 deactivate db xmeta | ||
Line 219: | Line 214: | ||
db2 start hadr on db database as standby | db2 start hadr on db database as standby | ||
+ | </cli> | ||
For example: | For example: | ||
+ | <cli> | ||
db2 start hadr db xmeta as standby | db2 start hadr db xmeta as standby | ||
Line 227: | Line 223: | ||
DB2000I The START HADR ON DATABASE command completed successfully | DB2000I The START HADR ON DATABASE command completed successfully | ||
+ | </cli> | ||
On the standby server, run the following command to verify the HADR role of the server: | On the standby server, run the following command to verify the HADR role of the server: | ||
Line 233: | Line 230: | ||
For example: | For example: | ||
+ | <cli> | ||
db2 get snapshot for db on xmeta | grep Role | db2 get snapshot for db on xmeta | grep Role | ||
Line 239: | Line 236: | ||
Role = Standby | Role = Standby | ||
+ | </cli> | ||
- | On the primary server, run the following command to activate the database: | + | On the primary server, run the following command to activate the database: |
- | + | db2 activate db database | |
- | db2 activate db database | + | |
- | + | ||
- | For example: | + | |
+ | For example: | ||
+ | <cli> | ||
db2 activate db xmeta | db2 activate db xmeta | ||
Line 251: | Line 248: | ||
db2 start hadr on db database as primary | db2 start hadr on db database as primary | ||
+ | </cli> | ||
For example: | For example: | ||
+ | <cli> | ||
db2 start hadr db xmeta as primary | db2 start hadr db xmeta as primary | ||
Line 283: | Line 281: | ||
State = Peer | State = Peer | ||
+ | </cli> | ||
=== Validating the HADR configuration === | === Validating the HADR configuration === | ||
Line 352: | Line 351: | ||
For example: | For example: | ||
+ | <cli> | ||
db2 get snapshot for db on xmeta | grep Role | db2 get snapshot for db on xmeta | grep Role | ||
Line 358: | Line 357: | ||
Role = Primary | Role = Primary | ||
+ | </cli> | ||
On each server, run the following command to verify that the databases are synchronized: | On each server, run the following command to verify that the databases are synchronized: | ||
Line 364: | Line 364: | ||
For example: | For example: | ||
+ | <cli> | ||
db2 get snapshot for database on xmeta | grep State | db2 get snapshot for database on xmeta | grep State | ||
Line 370: | Line 370: | ||
State = Peer | State = Peer | ||
+ | </cli> | ||