Monday, March 27, 2017

How To Identify Master Node in RAC


Key points to note about master node :-

1) Master node has the least Node-id in the cluster. Node-ids are  assigned to the nodes in the same order as the nodes join the cluster.   Hence, normally the node which joins the cluster first is the master node

2) CRSd process on the Master node is responsible to initiate the OCR backup as per the backup policy

3) Master node  is also responsible to sync OCR cache across the nodes

4) CRSd process on the master node reads from and writes to OCR on disk

5) In case of node eviction, The cluster is divided into two sub-clusters. The sub-cluster containing fewer no. of nodes is evicetd. But, in case both the sub-clusters have same no. of nodes, the sub-cluster having the master node survives whereas the other sub-cluster is evicted

6) If master node got evicted/rebooted, another node become master

7) Master node can be found by multiple ways, some of them are listed as
        1. by reading ocssd logs
        2. by reading crsd logs
        3. by identifying the node which takes the backup of the OCR


Check ocssd logs

[oracle@rac1 ~]$ cat /u01/app/11.2.0/grid/log/rac1/cssd/ocssd.log | grep 'master node' | tail -1

2017-03-27 06:18:58.922: [    CSSD][1283139904]clssgmCMReconfig: reconfiguration successful, incarnation 382986530 with 2 nodes, local node number 1, master node number 1

[root@host02 cssd]# cat $ORACLE_HOME/log/host02/cssd/ocssd.log |grep ‘master node’ |tail -1

2017-03-27 06:09:10.134: [    CSSD][1283107136]clssgmCMReconfig: reconfiguration successful, incarnation 382986528 with 2 nodes, local node number 2, master node number 1
Let's take OCR backup now and see which node will take this

[root@rac2 ~]# ocrconfig -manualbackup

rac1     2017/03/27 07:08:30     /u01/app/11.2.0/grid/cdata/rac-cluster/backup_20170327_070830.ocr

Check cssd logs

[root@rac1 ~]# cat /u01/app/11.2.0/grid/log/rac1/crsd/crsd.log | grep 'OCR MASTER' | tail -1

2017-03-27 06:00:08.886: [  OCRMAS][1270225216]th_master:13: I AM THE NEW OCR MASTER at incar 2. Node Number 1

[root@rac2 ~]# cat /u01/app/11.2.0/grid/log/rac2/crsd/crsd.log | grep 'OCR MASTER' | tail -1

2017-03-27 06:19:11.800: [  OCRMAS][1258043712]th_master: NEW OCR MASTER IS 1

Let's Reboot node 1 (rac1) and check for new master

[root@rac1 ~]# init 6

[root@rac2 ~]# cat /u01/app/11.2.0/grid/log/rac2/crsd/crsd.log | grep 'OCR MASTER' | tail -1

2017-03-27 07:19:16.495: [  OCRMAS][1258043712]th_master:13: I AM THE NEW OCR MASTER at incar 26. Node Number 2

Happy Learning !!

No comments:

Post a Comment