In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "HADR Construction Step Guide". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn the "HADR Construction Step Guide"!
1 Background and needs
Most of the databases of banks are HA+HADR environments, and the general mode is: 2 machines in Shanghai do HA and are also the host of HADR; 2 machines in Shenzhen do HA and are also the standby machines of HADR. Or vice versa. However, some databases are not built with HADR, only HADR interfaces are reserved (/etc/hosts,/etc/services and HADR parameters of the database are configured), so we need to build HADR environment after the standby machine is in place.
2 Preparation: 2.1 View Source Library Configuration
View and record database file system size on source repository
df -g|grep db
l View database version and installation path
db2level
l View and record instance ID, fence ID and the group to which they belong
lsuser
See which fence ID instance belongs to (see owner of file below)
ls -l $HOME/sqllib/adm/.fenced
lsuser
l View and record the last backup and write down the timestamp (for recovery)
db2 list history backup since 20170907 for db COSCO_DB
l View and record HADR configuration in database parameters
db2 get db cfg for COSCO_DB | grep HADR
HADR local host name (HADR_LOCAL_HOST) = TSM07_hadr1
HADR local service name (HADR_LOCAL_SVC) = TSM07_service_hadr1
HADR remote host name (HADR_REMOTE_HOST) = TSM07_hadr2
HADR remote service name (HADR_REMOTE_SVC) = TSM07_service_hadr2
HADR instance name of remote server (HADR_REMOTE_INST) = shruthra
HADR timeout value (HADR_TIMEOUT) = 120
HADR log write synchronization mode (HADR_SYNCMODE) = ASYNC
l View and record entries for HADR in/etc/hosts,/etc/services
grep -i hadr /etc/hosts
10.0.20.61 TSM07_hadr1
10.4.23.56 TSM07_hadr2
grep -i hadr /etc/services
TSM07_service_hadr1 6001/tcp
TSM07_service_hadr2 6002/tcp
l View and record tape library configuration information
cat /usr/openv/netbackup/bp.conf
2.2 Check backup configuration
l Check magnetic array mounting
Run getlun.sh command on both sides of standby HA to check magnetic array mounting (RAID10, disks on both sides need to correspond one by one), and lsvg datavg to check whether capacity meets requirements. This is very important. Otherwise, when you do it well and they discover that the magnetic array configuration is not compliant, you will have to do it again. I have been cheated like this!
l Check tape library configuration
Check to see if the file/usr/openv/netbackup/bp.conf exists, if not there is no configuration.
3 Steps to build HADR
After the preparation work is done, we can start building HADR, the specific steps are as follows:
l Configure/etc/hosts,/etc/services information
Use ifconfig -a command to view the IP address information on both sides (take the first IP of eth2). Generally, only the IP pointing to the backup library needs to be modified in the main library (both HA servers need to be modified), such as: 10.4.23.56 TSM07_hadr2. The two HA in the backup library need to be added with corresponding entries to keep consistent with the main library.
l Install db2 media on standby
Check the remaining capacity of the/opt directory and, if necessary, expand it with the following command:
chfs -a size=+5G /opt
The 2 HA's of the standby machine should be installed, and the version and installation path should be exactly the same as that of the host machine.
l Use commands like the following to create a database instance on the standby machine (no database)
Script on media server new.nim_master:/soft_new, pay attention to modify user/group and database size information, -Check YES means only output, change to NO to actually execute. This script creates users, file systems, and DB2 instances.
sh initdb2.sh -DBDATASIZEGB 150 -USERINFO db2inst1:db2igrp1,db2fenc1:db2fgrp1 -DB2PATH /opt/ibm/db2/V10.5.5_36366 -DB2VER V10.5.5 -NODENUM 1 -DB rptadb11 -CODEPAGE 1386 -TASK SYS FS USER INST DBM -Check YES
l Modify the size of the database-related file system
Keep consistent with the main library and expand it if necessary with commands like:
chfs -a size=+5G /db/actlog
If the extension error occurs, typically reaching the LV MAX LPs limit, check with lslv and modify with smitty chlv.
Modify the client side of the tape library so that it can access the backup of the main library
Backup the backup library/usr/openv/netbackup/bp.conf and overwrite it with the contents of the primary library.
l Generate database redirect recovery script
db2 "restore db load /usr/openv/netbackup/bin/nbdb2.sl64 taken at redirect generate script .ddl"
If there is an error, it means that there is a problem with the configuration of the client with the library. Contact the system administrator to solve it.
l Modify.ddl
Modify the file on db2path on newlogpath, and the table space path (if not auto storage). If the database is relatively large, enable parameters such as PARALLELISM, but it is estimated that the effect is not great.
l Background Run Recovery Script
nohup db2 -tvf .ddl &
After restore is complete, do not run the rollforward command. The standby database state should remain rollforward pending.
l Configure standby database parameters
Mainly the path to the relevant diag, log file system and HADR parameters (opposite to the main library, as follows)
HADR local host name (HADR_LOCAL_HOST) = TSM07_hadr2
HADR local service name (HADR_LOCAL_SVC) = TSM07_service_hadr2
HADR remote host name (HADR_REMOTE_HOST) = TSM07_hadr1
HADR remote service name (HADR_REMOTE_SVC) = TSM07_service_hadr1
l If there is hadr before, stop hadr first (stop in both main and standby machines)
db2 stop hadr on db
l Starting HADR on standby
db2 start hadr on db as standy
l On the host from HADR
db2 start hadr on db as primary
l Check HADR status
After HADR is started, the status should change from disconnected/remote catch up pending to connected/ remote catching up, indicating that the standby machine is tracking logs. You can see that the current log number of the standby machine is changing until it reaches connected/peer status.
db2pd -d -hadr
l Restore the file: /usr/openv/netbackup/bp.conf
At this point, I believe that everyone has a deeper understanding of the "HADR Construction Step Guide", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.