pcs
pcs is a command-line tool used to manage and configure high-availability clusters based on Pacemaker and Corosync. It allows administrators to manage cluster nodes, configure resources, control failover and fencing, and more. Below are some common pcs commands and their subcommands:
Cluster Management
pcs cluster start [nodes]Starts the Pacemaker cluster on specified nodes.pcs cluster start node1 node2pcs cluster stop [nodes]Stops the cluster on the specified nodes.pcs cluster stop node1 node2pcs cluster statusDisplays the status of the entire cluster.pcs cluster statuspcs cluster enable --allEnables the cluster to automatically start on boot for all nodes.pcs cluster enable --allpcs cluster disable --allDisables the cluster from starting automatically on boot.pcs cluster disable --allpcs cluster destroyRemoves the cluster configuration, essentially destroying the cluster setup.pcs cluster destroy
Resource Management
pcs resource create [resource-name] [type] [options]Creates a resource in the cluster. Resources can be services, IP addresses, filesystems, or other cluster-managed entities.pcs resource create my-ip ocf:heartbeat:IPaddr2 ip=192.168.1.100 cidr_netmask=24pcs resource delete [resource-name]Deletes a resource from the cluster.pcs resource delete my-ippcs resource restart [resource-name]Restarts a specific resource.pcs resource restart my-ippcs resource statusDisplays the status of all resources.pcs resource statuspcs resource manage [resource-name]Enables manual management of the resource, preventing Pacemaker from managing it automatically.pcs resource manage my-ippcs resource unmanage [resource-name]Reverts a manually managed resource back to automatic management by Pacemaker.pcs resource unmanage my-ip
Node Management
pcs node standby [node-name]Places the specified node into standby mode, preventing it from hosting resources.pcs node standby node1pcs node unstandby [node-name]Removes the node from standby mode, allowing it to host resources again.pcs node unstandby node1pcs node remove [node-name]Removes a node from the cluster.pcs node remove node2
Fencing and STONITH
pcs stonith create [name] [type] [options]Creates a STONITH (Shoot The Other Node In The Head) fencing device to reboot or power off a node in case of failure.pcs stonith create fence-device fence_ipmilan ipaddr=192.168.1.10 login=root passwd=password pcmk_host_list=node1pcs stonith delete [stonith-device-name]Deletes a STONITH device.pcs stonith delete fence-devicepcs stonith statusDisplays the status of all STONITH devices.pcs stonith status
Constraint Management
pcs constraint location [resource-name] prefers [node-name]Sets a location preference for a resource to run on a particular node.pcs constraint location my-ip prefers node1=100pcs constraint colocation add [resource1] with [resource2]Ensures that two resources run on the same node (or different nodes using a negative score).pcs constraint colocation add app with my-ippcs constraint order start [resource1] then [resource2]Sets the order in which resources are started or stopped.pcs constraint order start my-ip then app
Quorum and Status
pcs quorum statusShows quorum status for the cluster.pcs quorum statuspcs statusDisplays a high-level overview of the cluster, including nodes, resources, and fencing devices.pcs statuspcs configShows the current cluster configuration.pcs config
Property and Options Management
pcs property set [property-name]=[value]Sets cluster-wide properties, such as enabling or disabling STONITH.pcs property set stonith-enabled=falsepcs resource defaultsDisplays or sets default values for resource options such as timeouts or monitoring intervals.pcs resource defaults resource-stickiness=100
pcs is a comprehensive tool for managing Pacemaker/Corosync-based high-availability clusters. It provides rich functionality to configure, monitor, and troubleshoot clusters effectively, ensuring uptime and reliability in critical systems.
Last updated