Common Cluster Administrative Commands in Red Hat Enterprise Linux 6 and 7

Updated

CLUSTER INSTALLATION AND SETUP

Taskrgmanager (RHEL 6)Pacemaker (RHEL 6 and RHEL 7)
Available configuration toolsluci web UI
ccs command
pcs command
pcs web UI (RHEL 7 only)
Configuration filescluster.conf
Can be edited directly
corosync.conf
cib.xml
Do not edit cib.xml file directly
InstallationOn all nodes:
yum groupinstall 'High Availability' 'Resilient Storage'
On node that runs luci:
yum install luci
If using clustered file systems:
yum install lvm2-cluster gfs2-utils
RHEL 7
On all nodes:
yum install pcs
If using clustered file systems:
yum install lvm2-cluster gfs2-utils
RHEL 6
On all nodes:
yum install pacemaker cman pcs
chkconfig corosync off
If using clustered file systems:
yum install lvm2-cluster gfs2-utils
Starting and enabling cluster servicesOn all nodes:
service ricci start
chkconfig ricci on
On the node that runs luci:
service luci start
chkconfig luci on
On all nodes:
systemctl start pcsd.service
systemctl enable pcsd.service
AuthenticationOn all nodes:
passwd ricci
Authorization done on first connection from ccs to ricci
On all nodes:
passwd hacluster
On one node:
pcs cluster auth clusternode1 clusternode2...

CLUSTER CREATION

Taskrgmanager (RHEL 6)Pacemaker (RHEL 6 and RHEL 7)
Create clusterccs -h host --createcluster clusternamepcs cluster setup [--start] --name clustername node1 node2 ...
Start clusterccs -h host --startallStart on one node:
pcs cluster start
Start on all cluster members:
pcs cluster start --all
Enable clusterAutomatic with --startall
To prevent automatic enable, use:
ccs -h host --startall --noenable
pcs cluster --enable --all
Stop clusterccs -h host --stopallStop one node:
pcs cluster stop
Stop on all cluster members:
pcs cluster stop --all
Add node to clusterccs -h host --addnode nodepcs cluster node add node
Remove node from clusterccs -h host --rmnode nodepcs cluster node remove node
Show configured cluster nodesccs -h host --lsnodespcs cluster status
Show cluster configurationccs -h host --getconfpcs config show
Sync cluster configurationccs -h host --sync --activatePropagation is automatic on configuration for pacemaker cib.xml file
To sync corosync.conf in RHEL 7 or cluster.conf in RHEL 6:
pcs cluster sync

FENCING

Taskrgmanager (RHEL 6)Pacemaker (RHEL 6 and RHEL 7)
Show fence agentsccs -h host --lsfenceoptspcs stonith list
Show fence agent optionsccs -h host --lsfencopts agentnamepcs stonith describe fenceagent
Create fence deviceCreate fence device:
ccs -h host --addfencedev device_name agent=fenceagent agent_options
Create fence method:
ccs -h host --addmethod method node
Add fence instance to method:
ccs -h host --adfenceinst device_name node method options
pcs stonith create stonith_id stonith_device_type [stonith_device_options]
Configure backup fence deviceAdd second fence method to nodepcs stonith level add level node devices
Remove a fence deviceRemove fence device:
ccs -h host --rmfencedev device_name
Remove fence method:
ccs -h host --rmmethod method node
Remove all fence instances from a method:
ccs -h host --rmfenceinst device_name node method
pcs stonith delete stonith_id
Modify a fence deviceRemove fence device then create it again with modified attributes.pcs stonith update stonith_id stonith_device_options
Display configured fence devicesccs -h host --lsfencedevpcs stonith show

CLUSTER RESOURCES AND RESOURCE GROUPS

Taskrgmanager (RHEL 6)Pacemaker (RHEL 6 and RHEL 7)
List available resource agentsccs -h host --lsresourceoptpcs resource list
List options for a specific resourceccs -h host --lsserviceopts resourcetypepcs resource describe resourcetype
Create resourceglobal resource
ccs -h host addresource resourcetype resource_options
resource local to a service
Add resource to service group as subservice:
ccs -h host --addsubservice servicename subservice service_options
pcs resource create resource_id resourcetype resource_options
Create resource groupsCreate a service group, then add resources as subservices:
ccs -h host --addservice servicename service_options
ccs -h host --addsubservice servicename subservice service_options
pcs resource group add group_name resource_id1 [resource_id2] [...]
or create group on resource creation
pcs resource create resource_id resourcetype resource_options --group group_name
Create resource to run on all nodesCreate separate resource for each node; no actual "clone".pcs resource create resource_id resourcetype resource_options --clone clone_options
Display configured resourcesccs -h host --getconfpcs resource show [--full]
Configure resource contraintsCreate failover domain
ccs -h host --addfailoverdomain failover_domain_name
Add node to failover domain
ccs -h host –addfailoverdomainnode failover_domain_name node priority
Order constraints (if not using service groups)
pcs constraint order [action] resource_id1 then [action] resource_id2
Location constraints
pcs constraint location rsc prefers node[=score]
pcs constraint location rsc avoids node[=score]
Colocation constraints
pcs constraint colocation add source_resource with target_resource [=score]
Modify a resource optionRemove resource and reconfigure with modified optionspcs resource update resource_id resource_options

WEB UI

Taskrgmanager (RHEL 6)Pacemaker (RHEL 6 and RHEL 7)
URLhttps://node:8084https://node:2224
LoginLogin as root or as authorized luci userLogin as user hacluster or authorized pcsd user
Required services on node running Web UIluci, riccipcsd
AuthenticationAuthorization done on first connection from ccs to riccipcs cluster auth node1 node2 ...

TROUBLESHOOTING

Taskrgmanager (RHEL 6)Pacemaker (RHEL 6 and RHEL 7)
Display current cluster and resource statusclustatpcs status
Display current version informationclustat -v
cman_tool version
pcs status
Stop and disable a cluster elementclusvcadm -d service_name
Stop service until member transition or enablement:
clusvcadm -s service_name
pcs resource disable resource
Enable a cluster elementclusvcadm -e service_namepcs resource enable resource
Freeze a cluster element (prevent status check)clusvcadm -Z service_namepcs resource unmanage resource
Unfreeze a cluster element (resume status check)clusvcadm -U service_namepcs resource manage resource
Disable cluster resource managementDisable Pacemaker resource management:
pcs property set maintenance-mode=true
Re-enable Pacemaker resource management:
pcs property set maintenance-mode=false
Disable single nodeccs -h node --stoppcs cluster standby node
Re-enable nodeccs -h node --startpcs cluster unstandby node
Move cluster element to another nodeMove service to another node:
clusvcadm -r service_name -m nodename
Relocate virtual machine resources:
clusvcadm -M vm_resource
pcs resource move groupname move_to_nodename
(move_to_nodename remains preferred node until "pcs resource clear" is executed)
Article Type