Today we will see how we can stop any Linux pacemaker cluster resource through pcs command. Basically pcs command has various features and options to work on Linux cluster. But we will only see today how we could stop a process that running through Pacemaker cluster.

SetUP

For this we are using CentOS6.10

[root@srv1 ~]# cat /etc/redhat-release 
CentOS release 6.10 (Final)
[root@srv1 ~]# uname -r
2.6.32-754.11.1.el6.x86_64

Cluster Details

So we have two machines in this cluster

[root@srv1 ~]# pcs status nodes corosync
Corosync Nodes:
 Online: srv1 srv2

And we have some resource as well to that mange through this cluster.

[root@srv1 ~]# pcs resource
 Resource Group: MySQL
     MySQL_vip	(ocf::heartbeat:IPaddr2):	Started srv1
     MySQL_srv	(ocf::heartbeat:mysql):	Started srv1
 Resource Group: NFS
     NFS_vip	(ocf::heartbeat:IPaddr2):	Started srv2

Stop resource

So now we need to stop NFS_vip resource, we need to disable this resource, there is only one way to stop resource in pcs command, is to disable it like below

[root@srv1 ~]# pcs resource
 Resource Group: MySQL
     MySQL_vip	(ocf::heartbeat:IPaddr2):	Started srv1
     MySQL_srv	(ocf::heartbeat:mysql):	Started srv1
 Resource Group: NFS
     NFS_vip	(ocf::heartbeat:IPaddr2):	Started srv2

[root@srv1 ~]# pcs resource disable NFS_vip 

[root@srv1 ~]# pcs resource
 Resource Group: MySQL
     MySQL_vip	(ocf::heartbeat:IPaddr2):	Started srv1
     MySQL_srv	(ocf::heartbeat:mysql):	Started srv1
 Resource Group: NFS
     NFS_vip	(ocf::heartbeat:IPaddr2):	Stopped (disabled)

So , we stopped resource through disabling it. There is option of –wait which would wait to disable, otherwise it will come out command and print exit status of command like below

[root@srv1 ~]# pcs resource disable NFS_vip --wait=10s
Resource 'NFS_vip' is not running on any node

Start resource

So through this print in verbose mode, that specific resource is not running on any of node. We can also start resource through enable it like below.

[root@srv1 ~]# pcs resource enable NFS_vip --wait=10s
Resource 'NFS_vip' is running on node srv2.
[root@srv1 ~]# pcs resource
 Resource Group: MySQL
     MySQL_vip	(ocf::heartbeat:IPaddr2):	Started srv1
     MySQL_srv	(ocf::heartbeat:mysql):	Started srv1
 Resource Group: NFS
     NFS_vip	(ocf::heartbeat:IPaddr2):	Started srv2

Through this way now we know how we can stop or start Cluster resources through pcs command.