Categories

ID #1486

How do I switch the identity of the primary head node to the secondary head node?

This can be useful if you want to switch the active headnode to the passive headnode. For example, for the purposes of swapping hardware.

(NOTE: in this example the primary/active headnode is hpc001, and hpc002 is the passive/secondary

Current configuration

[root@hpc001 ~]# cmsh
[hpc001]% partition use base
[hpc001->partition[base]]% get headnode
hpc001
[hpc001->partition[base]]% failover
[hpc001->partition[base]->failover]% get secondaryheadnode
hpc002
[root@hpc001 ~]# cmha status
Node Status: running in active mode
hpc001* -> hpc002
failoverping [ OK ]
mysql [ OK ]
ping [ OK ]
status [ OK ]
hpc002 -> hpc001*
failoverping [ OK ]
mysql [ OK ]
ping [ OK ]
status [ OK ]

Now let's make the changes

[root@hpc001 ~]# cmsh
[hpc001]% partition use base
[hpc001->partition[base]]% failover
[hpc001->partition[base]->failover]% clear secondaryheadnode
[hpc001->partition*[base*]->failover*]% commit

[hpc001->partition*[base*]->failover]% ..
[hpc001->partition[base]]% set headnode hpc002
[hpc001->partition[base*]]% commit

[hpc001->partition[base]]% failover
[hpc001->partition[base]->failover]% set secondaryheadnode hpc001
[hpc001->partition*[base*]->failover*]% commit

At this point, HA will be in a confused state.

[root@hpc002 ~]# cmha status
No HA status available.
Unable to get passive head node, is failover setup complete?
Internal error, unable to set node HA status: No passive head node

Restart CMD on both nodes

[root@hpc001 ~]# service cmd restart
[root@hpc002 ~]# service cmd restart

Now make the previous secondary headnode the primary.

[root@hpc002 ~]# cmha makeactive
Continue(c)/Exit(e)? c
Initiating failover.............................. [ OK ]

Lets verify the status

[root@hpc002 ~]# cmha status
Node Status: running in active mode

hpc002* -> hpc001
failoverping [ OK ]
mysql [ OK ]
ping [ OK ]
status [ OK ]
hpc001 -> hpc002*
failoverping [ OK ]
mysql [ OK ]
ping [ OK ]
status [ OK ]

[root@hpc002 ~]# cmsh -c "partition ; failover ; get secondaryheadnode"
hpc001
[root@hpc002 ~]# cmsh -c "partition ; get headnode"
hpc002
[root@hpc001 ~]# cmsh -c "partition ; failover ; get secondaryheadnode"
hpc001
[root@hpc001 ~]# cmsh -c "partition ; get headnode"
hpc002

Tags: -

Related entries:

You cannot comment on this entry