Product SiteDocumentation Site

Pacemaker 1.1

Clusters from Scratch

Step-by-Step Instructions for Building Your First High-Availability Cluster

Edition 9

Andrew Beekhof

Primary author 
Red Hat

Raoul Scarazzini

Italian translation 

Dan Frîncu

Romanian translation 

Legal Notice

Copyright © 2009-2015 Andrew Beekhof.
The text of and illustrations in this document are licensed under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA")[1].
In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
In addition to the requirements of this license, the following activities are looked upon favorably:
  1. If you are distributing Open Publication works on hardcopy or CD-ROM, you provide email notification to the authors of your intent to redistribute at least thirty days before your manuscript or media freeze, to give the authors time to provide updated documents. This notification should describe modifications, if any, made to the document.
  2. All substantive modifications (including deletions) be either clearly marked up in the document or else described in an attachment to the document.
  3. Finally, while it is not mandatory under this license, it is considered good form to offer a free copy of any hardcopy or CD-ROM expression of the author(s) work.


The purpose of this document is to provide a start-to-finish guide to building an example active/passive cluster with Pacemaker and show how it can be converted to an active/active one.
The example cluster will use:
  1. CentOS 7.1 as the host operating system
  2. Corosync to provide messaging and membership services,
  3. Pacemaker to perform resource management,
  4. DRBD as a cost-effective alternative to shared storage,
  5. GFS2 as the cluster filesystem (in active/active mode)
Given the graphical nature of the install process, a number of screenshots are included. However the guide is primarily composed of commands, the reasons for executing them and their expected outputs.

Table of Contents

1. Document Conventions
1.1. Typographic Conventions
1.2. Pull-quote Conventions
1.3. Notes and Warnings
2. We Need Feedback!
1. Read-Me-First
1.1. The Scope of this Document
1.2. What Is Pacemaker?
1.3. Pacemaker Architecture
1.3.1. Internal Components
1.4. Types of Pacemaker Clusters
2. Installation
2.1. Install CentOS 7.1
2.1.1. Boot the Install Image
2.1.2. Installation Options
2.1.3. Configure Network
2.1.4. Configure Disk
2.1.5. Configure Time Synchronization
2.1.6. Finish Install
2.2. Configure the OS
2.2.1. Verify Networking
2.2.2. Login Remotely
2.2.3. Apply Updates
2.2.4. Use Short Node Names
2.3. Repeat for Second Node
2.4. Configure Communication Between Nodes
2.4.1. Configure Host Name Resolution
2.4.2. Configure SSH
2.5. Install the Cluster Software
2.6. Configure the Cluster Software
2.6.1. Allow cluster services through firewall
2.6.2. Enable pcs Daemon
2.6.3. Configure Corosync
3. Pacemaker Tools
3.1. Simplify administration using a cluster shell
3.2. Explore pcs
4. Start and Verify Cluster
4.1. Start the Cluster
4.2. Verify Corosync Installation
4.3. Verify Pacemaker Installation
5. Create an Active/Passive Cluster
5.1. Explore the Existing Configuration
5.2. Add a Resource
5.3. Perform a Failover
5.4. Prevent Resources from Moving after Recovery
6. Add Apache as a Cluster Service
6.1. Install Apache
6.2. Create Website Documents
6.3. Enable the Apache status URL
6.4. Configure the Cluster
6.5. Ensure Resources Run on the Same Host
6.6. Ensure Resources Start and Stop in Order
6.7. Prefer One Node Over Another
6.8. Move Resources Manually
7. Replicate Storage Using DRBD
7.1. Install the DRBD Packages
7.2. Allocate a Disk Volume for DRBD
7.3. Configure DRBD
7.4. Initialize DRBD
7.5. Populate the DRBD Disk
7.6. Configure the Cluster for the DRBD device
7.7. Configure the Cluster for the Filesystem
7.8. Test Cluster Failover
8. Configure STONITH
8.1. What is STONITH?
8.2. Choose a STONITH Device
8.3. Configure the Cluster for STONITH
8.4. Example
9. Convert Cluster to Active/Active
9.1. Install Cluster Filesystem Software
9.2. Configure the Cluster for the DLM
9.3. Create and Populate GFS2 Filesystem
9.4. Reconfigure the Cluster for GFS2
9.5. Clone the IP address
9.6. Clone the Filesystem and Apache Resources
9.7. Test Failover
A. Configuration Recap
A.1. Final Cluster Configuration
A.2. Node List
A.3. Cluster Options
A.4. Resources
A.4.1. Default Options
A.4.2. Fencing
A.4.3. Service Address
A.4.4. DRBD - Shared Storage
A.4.5. Cluster Filesystem
A.4.6. Apache
B. Sample Corosync Configuration
C. Further Reading
D. Revision History

List of Figures

1.1. The Pacemaker Stack
1.2. Internal Components
1.3. Active/Passive Redundancy
1.4. Shared Failover
1.5. N to N Redundancy
2.1. CentOS 7.1 Installation Welcome Screen
2.2. CentOS 7.1 Installation Summary Screen
2.3. CentOS 7.1 Console Prompt

List of Examples

5.1. The last XML you’ll see in this document