Skip to content

Resource Groups

Pacemaker resources represent the services, IP addresses, or filesystems that your cluster manages to ensure high availability. Defining and managing these resources is critical to configuring a resilient cluster. This section provides step-by-step guidance for creating and managing resources using the pcs (Pacemaker Cluster Suite) command-line tool.


Creating Resources

Service Resources

To define a service resource, use the pcs resource create command with the service name and the underlying systemd unit. For example, to create a resource for Apache:

pcs resource create apache systemd:apache

This creates a resource named apache that starts the apache2 service. You can verify its existence with:

pcs resource show

IP Address Resources

IP address resources ensure a consistent IP address is available across cluster nodes. Use the IPaddr2 resource agent:

pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.1.100 interface=eth0

This creates a resource named virtual_ip that manages the IP address 192.168.1.100 on the eth0 interface. Adjust the IP and interface as needed.

Filesystem Resources

Filesystems are managed using the Filesystem resource agent. Define a resource to mount a shared filesystem:

pcs resource create shared_fs ocf:heartbeat:Filesystem device=/dev/sdb1 directory=/mnt/shared options=rw

This mounts the /dev/sdb1 device to /mnt/shared with read-write permissions. Ensure the device and mount point match your storage configuration.


Managing Resources

Starting and Stopping Resources

Use pcs resource start and pcs resource stop to control individual resources:

pcs resource start apache
pcs resource stop virtual_ip

To stop all resources on a node, use:

pcs resource stop --all

Migrating Resources

Move a resource to a specific node with:

pcs resource move apache node2

This ensures the apache service runs on node2. To force a migration, add the --force flag:

pcs resource move apache node2 --force

Checking Resource Status

Use pcs status to view the current state of all resources and their locations:

pcs status

This output shows which node hosts each resource and whether they are online or offline.


Key Takeaways

  • Use pcs resource create to define services, IP addresses, and filesystems with appropriate resource agents.
  • Manage resources with pcs resource start, stop, move, and disable commands.
  • Always verify resource status with pcs status to ensure proper cluster behavior.
  • Test migrations and failover scenarios to validate resource resilience.