Redhat cluster clusvcadm cheat sheet Part – 1

In this article I am going to show you the usage of clusvcadm. I have shown various use cases. Its like cheat sheet with output. Refer the man page of clusvcadm for more details.

            Case 1 : Enabling the service.

Before Status :

[root@Node1 ~]#  clustat -l
Cluster Status for Shiv @ Sun Oct  5 10:25:19 2014
Member Status: Quorate

Member Name                             ID   Status
—— —-                             —- ——
192.168.111.150                             1 Online, Local, rgmanager
192.168.111.151                             2 Online, rgmanager
192.168.111.152                             3 Online, rgmanager

Service Information
——- ———–

Service Name      : service:IP_sg1
Current State   : disabled (119)
Flags           : none (0)
Owner           : none
Last Owner      : none
Last Transition : Wed Dec 31 19:00:00 1969

Command Used :

[root@Node1 ~]# clusvcadm -e service:IP_sg1
Local machine trying to enable service:IP_sg1…Success
service:IP_sg1 is now running on 192.168.111.150

After Status :

[root@Node1 ~]#  clustat -l
Cluster Status for Shiv @ Sun Oct  5 10:25:56 2014
Member Status: Quorate

Member Name                             ID   Status
—— —-                             —- ——
192.168.111.150                             1 Online, Local, rgmanager
192.168.111.151                             2 Online, rgmanager
192.168.111.152                             3 Online, rgmanager

Service Information
——- ———–

Service Name      : service:IP_sg1
Current State   : started (112)
Flags           : none (0)
Owner           : 192.168.111.150
Last Owner      : none
Last Transition : Sun Oct  5 10:25:29 2014

Log Messages during this transition.

/var/log/message
Oct  5 10:24:26 Node1 rgmanager[3895]: State change: 192.168.111.152 UP
Oct  5 10:25:29 Node1 rgmanager[3895]: Starting disabled service service:IP_sg1
Oct  5 10:25:30 Node1 rgmanager[5273]: [ip] Adding IPv4 address 192.168.111.160/24 to eth0
Oct  5 10:25:33 Node1 rgmanager[3895]: Service service:IP_sg1 started

I initiated the reboot of Node1 (192.168.111.150) Service got failover to second node192.168.111.151.

[root@Node3 ~]# clustat -s service:IP_sg1
Service Name                 Owner (Last)                 State
——- —-                 —– ——                 —–
service:IP_sg1               192.168.111.151              started

Case 2 : Moving the service from one node to another node.

Source Node : Node2
Target Node : Node1
Before Status :

Service Information
——- ———–

Service Name      : service:IP_sg1
Current State   : started (112)
Flags           : none (0)
Owner           : 192.168.111.151
Last Owner      : 192.168.111.150
Last Transition : Sun Oct  5 10:39:42 2014

Command Used :
[root@Node2 ~]# clusvcadm -r service:IP_sg1 -m 192.168.111.150
Trying to relocate service:IP_sg1 to 192.168.111.150…Success
service:IP_sg1 is now running on 192.168.111.150
After Status :

Service Information
——- ———–

Service Name      : service:IP_sg1
Current State   : started (112)
Flags           : none (0)
Owner           : 192.168.111.150
Last Owner      : 192.168.111.151
Last Transition : Sun Oct  5 10:43:45 2014

Source Node (Node1) logs
Oct  5 10:43:36 Node2 rgmanager[2143]: Stopping service service:IP_sg1
Oct  5 10:43:36 Node2 rgmanager[7393]: [ip] Removing IPv4 address 192.168.111.16                                   0/24 from eth0
Oct  5 10:43:46 Node2 rgmanager[2143]: Service service:IP_sg1 is stopped

Target Node (Node2) logs
Oct  5 10:43:45 Node1 rgmanager[2050]: Starting stopped service service:IP_sg1
Oct  5 10:43:45 Node1 rgmanager[3099]: [ip] Adding IPv4 address 192.168.111.160/24 to eth0
Oct  5 10:43:48 Node1 rgmanager[2050]: Service service:IP_sg1 started

Case 3 : Disabling the service.

Before Status :
[root@Node1 ~]#  clustat -l
Cluster Status for Shiv @ Sun Oct  5 10:25:56 2014
Member Status: Quorate

Member Name                             ID   Status
—— —-                             —- ——
192.168.111.150                             1 Online, Local, rgmanager
192.168.111.151                             2 Online, rgmanager
192.168.111.152                             3 Online, rgmanager

Service Information
——- ———–

Service Name      : service:IP_sg1
Current State   : started (112)
Flags           : none (0)
Owner           : 192.168.111.150
Last Owner      : none
Last Transition : Sun Oct  5 10:25:29 2014

Command Used :
[root@Node1 ~]# clusvcadm -d service:IP_sg1
Local machine disabling service:IP_sg1…Success

After Status :
[root@Node1 ~]#  clustat -l
Cluster Status for Shiv @ Sun Oct  5 10:33:02 2014
Member Status: Quorate

Member Name                                                     ID   Status
—— —-                                                     —- ——
192.168.111.150                                                     1 Online, Local, rgmanager
192.168.111.151                                                     2 Online, rgmanager
192.168.111.152                                                     3 Online, rgmanager

Service Information
——- ———–

Service Name      : service:IP_sg1
Current State   : disabled (119)
Flags           : none (0)
Owner           : none
Last Owner      : 192.168.111.150
Last Transition : Sun Oct  5 10:31:24 2014

Log messages during this transition.
Oct  5 10:31:14 Node1 rgmanager[3895]: Stopping service service:IP_sg1
Oct  5 10:31:14 Node1 rgmanager[7465]: [ip] Removing IPv4 address 192.168.111.16    0/24 from eth0
Oct  5 10:31:24 Node1 rgmanager[3895]: Service service:IP_sg1 is disabled

Initiated reboot of server to see whether service is coming up automatically or not.

Conclusion : Service remain on that node only didn’t get failover.

[root@Node3 ~]# clustat -s service:IP_sg1
Service Name                 Owner (Last)                 State
——- —-                 —– ——                 —–
service:IP_sg1               (192.168.111.150)            disabled

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s