Hostname | Role | File Systems |
azsuascst01 | PAS & ASCS VM | 1. /usr/sap 2. /sapmnt/T01 |
azsudbudbt01 | DB2 Database Node1 | 1. /db2/db2t01 2. /db2/T01 3. /db2/T01/log_dir 4. /db2/T01/logarch 5. /db2/T01/backup |
azsudbhdrt01 | DB2 Database Node2 | 1. /db2/db2t01 2. /db2/T01 3. /db2/T01/log_dir |
azsudbhat01 | Virtual Hostname for DB Cluster | |
azsusdbt01 | iSCSI VM |
sudo <swpm>/sapinst SAPINST_REMOTE_ACCESS_USER=<OS admin user>
Steps at ASCS VM (Source System)
Steps at DB VM (Target System)
(Make sure to enable floating IP & Increase the Idle timeout to 30 seconds for each Load Balancing rule.)
In Primary DB :
db2 UPDATE DB CFG FOR T01 USING HADR_LOCAL_HOST AZSUDBUDBT01
db2 UPDATE DB CFG FOR T01 USING HADR_LOCAL_SVC T01_HADR_1
db2 UPDATE DB CFG FOR T01 USING HADR_REMOTE_HOST AZSUDBHDRT01
db2 UPDATE DB CFG FOR T01 USING HADR_REMOTE_SVC T01_HADR_2
db2 UPDATE DB CFG FOR T01 USING HADR_REMOTE_INST db2t01
db2 UPDATE DB CFG FOR T01 USING HADR_TIMEOUT 60
db2 UPDATE DB CFG FOR T01 USING HADR_SYNCMODE NEARSYNC
db2 UPDATE DB CFG FOR T01 USING HADR_SPOOL_LIMIT 1000
db2 UPDATE DB CFG FOR T01 USING HADR_PEER_WINDOW 300
db2 UPDATE DB CFG FOR T01 USING indexrec RESTART logindexbuild ON
In Standby DB :
db2 UPDATE DB CFG FOR T01 USING HADR_LOCAL_HOST AZSUDBHDRT01
db2 UPDATE DB CFG FOR T01 USING HADR_LOCAL_SVC T01_HADR_2
db2 UPDATE DB CFG FOR T01 USING HADR_REMOTE_HOST AZSUDBUDBT01
db2 UPDATE DB CFG FOR T01 USING HADR_REMOTE_SVC T01_HADR_1
db2 UPDATE DB CFG FOR T01 USING HADR_REMOTE_INST db2t01
db2 UPDATE DB CFG FOR T01 USING HADR_TIMEOUT 60
db2 UPDATE DB CFG FOR T01 USING HADR_SYNCMODE NEARSYNC
db2 UPDATE DB CFG FOR T01 USING HADR_SPOOL_LIMIT 1000
db2 UPDATE DB CFG FOR T01 USING HADR_PEER_WINDOW 300
db2 UPDATE DB CFG FOR T01 USING indexrec RESTART logindexbuild ON
Note : If you are using Azure Fencing agent then use following parameter values
HADR_PEER_WINDOW 900
azsudbudbt01:db2t01 57> db2pd -d T01 -hadr
Database Member 0 -- Database T01 -- Active -- Up 0 days 00:11:15 -- Date 2018-11-14-02.25.34.585178
HADR_ROLE = PRIMARY
REPLAY_TYPE = PHYSICAL
HADR_SYNCMODE = NEARSYNC
STANDBY_ID = 1
LOG_STREAM_ID = 0
HADR_STATE = PEER
HADR_FLAGS = TCP_PROTOCOL
PRIMARY_MEMBER_HOST = AZSUDBUDBT01
PRIMARY_INSTANCE = db2t01
PRIMARY_MEMBER = 0
STANDBY_MEMBER_HOST = AZSUDBHDRT01
STANDBY_INSTANCE = db2t01
STANDBY_MEMBER = 0
HADR_CONNECT_STATUS = CONNECTED
HADR_CONNECT_STATUS_TIME = 11/14/2018 02:14:36.164342 (1542161676)
HEARTBEAT_INTERVAL(seconds) = 30
HEARTBEAT_MISSED = 0
HEARTBEAT_EXPECTED = 15
HADR_TIMEOUT(seconds) = 120
TIME_SINCE_LAST_RECV(seconds) = 0
PEER_WAIT_LIMIT(seconds) = 0
LOG_HADR_WAIT_CUR(seconds) = 0.000
LOG_HADR_WAIT_RECENT_AVG(seconds) = 0.004486
LOG_HADR_WAIT_ACCUMULATED(seconds) = 12.180
LOG_HADR_WAIT_COUNT = 6904
SOCK_SEND_BUF_REQUESTED,ACTUAL(bytes) = 0, 46080
SOCK_RECV_BUF_REQUESTED,ACTUAL(bytes) = 0, 374400
PRIMARY_LOG_FILE,PAGE,POS = S0000011.LOG, 1065, 15289342814
STANDBY_LOG_FILE,PAGE,POS = S0000010.LOG, 19445, 15282741896
HADR_LOG_GAP(bytes) = 69432348
STANDBY_REPLAY_LOG_FILE,PAGE,POS = S0000010.LOG, 19436, 15282702198
STANDBY_RECV_REPLAY_GAP(bytes) = 4357875
PRIMARY_LOG_TIME = 11/14/2018 02:25:34.000000 (1542162334)
STANDBY_LOG_TIME = 11/14/2018 02:25:16.000000 (1542162316)
STANDBY_REPLAY_LOG_TIME = 11/14/2018 02:25:16.000000 (1542162316)
STANDBY_RECV_BUF_SIZE(pages) = 2048
STANDBY_RECV_BUF_PERCENT = 0
STANDBY_SPOOL_LIMIT(pages) = 1000
STANDBY_SPOOL_PERCENT = 0
STANDBY_ERROR_TIME = NULL
PEER_WINDOW(seconds) = 240
PEER_WINDOW_END = 11/14/2018 02:29:32.000000 (1542162572)
READS_ON_STANDBY_ENABLED = N
https://github.com/ClusterLabs/resource-agents/blob/master/heartbeat/db2
• Deploy a new VM with OS as SUSE 12 SP13. Make sure to use premium storage disk. (For production cluster environment, its recommended to use 3 iSCSI target servers.)
• Update SLSE
sudo zypper update
• Install iSCSI target packages
sudo zypper install targetcli-fb dbus-1-python
• Enable the iSCSI target service
sudo systemctl enable targetcli
sudo systemctl start targetcli
• Create the root folder for SBD devices
sudo mkdir /sbd
• Create the SBD device for the database cluster of SAP System T01
sudo targetcli backstores/fileio create sbddbt01 /sbd/sbddbt01 50M write_back=false
sudo targetcli iscsi/ create iqn.2006-04.dbt01.local:dbt01
sudo targetcli iscsi/iqn.2006-04.dbt01.local:dbt01/tpg1/luns/ create /backstores/fileio/sbddbt01
sudo targetcli iscsi/iqn.2006-04.dbt01.local:dbt01/tpg1/acls/ create iqn.2006-04.azsudbudbt01.local:azsudbudbt01
sudo targetcli iscsi/iqn.2006-04.dbt01.local:dbt01/tpg1/acls/ create iqn.2006-04.azsudbhdrt01.local:azsudbhdrt01
• Save the targetcli changes
sudo targetcli saveconfig
• [A] Enable the iSCSI & SBD services
sudo systemctl enable iscsid
sudo systemctl enable iscsi
sudo systemctl enable sbd
• [1] Change the initiator name on the first node
sudo vi /etc/iscsi/initiatorname.iscsi
Change the content of the file to match the ACLs you used when creating the iSCSI device on the iSCSI target server.
InitiatorName=iqn.2006-04.azsudbudbt01.local:azsudbudbt01
• [2] Change the initiator name on the second node
sudo vi /etc/iscsi/initiatorname.iscsi
Change the content of the file to match the ACLs you used when creating the iSCSI device on the iSCSI target server.
InitiatorName=iqn.2006-04.azsudbhdrt01.local:azsudbhdrt01
• [A] Restart the iSCSI service
sudo systemctl restart iscsid
sudo systemctl restart iscsi
• [A] Connect the iSCSI devices
sudo iscsiadm -m discovery --type=st --portal=10.0.1.136:3260
sudo iscsiadm -m node -T iqn.2006-04.dbt01.local:dbt01 --login --portal=10.0.1.136:3260
sudo iscsiadm -m node -p 10.0.1.136:3260 --op=update --name=node.startup --value=automatic
• [A] Make sure that the iSCSI devices are available and note down the device name
azsudbudbt01:/db2/T01 # lsscsi
[2:0:0:0] disk Msft Virtual Disk 1.0 /dev/sda
[3:0:1:0] disk Msft Virtual Disk 1.0 /dev/sdb
[5:0:0:0] disk Msft Virtual Disk 1.0 /dev/sdc
[6:0:0:0] disk LIO-ORG sbddbt01 4.0 /dev/sdd
• [A] Now, retrieve the IDs of the iSCSI devices.
ls -l /dev/disk/by-id/scsi-* | grep sdd
lrwxrwxrwx 1 root root 9 Nov 14 11:43 /dev/disk/by-id/scsi-1LIO-ORG_sbddbt01:75af6b58-fa6f-4c41-8fb4-d33c7c3ec533 -> ../../sdd
lrwxrwxrwx 1 root root 9 Nov 14 11:43 /dev/disk/by-id/scsi-3600140575af6b58fa6f4c418fb4d33c7 -> ../../sdd
lrwxrwxrwx 1 root root 9 Nov 14 11:43 /dev/disk/by-id/scsi-SLIO-ORG_sbddbt01_75af6b58-fa6f-4c41-8fb4-d33c7c3ec533 -> ../../sdd
• [1] Use the device ID of the iSCSI devices to create the new SBD devices on the first cluster node
sudo sbd -d /dev/disk/by-id/scsi-3600140575af6b58fa6f4c418fb4d33c7 -1 60 -4 120 create
• [A] Adapt the SBD config
sudo vi /etc/sysconfig/sbd
[...]
SBD_DEVICE="/dev/disk/by-id/scsi-3600140575af6b58fa6f4c418fb4d33c7
[...]
SBD_PACEMAKER="yes"
[...]
SBD_STARTMODE="always"
[...]
SBD_WATCHDOG="yes"
• [A]Create the softdog configuration file
echo softdog | sudo tee /etc/modules-load.d/softdog.conf
And Load the module.
sudo modprobe -v softdog
• [A] Update SLSE
sudo zypper update
• [A] Configure Operating System
# Edit the configuration file
sudo vi /etc/systemd/system.conf
# Change the DefaultTasksMax
#DefaultTasksMax=512
DefaultTasksMax=4096
#and to activate this setting
sudo systemctl daemon-reload
# test if the change was successful
sudo systemctl --no-pager show | grep DefaultTasksMax
Reduce the size of Dirty cache
sudo vi /etc/sysctl.conf
# Change/set the following settings
vm.dirty_bytes = 629145600
vm.dirty_background_bytes = 314572800
• [A] Enable ssh access between cluster node
sudo ssh-keygen
Enter file in which to save the key (/root/.ssh/id_rsa): -> Press ENTER
Enter passphrase (empty for no passphrase): -> Press ENTER
Enter same passphrase again: -> Press ENTER
Display the public Key
sudo cat /root/.ssh/id_rsa.pub
Insert the public Key (of each other which means insert of the public key of Node 1 into the below file of Node 2 & vice-versa)
sudo vi /root/.ssh/authorized_keys
• [A] Install Fence Agent
sudo zypper install fence-agents
• [1] Install Cluster
sudo ha-cluster-init
(For NTP warning, continue with ‘y’. Do not overwrite ssh key and fence agent device. Rest all press ‘enter’.)
• [2] Add node to cluster
sudo ha-cluster-join
(For NTP warning, continue with ‘y’. Enter IP address of Node1 which is already part of cluster. Do not overwrite ssh key and fence agent device. Rest all press ‘enter’.)
• [A] Change the ‘hacluster’ user password
sudo passwd hacluster
(Keep the password same for both the nodes of cluster)
• [A] Update Configuration of corosync.
sudo vi /etc/corosync/corosync.conf
[...]
token: 30000
token_retransmits_before_loss_const: 10
join: 60
consensus: 36000
max_messages: 20
interface {
[...]
}
transport: udpu
# remove parameter mcastaddr
# mcastaddr: IP
}
nodelist {
node {
# IP address of azsudbudbt01
ring0_addr:10.0.1.134
}
node {
# IP address of azsudbhdrt01
ring0_addr:10.0.1.135
}
}
logging {
[...]
}
quorum {
# Enable and configure quorum subsystem (default: off)
# see also corosync.conf.5 and votequorum.5
provider: corosync_votequorum
expected_votes: 2
two_node: 1
}
Restart the corosync service
sudo service corosync restart
• Cluster property change to maintenance mode
sudo crm configure property maintenance-mode="true"
• Configure the virtual IP and health probe resources as defined in Internal Load Balancer
sudo crm configure primitive ip_azsudbhat01 ocf:heartbeat:IPaddr2 \
op monitor interval="10s" timeout="20s" \
params ip="10.0.1.140"
sudo crm configure primitive nc_azsudbhat01 anything \
params binfile="/usr/bin/socat" cmdline_options="-U TCP-LISTEN:62500,backlog=10,fork,reuseaddr /dev/null" \
op monitor timeout=20s interval=10 depth=0
sudo crm configure group g_ip_T01_azsudbhat01 ip_azsudbhat01 nc_azsudbhat01
• Configure the DB2 DB resources and define the constrains
sudo crm configure primitive db_db2t01 ocf:heartbeat:db2 \
params instance="db2t01" dblist="t01" \
op start interval="0" timeout="130" \
op stop interval="0" timeout="120" \
op promote interval="0" timeout="120" \
op demote interval="0" timeout="120" \
op monitor interval="30" timeout="60" \
op monitor interval="45" role="Master" timeout="60"
sudo crm configure ms ms_db2_t01 db_db2t01 \
meta target-role="Started" notify="true"
sudo crm configure colocation ip_db_with_master inf: g_ip_T01_azsudbhat01:Started ms_db2_t01:Master
sudo crm configure order ip_db_after_master inf: ms_db2_t01:promote g_ip_T01_azsudbhat01:start
sudo crm configure rsc_defaults resource-stickiness=1000
sudo crm configure rsc_defaults migration-threshold=5000
• Cluster property change to normal mode
sudo crm configure property maintenance-mode="false"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |