Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build DB2_PureScale Environment HADR

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to build DB2_PureScale environment HADR", the content is simple and easy to understand, clear organization, I hope to help you solve doubts, let Xiaobian lead you to study and learn "DB2_PureScale environment HADR how to build" this article.

#####HADR build #####

1. Create a backup of the master library

db2 BACKUP DB sampledb to /gpfs1nsd/backup

-- db2 backup db sampledb online to /gpfs1nsd/backup include logs

2, restore initialization backup library

db2 RESTORE DB sampledb from /gpfs1nsd/backup

-- db2 restore db sampledb from "/gpfs1nsd/backup" taken at 20170124085238 to "/gpfs1nsd/SAMPLEDB" logtarget "/gpfs1nsd/backup" with 2 buffers buffer 12800 replace history file parallelism 4

On the primary database, the DBA sets cluster-level HADR parameters that specify standby clusters and synchronization methods.

db2 "UPDATE DB CFG FOR sampledb USING\

HADR_TARGET_LIST {psnode1-standby:4000|psnode2-standby:4000}\

HADR_REMOTE_HOST {psnode1-standby:4000|psnode2-standby:4000}\

HADR_REMOTE_INST db2sdin1\

HADR_SYNCMODE async"

(Parameters need to be restarted to take effect)

DBAs set member-level HADR parameters on the primary database that identify the address and port of each member.

For Member 0:

db2 "UPDATE DB CFG FOR sampledb MEMBER 0 USING HADR_LOCAL_HOST psnode1-primay HADR_LOCAL_SVC 4000"

For Member 1:

db2 "UPDATE DB CFG FOR sampledb MEMBER 1 USING HADR_LOCAL_HOST psnode2-primay HADR_LOCAL_SVC 4000"

5. On the standby database, the DBA sets cluster-level HADR parameters, which specify the primary cluster and synchronization method.

db2 "UPDATE DB CFG FOR sampledb USING\

HADR_TARGET_LIST {psnode1-primay:4000|psnode2-primay:4000}\

HADR_REMOTE_HOST {psnode1-primay:4000|psnode2-primay:4000}\

HADR_REMOTE_INST db2inst1\

HADR_SYNCMODE async"

The DBA sets member-level HADR parameters on the standby database that identify the address and port of each member:

For Member 0:

db2 "UPDATE DB CFG FOR sampledb MEMBER 0 USING HADR_LOCAL_HOST psnode1-standby HADR_LOCAL_SVC 4000"

For Member 1:

db2 "UPDATE DB CFG FOR sampledb MEMBER 1 USING HADR_LOCAL_HOST psnode2-standby HADR_LOCAL_SVC 4000"

7. Start the backup library

db2 START HADR ON DB sampledb AS STANDBY

db2sdin1@psnode1:/gpfs1nsd/backup> db2 START HADR ON DB sampledb AS STANDBY

SQL1766W The command completed successfully. However, LOGINDEXBUILD was not

enabled before HADR was started.

8. Start the main library

db2 START HADR ON DB sampledb AS PRIMARY

db2inst1@psnode2:/gpfs1nsd/backup> db2 START HADR ON DB sampledb AS PRIMARY

SQL1766W The command completed successfully. However, LOGINDEXBUILD was not

enabled before HADR was started.

9. Check HADR

db2 "select LOG_STREAM_ID, PRIMARY_MEMBER, STANDBY_MEMBER, HADR_STATE from table (mon_get_hadr(-2))"

LOG_STREAM_ID PRIMARY_MEMBER STANDBY_MEMBER HADR_STATE

------------- -------------- -------------- -----------------------

1 1 0 PEER

0 0 0 PEER

2 record(s) selected.

db2pd -d sampledb -hadr

db2 get db cfg for sampledb | grep -i hadr

#####Role Switching ###

DBAs ensure that no member of the main item is in an abnormal state:

db2inst1@psnode1:~> db2 "SELECT ID,varchar(STATE,21) AS STATE,varchar(HOME_HOST,10) AS HOME_HOST, varchar(CURRENT_HOST,10) AS CUR_HOST, ALERT FROM SYSIBMADM.DB2_MEMBER"

ID STATE HOME_HOST CUR_HOST ALERT

------ --------------------- ---------- ---------- --------

0 STARTED psnode1 psnode1 NO

1 STARTED psnode2 psnode2 NO

2 record(s) selected.

DBAs ensure that all log streams are in PEER state:

db2inst1@psnode1:~> db2 "select LOG_STREAM_ID, PRIMARY_MEMBER, STANDBY_MEMBER, HADR_STATE from table (mon_get_hadr(-2))"

LOG_STREAM_ID PRIMARY_MEMBER STANDBY_MEMBER HADR_STATE

------------- -------------- -------------- -----------------------

1 1 0 PEER

0 0 0 PEER

2 record(s) selected.

3. In standby, DBA issues TAKEOVER HADR command to member 0:

db2sdin1@psnode1:~> db2 TAKEOVER HADR ON DB sampledb

DB20000I The TAKEOVER HADR ON DATABASE command completed successfully.

At primary, DBAs deactivate the database on spares (this keeps the database in the role of HADR spares):

db2 DEACTIVATE DATABASE sampledb

db2stop

perform maintenance operations

db2start

db2 activate database sampledb

5. At primary, execute the switching command

db2 TAKEOVER HADR ON DB sampledb

That's all for "DB2_PureScale Environment HADR How to Build". Thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report