Red Hat Enterprise Linux-6-Configuring The Red Hat High Availability Add-On With Pacemaker-en-US
Red Hat Enterprise Linux-6-Configuring The Red Hat High Availability Add-On With Pacemaker-en-US
Red Hat Enterprise Linux-6-Configuring The Red Hat High Availability Add-On With Pacemaker-en-US
Reference Document for the High Availability Add-On for Red Hat Enterprise Linux
6
Reference Document for the High Availability Add-On for Red Hat Enterprise Linux 6
Steven Levine
Red Hat Customer Content Services
[email protected]
Legal Notice
This document is licensed by Red Hat under the Creative Commons Attribution-ShareAlike 3.0
Unported License. If you distribute this document, or a modified version of it, you must provide
attribution to Red Hat, Inc. and provide a link to the original. If the document is modified, all Red
Hat trademarks must be removed.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert,
Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity
logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other
countries.
Linux ® is the registered trademark of Linus Torvalds in the United States and other countries.
XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United
States and/or other countries.
MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and
other countries.
Node.js ® is an official trademark of Joyent. Red Hat Software Collections is not formally related
to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack ® Word Mark and OpenStack logo are either registered trademarks/service marks
or trademarks/service marks of the OpenStack Foundation, in the United States and other
countries and are used with the OpenStack Foundation's permission. We are not affiliated with,
endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
Abstract
Configuring the Red Hat High Availability Add-On with Pacemaker provides information on
configuring the Red Hat High Availability Add-On using Pacemaker.
Table of Contents
Table of Contents
.INTRODUCTION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4. . . . . . . . . . . .
1. FEEDBACK 4
CHAPTER 1. RED HAT HIGH AVAILABILITY ADD-ON CONFIGURATION AND MANAGEMENT REFERENCE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6. . . . . . . . . . . .
OVERVIEW
1.1. INSTALLING PACEMAKER CONFIGURATION TOOLS 6
1.2. CONFIGURING THE IPTABLES FIREWALL TO ALLOW CLUSTER COMPONENTS 6
1.3. THE CLUSTER AND PACEMAKER CONFIGURATION FILES 7
1.4. CLUSTER CONFIGURATION CONSIDERATIONS 7
.CHAPTER
. . . . . . . . . . 2.
. . THE
. . . . . PCS
. . . . .COMMAND
. . . . . . . . . . . .LINE
. . . . .INTERFACE
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8. . . . . . . . . . . .
2.1. THE PCS COMMANDS 8
2.2. PCS USAGE HELP DISPLAY 8
2.3. VIEWING THE RAW CLUSTER CONFIGURATION 9
2.4. SAVING A CONFIGURATION CHANGE TO A FILE 9
2.5. DISPLAYING STATUS 9
2.6. DISPLAYING THE FULL CLUSTER CONFIGURATION 10
2.7. DISPLAYING THE CURRENT PCS VERSION 10
. . . . . . . . . . . 3.
CHAPTER . . CLUSTER
. . . . . . . . . . .CREATION
. . . . . . . . . . . AND
. . . . . ADMINISTRATION
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
.............
3.1. CLUSTER CREATION 11
3.1.1. Starting the pcsd daemon 11
3.1.2. Authenticating the Cluster Nodes 11
3.1.3. Configuring and Starting the Cluster Nodes 12
3.1.4. Enabling and Disabling Cluster Services 12
3.2. MANAGING CLUSTER NODES 13
3.2.1. Stopping Cluster Services 13
3.2.2. Adding Cluster Nodes 13
3.2.3. Removing Cluster Nodes 14
3.2.4. Standby Mode 15
3.3. SETTING USER PERMISSIONS 15
3.4. REMOVING THE CLUSTER CONFIGURATION 17
3.5. DISPLAYING CLUSTER STATUS 17
.CHAPTER
. . . . . . . . . . 4.
. . .FENCING:
. . . . . . . . . .CONFIGURING
. . . . . . . . . . . . . . . STONITH
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18
.............
4.1. AVAILABLE STONITH (FENCING) AGENTS 18
4.2. GENERAL PROPERTIES OF FENCING DEVICES 18
4.3. DISPLAYING DEVICE-SPECIFIC FENCING OPTIONS 19
4.4. CREATING A FENCING DEVICE 20
4.5. CONFIGURING STORAGE-BASED FENCE DEVICES WITH UNFENCING 20
4.6. DISPLAYING FENCING DEVICES 20
4.7. MODIFYING AND DELETING FENCING DEVICES 21
4.8. MANAGING NODES WITH FENCE DEVICES 21
4.9. ADDITIONAL FENCING CONFIGURATION OPTIONS 21
4.10. CONFIGURING FENCING LEVELS 24
4.11. CONFIGURING FENCING FOR REDUNDANT POWER SUPPLIES 25
4.12. CONFIGURING ACPI FOR USE WITH INTEGRATED FENCE DEVICES 26
4.12.1. Disabling ACPI Soft-Off with chkconfig Management 27
4.12.2. Disabling ACPI Soft-Off with the BIOS 27
4.12.3. Disabling ACPI Completely in the grub.conf File 28
.CHAPTER
. . . . . . . . . . 5.
. . CONFIGURING
. . . . . . . . . . . . . . . .CLUSTER
. . . . . . . . . .RESOURCES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
..............
5.1. RESOURCE CREATION 30
1
Configuring the Red Hat High Availability Add-On with Pacemaker
.CHAPTER
. . . . . . . . . . 6.
. . RESOURCE
. . . . . . . . . . . . .CONSTRAINTS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41
.............
6.1. LOCATION CONSTRAINTS 41
6.1.1. Configuring an "Opt-In" Cluster 43
6.1.2. Configuring an "Opt-Out" Cluster 43
6.2. ORDER CONSTRAINTS 43
6.2.1. Mandatory Ordering 44
6.2.2. Advisory Ordering 45
6.2.3. Ordered Resource Sets 45
6.2.4. Removing Resources From Ordering Constraints 46
6.3. COLOCATION OF RESOURCES 46
6.3.1. Mandatory Placement 47
6.3.2. Advisory Placement 47
6.3.3. Colocating Sets of Resources 47
6.3.4. Removing Colocation Constraints 48
6.4. DISPLAYING CONSTRAINTS 48
. . . . . . . . . . . 7.
CHAPTER . . MANAGING
. . . . . . . . . . . . .CLUSTER
. . . . . . . . . .RESOURCES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
..............
7.1. MANUALLY MOVING RESOURCES AROUND THE CLUSTER 50
7.1.1. Moving a Resource from its Current Node 50
7.1.2. Moving a Resource to its Preferred Node 51
7.2. MOVING RESOURCES DUE TO FAILURE 52
7.3. MOVING RESOURCES DUE TO CONNECTIVITY CHANGES 52
7.4. ENABLING, DISABLING, AND BANNING CLUSTER RESOURCES 53
7.5. DISABLING A MONITOR OPERATIONS 54
7.6. MANAGED RESOURCES 54
. . . . . . . . . . . 8.
CHAPTER . . .ADVANCED
. . . . . . . . . . . . RESOURCE
. . . . . . . . . . . . TYPES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
..............
8.1. RESOURCE CLONES 56
8.1.1. Creating and Removing a Cloned Resource 56
8.1.2. Clone Constraints 57
8.1.3. Clone Stickiness 58
8.2. MULTI-STATE RESOURCES: RESOURCES THAT HAVE MULTIPLE MODES 58
8.2.1. Monitoring Multi-State Resources 59
8.2.2. Multi-state Constraints 59
8.2.3. Multi-state Stickiness 60
8.3. CONFIGURING A VIRTUAL DOMAIN AS A RESOURCE 60
8.4. THE PACEMAKER_REMOTE SERVICE 62
8.4.1. Host and Guest Authentication 63
8.4.2. Guest Node Resource Options 63
8.4.3. Remote Node Resource Options 64
8.4.4. Changing Default pacemaker_remote Options 64
2
Table of Contents
. . . . . . . . . . . 9.
CHAPTER . . PACEMAKER
. . . . . . . . . . . . . . .RULES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
..............
9.1. NODE ATTRIBUTE EXPRESSIONS 70
9.2. TIME/DATE BASED EXPRESSIONS 71
9.3. DATE SPECIFICATIONS 71
9.4. DURATIONS 72
9.5. CONFIGURING RULES WITH PCS 72
9.6. SAMPLE TIME BASED EXPRESSIONS 72
9.7. USING RULES TO DETERMINE RESOURCE LOCATION 73
.CHAPTER
. . . . . . . . . . 10.
. . . PACEMAKER
. . . . . . . . . . . . . . .CLUSTER
. . . . . . . . . .PROPERTIES
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
..............
10.1. SUMMARY OF CLUSTER PROPERTIES AND OPTIONS 74
10.2. SETTING AND REMOVING CLUSTER PROPERTIES 76
10.3. QUERYING CLUSTER PROPERTY SETTINGS 76
.CHAPTER
. . . . . . . . . . 11.
. . .TRIGGERING
. . . . . . . . . . . . . .SCRIPTS
. . . . . . . . . FOR
. . . . .CLUSTER
. . . . . . . . . . EVENTS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
..............
11.1. PACEMAKER ALERT AGENTS (RED HAT ENTERPRISE LINUX 6.9 AND LATER) 78
11.1.1. Using the Sample Alert Agents 78
11.1.2. Alert Creation 79
11.1.3. Displaying, Modifying, and Removing Alerts 80
11.1.4. Alert Recipients 80
11.1.5. Alert Meta Options 80
11.1.6. Alert Configuration Command Examples 81
11.1.7. Writing an Alert Agent 83
11.2. EVENT NOTIFICATION WITH MONITORING RESOURCES 85
APPENDIX A. CLUSTER CREATION IN RED HAT ENTERPRISE LINUX RELEASE 6.5 AND RED HAT
. . . . . . . . . . . . . . LINUX
ENTERPRISE . . . . . . . .RELEASE
. . . . . . . . . .6.6
. . . (AND
. . . . . . LATER)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
..............
A.1. CLUSTER CREATION WITH RGMANAGER AND WITH PACEMAKER 88
A.2. CLUSTER CREATION WITH PACEMAKER IN RED HAT ENTERPRISE LINUX RELEASE 6.5 AND RED HAT
ENTERPRISE LINUX RELEASE 6.6 (AND LATER) 92
. . . . . . . . . . . . B.
APPENDIX . . .CONFIGURATION
. . . . . . . . . . . . . . . . . .EXAMPLE
. . . . . . . . . . .USING
. . . . . . .PCS
. . . . COMMANDS
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
..............
B.1. INITIAL SYSTEM SETUP 93
B.1.1. Installing the Cluster Software 93
B.1.2. Creating and Starting the Cluster 93
B.2. FENCING CONFIGURATION 95
B.3. CONFIGURING AN APACHE HTTP SERVER IN A RED HAT HIGH AVAILABILITY CLUSTER WITH THE PCS
COMMAND 96
B.3.1. Configuring an LVM Volume with an ext4 File System 96
B.3.2. Web Server Configuration 97
B.3.3. Exclusive Activation of a Volume Group in a Cluster 98
B.3.4. Creating the Resources and Resource Groups with the pcs Command 100
B.3.5. Testing the Resource Configuration 101
. . . . . . . . . . . . C.
APPENDIX . . .UPDATING
. . . . . . . . . . . SOFTWARE
. . . . . . . . . . . . PACKAGES
. . . . . . . . . . . . .ON
. . .A
. . RUNNING
. . . . . . . . . . .CLUSTER
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
...............
. . . . . . . . . . . . D.
APPENDIX . . .CREATING
. . . . . . . . . . .NEW
. . . . . LOGICAL
. . . . . . . . . .VOLUMES
. . . . . . . . . . .FOR
. . . . .AN
. . . EXISTING
. . . . . . . . . . .CLUSTER
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
...............
. . . . . . . . . . . . E.
APPENDIX . . REVISION
. . . . . . . . . . . HISTORY
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
..............
3
Configuring the Red Hat High Availability Add-On with Pacemaker
INTRODUCTION
This document provides information about installing, configuring and managing Red Hat High
Availability Add-On components. Red Hat High Availability Add-On components allow you to connect a
group of computers (called nodes or members) to work together as a cluster. In this document, the use
of the word cluster or clusters is used to refer to a group of computers running the Red Hat High
Availability Add-On.
The audience of this document should have advanced working knowledge of Red Hat Enterprise Linux
and understand the concepts of clusters, storage, and server computing.
For more information about Red Hat Enterprise Linux 6, see the following resources:
Red Hat Enterprise Linux Installation Guide— Provides information regarding installation of Red
Hat Enterprise Linux 6.
Red Hat Enterprise Linux Deployment Guide— Provides information regarding the deployment,
configuration and administration of Red Hat Enterprise Linux 6.
For more information about the High Availability Add-On and related products for Red Hat Enterprise
Linux 6, see the following resources:
High Availability Add-On Overview — Provides a high-level overview of the Red Hat High
Availability Add-On.
Cluster Administration — Provides information about installing, configuring and managing the
High Availability Add-On.
Logical Volume Manager Administration — Provides a description of the Logical Volume Manager
(LVM), including information on running LVM in a clustered environment.
Global File System 2: Configuration and Administration— Provides information about installing,
configuring, and maintaining Red Hat GFS2 (Red Hat Global File System 2), which is included in
the Resilient Storage Add-On.
DM Multipath — Provides information about using the Device-Mapper Multipath feature of Red
Hat Enterprise Linux 6.
Release Notes — Provides information about the current release of Red Hat products.
Red Hat documents are available in HTML, PDF, and RPM versions on the Red Hat Enterprise
Documentation CD and online at https://access.redhat.com/site/documentation/.
1. FEEDBACK
If you spot a typo, or if you have thought of a way to make this manual better, we would love to hear
from you. Please submit a report in Bugzilla: http://bugzilla.redhat.com/bugzilla/. File the bug against
the product Red Hat Enterprise Linux 6 and the component doc-Cluster_General.
4
INTRODUCTION
Configuring_High_Availability_With_Pacemaker(EN)-6 (2017-1-4T16:26)
By mentioning this manual's identifier, we know exactly which version of the guide you have.
If you have a suggestion for improving the documentation, try to be as specific as possible. If you have
found an error, include the section number and some of the surrounding text so we can find it easily.
5
Configuring the Red Hat High Availability Add-On with Pacemaker
This manual documents the use of the pcs configuration interface for the Red Hat Enterprise Linux
Release 6.6 and later.
NOTE
For information on best practices for deploying and upgrading Red Hat Enterprise Linux
clusters using the High Availability Add-On and Red Hat Global File System 2 (GFS2) see
the article "Red Hat Enterprise Linux Cluster, High Availability, and GFS Deployment
Best Practices" on Red Hat Customer Portal at
https://access.redhat.com/kb/docs/DOC-40821.
The lvm2-cluster and gfs2-utils packages are part of ResilientStorage channel. You can install
them, as needed, with the following command.
WARNING
After you install the Red Hat High Availability Add-On packages, you should ensure
that your software update preferences are set so that nothing is installed
automatically. Installation on a running cluster can cause unexpected behaviors.
6
CHAPTER 1. RED HAT HIGH AVAILABILITY ADD-ON CONFIGURATION AND MANAGEMENT REFERENCE OVERVIEW
TCP 3121 Required on all nodes if the cluster has any Pacemaker Remote nodes
TCP 21064 Required on all nodes if the cluster contains any resources requiring DLM (such as
clvm or GFS2)
UDP 5404 Required on cluster nodes if corosync is configured for multicast UDP
The cluster.conf file provides the cluster parameters used by corosync, the cluster manager that
Pacemaker is built on.
The cib.xml file is an XML file that represents both the cluster’s configuration and current state of all
resources in the cluster. This file is used by Pacemaker's Cluster Information Base (CIB). The contents
of the CIB are automatically kept in sync across the entire cluster
Red Hat does not support cluster deployments greater than 16 full cluster nodes. It is possible,
however, to scale beyond that limit with remote nodes running the pacemaker_remote
service. For information on the pacemaker_remote service, see Section 8.4, “The
pacemaker_remote Service”.
The use of Dynamic Host Configuration Protocol (DHCP) for obtaining an IP address on a
network interface that is utilized by the corosync daemons is not supported. The DHCP client
can periodically remove and re-add an IP address to its assigned interface during address
renewal. This will result in corosync detecting a connection failure, which will result in fencing
activity from any other nodes in the cluster using corosync for heartbeat connectivity.
7
Configuring the Red Hat High Availability Add-On with Pacemaker
cluster
Configure cluster options and nodes. For information on the pcs cluster command, see
Chapter 3, Cluster Creation and Administration.
resource
Create and manage cluster resources. For information on the pcs cluster command, see
Chapter 5, Configuring Cluster Resources, Chapter 7, Managing Cluster Resources, and Chapter 8,
Advanced Resource types.
stonith
Configure fence devices for use with Pacemaker. For information on the pcs stonith
command, see Chapter 4, Fencing: Configuring STONITH.
constraint
Manage resource constraints. For information on the pcs constraint command, see
Chapter 6, Resource Constraints.
property
Set Pacemaker properties. For information on setting properties with the pcs property
command, see Chapter 10, Pacemaker Cluster Properties.
status
View current cluster and resource status. For information on the pcs status command, see
Section 2.5, “Displaying Status”.
config
Display complete cluster configuration in user-readable form. For information on the pcs
config command, see Section 2.6, “Displaying the Full Cluster Configuration” .
8
CHAPTER 2. THE PCS COMMAND LINE INTERFACE
# pcs resource -h
Usage: pcs resource [commands]...
Manage pacemaker resources
Commands:
show [resource id] [--all]
Show all currently configured resources or if a resource is
specified
show the options for the configured resource. If --all is
specified
resource options will be displayed
You can save the raw cluster configuration to a specified file with the pcs cluster cib filename
as described in Section 2.4, “Saving a Configuration Change to a File” .
If you have previously configured a cluster and there is already an active CIB, you use the following
command to save the raw xml a file.
For example, the following command saves the raw xml from the CIB into a file name testfile.
The following command creates a resource in the file testfile1 but does not add that resource to
the currently running cluster configuration.
You can push the current content of testfile to the CIB with the following command.
9
Configuring the Red Hat High Availability Add-On with Pacemaker
If you do not specify a commands parameter, this command displays all information about the cluster
and the resources. You display the status of only particular cluster components by specifying
resources, groups, cluster, nodes, or pcsd.
pcs config
pcs --version
10
CHAPTER 3. CLUSTER CREATION AND ADMINISTRATION
The following sections described the commands that you use to perform these steps.
The user name for the pcs administrator must be hacluster on every node. It is
recommended that the password for user hacluster be the same on each node.
If you do not specify user name or password, the system will prompt you for those parameters
for each node when you execute the command.
If you do not specify any nodes, this command will authenticate pcs on the nodes that are
specified with a pcs cluster setup command, if you have previously executed that
command.
For example, the following command authenticates user hacluster on z1.example.com for both of
the nodes in the cluster that consist of z1.example.com and z2.example.com. This command
prompts for the password for user hacluster on the cluster nodes.
11
Configuring the Red Hat High Availability Add-On with Pacemaker
If you specify the --start option, the command will also start the cluster services on the
specified nodes. If necessary, you can also start the cluster services with a separate pcs
cluster start command.
When you create a cluster with the pcs cluster setup --start command or when you
start cluster services with the pcs cluster start command, there may be a slight delay
before the cluster is up and running. Before performing any subsequent actions on the cluster
and its configuration, it is recommended that you use the pcs cluster status command to
be sure that the cluster is up and running.
If you specify the --local option, the command will perform changes on the local node only.
pcs cluster setup [--start] [--local] --name cluster_ name node1 [node2]
[...]
The following command starts cluster services on the specified node or nodes.
If you specify the --all option, the command starts cluster services on all nodes.
If you do not specify any nodes, cluster services are started on the local node only.
If you specify the --all option, the command enables cluster services on all nodes.
If you do not specify any nodes, cluster services are enabled on the local node only.
Use the following command to configure the cluster services not to run on startup on the specified
node or nodes.
If you specify the --all option, the command disables cluster services on all nodes.
If you do not specify any nodes, cluster services are disabled on the local node only.
You can verify whether cluster services are enabled by running the pcs status command on a
running cluster. At the bottom of the output of this command, you should see that pacemaker is
enabled, which ensures that the cluster starts on reboot. All other services should be disabled.
12
CHAPTER 3. CLUSTER CREATION AND ADMINISTRATION
# pcs status
...
Daemon Status:
cman: active/disabled
corosync: active/disabled
pacemaker: active/enabled
pcsd: active/disabled
If the cluster is not running, you can verify whether cluster services are enabled by running the
following chkconfig command. If 2, 3, 4, and 5 are on, the cluster is enabled.
You can force a stop of cluster services on the local node with the following command, which performs
a kill -9 command.
NOTE
It is highly recommended that you add nodes to existing clusters only during a
production maintenance window. This allows you to perform appropriate resource and
deployment testing for the new node and its fencing configuration.
Use the following procedure to add a new node to an existing cluster. In this example, the existing
cluster nodes are clusternode-01.example.com, clusternode-02.example.com, and
clusternode-03.example.com. The new node is newnode.example.com.
On the new node to add to the cluster, perform the following tasks.
1. Install the cluster packages. If the cluster uses SBD, you must manually install the sbd package
on the new node as well.
13
Configuring the Red Hat High Availability Add-On with Pacemaker
2. To prevent corosync from starting without cman, execute the following command:
3. Set a password for the user ID hacluster. It is recommended that you use the same password
for each node in the cluster.
2. Add the new node to the existing cluster. This command also syncs the cluster configuration
file cluster.conf to all nodes in the cluster, including the new node you are adding.
On the new node to add to the cluster, perform the following tasks.
1. Enable cluster services on the new node. In Red Hat Enterprise Linux 6, the new node is
started automatically by PCS.
2. Ensure that you configure and test a fencing device for the new cluster node. For information
on configuring fencing devices, see Chapter 4, Fencing: Configuring STONITH.
14
CHAPTER 3. CLUSTER CREATION AND ADMINISTRATION
You can use this command when updating a resource's packages. You can also use this command when
testing a configuration, to simulate recovery without actually shutting down a node.
The following command removes the specified node from standby mode. After running this command,
the specified node is then able to host resources. If you specify the --all, this command removes all
nodes from standby mode.
Note that when you execute the pcs cluster standby command, this adds constraints to the
resources to prevent them from running on the indicated node. When you execute the pcs cluster
unstandby command, this removes the constraints. This does not necessarily move the resources
back to the indicated node; where the resources can run at that point depends on how you have
configured your resources initially. For information on resource constraints, see Chapter 6, Resource
Constraints.
1. Execute the pcs acl role create... command to create a role which defines the
permissions for that role.
2. Assign the role you created to a user with the pcs acl user create command.
The following example procedure provides read-only access for a cluster configuration to a local user
named rouser.
1. This procedure requires that the user rouser exists on the local system and that the user
rouser is a member of the group haclient.
# adduser rouser
# usermod -a -G haclient rouser
15
Configuring the Red Hat High Availability Add-On with Pacemaker
3. Create a role named read-only with read-only permissions for the cib.
4. Create the user rouser in the pcs ACL system and assign that user the read-only role.
# pcs acl
User: rouser
Roles: read-only
Role: read-only
Description: Read access to cluster
Permission: read xpath /cib (read-only-read)
The following example procedure provides write access for a cluster configuration to a local user
named wuser.
1. This procedure requires that the user wuser exists on the local system and that the user
wuser is a member of the group haclient.
# adduser wuser
# usermod -a -G haclient wuser
3. Create a role named write-access with write permissions for the cib.
4. Create the user wuser in the pcs ACL system and assign that user the write-access role.
# pcs acl
User: rouser
Roles: read-only
User: wuser
Roles: write-access
Role: read-only
Description: Read access to cluster
16
CHAPTER 3. CLUSTER CREATION AND ADMINISTRATION
For further information about cluster ACLs, see the help screen for the pcs acl command.
WARNING
This command permanently removes any cluster configuration that has been
created. It is recommended that you run pcs cluster stop before destroying
the cluster.
pcs status
You can display a subset of information about the current status of the cluster with the following
commands.
The following command displays the status of the cluster, but not the cluster resources.
17
Configuring the Red Hat High Availability Add-On with Pacemaker
Just because a node is unresponsive, this does not mean it is not accessing your data. The only way to
be 100% sure that your data is safe, is to fence the node using STONITH so we can be certain that the
node is truly offline, before allowing the data to be accessed from another node.
STONITH also has a role to play in the event that a clustered service cannot be stopped. In this case,
the cluster uses STONITH to force the whole node offline, thereby making it safe to start the service
elsewhere.
NOTE
To disable a fencing device/resource, you can set the target-role as you would for a
normal resource.
NOTE
To prevent a specific node from using a fencing device, you can configure location
constraints for the fencing resource.
Table 4.1, “General Properties of Fencing Devices” describes the general properties you can set for
fencing devices. Refer to Section 4.3, “Displaying Device-Specific Fencing Options” for information on
fencing properties you can set for specific fencing devices.
NOTE
For information on more advanced fencing configuration properties, see Section 4.9,
“Additional Fencing Configuration Options”
18
CHAPTER 4. FENCING: CONFIGURING STONITH
For example, the following command displays the options for the fence agent for APC over telnet/SSH.
19
Configuring the Red Hat High Availability Add-On with Pacemaker
If you use a single fence device for several nodes, using a different port of each node, you do not need
to create a device separately for each node. Instead you can use the pcmk_host_map option to define
which port goes to which node. For example, the following command creates a single fencing device
called myapc-west-13 that uses an APC powerswitch called west-apc and uses port 15 for node
west-13.
The following example, however, uses the APC powerswitch named west-apc to fence nodes west-
13 using port 15, west-14 using port 17, west-15 using port 18, and west-16 using port 19.
Setting the provides=unfencing meta option is not necessary when configuring a power-based
fence device, since the device itself is providing power to the node in order for it to boot (and attempt
to rejoin the cluster). The act of booting in this case implies that unfencing occurred.
The following command configures a stonith device named my-scsi-shooter that uses the
fence_scsi fence agent, enabling unfencing for the device.
20
CHAPTER 4. FENCING: CONFIGURING STONITH
Use the following command to remove a fencing device from the current configuration.
In a situation where no stonith device is able to fence a node even if it is no longer active, the cluster
may not be able to recover the resources on the node. If this occurs, after manually ensuring that the
node is powered down you can run the following command to confirm to the cluster that the node is
powered down and free its resources for recovery.
WARNING
If the node you specify is not actually off, but running the cluster software or
services normally controlled by the cluster, data corruption/cluster failure will
occur.
21
Configuring the Red Hat High Availability Add-On with Pacemaker
22
CHAPTER 4. FENCING: CONFIGURING STONITH
23
Configuring the Red Hat High Availability Add-On with Pacemaker
If a device fails, processing terminates for the current level. No further devices in that level are
exercised and the next level is attempted instead.
If all devices are successfully fenced, then that level has succeeded and no other levels are
tried.
24
CHAPTER 4. FENCING: CONFIGURING STONITH
The operation is finished when a level has passed (success), or all levels have been attempted
(failed).
Use the following command to add a fencing level to a node. The devices are given as a comma-
separated list of stonith ids, which are attempted for the node at that level.
The following command lists all of the fencing levels that are currently configured.
In the following example, there are two fence devices configured for node rh7-2: an ilo fence device
called my_ilo and an apc fence device called my_apc. These commands sets up fence levels so that if
the device my_ilo fails and is unable to fence the node, then Pacemaker will attempt to use the device
my_apc. This example also shows the output of the pcs stonith level command after the levels
are configured.
The following command removes the fence level for the specified node and devices. If no nodes or
devices are specified then the fence level you specify is removed from all nodes.
The following command clears the fence levels on the specified node or stonith id. If you do not specify
a node or stonith id, all fence levels are cleared.
If you specify more than one stonith id, they must be separated by a comma and no spaces, as in the
following example.
The following command verifies that all fence devices and nodes specified in fence levels exist.
If the node never completely loses power, the node may not release its resources. This opens up the
possibility of nodes accessing these resources simultaneously and corrupting them.
25
Configuring the Red Hat High Availability Add-On with Pacemaker
Prior to Red Hat Enterprise Linux 6.8, you needed to explicitly configure different versions of the
devices which used either the 'on' or 'off' actions. Since Red Hat Enterprise Linux 6.8, it is now only
required to define each device once and to specify that both are required to fence the node, as in the
following example.
If a cluster node is configured to be fenced by an integrated fence device, disable ACPI Soft-Off for
that node. Disabling ACPI Soft-Off allows an integrated fence device to turn off a node immediately
and completely rather than attempting a clean shutdown (for example, shutdown -h now).
Otherwise, if ACPI Soft-Off is enabled, an integrated fence device can take four or more seconds to
turn off a node (refer to note that follows). In addition, if ACPI Soft-Off is enabled and a node panics or
freezes during shutdown, an integrated fence device may not be able to turn off the node. Under those
circumstances, fencing is delayed or unsuccessful. Consequently, when a node is fenced with an
integrated fence device and ACPI Soft-Off is enabled, a cluster recovers slowly or requires
administrative intervention to recover.
NOTE
The amount of time required to fence a node depends on the integrated fence device
used. Some integrated fence devices perform the equivalent of pressing and holding the
power button; therefore, the fence device turns off the node in four to five seconds.
Other integrated fence devices perform the equivalent of pressing the power button
momentarily, relying on the operating system to turn off the node; therefore, the fence
device turns off the node in a time span much longer than four to five seconds.
To disable ACPI Soft-Off, use chkconfig management and verify that the node turns off immediately
when fenced. The preferred way to disable ACPI Soft-Off is with chkconfig management: however, if
that method is not satisfactory for your cluster, you can disable ACPI Soft-Off with one of the following
alternate methods:
Changing the BIOS setting to "instant-off" or an equivalent setting that turns off the node
without delay
NOTE
Disabling ACPI Soft-Off with the BIOS may not be possible with some
computers.
26
CHAPTER 4. FENCING: CONFIGURING STONITH
Appending acpi=off to the kernel boot command line of the /boot/grub/grub.conf file
IMPORTANT
This method completely disables ACPI; some computers do not boot correctly if
ACPI is completely disabled. Use this method only if the other methods are not
effective for your cluster.
The following sections provide procedures for the preferred method and alternate methods of
disabling ACPI Soft-Off:
Section 4.12.1, “Disabling ACPI Soft-Off with chkconfig Management” — Preferred method
Section 4.12.2, “Disabling ACPI Soft-Off with the BIOS” — First alternate method
Section 4.12.3, “Disabling ACPI Completely in the grub.conf File” — Second alternate method
You can use chkconfig management to disable ACPI Soft-Off either by removing the ACPI daemon
(acpid) from chkconfig management or by turning off acpid.
NOTE
Disable ACPI Soft-Off with chkconfig management at each cluster node as follows:
— OR —
chkconfig --level 345 acpid off — This command turns off acpid.
3. When the cluster is configured and running, verify that the node turns off immediately when
fenced. For information on testing a fence device, see How to test fence devices and fencing
configuration in a RHEL 5, 6, or 7 High Availability cluster?.
NOTE
Disabling ACPI Soft-Off with the BIOS may not be possible with some computers.
27
Configuring the Red Hat High Availability Add-On with Pacemaker
You can disable ACPI Soft-Off by configuring the BIOS of each cluster node as follows:
1. Reboot the node and start the BIOS CMOS Setup Utility program.
3. At the Power menu, set the Soft-Off by PWR-BTTN function (or equivalent) to Instant-Off (or
the equivalent setting that turns off the node by means of the power button without delay).
Example 4.1, “BIOS CMOS Setup Utility: Soft-Off by PWR-BTTN set to Instant-Off”
shows a Power menu with ACPI Function set to Enabled and Soft-Off by PWR-BTTN set to
Instant-Off.
NOTE
4. Exit the BIOS CMOS Setup Utility program, saving the BIOS configuration.
5. When the cluster is configured and running, verify that the node turns off immediately when
fenced. For information on testing a fence device, see How to test fence devices and fencing
configuration in a RHEL 5, 6, or 7 High Availability cluster?.
Example 4.1. BIOS CMOS Setup Utility: Soft-Off by PWR-BTTN set to Instant-Off
+---------------------------------------------|-------------------+
| ACPI Function [Enabled] | Item Help |
| ACPI Suspend Type [S1(POS)] |-------------------|
| x Run VGABIOS if S3 Resume Auto | Menu Level * |
| Suspend Mode [Disabled] | |
| HDD Power Down [Disabled] | |
| Soft-Off by PWR-BTTN [Instant-Off | |
| CPU THRM-Throttling [50.0%] | |
| Wake-Up by PCI card [Enabled] | |
| Power On by Ring [Enabled] | |
| Wake Up On LAN [Enabled] | |
| x USB KB Wake-Up From S3 Disabled | |
| Resume by Alarm [Disabled] | |
| x Date(of Month) Alarm 0 | |
| x Time(hh:mm:ss) Alarm 0 : 0 : | |
| POWER ON Function [BUTTON ONLY | |
| x KB Power ON Password Enter | |
| x Hot Key Power ON Ctrl-F1 | |
| | |
| | |
+---------------------------------------------|-------------------+
This example shows ACPI Function set to Enabled, and Soft-Off by PWR-BTTN set to Instant-Off.
28
CHAPTER 4. FENCING: CONFIGURING STONITH
The preferred method of disabling ACPI Soft-Off is with chkconfig management (Section 4.12.1,
“Disabling ACPI Soft-Off with chkconfig Management”). If the preferred method is not effective for
your cluster, you can disable ACPI Soft-Off with the BIOS power management (Section 4.12.2,
“Disabling ACPI Soft-Off with the BIOS”). If neither of those methods is effective for your cluster, you
can disable ACPI completely by appending acpi=off to the kernel boot command line in the
grub.conf file.
IMPORTANT
This method completely disables ACPI; some computers do not boot correctly if ACPI is
completely disabled. Use this method only if the other methods are not effective for your
cluster.
You can disable ACPI completely by editing the grub.conf file of each cluster node as follows:
4. When the cluster is configured and running, verify that the node turns off immediately when
fenced. For information on testing a fence device, see How to test fence devices and fencing
configuration in a RHEL 5, 6, or 7 High Availability cluster?.
In this example, acpi=off has been appended to the kernel boot command line — the line starting
with "kernel /vmlinuz-2.6.32-193.el6.x86_64.img".
29
Configuring the Red Hat High Availability Add-On with Pacemaker
For example, the following command creates a resource with the name VirtualIP of standard ocf,
provider heartbeat, and type IPaddr2. The floating address of this resource is 192.168.0.120, the
system will check whether the resource is running every 30 seconds.
Alternately, you can omit the standard and provider fields and use the following command. This will
default to a standard of ocf and a provider of heartbeat.
As of the Red Hat Enterprise Linux 6.8 release, resources start as soon as their state has been
confirmed on all nodes and all dependencies have been satisfied, rather than waiting for the state of all
resources to be confirmed. This allows for faster startup of some services, and more even startup load.
For example, the following command deletes an existing resource with a resource ID of VirtualIP
For information on the resource_id, standard, provider, and type fields of the pcs resource
create command, see Section 5.2, “Resource Properties”.
For information on defining resource parameters for individual resources, see Section 5.3,
“Resource-Specific Parameters”.
For information on defining resource meta options, which are used by the cluster to decide
how a resource should behave, see Section 5.4, “Resource Meta Options” .
For information on defining the operations to perform on a resource, see Section 5.6,
“Resource Operations”.
30
CHAPTER 5. CONFIGURING CLUSTER RESOURCES
The properties that you define for a resource tell the cluster which script to use for the resource, where
to find that script and what standards it conforms to. Table 5.1, “Resource Properties” describes these
properties.
Field Description
standard The standard the script conforms to. Allowed values: ocf, service, upstart,
systemd, lsb, stonith
type The name of the Resource Agent you wish to use, for example IPaddr or
Filesystem
provider The OCF spec allows multiple vendors to supply the same ResourceAgent. Most of
the agents shipped by Red Hat use heartbeat as the provider.
Table 5.2, “Commands to Display Resource Properties”. summarizes the commands that display the
available resource properties.
pcs resource list string Displays a list of available resources filtered by the specified
string. You can use this command to display resources
filtered by the name of a standard, a provider, or a type.
For example, the following command displays the parameters you can set for a resource of type LVM.
31
Configuring the Red Hat High Availability Add-On with Pacemaker
priority 0 If not all resources can be active, the cluster will stop
lower priority resources in order to keep higher priority
ones active.
target-role Started What state should the cluster attempt to keep this
resource in? Allowed values:
is-managed true Is the cluster allowed to start and stop the resource?
Allowed values: true, false
32
CHAPTER 5. CONFIGURING CLUSTER RESOURCES
migration- INFINITY How many failures may occur for this resource on a
threshold (disabled) node, before this node is marked ineligible to host this
resource. For information on configuring the
migration-threshold option, refer toSection 7.2,
“Moving Resources Due to Failure”.
multiple-active stop_start What should the cluster do if it ever finds the resource
active on more than one node. Allowed values:
To change the default value of a resource option, use the following command.
33
Configuring the Red Hat High Availability Add-On with Pacemaker
For example, the following command resets the default value of resource-stickiness to 100.
Omitting the options parameter from the pcs resource defaults displays a list of currently
configured default values for resource options. The following example shows the output of this
command after you have reset the default value of resource-stickiness to 100.
Whether you have reset the default value of a resource meta option or not, you can set a resource
option for a particular resource to a value other than the default when you create the resource. The
following shows the format of the pcs resource create command you use when specifying a value
for a resource meta option.
For example, the following command creates a resource with a resource-stickiness value of 50.
You can also set the value of a resource meta option for an existing resource, group, cloned resource,
or master resource with the following command.
In the following example, there is an existing resource named dummy_resource. This command sets
the failure-timeout meta option to 20 seconds, so that the resource can attempt to restart on the
same node in 20 seconds.
After executing this command, you can display the values for the resource to verity that failure-
timeout=20s is set.
34
CHAPTER 5. CONFIGURING CLUSTER RESOURCES
For information on resource clone meta options, see Section 8.1, “Resource Clones”. For information
on resource master meta options, see Section 8.2, “Multi-State Resources: Resources That Have
Multiple Modes”.
You create a resource group with the following command, specifying the resources to include in the
group. If the group does not exist, this command creates the group. If the group exists, this command
adds additional resources to the group. The resources will start in the order you specify them with this
command, and will stop in the reverse order of their starting order.
You can also add a new resource to an existing group when you create the resource, using the
following command. The resource you create is added to the group named group_name.
You remove a resource from a group with the following command. If there are no resources in the
group, this command removes the group itself.
The following example creates a resource group named shortcut that contains the existing
resources IPaddr and Email.
There is no limit to the number of resources a group can contain. The fundamental properties of a
group are as follows.
Resources are started in the order in which you specify them (in this example, IPaddr first,
then Email).
Resources are stopped in the reverse order in which you specify them. (Email first, then
IPaddr).
If a resource in the group cannot run anywhere, then no resource specified after that resource is
allowed to run.
If Email cannot run anywhere, however, this does not affect IPaddr in any way.
35
Configuring the Red Hat High Availability Add-On with Pacemaker
Obviously as the group grows bigger, the reduced configuration effort of creating resource groups can
become significant.
Stickiness, the measure of how much a resource wants to stay where it is, is additive in groups. Every
active resource of the group will contribute its stickiness value to the group’s total. So if the default
resource-stickiness is 100, and a group has seven members, five of which are active, then the
group as a whole will prefer its current location with a score of 500.
Table 5.4, “Properties of an Operation” summarizes the properties of a resource monitoring operation.
Field Description
id Unique name for the action. The system assigns this when you configure an operation.
interval How frequently (in seconds) to perform the operation. Default value: 0 , meaning never.
timeout How long to wait before declaring the action has failed. If you find that your system
includes a resource that takes a long time to start or stop or perform a non-recurring
monitor action at startup, and requires more time than the system allows before
declaring that the start action has failed, you can increase this value from the default
of 20 or the value of timeout in "op defaults".
36
CHAPTER 5. CONFIGURING CLUSTER RESOURCES
Field Description
on-fail The action to take if this action ever fails. Allowed values:
* restart - Stop the resource and start it again (possibly on a different node)
* standby - Move all resources away from the node on which the resource failed
The default for the stop operation is fence when STONITH is enabled and block
otherwise. All other operations default to restart.
enabled If false, the operation is treated as if it does not exist. Allowed values:true, false
You can configure monitoring operations when you create a resource, using the following command.
For example, the following command creates an IPaddr2 resource with a monitoring operation. The
new resource is called VirtualIP with an IP address of 192.168.0.99 and a netmask of 24 on eth2. A
monitoring operation will be performed every 30 seconds.
Alternately, you can add a monitoring operation to an existing resource with the following command.
NOTE
You must specify the exact operation properties to properly remove an existing
operation.
To change the values of a monitoring option, you remove the existing operation, then add the new
operation. For example, you can create a VirtualIP with the following command.
37
Configuring the Red Hat High Availability Add-On with Pacemaker
The change the stop timeout operation, execute the following commands.
To set global default values for monitoring operations, use the following command.
For example, the following command sets a global default of a timeout value of 240s for all
monitoring operations.
To display the currently configured default values for monitoring operations, do not specify any options
when you execute the pcs resource op defaults command.
For example, following command displays the default monitoring operation values for a cluster which
has been configured with a timeout value of 240s.
For example, if your system is configured with a resource named VirtualIP and a resource named
WebSite, the pcs resource show command yields the following output.
38
CHAPTER 5. CONFIGURING CLUSTER RESOURCES
To display a list of all configured resources and the parameters configured for those resources, use the
--full option of the the pcs resource show command, as in the following example.
To display the configured parameters for a resource, use the following command.
For example, the following command displays the currently configured parameters for resource
VirtualIP.
The following sequence of commands show the initial values of the configured parameters for resource
VirtualIP, the command to change the value of the ip parameter, and the values following the
update command.
39
Configuring the Red Hat High Availability Add-On with Pacemaker
NOTE
When configuring multiple monitor operations, you must ensure that no two operations
are performed at the same interval.
To configure additional monitoring operations for a resource that supports more in-depth checks at
different levels, you add an OCF_CHECK_LEVEL=n option.
For example, if you configure the following IPaddr2 resource, by default this creates a monitoring
operation with an interval of 10 seconds and a timeout value of 20 seconds.
If the Virtual IP supports a different check with a depth of 10, the following command causes
Pacemaker to perform the more advanced monitoring check every 60 seconds in addition to the
normal Virtual IP check every 10 seconds. (As noted, you should not configure the additional
monitoring operation with a 10-second interval as well.)
40
CHAPTER 6. RESOURCE CONSTRAINTS
location constraints — A location constraint determines which nodes a resource can run on.
Location constraints are described in Section 6.1, “Location Constraints”.
order constraints — An order constraint determines the order in which the resources run.
Order constraints are described in Section 6.2, “Order Constraints” .
As a shorthand for configuring a set of constraints that will locate a set of resources together and
ensure that the resources start sequentially and stop in reverse order, Pacemaker supports the
concept of resource groups. For information on resource groups, see Section 5.5, “Resource Groups”.
Table 6.1, “Location Constraint Options”. summarizes the options for configuring location constraints.
Field Description
id A unique name for the constraint. This is set by the system when you
configure a location constraint with pcs.
score Value to indicate the preference for whether a resource should run on or
avoid a node.
41
Configuring the Red Hat High Availability Add-On with Pacemaker
Field Description
resource-discovery
Value to indicate the preference for whether Pacemaker should perform
resource discovery on this node for the specified resource. Limiting resource
discovery to a subset of nodes the resource is physically capable of running on
can significantly boost performance when a large set of nodes is present. When
pacemaker_remote is in use to expand the node count into the hundreds of
nodes range, this option should be considered. Possible values include:
always : Always perform resource discovery for the specified resource on this
node.
never: Never perform resource discovery for the specified resource on this
node.
Note that setting this option to never or exclusive allows the possibility
for the resource to be active in those locations without the cluster’s knowledge.
This can lead to the resource being active in more than one location if the service
is started outside the cluster's control (for example, by systemd or by an
administrator). This can also occur if the resource-discovery property
is changed while part of the cluster is down or suffering split-brain, or if the
resource-discovery property is changed for a resource and node while
the resource is active on that node. For this reason, using this option is
appropriate only when you have more than eight nodes and there is a way to
guarantee that the resource can run only in a particular location (for example,
when the required software is not installed anywhere else).
The following command creates a location constraint for a resource to prefer the specified node or
nodes.
The following command creates a location constraint for a resource to avoid the specified node or
nodes.
There are two alternative strategies for specifying which nodes a resources can run on:
42
CHAPTER 6. RESOURCE CONSTRAINTS
Opt-In Clusters — Configure a cluster in which, by default, no resource can run anywhere and
then selectively enable allowed nodes for specific resources. The procedure for configuring an
opt-in cluster is described in Section 6.1.1, “Configuring an "Opt-In" Cluster” .
Opt-Out Clusters — Configure a cluster in which, by default, all resources an run anywhere and
then create location constraints for resources that are not allowed to run on specific nodes.
The procedure for configuring an opt-out cluster is described in Section 6.1.2, “Configuring an
"Opt-Out" Cluster”.
Whether you should choose to configure an opt-in or opt-out cluster depends both on your personal
preference and the make-up of your cluster. If most of your resources can run on most of the nodes,
then an opt-out arrangement is likely to result in a simpler configuration. On the other-hand, if most
resources can only run on a small subset of nodes an opt-in configuration might be simpler.
Enable nodes for individual resources. The following commands configure location constraints so that
the resource Webserver prefers node example-1, the resource Database prefers node example-2,
and both resources can fail over to node example-3 if their preferred node fails.
The following commands will then yield a configuration that is equivalent to the example in
Section 6.1.1, “Configuring an "Opt-In" Cluster” . Both resources can fail over to node example-3 if
their preferred node fails, since every node has an implicit score of 0.
Note that it is not necessary to specify a score of INFINITY in these commands, since that is the default
value for the score.
43
Configuring the Red Hat High Availability Add-On with Pacemaker
Table 6.2, “Properties of an Order Constraint” . summarizes the properties and options for configuring
order constraints.
Field Description
action The action to perform on a resource. Possible values of the action property are as
follows:
kind option How to enforce the constraint. The possible values of the kind option are as
follows:
* Optional - Only applies if both resources are starting and/or stopping. For
information on optional ordering, see Section 6.2.2, “Advisory Ordering”.
symmetrical options If true, which is the default, stop the resources in the reverse order. Default value:
true
If the first resource you specified resource was running and is stopped, the second resource
you specified will also be stopped (if it is running).
44
CHAPTER 6. RESOURCE CONSTRAINTS
If the first resource you specified resource was not running and cannot be started, the second
resource you specified will be stopped (if it is running).
If the first resource you specified is (re)started while the second resource you specified is
running, the second resource you specified will be stopped and restarted.
The following command configures an advisory ordering constraint for the resources named
VirtualIP and dummy_resource,
You can set the following options for a set of resources with the pcs constraint order set
command.
sequential, which can be set to true or false to indicate whether the set of resources
must be ordered relative to each other.
Setting sequential to false allows a set to be ordered relative to other sets in the ordering
constraint, without its members being ordered relative to each other. Therefore, this option
makes sense only if multiple sets are listed in the constraint; otherwise, the constraint has no
effect.
require-all, which can be set to true or false to indicate whether all of the resources in
the set must be active before continuing. Setting require-all to false means that only one
resource in the set needs to be started before continuing on to the next set. Setting require-
all to false has no effect unless used in conjunction with unordered sets, which are sets for
which sequential is set to false.
action, which can be set to start, promote, demote or stop, as described in Table 6.2,
“Properties of an Order Constraint”.
You can set the following constraint options for a set of resources following the setoptions
parameter of the pcs constraint order set command.
score, to indicate the degree of preference for this constraint. For information on this option,
see Table 6.3, “Properties of a Colocation Constraint” .
45
Configuring the Red Hat High Availability Add-On with Pacemaker
If you have three resources named D1, D2, and D3, the following command configures them as an
ordered resource set.
There is an important side effect of creating a colocation constraint between two resources: it affects
the order in which resources are assigned to a node. This is because you cannot place resource A
relative to resource B unless you know where resource B is. So when you are creating colocation
constraints, it is important to consider whether you should colocate resource A with resource B or
resource B with resource A.
Another thing to keep in mind when creating colocation constraints is that, assuming resource A is
collocated with resource B, the cluster will also take into account resource A's preferences when
deciding which node to choose for resource B.
For information on master and slave resources, see Section 8.2, “Multi-State Resources: Resources
That Have Multiple Modes”.
Table 6.3, “Properties of a Colocation Constraint” . summarizes the properties and options for
configuring colocation constraints.
Field Description
source_resource The colocation source. If the constraint cannot be satisfied, the cluster may
decide not to allow the resource to run at all.
target_resource The colocation target. The cluster will decide where to put this resource first and
then decide where to put the source resource.
46
CHAPTER 6. RESOURCE CONSTRAINTS
Field Description
score Positive values indicate the resource should run on the same node. Negative
values indicate the resources should not run on the same node. A value of +
INFINITY, the default value, indicates that the source_resource must run on the
same node as the target_resource. A value of - INFINITY indicates that the
source_resource must not run on the same node as thetarget_resource.
If you need myresource1 to always run on the same machine as myresource2, you would add the
following constraint:
Because INFINITY was used, if myresource2 cannot run on any of the cluster nodes (for whatever
reason) then myresource1 will not be allowed to run.
Alternatively, you may want to configure the opposite, a cluster in which myresource1 cannot run on
the same machine as myresource2. In this case use score=-INFINITY
Again, by specifying -INFINITY, the constraint is binding. So if the only place left to run is where
myresource2 already is, then myresource1 may not run anywhere.
You can set the following options for a set of resources with the pcs constraint colocation
set command.
47
Configuring the Red Hat High Availability Add-On with Pacemaker
sequential, which can be set to true or false to indicate whether the members of the set
must be colocated with each other.
Setting sequential to false allows the members of this set to be colocated with another
set listed later in the constraint, regardless of which members of this set are active. Therefore,
this option makes sense only if another set is listed after this one in the constraint; otherwise,
the constraint has no effect.
role, which can be set to Stopped, Started, Master, or Slave. For information on multi-
state resources, see Section 8.2, “Multi-State Resources: Resources That Have Multiple
Modes”.
You can set the following constraint options for a set of resources following the setoptions
parameter of the pcs constraint colocation set command.
kind, to indicate how to enforce the constraint. For information on this option, see Table 6.2,
“Properties of an Order Constraint”.
symmetrical, to indicate the order in which to stop the resources. If true, which is the default,
stop the resources in the reverse order. Default value: true
When listing members of a set, each member is colocated with the one before it. For example, "set A B"
means "B is colocated with A". However, when listing multiple sets, each set is colocated with the one
after it. For example, "set C D sequential=false set A B" means "set C D (where C and D have no
relation between each other) is colocated with set A B (where B is colocated with A)".
The following command lists all current location, order, and colocation constraints.
If resources is specified, location constraints are displayed per resource. This is the default
behavior.
48
CHAPTER 6. RESOURCE CONSTRAINTS
If specific resources or nodes are specified, then only information about those resources or
nodes is displayed.
The following command lists all current ordering constraints. If the --full option is specified, show
the internal constraint IDs.
The following command lists all current colocation constraints. If the --full option is specified, show
the internal constraint IDs.
The following command lists the constraints that reference specific resources.
49
Configuring the Red Hat High Availability Add-On with Pacemaker
When a node is under maintenance, and you need to move all resources running on that node
to a different node
To move all resources running on a node to a different node, you put the node in standby mode. For
information on putting a cluster node in standby node, see Section 3.2.4, “Standby Mode”.
You can move individually specified resources in either of the following ways.
You can use the pcs resource move command to move a resource off a node on which it is
currently running, as described in Section 7.1.1, “Moving a Resource from its Current Node” .
You can use the pcs resource relocate run command to move a resource to its
preferred node, as determined by current cluster status, constraints, location of resources and
other settings. For information on this command, see Section 7.1.2, “Moving a Resource to its
Preferred Node”.
NOTE
When you execute the pcs resource move command, this adds a constraint to the
resource to prevent it from running on the node on which it is currently running. You can
execute the pcs resource clear or the pcs constraint delete command to
remove the constraint. This does not necessarily move the resources back to the
original node; where the resources can run at that point depends on how you have
configured your resources initially.
50
CHAPTER 7. MANAGING CLUSTER RESOURCES
If you specify the --master parameter of the pcs resource ban command, the scope of the
constraint is limited to the master role and you must specify master_id rather than resource_id.
You can optionally configure a lifetime parameter for the pcs resource move command to
indicate a period of time the constraint should remain. You specify the units of a lifetime parameter
according to the format defined in ISO 8601, which requires that you specify the unit as a capital letter
such as Y (for years), M (for months), W (for weeks), D (for days), H (for hours), M (for minutes), and S
(for seconds).
To distinguish a unit of minutes(M) from a unit of months(M), you must specify PT before indicating the
value in minutes. For example, a lifetime parameter of 5M indicates an interval of five months, while
a lifetime parameter of PT5M indicates an interval of five minutes.
You can optionally configure a --wait[=n] parameter for the pcs resource ban command to
indicate the number of seconds to wait for the resource to start on the destination node before
returning 0 if the resource is started or 1 if the resource has not yet started. If you do not specify n, the
default resource timeout will be used.
The following command moves the resource resource1 to node example-node2 and prevents it
from moving back to the node on which it was originally running for one hour and thirty minutes.
The following command moves the resource resource1 to node example-node2 and prevents it
from moving back to the node on which it was originally running for thirty minutes.
If you do not specify any resources, all resource are relocated to their preferred nodes.
This command calculates the preferred node for each resource while ignoring resource stickiness.
After calculating the preferred node, it creates location constraints which will cause the resources to
move to their preferred nodes. Once the resources have been moved, the constraints are deleted
automatically. To remove all constraints created by the pcs resource relocate run command,
51
Configuring the Red Hat High Availability Add-On with Pacemaker
you can run the pcs resource relocate clear command. To display the current status of
resources and their optimal node ignoring resource stickiness, run the pcs resource relocate
show command.
The administrator manually resets the resource's failcount using the pcs resource
failcount command.
NOTE
The following example adds a migration threshold of 10 to the resource named dummy_resource,
which indicates that the resource will move to a new node after 10 failures.
You can add a migration threshold to the defaults for the whole cluster with the following command.
To determine the resource's current failure status and limits, use the pcs resource failcount
command.
There are two exceptions to the migration threshold concept; they occur when a resource either fails
to start or fails to stop. If the cluster property start-failure-is-fatal is set to true (which is the
default), start failures cause the failcount to be set to INFINITY and thus always cause the resource to
move immediately.
Stop failures are slightly different and crucial. If a resource fails to stop and STONITH is enabled, then
the cluster will fence the node in order to be able to start the resource elsewhere. If STONITH is not
enabled, then the cluster has no way to continue and will not try to start the resource elsewhere, but
will try to stop it again after the failure timeout.
1. Add a ping resource to the cluster. The ping resource uses the system utility of the same
name to test if a list of machines (specified by DNS host name or IPv4/IPv6 address) are
reachable and uses the results to maintain a node attribute called pingd.
52
CHAPTER 7. MANAGING CLUSTER RESOURCES
2. Configure a location constraint for the resource that will move the resource to a different node
when connectivity is lost.
Table 5.1, “Resource Properties” describes the properties you can set for a ping resource.
Field Description
dampen The time to wait (dampening) for further changes to occur. This prevents a
resource from bouncing around the cluster when cluster nodes notice the
loss of connectivity at slightly different times.
multiplier The number of connected ping nodes gets multiplied by this value to get a
score. Useful when there are multiple ping nodes configured.
The following example command creates a ping resource that verifies connectivity to
www.example.com. In practice, you would verify connectivity to your network gateway/router. You
configure the ping resource as a clone so that the resource will run on all cluster nodes.
The following example configures a location constraint rule for the existing resource named
Webserver. This will cause the Webserver resource to move to a host that is able to ping
www.example.com if the host that it is currently running on cannot ping www.example.com
You can manually stop a running resource and prevent the cluster from starting it again with the
following command. Depending on the rest of the configuration (constraints, options, failures, and so),
the resource may remain started. If you specify the --wait option, pcs will wait up to 'n' seconds for
the resource to stop and then return 0 if the resource is stopped or 1 if the resource has not stopped. If
'n' is not specified it defaults to 60 minutes.
You can use the following command to allow the cluster to start a resource. Depending on the rest of
the configuration, the resource may remain stopped. If you specify the --wait option, pcs will wait up
to 'n' seconds for the resource to start and then return 0 if the resource is started or 1 if the resource
has not started. If 'n' is not specified it defaults to 60 minutes.
53
Configuring the Red Hat High Availability Add-On with Pacemaker
Use the following command to prevent a resource from running on a specified node, or on the current
node if no node is specified.
Note that when you execute the pcs resource ban command, this adds a -INFINITY location
constraint to the resource to prevent it from running on the indicated node. You can execute the pcs
resource clear or the pcs constraint delete command to remove the constraint. This does
not necessarily move the resources back to the indicated node; where the resources can run at that
point depends on how you have configured your resources initially. For information on resource
constraints, see Chapter 6, Resource Constraints.
If you specify the --master parameter of the pcs resource ban command, the scope of the
constraint is limited to the master role and you must specify master_id rather than resource_id.
You can optionally configure a lifetime parameter for the pcs resource ban command to
indicate a period of time the constraint should remain. For information on specifying units for the
lifetime parameter and on specifying the intervals at which the lifetime parameter should be
checked, see Section 7.1, “Manually Moving Resources Around the Cluster” .
You can optionally configure a --wait[=n] parameter for the pcs resource ban command to
indicate the number of seconds to wait for the resource to start on the destination node before
returning 0 if the resource is started or 1 if the resource has not yet started. If you do not specify n, the
default resource timeout will be used.
You can use the debug-start parameter of the pcs resource command to force a specified
resource to start on the current node, ignoring the cluster recommendations and printing the output
from starting the resource. This is mainly used for debugging resources; starting resources on a
cluster is (almost) always done by Pacemaker and not directly with a pcs command. If your resource is
not starting, it is usually due to either a misconfiguration of the resource (which you debug in the
system log), constraints that the resource from starting, or the resource being disabled. You can use
this command to test resource configuration, but it should not normally be used to start resources in a
cluster.
54
CHAPTER 7. MANAGING CLUSTER RESOURCES
The following command sets resources to managed mode, which is the default state.
You can specify the name of a resource group with the pcs resource manage or pcs resource
unmanage command. The command will act on all of the resources in the group, so that you can
manage or unmanage all of the resource in a group with a single command and then manage the
contained resources individually.
55
Configuring the Red Hat High Availability Add-On with Pacemaker
NOTE
Only resources that can be active on multiple nodes at the same time are suitable for
cloning. For example, a Filesystem resource mounting a non-clustered file system
such as ext4 from a shared memory device should not be cloned. Since the ext4
partition is not cluster aware, this file system is not suitable for read/write operations
occurring from multiple nodes at the same time.
You cannot create a resource group and a clone of that resource group in a single command.
Alternately, you can create a clone of a previously-created resource or resource group with the
following command.
NOTE
NOTE
When configuring constraints, always use the name of the group or clone.
When you create a clone of a resource, the clone takes on the name of the resource with -clone
appended to the name. The following commands creates a resource of type apache named webfarm
and a clone of that resource named webfarm-clone.
56
CHAPTER 8. ADVANCED RESOURCE TYPES
Use the following command to remove a clone of a resource or a resource group. This does not remove
the resource or resource group itself.
Table 8.1, “Resource Clone Options” describes the options you can specify for a cloned resource.
Field Description
priority, Options inherited from resource that is being cloned, as described in Table 5.3,
target-role, is- “Resource Meta Options”.
managed
clone-max How many copies of the resource to start. Defaults to the number of nodes in the
cluster.
clone-node-max How many copies of the resource can be started on a single node; the default
value is 1 .
clone-min The number of instances that must be running before any dependent resources
can run. This parameter can be of particular use for services behind a virtual IP
and HAProxy, such as is often required for an OpenStack platform.
notify When stopping or starting a copy of the clone, tell all the other copies
beforehand and when the action was successful. Allowed values: false, true.
The default value is false.
globally-unique Does each copy of the clone perform a different function? Allowed values:
false, true
If the value of this option is true, a copy of the clone running on one machine is
not equivalent to another instance, whether that instance is running on another
node or on the same node. The default value is true if the value of clone-
node-max is greater than one; otherwise the default value isfalse.
ordered Should the copies be started in series (instead of in parallel). Allowed values:
false, true. The default value isfalse.
57
Configuring the Red Hat High Availability Add-On with Pacemaker
In most cases, a clone will have a single copy on each active cluster node. You can, however, set
clone-max for the resource clone to a value that is less than the total number of nodes in the cluster.
If this is the case, you can indicate which nodes the cluster should preferentially assign copies to with
resource location constraints. These constraints are written no differently to those for regular
resources except that the clone's id must be used.
The following command creates a location constraint for the cluster to preferentially assign resource
clone webfarm-clone to node1.
Ordering constraints behave slightly differently for clones. In the example below, webfarm-stats will
wait until all copies of webfarm-clone that need to be started have done so before starting itself.
Only if no copies of webfarm-clone can be started then webfarm-stats will be prevented from
being active. Additionally, webfarm-clone will wait for webfarm-stats to be stopped before
stopping itself.
Colocation of a regular (or group) resource with a clone means that the resource can run on any
machine with an active copy of the clone. The cluster will choose a copy based on where the clone is
running and the resource's own location preferences.
Colocation between clones is also possible. In such cases, the set of allowed locations for the clone is
limited to nodes on which the clone is (or will be) active. Allocation is then performed as normally.
The following command creates a colocation constraint to ensure that the resource webfarm-stats
runs on the same node as an active copy of webfarm-clone.
You can create a resource as a master/slave clone with the following single command.
58
CHAPTER 8. ADVANCED RESOURCE TYPES
Alternately, you can create a master/slave resource from a previously-created resource or resource
group with the following command: When you use this command, you can specify a name for the
master/slave clone. If you do not specify a name, the name of the master/slave clone will be
resource_id-master or group_name-master.
Table 8.2, “Properties of a Multi-State Resource” describes the options you can specify for a multi-
state resource.
Field Description
The following example configures a monitor operation with an interval of 11 seconds on the master
resource for ms_resource. This monitor operation is in addition to the default monitor operation with
the default monitor interval of 10 seconds.
59
Configuring the Red Hat High Availability Add-On with Pacemaker
For information on resource location constraints, see Section 6.1, “Location Constraints”.
You can create a colocation constraint which specifies whether the resources are master or slave
resources. The following command creates a resource colocation constraint.
When configuring an ordering constraint that includes multi-state resources, one of the actions that
you can specify for the resources is promote, indicating that the resource be promoted from slave to
master. Additionally, you can specify an action of demote, indicated that the resource be demoted
from master to slave.
For information on resource order constraints, see Section 6.2, “Order Constraints” .
When configuring a virtual domain as a resource, take the following considerations into account:
Once a virtual domain is a cluster resource, it should not be started, stopped, or migrated
except through the cluster tools.
Do not configure a virtual domain that you have configured as a cluster resource to start when
its host boots.
All nodes must have access to the necessary configuration files and storage devices for each
managed virtual domain.
If you want the cluster to manage services within the virtual domain itself, you can configure the
virtual domain as a guest node. For information on configuring guest nodes, see Section 8.4, “The
pacemaker_remote Service”
For information on configuring virtual domains, see the Virtualization Deployment and Administration
Guide.
60
CHAPTER 8. ADVANCED RESOURCE TYPES
Table 8.3, “Resource Options for Virtual Domain Resources” describes the resource options you can
configure for a VirtualDomain resource.
hypervisor System Hypervisor URI to connect to. You can determine the
dependent system's default URI by running the virsh --quiet
uri command.
autoset_utilizatio true If set to true, the agent will detect the number of
n_cpu domainU's vCPUs from virsh, and put it into the CPU
utilization of the resource when the monitor is
executed.
autoset_utilizatio true If set it true, the agent will detect the number of Max
n_hv_memory memory from virsh, and put it into the hv_memory
utilization of the source when the monitor is executed.
migrateport random highport This port will be used in the qemu migrate URI. If unset,
the port will be a random highport.
61
Configuring the Red Hat High Availability Add-On with Pacemaker
In addition to the VirtualDomain resource options, you can configure the allow-migrate
metadata option to allow live migration of the resource to another node. When this option is set to
true, the resource can be migrated without loss of state. When this option is set to false, which is the
default state, the virtual domain will be shut down on the first node and then restarted on the second
node when it is moved from one node to the other.
The following example configures a VirtualDomain resource named VM. Since the allow-migrate
option is set to true a pcs move VM nodeX command would be done as a live migration.
Among the capabilities that the pacemaker_remote service provides are the following:
The pacemaker_remote service allows you to scale beyond the corosync 16-node limit.
cluster node — A node running the High Availability services ( pacemaker and corosync).
remote node — A node running pacemaker_remote to remotely integrate into the cluster
without requiring corosync cluster membership. A remote node is configured as a cluster
resource that uses the ocf:pacemaker:remote resource agent.
guest node — A virtual guest node running the pacemaker_remote service. A guest node is
configured using the remote-node metadata option of a resource agent such as
ocf:pacemaker:VirtualDomain. The virtual guest resource is managed by the cluster; it is
both started by the cluster and integrated into the cluster as a remote node.
62
CHAPTER 8. ADVANCED RESOURCE TYPES
A Pacemaker cluster running the pacemaker_remote service has the following characteristics.
The remote nodes and/or the guest nodes run the pacemaker_remote service (with very
little configuration required on the virtual machine side).
The cluster stack (pacemaker and corosync), running on the cluster nodes, connects to the
pacemaker_remote service on the remote nodes, allowing them to integrate into the cluster.
The cluster stack (pacemaker and corosync), running on the cluster nodes, launches the
guest nodes and immediately connects to the pacemaker_remote service on the guest
nodes, allowing them to integrate into the cluster.
The key difference between the cluster nodes and the remote and guest nodes that the cluster nodes
manage is that the remote and guest nodes are not running the cluster stack. This means the remote
and guest nodes have the following limitations:
On the other hand, remote nodes and guest nodes are not bound to the scalability limits associated
with the cluster stack.
Other than these noted limitations, the remote nodes behave just like cluster nodes in respect to
resource management, and the remote and guest nodes can themselves be fenced. The cluster is fully
capable of managing and monitoring resources on each remote and guest node: You can build
constraints against them, put them in standby, or perform any other action you perform on cluster
nodes with the pcs commands. Remote and guest nodes appear in cluster status output just as cluster
nodes do.
In addition to the VirtualDomain resource options, you can configure metadata options to both
enable the resource as a guest node and define the connection parameters. Table 8.4, “Metadata
Options for Configuring KVM/LXC Resources as Remote Nodes” describes these metadata options.
63
Configuring the Red Hat High Availability Add-On with Pacemaker
Table 8.4. Metadata Options for Configuring KVM/LXC Resources as Remote Nodes
remote-node <none> The name of the guest node this resource defines. This
both enables the resource as a guest node and defines
the unique name used to identify the guest node.
WARNING: This value cannot overlap with any resource
or node IDs.
64
CHAPTER 8. ADVANCED RESOURCE TYPES
#
# Specify a custom port for Pacemaker Remote connections
PCMK_remote_port=3121
Note that when you change the default key location on a particular node (cluster node, guest node or
remote node), it is sufficient to set PCMK_authkey_location on that node (and put the key in that
location). It is not necessary that the location be the same on every node, although doing so makes
administration easier.
When changing the default port used by a particular guest node or remote node, the
PCMK_remote_port variable must be set in that node's /etc/sysconfig/pacemaker file, and the
cluster resource creating the guest node or remote node connection must also be configured with the
same port number (using the remote-port metadata option for guest nodes, or the port option for
remote nodes).
1. After installing the virtualization software and enabling the libvirtd service on the cluster
nodes, put the same encryption key with the path /etc/pacemaker/authkey on every
cluster node and virtual machine. This secures remote communication and authentication.
Run the following set of commands on every node to create the authkey directory with
secure permissions.
The following command shows one method to create an encryption key. You should create the
key only once and then copy it to all of the nodes.
3. Give each virtual machine a static network address and unique host name, which should be
known to all nodes. For information on setting a static IP address for the guest virtual machine,
see the Virtualization Deployment and Administration Guide.
4. To create the VirtualDomain resource agent for the management of the virtual machine,
Pacemaker requires the virtual machine's xml config file to be dumped to a file on disk. For
example, if you created a virtual machine named guest1, dump the xml to a file somewhere on
65
Configuring the Red Hat High Availability Add-On with Pacemaker
the host. You can use a file name of your choosing; this example uses
/etc/pacemaker/guest1.xml.
5. If it is running, shut down the guest node. Pacemaker will start the node when it is configured in
the cluster.
6. Create the VirtualDomain resource, configuring the remote-note resource meta option to
indicate that the virtual machine is a guest node capable of running resources.
In the example below, the meta-attribute remote-node=guest1 tells pacemaker that this
resource is a guest node with the host name guest1 that is capable of being integrated into
the cluster. The cluster will attempt to contact the virtual machine’s pacemaker_remote
service at the host name guest1 after it launches.
7. After creating the VirtualDomain resource, you can treat the guest node just as you would
treat any other node in the cluster. For example, you can create a resource and place a
resource constraint on the resource to run on the guest node as in the following commands,
which are run from a cluster node. As of Red Hat Enterprise Linux 6.8, you can include guest
nodes in groups, which allows you to group a storage device, file system, and VM.
1. On the node that you will be configuring as a remote node, allow cluster-related services
through the local firewall.
NOTE
If you are using iptables directly, or some other firewall solution besides
firewalld, simply open the following ports, which can be used by various
clustering components: TCP ports 2224, 3121, and 21064, and UDP port 5405.
66
CHAPTER 8. ADVANCED RESOURCE TYPES
3. All nodes (both cluster nodes and remote nodes) must have the same authentication key
installed for the communication to work correctly. If you already have a key on an existing
node, use that key and copy it to the remote node. Otherwise, create a new key on the remote
node.
Run the following set of commands on the remote node to create a directory for the
authentication key with secure permissions.
The following command shows one method to create an encryption key on the remote node.
5. On the cluster node, create a location for the shared authentication key with the same path as
the authentication key on the remote node and copy the key into that directory. In this
example, the key is copied from the remote node where the key was created.
6. Run the following command from a cluster node to create a remote resource. In this case the
remote node is remote1.
7. After creating the remote resource, you can treat the remote node just as you would treat any
other node in the cluster. For example, you can create a resource and place a resource
constraint on the resource to run on the remote node as in the following commands, which are
run from a cluster node.
67
Configuring the Red Hat High Availability Add-On with Pacemaker
WARNING
8. Configure fencing resources for the remote node. Remote nodes are fenced the same way as
cluster nodes. Configure fencing resources for use with remote nodes the same as you would
with cluster nodes. Note, however, that remote nodes can never initiate a fencing action. Only
cluster nodes are capable of actually executing a fencing operation against another node.
If you wish to avoid monitor failures when the pacemaker_remote service is stopped on an active
Pacemaker Remote node, you can use the following procedure to take the node out of the cluster
before performing any system administration that might stop pacemaker_remote
WARNING
For Red Hat Enterprise Linux release 6.7 and earlier, if pacemaker_remote stops
on a node that is currently integrated into a cluster, the cluster will fence that
node. If the stop happens automatically as part of a yum update process, the
system could be left in an unusable state (particularly if the kernel is also being
upgraded at the same time as pacemaker_remote). For Red Hat Enterprise Linux
release 6.7 and earlier you must use the following procedure to take the node out
of the cluster before performing any system administration that might stop
pacemaker_remote.
Use the following procedure to take a node out of a cluster when performing maintenance on a node
running pacemaker_remote:
1. Stop the node's connection resource with the pcs resource disable resourcename,
which will move all services off the node. For guest nodes, this will also stop the VM, so the VM
must be started outside the cluster (for example, using virsh) to perform any maintenance.
3. When ready to return the node to the cluster, re-enable the resource with the pcs resource
enable.
68
CHAPTER 8. ADVANCED RESOURCE TYPES
Use the following command to disable a resource configured as a guest node on the specified host.
69
Configuring the Red Hat High Availability Add-On with Pacemaker
Another use of rules might be to assign machines to different processing groups (using a node
attribute) based on time and to then use that attribute when creating location constraints.
Each rule can contain a number of expressions, date-expressions and even other rules. The results of
the expressions are combined based on the rule's boolean-op field to determine if the rule ultimately
evaluates to true or false. What happens next depends on the context in which the rule is being
used.
Field Description
role Limits the rule to apply only when the resource is in that role. Allowed values:
Started, Slave, and Master . NOTE: A rule with role="Master" cannot
determine the initial location of a clone instance. It will only affect which of the
active instances will be promoted.
score The score to apply if the rule evaluates to true. Limited to use in rules that are part
of location constraints.
score- The node attribute to look up and use as a score if the rule evaluates to true.
attribute Limited to use in rules that are part of location constraints.
boolean-op How to combine the result of multiple expression objects. Allowed values: and and
or. The default value isand.
Field Description
type Determines how the value(s) should be tested. Allowed values: string , integer,
version
70
CHAPTER 9. PACEMAKER RULES
Field Description
* lte - True if the node attribute’s value is less than or equal tovalue
* gte - True if the node attribute’s value is greater than or equal tovalue
* not_defined - True if the node does not have the named attribute
Field Description
operation Compares the current date/time with the start and/or end date, depending on the
context. Allowed values:
For example, monthdays="1" matches the first day of every month and hours="09-17" matches
the hours between 9am and 5pm (inclusive). However, you cannot specify weekdays="1,2" or
weekdays="1-2,5-6" since they contain multiple ranges.
71
Configuring the Red Hat High Availability Add-On with Pacemaker
Field Description
9.4. DURATIONS
Durations are used to calculate a value for end when one is not supplied to in_range operations. They
contain the same fields as date_spec objects but without the limitations (ie. you can have a duration
of 19 months). Like date_specs, any field not supplied is ignored.
To remove a rule, use the following. If the rule that you are removing is the last rule in its constraint,
the constraint will be removed.
72
CHAPTER 9. PACEMAKER RULES
years=2005
The following command configures an expression that is true from 9am to 5pm, Monday through
Friday. Note that the hours value of 16 matches up to 16:59:59, as the numeric value (hour) still
matches.
The following command configures an expression that is true when there is a full moon on Friday the
13th.
defined|not_defined attribute
date-spec date_spec_options
73
Configuring the Red Hat High Availability Add-On with Pacemaker
Section 10.2, “Setting and Removing Cluster Properties” describes how to set cluster
properties.
Section 10.3, “Querying Cluster Property Settings” describes how to list the currently set
cluster properties.
NOTE
In addition to the properties described in this table, there are additional cluster
properties that are exposed by the cluster software. For these properties, it is
recommended that you not change their values from their defaults.
batch-limit 30 The number of jobs that the transition engine (TE) is allowed
to execute in parallel. The "correct" value will depend on the
speed and load of your network and cluster nodes.
no-quorum-policy stop What to do when the cluster does not have quorum. Allowed
values:
symmetric-cluster true Indicates whether resources can run on any node by default.
74
CHAPTER 10. PACEMAKER CLUSTER PROPERTIES
stonith-enabled true Indicates that failed nodes and nodes with resources that
cannot be stopped should be fenced. Protecting your data
requires that you set this true.
cluster-delay 60s Round trip delay over the network (excluding action
execution). The "correct" value will depend on the speed and
load of your network and cluster nodes.
75
Configuring the Red Hat High Availability Add-On with Pacemaker
shutdown-escalation 20min The time after which to give up trying to shut down
gracefully and just exit. Advanced use only.
enable-acl false (Red Hat Enterprise Linux 6.6 and later) Indicates whether
the cluster can use access control lists, as set with the pcs
acl command.
For example, to set the value of symmetric-cluster to false, use the following command.
You can remove a cluster property from the configuration with the following command.
Alternately, you can remove a cluster property from a configuration by leaving the value field of the
pcs property set command blank. This restores that property to its default value. For example, if
you have previously set the symmetric-cluster property to false, the following command
removes the value you have set from the configuration and restores the value of symmetric-
cluster to true, which is its default value.
76
CHAPTER 10. PACEMAKER CLUSTER PROPERTIES
To display the values of the property settings that have been set for the cluster, use the following pcs
command.
To display all of the values of the property settings for the cluster, including the default values of the
property settings that have not been explicitly set, use the following command.
To display the current value of a specific cluster property, use the following command.
For example, to display the current value of the cluster-infrastructure property, execute the
following command:
For informational purposes, you can display a list of all of the default values for the properties, whether
they have been set to a value other than the default or not, by using the following command.
77
Configuring the Red Hat High Availability Add-On with Pacemaker
As of Red Hat Enterprise Linux 6.9, you can configure Pacemaker alerts by means of alert
agents, which are external programs that the cluster calls in the same manner as the cluster
calls resource agents to handle resource configuration and operation. This is the preferred,
simpler method of configuring cluster alerts. Pacemaker alert agents are described in
Section 11.1, “Pacemaker Alert Agents (Red Hat Enterprise Linux 6.9 and later)” .
The ocf:pacemaker:ClusterMon resource can monitor the cluster status and trigger alerts
on each cluster event. This resource runs the crm_mon command in the background at regular
intervals. For information on the ClusterMon resource see Section 11.2, “Event Notification
with Monitoring Resources”.
General information on configuring and administering alert agents is provided in Section 11.1.2,
“Alert Creation”, Section 11.1.3, “Displaying, Modifying, and Removing Alerts” , Section 11.1.4,
“Alert Recipients”, Section 11.1.5, “Alert Meta Options” , and Section 11.1.6, “Alert Configuration
Command Examples”.
You can write your own alert agents for a Pacemaker alert to call. For information on writing
alert agents, see Section 11.1.7, “Writing an Alert Agent” .
To use one of the sample alert agents, you must install the agent on each node in the cluster. For
example, the following command installs the alert_snmp.sh.sample script as alert_snmp.sh.
After you have installed the script, you can create an alert that uses the script. The following example
78
CHAPTER 11. TRIGGERING SCRIPTS FOR CLUSTER EVENTS
configures an alert that uses the installed alert_snmp.sh alert agent to send cluster events as
SNMP traps. By default, the script will send all events except successful monitor calls to the SNMP
server. This example configures the timestamp format as a meta option. For information about meta
options, see Section 11.1.5, “Alert Meta Options” . After configuring the alert, this example configures a
recipient for the alert and displays the alert configuration.
The following example installs the alert_smtp.sh agent and then configures an alert that uses the
installed alert agent to send cluster events as email messages. After configuring the alert, this example
configures a recipient and displays the alert configuration.
For more information on the format of the pcs alert create and pcs alert recipient add
commands, see Section 11.1.2, “Alert Creation” and Section 11.1.4, “Alert Recipients”.
Multiple alert agents may be configured; the cluster will call all of them for each event. Alert agents will
be called only on cluster nodes. They will be called for events involving Pacemaker Remote nodes, but
they will never be called on those nodes.
The following example creates a simple alert that will call my-script.sh for each event.
79
Configuring the Red Hat High Availability Add-On with Pacemaker
For an example that shows how to create a cluster alert that uses one of the sample alert agents, see
Section 11.1.1, “Using the Sample Alert Agents” .
The following command updates an existing alert with the specified alert-id value.
The following command removes an alert with the specified alert-id value.
The recipient may be anything the alert agent can recognize: an IP address, an email address, a file
name, or whatever the particular agent supports.
The following example command adds the alert recipient my-alert-recipient with a recipient ID of
my-recipient-id to the alert my-alert. This will configure the cluster to call the alert script that
has been configured for my-alert for each event, passing the recipient some-address as an
environment variable.
80
CHAPTER 11. TRIGGERING SCRIPTS FOR CLUSTER EVENTS
As with resource agents, meta options can be configured for alert agents to affect how Pacemaker
calls them. Table 11.1, “Alert Meta Options” describes the alert meta options. Meta options can be
configured per alert agent as well as per recipient.
timestamp- %H:%M:%S.%06N Format the cluster will use when sending the event’s
format timestamp to the agent. This is a string as used with the
date(1) command.
timeout 30s If the alert agent does not complete within this amount of
time, it will be terminated.
The following example configures an alert that calls the script my-script.sh and then adds two
recipients to the alert. The first recipient has an ID of my-alert-recipient1 and the second
recipient has an ID of my-alert-recipient2. The script will get called twice for each event, with
each call using a 15-second timeout. One call will be passed to the recipient [email protected]
with a timestamp in the format %D %H:%M, while the other call will be passed to the recipient
[email protected] with a timestamp in the format %c. `
The following commands create a simple alert, add two recipients to the alert, and display the
configured values.
Since no alert ID value is specified, the system creates an alert ID value of alert.
The first recipient creation command specifies a recipient of rec_value. Since this command
does not specify a recipient ID, the value of alert-recipient is used as the recipient ID.
The second recipient creation command specifies a recipient of rec_value2. This command
specifies a recipient ID of my-recipient for the recipient.
81
Configuring the Red Hat High Availability Add-On with Pacemaker
This following commands add a second alert and a recipient for that alert. The alert ID for the second
alert is my-alert and the recipient value is my-other-recipient. Since no recipient ID is specified,
the system provides a recipient id of my-alert-recipient.
The following commands modify the alert values for the alert my-alert and for the recipient my-
alert-recipient.
82
CHAPTER 11. TRIGGERING SCRIPTS FOR CLUSTER EVENTS
CRM_alert_desc Detail about event. For node alerts, this is the node’s current state
(member or lost). For fencing alerts, this is a summary of the requested
fencing operation, including origin, target, and fencing operation error
code, if any. For resource alerts, this is a readable string equivalent of
CRM_alert_status .
CRM_alert_nodeid ID of node whose status changed (provided with node alerts only)
83
Configuring the Red Hat High Availability Add-On with Pacemaker
CRM_alert_target_rc The expected numerical return code of the operation (resource alerts
only)
When writing an alert agent, you must take the following concerns into account.
Alert agents may be called with no recipient (if none is configured), so the agent must be able
to handle this situation, even if it only exits in that case. Users may modify the configuration in
stages, and add a recipient later.
If more than one recipient is configured for an alert, the alert agent will be called once per
recipient. If an agent is not able to run concurrently, it should be configured with only a single
recipient. The agent is free, however, to interpret the recipient as a list.
When a cluster event occurs, all alerts are fired off at the same time as separate processes.
Depending on how many alerts and recipients are configured and on what is done within the
alert agents, a significant load burst may occur. The agent could be written to take this into
consideration, for example by queuing resource-intensive actions into some other instance,
instead of directly executing them.
Alert agents are run as the hacluster user, which has a minimal set of permissions. If an
agent requires additional privileges, it is recommended to configure sudo to allow the agent to
run the necessary commands as another user with the appropriate privileges.
If a cluster contains resources for which the onfail parameter is set to fence, there will be
multiple fence notifications on failure, one for each resource for which this parameter is set
plus one additional notification. Both the STONITH daemon and the crmd daemon will send
notifications. Pacemaker performs only one actual fence operation in this case, however, no
matter how many notifications are sent.
84
CHAPTER 11. TRIGGERING SCRIPTS FOR CLUSTER EVENTS
NOTE
The alerts interface is designed to be backward compatible with the external scripts
interface used by the ocf:pacemaker:ClusterMon resource. To preserve this
compatibility, the environment variables passed to alert agents are available prepended
with CRM_notify_ as well as CRM_alert_. One break in compatibility is that the
ClusterMon resource ran external scripts as the root user, while alert agents are run
as the hacluster user. For information on configuring scripts that are triggered by the
ClusterMon, see Section 11.2, “Event Notification with Monitoring Resources” .
By default, the crm_mon command listens for resource events only; to enable listing for fencing events
you can provide the --watch-fencing option to the command when you configure the ClusterMon
resource. The crm_mon command does not monitor for membership issues but will print a message
when fencing is started and when monitoring is started for that node, which would imply that a
member just joined the cluster.
The ClusterMon resource can execute an external program to determine what to do with cluster
notifications by means of the extra_options parameter. Table 11.3, “Environment Variables Passed
to the External Monitor Program” lists the environment variables that are passed to that program,
which describe the type of cluster event that occurred.
CRM_notify_desc The textual output relevant error code of the operation (if any) that caused the
status change
The following example configures a ClusterMon resource that executes the external program
crm_logger.sh which will log the event notifications specified in the program.
85
Configuring the Red Hat High Availability Add-On with Pacemaker
The following procedure creates the crm_logger.sh program that this resource will use.
1. On one node of the cluster, create the program that will log the event notifications.
3. Use the scp command to copy the crm_logger.sh program to the other nodes of the
cluster, putting the program in the same location on those nodes and setting the same
ownership and permissions for the program.
The following example configures the ClusterMon resource, named ClusterMon-External, that
runs the program /usr/local/bin/crm_logger.sh. The ClusterMon resource outputs the
cluster status to an html file, which is /var/www/html/cluster_mon.html in this example. The
pidfile detects whether ClusterMon is already running; in this example that file is
/var/run/crm_mon-external.pid. This resource is created as a clone so that it will run on every
node in the cluster. The watch-fencing is specified to enable monitoring of fencing events in
addition to resource events, including the start/stop/monitor, start/monitor. and stop of the fencing
resource.
NOTE
The crm_mon command that this resource executes and which could be run manually is
as follows:
# /usr/sbin/crm_mon -p /var/run/crm_mon-manual.pid -d -i 5 \
-h /var/www/html/crm_mon-manual.html -E
"/usr/local/bin/crm_logger.sh" \
--watch-fencing
The following example shows the format of the output of the monitoring notifications that this example
yields.
86
CHAPTER 11. TRIGGERING SCRIPTS FOR CLUSTER EVENTS
87
Configuring the Red Hat High Availability Add-On with Pacemaker
The Red Hat Enterprise Linux 6.6 release provides some new features for cluster configuration with
Pacemaker. Section A.2, “Cluster Creation with Pacemaker in Red Hat Enterprise Linux Release 6.5
and Red Hat Enterprise Linux Release 6.6 (and later)” summarizes some small configuration
differences between pcs support in Red Hat Enterprise Linux release 6.5 and pcs support in Red Hat
Enterprise Linux release 6.6 and later.
Table A.1. Comparison of Cluster Configuration with rgmanager and with Pacemaker
Cluster configuration The cluster configuration file on each The cluster and Pacemaker
file node is cluster.conf file, which configuration files are
can can be edited directly if desired. cluster.conf and cib.xml. Do
Otherwise, use the luci or ccs not edit the cib.xml file directly; use
interface to define the cluster the pcs interface instead.
configuration.
Network setup Configure IP addresses and SSH Configure IP addresses and SSH
before configuring the cluster. before configuring the cluster.
Installation Install rgmanager (which pulls in all Install pacemaker, cman, pcs, and
dependencies, including ricci, the resource and fencing agents you
luci, and the resource and fencing require. If needed, install lvm2-
agents). If needed, install lvm2- cluster and gfs2-utils.
cluster and gfs2-utils.
88
CREATION IN RED HAT ENTERPRISE LINUX RELEASE 6.5 AND RED HAT ENTERPRISE LINUX RELEASE 6.6 (AND LATER)
Starting cluster Start and enable cluster services with Start and enable cluster services with
services the following procedure: the following procedure:
Controlling access to For luci, the root user or a user with There is no configuration GUI.
configuration tools luci permissions can access luci. All
access requires the ricci password
for the node.
Cluster creation Name the cluster and define which Name the cluster and include nodes
nodes to include in the cluster with with the pcs cluster setup
luci or ccs, or directly edit the command.
cluster.conf file.
Propagating cluster When configuration a cluster with luci, Propagation of the cluster and
configuration to all propagation is automatic. With ccs, Pacemaker configuration files,
nodes use the --sync option. You can also cluster.conf and cib.xml, is
use the cman_tool version -r automatic on cluster setup or when
command. adding a resource.
Global cluster The following feature are supported Pacemaker supports the following
properties with rgmanager: features for a cluster:
* You can configure the system so that * You can set no-quorum-policy
the system chooses which multicast for the cluster to specify what the
address to use for IP multicasting in system should do when the cluster
the cluster network. does not have quorum.
Logging You can set global and daemon- See the file
specific logging configuration. /etc/sysconfig/pacemaker for
information on how to configure
logging manually.
89
Configuring the Red Hat High Availability Add-On with Pacemaker
Validating the cluster Cluster validation is automatic with The cluster is automatically validated
luci and with ccs, using the cluster on startup, or you can validate the
schema. The cluster is automatically cluster with pcs cluster
validated on startup. verify .
Quorum in 2-node With a two-node cluster, you can pcs automatically adds the necessary
clusters configure how the system determines options for a two-node cluster to
quorum: cman.
Cluster status On luci, the current status of the You can display the current cluster
cluster is visible in the various status with the pcs status.
components of the interface, which
can be refreshed. You can use the --
getconf option of the ccs command
to see current the configuration file.
You can use the clustat command
to display cluster status.
Resources You add resources of defined types You add resources of defined types
and configure resource-specific and configure resource-specific
properties with luci or the ccs properties with the pcs resource
command, or by editing the create . For general information on
cluster.conf configuration file. configuring cluster resources with
Pacemaker see Chapter 5, Configuring
Cluster Resources.
90
CREATION IN RED HAT ENTERPRISE LINUX RELEASE 6.5 AND RED HAT ENTERPRISE LINUX RELEASE 6.6 (AND LATER)
Resource behavior, Define cluster services to configure With Pacemaker you use resource
grouping, and how resources interact. groups as a shorthand method of
start/stop order defining a set of resources that need
to be located together and started and
stopped sequentially. In addition, you
define how resources behave and
interact in the following ways:
Resource With luci, you can manage clusters, You can temporarily disable a node so
administration: Moving, individual cluster nodes, and cluster that it cannot host resources with the
starting, stopping services. With the ccs command, you pcs cluster standby
resources can manage cluster. You can use the command, which causes the resources
clusvadm to manage cluster to migrate. You can stop a resource
services. with the pcs resource disable
command.
Removing a cluster With luci, you can select all nodes in a You can remove a cluster
configuration cluster for deletion to delete a cluster configuration from a node with the
completely entirely. You can also remove the pcs cluster destroy
cluster.conf from each node in command.
the cluster.
91
Configuring the Red Hat High Availability Add-On with Pacemaker
Fencing -- single fence Create fencing devices globally or Create a fencing device for each node
device per node locally and add them to nodes. You with the pcs stonith create
can define post-fail delay and command. For devices that can fence
post-join delay values for the multiple nodes, you need to define
cluster as a whole. them only once rather than separately
for each node. You can also define
pcmk_host_map to configure
fencing devices for all nodes with a
single command; for information on
pcmk_host_map see Table 4.1,
“General Properties of Fencing
Devices”. You can define the
stonith-timeout value for the
cluster as a whole.
Multiple (backup) Define backup devices with luci or the Configure fencing levels.
fencing devices per ccs command, or by editing the
node cluster.conf file directly.
In Red Hat Enterprise Linux 6.6 and later, you run the cluster creation command from one node of the
cluster. The following command, run from one node only, creates the cluster named my_cluster that
consists of nodes z1-rhel66.example.com and z2-rhel66.example.com and starts cluster
services on those nodes.
92
APPENDIX B. CONFIGURATION EXAMPLE USING PCS COMMANDS
Configuring the cluster provided in this chapter requires that your system include the following
components:
2 nodes, which will be used to create the cluster. In this example, the nodes used are
z1.example.com and z2.example.com.
Network switches for the private network, required for communication among the cluster
nodes and other cluster hardware such as network power switches and Fibre Channel
switches.
A power fencing device for each node of the cluster. This example uses two ports of the APC
power switch with a host name of zapc.example.com.
2. After installation, to prevent corosync from starting without cman, execute the following
commands on all nodes in the cluster.
1. In order to use pcs to configure the cluster and communicate among the nodes, you must set a
password on each node for the user ID hacluster, which is the pcs administration account. It
is recommended that the password for user hacluster be the same on each node.
# passwd hacluster
Changing password for user hacluster.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
93
Configuring the Red Hat High Availability Add-On with Pacemaker
2. Before the cluster can be configured, the pcsd daemon must be started. This daemon works
with the pcs command to manage configuration across the nodes in the cluster.
On each node in the cluster, execute the following commands to start the pcsd service and to
enable pcsd at system start.
3. Authenticate the pcs user hacluster for each node in the cluster on the node from which
you will be running pcs.
The following command authenticates user hacluster on z1.example.com for both of the
nodes in the example two-node cluster, z1.example.com and z2.example.com.
4. Execute the following command from z1.example.com to create the two-node cluster
mycluster that consists of nodes z1.example.com and z2.example.com. This will
propagate the cluster configuration files to both nodes in the cluster. This command includes
the --start option, which will start the cluster services on both nodes in the cluster.
5. Optionally, you can enable the cluster services to run on each node in the cluster when the
node is booted.
NOTE
For your particular environment, you may choose to leave the cluster services
disabled by skipping this step. This allows you to ensure that if a node goes
down, any issues with your cluster or your resources are resolved before the
node rejoins the cluster. If you leave the cluster services disabled, you will need
to manually start the services when you reboot a node by executing the pcs
cluster start command on that node.
You can display the current status of the cluster with the pcs cluster status command. Because
there may be a slight delay before the cluster is up and running when you start the cluster services
with the --start option of the pcs cluster setup command, you should ensure that the cluster is
up and running before performing any subsequent actions on the cluster and its configuration.
94
APPENDIX B. CONFIGURATION EXAMPLE USING PCS COMMANDS
NOTE
When configuring a fencing device, you should ensure that your fencing device does not
share power with the node that it controls.
This example uses the APC power switch with a host name of zapc.example.com to fence the nodes,
and it uses the fence_apc_snmp fencing agent. Because both nodes will be fenced by the same
fencing agent, you can configure both fencing devices as a single resource, using the pcmk_host_map
and pcmk_host_list options.
You create a fencing device by configuring the device as a stonith resource with the pcs stonith
create command. The following command configures a stonith resource named myapc that uses
the fence_apc_snmp fencing agent for nodes z1.example.com and z2.example.com. The
pcmk_host_map option maps z1.example.com to port 1, and z2.example.com to port 2. The login
value and password for the APC device are both apc. By default, this device will use a monitor interval
of 60s for each node.
Note that you can use an IP address when specifying the host name for the nodes.
NOTE
When you create a fence_apc_snmp stonith device, you may see the following
warning message, which you can safely ignore:
95
Configuring the Red Hat High Availability Add-On with Pacemaker
This example requires that your system include the following components:
A 2-node Red Hat High Availability cluster with power fencing configured for each node. This
procedure uses the cluster example provided in Section B.1.2, “Creating and Starting the
Cluster”.
Shared storage for the nodes in the cluster, using iSCSI or Fibre Channel.
The cluster is configured with an Apache resource group, which contains the cluster components that
the web server requires: an LVM resource, a file system resource, an IP address resource, and a web
server resource. This resource group can fail over from one node of the cluster to the other, allowing
either node to run the web server. Before creating the resource group for this cluster, you will perform
the following procedures:
1. Configure an ext4 file system mounted on the logical volume my_lv, as described in
Section B.3.1, “Configuring an LVM Volume with an ext4 File System” .
3. Ensure that only the cluster is capable of activating the volume group that contains my_lv,
and that the volume group will not be activated outside of the cluster on startup, as described
in Section B.3.3, “Exclusive Activation of a Volume Group in a Cluster” .
After performing these procedures, you create the resource group and the resources it contains, as
described in Section B.3.4, “Creating the Resources and Resource Groups with the pcs Command” .
The following procedure creates an LVM logical volume and then creates an ext4 file system on that
volume. In this example, the shared partition /dev/sdb1 is used to store the LVM physical volume
from which the LVM logical volume will be created.
96
APPENDIX B. CONFIGURATION EXAMPLE USING PCS COMMANDS
NOTE
LVM volumes and the corresponding partitions and devices used by cluster nodes must
be connected to the cluster nodes only.
Since the /dev/sdb1 partition is storage that is shared, you perform this procedure on one node only,
# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
2. Create the volume group my_vg that consists of the physical volume /dev/sdb1.
You can use the lvs command to display the logical volume.
# lvs
LV VG Attr LSize Pool Origin Data% Move Log
Copy% Convert
my_lv my_vg -wi-a---- 452.00m
...
# mkfs.ext4 /dev/my_vg/my_lv
mke2fs 1.42.7 (21-Jan-2013)
Filesystem label=
OS type: Linux
...
1. Ensure that the Apache HTTP server is installed on each node in the cluster. You also need the
wget tool installed on the cluster to be able to check the status of Apache.
2. In order for the Apache resource agent to get the status of Apache, ensure that the following
text is present in the /etc/httpd/conf/httpd.conf file on each node in the cluster, and
97
Configuring the Red Hat High Availability Add-On with Pacemaker
ensure that it has not been commented out. If this text is not already present, add the text to
the end of the file.
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
3. Create a web page for Apache to serve up. On one node in the cluster, mount the file system
you created in Section B.3.1, “Configuring an LVM Volume with an ext4 File System” , create
the file index.html on that file system, then unmount the file system.
NOTE
You must ensure that the lvmetad daemon is disabled when using Pacemaker. You can
check whether the daemon is disabled and whether any lvmetad processes are running
by executing the following commands.
This procedure modifies the volume_list entry in the /etc/lvm/lvm.conf configuration file.
Volume groups listed in the volume_list entry are allowed to automatically activate on the local
node outside of the cluster manager's control. Volume groups related to the node's local root and
98
APPENDIX B. CONFIGURATION EXAMPLE USING PCS COMMANDS
home directories should be included in this list. All volume groups managed by the cluster manager
must be excluded from the volume_list entry. Note that this procedure does not require the use of
clvmd.
1. Determine which volume groups are currently configured on your local storage with the
following command. This will output a list of the currently-configured volume groups. If you
have space allocated in separate volume groups for root and for your home directory on this
node, you will see those volumes in the output, as in this example.
2. Add the volume groups other than my_vg (the volume group you have just defined for the
cluster) as entries to volume_list in the /etc/lvm/lvm.conf configuration file. For
example, if you have space allocated in separate volume groups for root and for your home
directory, you would uncomment the volume_list line of the lvm.conf file and add these
volume groups as entries to volume_list as follows:
NOTE
3. Rebuild the initramfs boot image to guarantee that the boot image will not try to activate a
volume group controlled by the cluster. Update the initramfs device with the following
command. This command may take up to a minute to complete.
NOTE
If you have installed a new Linux kernel since booting the node on which you
created the boot image, the new initrd image will be for the kernel that was
running when you created it and not for the new kernel that is running when you
reboot the node. You can ensure that the correct initrd device is in use by
running the uname -r command before and after the reboot to determine the
kernel release that is running. If the releases are not the same, update the
initrd file after rebooting with the new kernel and then reboot the node.
5. When the node has rebooted, check whether the cluster services have started up again on that
node by executing the pcs cluster status command on that node. If this yields the
message Error: cluster is not currently running on this node then enter the
99
Configuring the Red Hat High Availability Add-On with Pacemaker
following command.
Alternately, you can wait until you have rebooted each node in the cluster and start cluster
services on each of the nodes with the following command.
B.3.4. Creating the Resources and Resource Groups with the pcs Command
This use case requires that you create four cluster resources. To ensure these resources all run on the
same node, they are configured as part of the resource group apachegroup. The resources to create
are as follows, listed in the order in which they will start.
1. An LVM resource named my_lvm that uses the LVM volume group you created in Section B.3.1,
“Configuring an LVM Volume with an ext4 File System”.
2. A Filesystem resource named my_fs, that uses the filesystem device /dev/my_vg/my_lv
you created in Section B.3.1, “Configuring an LVM Volume with an ext4 File System” .
3. An IPaddr2 resource, which is a floating IP address for the apachegroup resource group.
The IP address must not be one already associated with a physical node. If the IPaddr2
resource's NIC device is not specified, the floating IP must reside on the same network as the
statically assigned IP addresses used by the cluster nodes, otherwise the NIC device to assign
the floating IP address cannot be properly detected.
4. An apache resource named Website that uses the index.html file and the Apache
configuration you defined in Section B.3.2, “Web Server Configuration”.
The following procedure creates the resource group apachegroup and the resources that the group
contains. The resources will start in the order in which you add them to the group, and they will stop in
the reverse order in which they are added to the group. Run this procedure from one node of the
cluster only.
1. The following command creates the LVM resource my_lvm. This command specifies the
exclusive=true parameter to ensure that only the cluster is capable of activating the LVM
logical volume. Because the resource group apachegroup does not yet exist, this command
creates the resource group.
When you create a resource, the resource is started automatically. You can use the following
command to confirm that the resource was created and has started.
You can manually stop and start an individual resource with the pcs resource disable
and pcs resource enable commands.
100
APPENDIX B. CONFIGURATION EXAMPLE USING PCS COMMANDS
2. The following commands create the remaining resources for the configuration, adding them to
the existing resource group apachegroup.
3. After creating the resources and the resource group that contains them, you can check the
status of the cluster. Note that all four resources are running on the same node.
Note that if you have not configured a fencing device for your cluster, as described in
Section B.2, “Fencing Configuration”, by default the resources do not start.
4. Once the cluster is up and running, you can point a browser to the IP address you defined as
the IPaddr2 resource to view the sample display, consisting of the simple word "Hello".
Hello
If you find that the resources you configured are not running, you can run the pcs resource
debug-start resource command to test the resource configuration. For information on
the pcs resource debug-start command, see the High Availability Add-On Reference
manual.
101
Configuring the Red Hat High Availability Add-On with Pacemaker
In the cluster status display shown in Section B.3.4, “Creating the Resources and Resource Groups
with the pcs Command”, all of the resources are running on node z1.example.com. You can test
whether the resource group fails over to node z2.example.com by using the following procedure to
put the first node in standby mode, after which the node will no longer be able to host resources.
2. After putting node z1 in standby mode, check the cluster status. Note that the resources
should now all be running on z2.
The web site at the defined IP address should still display, without interruption.
NOTE
Removing a node from standby mode does not in itself cause the resources to
fail back over to that node. For information on controlling which node resources
can run on, see the chapter on configuring cluster resources in the Red Hat High
Availability Add-On Reference.
102
APPENDIX C. UPDATING SOFTWARE PACKAGES ON A RUNNING CLUSTER
WARNING
It is critical when performing software update procedures for Red Hat Enterprise
Linux High Availability and Resilient Storage clusters to ensure that any node that
will undergo updates is not an active member of the cluster before those updates
are initiated. Swapping out the software that the cluster stack relies on while it is in
use can lead to various problems and unexpected behaviors, including but not
limited to issues that can cause complete outages of the cluster and services it is
managing.
When performing a rolling update, the presence of different versions of the High Availability
and Resilient Storage packages within the same cluster introduces a risk that there may be
unexpected behavior. The only way to completely eliminate this risk is to update the entire
cluster by stopping the cluster software on all nodes, update those nodes by following this
procedure, then start the cluster software again.
New software versions always come with the potential for unexpected behavior, changes in
functionality that may require advance preparation, or in rare cases, bugs causing that could
impact the operation of the product. Red Hat strongly recommends having a test,
development, or staging cluster configured identically to any production clusters, and using
such a cluster to roll out any updates to first for thorough testing prior to the roll-out in
production.
Performing a rolling update necessarily means reducing the overall capacity and redundancy
within the cluster. The size of the cluster dictates whether the absence of a single node poses a
significant risk, with larger clusters being able to absorb more node failures before reaching
the critical limit, and with smaller clusters being less capable or not capable at all of
withstanding the failure of another node while one is missing. It is important that the potential
for failure of additional nodes during the update procedure be considered and accounted for. If
at all possible, taking a complete outage and updating the cluster entirely may be the
preferred option so as to not leave the cluster operating in a state where additional failures
could lead to an unexpected outage.
Perform the following steps to update the base Red Hat Enterprise Linux packages, High Availability
Add-On packages, and Resilient Storage Add-On packages on each node in a rolling fashion.
1. Choose a single node where the software will be updated. If any preparations need to be made
before stopping or moving the resources or software running on that node, carry out those
steps now.
103
Configuring the Red Hat High Availability Add-On with Pacemaker
2. Move any managed resources off of this node as needed. If there are specific requirements or
preferences for where resources should be relocated to, then consider creating new location
constraints to place the resources on the correct node. The location of resources can be
strategically chosen to result in the least number of moves throughout the rolling update
procedure, rather than moving resources in preparation for every single node update. If
allowing the cluster to automatically manage placement of resources on its own is acceptable,
then the next step will automatically take care of this.
3. Place the chosen node in standby mode to ensure it is not considered in service, and to cause
any remaining resources to be relocated elsewhere or stopped.
6. If any software was updated that necessitates a reboot, prepare to perform that reboot. It is
recommended that cluster software be disabled from starting on boot so that the host can be
checked to ensure it is fully functional on its new software versions before bringing it into the
cluster. The following command disables the cluster from starting on boot.
Perform the reboot when ready, and when the boot is complete, ensure that the host is fully
functional and is using the correct software in any relevant areas (such as having booted into
the latest kernel). If anything does not seem correct, then do not proceed until the situation is
resolved.
Once everything is set up correctly, re-enable the cluster software on this chosen node if it was
previously enabled.
7. Start cluster services on the updated node so that the node will rejoin the cluster.
Check the output of the pcs status command to determine that appears as it should. Once
the node is functioning properly, reactivate it for service by taking it out of standby mode.
8. If any temporary location constraints were created to move managed resources off the node,
adjust or remove the constraints to allow resources to return to their normally preferred
locations.
104
APPENDIX D. CREATING NEW LOGICAL VOLUMES FOR AN EXISTING CLUSTER
NOTE
In Red Hat Enterprise Release 6 HA Cluster with Pacemaker, clvmd is not supported in
combination with the LVM resource agent used by Pacemaker when using the volumes
in an exclusive, active/passive manner.
To create new volumes, either volumes need to be added to a managed volume group on the node
where it is already activated by the service, or the volume_list must be temporarily bypassed or
overridden to allow for creation of the volumes until they can be prepared to be configured by a cluster
resource.
To create a new logical volume on the same node where the LVM resource for that volume group is
already started,m use the following procedure:
1. The volume group should already be tagged on the node owning that service, so simply create
the volumes with a standard lvcreate command on that node.
# pcs resource
On the node where the service is started, create the logical volume.
2. Add the volume into the service configuration in whatever way is necessary.
1. Create the volume group on one node with the tag pacemaker while overriding the
volume_list to allow this tag. Specify any desired settings for this volume group as normal
and specify the --addtag and --config options as in the following example:
2. Create logical volumes within this volume group as in the following example, otherwise
perform any necessary administration on the volume group. This example creates a logical
volume that is 1G in size. Create the filesystem as well on the logical volume if required.
3. When the volume group activity is complete, deactivate the volume group and remove the tag,
as in the following example.
105
Configuring the Red Hat High Availability Add-On with Pacemaker
NOTE
Use the same tag as you used previously, if you used a tag other than
pacemaker. When you add the volume group as a resource in the cluster, all the
logical volumes in that volume group will get activated on a single node.
106
APPENDIX E. REVISION HISTORY
107