Install

From ClusterLabs

Contents

READ ME FIRST

Please do not attempt to install Pacemaker with anything less than Heartbeat 3.0.0

Since Pacemaker was originally part of Heartbeat, it naturally includes many of the files contained in Heartbeat 2.x Most package managers including YUM, RPM and DEB will complain extremely loudly if you try this.

Versions and Compatibilty

The list of current and supported versions of Pacemaker are available at the Releases page. If you already have Pacemaker installed, please read the documentation on upgrading Pacemaker before following any of the instructions here.

Supported Branches

Version

Current Release

Tested w/ Glue

Tested w/ Corosync

Tested w/ Heartbeat

First Released

This Release

Supported Until

1.1

NA

1.0.5

1.2.1

3.0.3

--

--

Q4 2010

1.0

1.0.8

1.0.3

1.2.1

3.0.3

Oct 9, 2008

Mar 16, 2010

Q4 2011 (at least)

Deprecated Branches

Version   

Last Release   

First Released   

Last Released   

0.7

0.7.3

June 25, 2008

Sep 22, 2008

0.6

0.6.7

Jan 16, 2008

Dec 15, 2008

Binary Packages

RPM

Binary packages for current Fedora, OpenSUSE and EPEL compatible distributions (eg. RHEL, CentOS and Scientific Linux) releases can be found at:

http://www.clusterlabs.org/rpm/

Simply browse for your distribution and download the relevant packages.

Once installed, you can decide which cluster stack to use at runtime simply by starting either /etc/init.d/heartbeat or /etc/init.d/corosync. You can also choose not to install whichever stack you don't wish to use.

Installing on Fedora

For Fedora-11, installation is as simple as:

 wget -O /etc/yum.repos.d/pacemaker.repo http://clusterlabs.org/rpm/fedora-11/clusterlabs.repo 
 yum install -y pacemaker corosync heartbeat

As of Fedora-12, Pacemaker is part of the distribution and updates are usually quickly available via the regular channels. There is nothing extra to download, just run:

 yum install -y pacemaker corosync heartbeat

Installing on EPEL Compatible Distributions: RHEL, CentOS, etc

The Pacemaker packages in the EPEL directories build against some additional packages that don't exist on vanilla RHEL/CentOS installs. For more information on EPEL, see http://fedoraproject.org/wiki/EPEL/FAQ

So before installing Pacemaker, you will first need to tell the machine how to find the EPEL packages Pacemaker depends on. To do this, download and install the EPEL package that matches your RHEL/CentOS version.

For example to install on RHEL5.3 for i386, you'd run:

 su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm'

Now add the Cluster Labs repo:

 wget -O /etc/yum.repos.d/pacemaker.repo http://clusterlabs.org/rpm/epel-5/clusterlabs.repo

And finally, install Pacemaker:

 yum install -y pacemaker corosync heartbeat

Installing on openSUSE

openSUSE uses zypper instead of yum, but the procedure is much the same:

 zypper ar http://clusterlabs.org/rpm/opensuse-11.1/clusterlabs.repo
 zypper refresh
 zypper in pacemaker corosync heartbeat

Intra-Stack Package Dependancies

Installation Dependencies

Single Stack Configurations (RPM only)

For those that refuse to install the libraries of whichever stack you wont be using, you can rebuild the published rpms to meet your needs. To do this:

  1. Download the src.rpm
    Browse to http://clusterlabs.org/rpm/
    Look for the src directory underneath the one for your distro (eg. fedora-11/src) and download the most recent version of Pacemaker.
  2. Tell RPM to rebuild the package
    1. rpmbuild --rebuild --without heartbeat pacemaker-[0-9].*.src.rpm
      or
    2. rpmbuild --rebuild --without ais pacemaker-[0-9].*.src.rpm
  3. Install the result
    rpm -Uvh /usr/src/packages/RPMS/i586/pacemaker-[0-9]*.rpm

Re-Building RPMs for Other Architectures

If your packages are not available for your distro/version, you can rebuild the published rpms to meet your needs. To do this:

  1. Download the src.rpm
    Browse to http://clusterlabs.org/rpm/fedora-11/src/ and download the most recent version of Pacemaker.
  2. Tell RPM to rebuild the package
    rpmbuild --rebuild pacemaker-[0-9].*.src.rpm
  3. Install the result
    rpm -Uvh /usr/src/packages/RPMS/i586/pacemaker-[0-9]*.rpm

Debian

Martin Loschwitz from LINBIT does the official builds for Pacemaker (and any other required parts of the stack). "Official" in this sense means that the packages are endorsed by Andrew and the Pacemaker maintainers. These builds have been merged into Debian GNU/Linux Unstable proper as of 2010-04-06.

Please note that the repository URLs changed between Pacemaker releases 1.0.4 and 1.0.5. This is due to the fact that the 1.0.5 packages are integrated with Corosync, which the 1.0.4 packages were not -- this required a makeover to the package build layout.

For detailed installation instructions, refer to the Debian Lenny HowTo. If you run into any issues installing, updating, or using these packages, please let us know on the mailing list.

Use your favorite editor to add one of the following to /etc/apt/sources.list

For Debian 5.0 (lenny):

 deb http://people.debian.org/~madkiss/ha lenny main

For Debian unstable (sid):

 deb http://people.debian.org/~madkiss/ha sid main

Once this has been completed, run:

 apt-get update

Finally, to install Pacemaker simply decide which stack you wish to use and run

 apt-get install pacemaker corosync

or

 apt-get install pacemaker heartbeat

Please note: currently, no direct, "rolling upgrade" path exists for Debian users to move from the woefully outdated Heartbeat 2.1.3 with built-in CRM that continues to be part of the official Debian package repositories. Providing this upgrade path is something that Martin has on his to-do list, but it's a little more challenging than it looks to an observer.

Building from Source

To obtain the latest bug fixes, you may wish to build debian packages from source. To do so:

  • Download the Pacemaker source tarball
 apt-get source pacemaker
  • Install the build-time dependancies
 apt-get build-dep pacemaker
  • Build the .deb
 cd pacemaker-{someversion}
 dpkg-buildpackage -rfakeroot -uc -us

Ubuntu

As of Ubuntu 10.4 (Lucid Lynx), Pacemaker and all its dependancies are part of the distribution. Simply run:

 aptitude install corosync pacemaker

or

 aptitude install heartbeat pacemaker


Users of Ubuntu versions prior to 10.4 can either install the Debian packages, or try the ones from LaunchPad by adding

 deb http://ppa.launchpad.net/ubuntu-ha/ppa/ubuntu karmic main 
 deb-src http://ppa.launchpad.net/ubuntu-ha/ppa/ubuntu karmic main

to /etc/apt/sources.list before running the same aptitude command above.

Darwin/MacOS X

Follow the source based installation instructions below after having installed MacPorts and installing the following pre-requisites:

 sudo port install pkgconfig glib2 help2man

And make sure the default autoconf installation understands the pkg-config macros:

 sudo ln -s /opt/local/share/aclocal/pkg.m4 /usr/share/aclocal/

From Source

Build Dependencies

First Steps

Setup a number of variables that we'll use throughout the build process. Adjust them to your needs.

 export PREFIX=/usr
 export LCRSODIR=$PREFIX/libexec/lcrso 
 export CLUSTER_USER=hacluster
 export CLUSTER_GROUP=haclient

Create a user and group for the cluster

 getent group ${CLUSTER_GROUP} >/dev/null || groupadd -r ${CLUSTER_GROUP}
 getent passwd ${CLUSTER_USER} >/dev/null || useradd -r -g ${CLUSTER_GROUP} -d /var/lib/heartbeat/cores/hacluster -s /sbin/nologin -c "cluster user" ${CLUSTER_USER}

Cluster Glue

Obtain the latest Cluster Glue sources, then create and initialize the build directory

 wget -O cluster-glue.tar.bz2 http://hg.linux-ha.org/glue/archive/tip.tar.bz2
 tar jxvf cluster-glue.tar.bz2
 cd Reusable-Cluster-Components-*

Or, if you want to fetch Cluster Glue directly from the Mercurial repository:

 hg clone http://hg.linux-ha.org/glue
 cd glue

Teach Cluster Glue about the machine it will run on

 ./autogen.sh && ./configure --prefix=$PREFIX  --with-daemon-user=${CLUSTER_USER} --with-daemon-group=${CLUSTER_GROUP}

Once configure reports success, simply execute

 make
 sudo make install

Resource Agents

Obtain the latest sources:

  wget -O resource-agents.tar.bz2 http://hg.linux-ha.org/agents/archive/tip.tar.bz2

Create and initialize the build directory

 tar jxvf resource-agents.tar.bz2
 cd Cluster-Resource-Agents-*

Teach Agents about the machine it will run on

 ./autogen.sh && ./configure --prefix=$PREFIX

Once configure reports success, simply execute

 make
 sudo make install

Heartbeat*

* You can skip this step if you prefer to use the OpenAIS/Corosync cluster stack.

Obtain the latest Heartbeat sources:

  wget -O heartbeat.tar.bz2 http://hg.linux-ha.org/dev/archive/tip.tar.bz2

Create and initialize the build directory

 tar jxvf heartbeat.tar.bz2
 cd Linux-HA-Dev-*

Teach Heartbeat about the machine it will run on

 ./bootstrap && ./configure --prefix=$PREFIX

Once configure reports success, simply execute

 make
 sudo make install

CoroSync*

*You can skip this step if you prefer to use the Heartbeat cluster stack.

CoroSync contains the infrastructure (such as interprocess communication and network protocols) that used to be part of OpenAIS. See the CoroSync FAQ entry for more details.


For the majority of Pacemaker users, it is simplest to think of CoroSync as simply a new version of OpenAIS without a bunch of stuff you weren't using anyway.


Grab the latest code from the CoroSync project which has all the required patches to support Pacemaker

  svn co http://svn.fedorahosted.org/svn/corosync/branches/flatiron/
  cd flatiron

Teach CoroSync about the machine it will run on

 ./autogen.sh && ./configure --prefix=$PREFIX --with-lcrso-dir=$LCRSODIR

Once configure reports success, simply execute

 make
 sudo make install

OpenAIS*

*You can skip this step if you prefer to use the Heartbeat cluster stack or don't plan on using GFS2 or OCFS2.

Although Pacemaker doesn't require the full OpenAIS stack (just CoroSync is sufficient), some cluster services do. These include:

* OCFS2
* GFS2
* cLVM 

In order to use any of the above services in a Pacemaker cluster, you'll need to install OpenAIS.


Grab the latest code from the OpenAIS project

 svn co http://svn.fedorahosted.org/svn/openais/branches/wilson
 cd wilson
Teach OpenAIS about the machine it will run on
 ./autogen.sh && ./configure --prefix=$PREFIX --with-lcrso-dir=$LCRSODIR

Once configure reports success, simply execute

 make
 sudo make install

Pacemaker

Obtain the latest Pacemaker sources:

 wget -O pacemaker.tar.bz2 http://hg.clusterlabs.org/pacemaker/stable-1.0/archive/tip.tar.bz2

You can obtain a specific release by substituting tip with Pacemaker-{version}. eg.

 wget -O pacemaker.tar.bz2 http://hg.clusterlabs.org/pacemaker/stable-1.0/archive/Pacemaker-1.0.5.tar.bz2

Alternatively, for people that want to update regularly, clone the underlying Mercurial repository:

 hg clone http://hg.clusterlabs.org/pacemaker/stable-1.0
 cd stable-1.0
 hg update -C stable-1.0

Create and initialize the build directory

 tar jxvf pacemaker.tar.bz2
 cd Pacemaker-1-0-*

Teach Pacemaker about the machine it will run on

 ./autogen.sh && ./configure --prefix=$PREFIX --with-lcrso-dir=$LCRSODIR

Once configure reports success, simply execute

 make
 sudo make install

for some reason this also appears to be necessary

 sudo ldconfig -v

be sure to first update LD_LIBRARY_PATH if you installed Pacemaker (or anything else) into a non-standard location.

GUI

Although I personally dislike the current GUI, it does appear to be getting better and many people seem to get value from it.

Similar to Pacemaker, you can get the latest sources from:

http://hg.clusterlabs.org/pacemaker/pygui/archive/tip.tar.bz2

Initial Configuration


Contents

[hide]

Basic Stack Configuration

Heartbeat

Sample /etc/ha.d/ha.cf configuration file

 # Logging
 debug				1
 use_logd			false
 logfacility			daemon
 
 # Misc Options
 traditional_compression 	off
 compression			bz2
 coredumps			true
 
 # Communications
 udpport			691
 bcast				eth0
 autojoin			any
   
 # Thresholds (in seconds)
 keepalive			1
 warntime			6
 deadtime			10
 initdead			15

For more details on these and other available options, please refer to http://www.linux-ha.org/ha.cf

CoroSync

Before starting CoroSync for the first time, you need to create the authkey-file for authentication within cluster communication.

Create /etc/corosync/authkey
corosync-keygen #no arguments required

Then you need to copy that file to all of your nodes and put it in /etc/corosync/ with user=root, group=root and mode 0400.

Example /etc/corosync/corosync.conf configuration file
  totem {
 
 	version: 2
 
 	# How long before declaring a token lost (ms)
 	token:          5000
 
 	# How many token retransmits before forming a new configuration
 	token_retransmits_before_loss_const: 20
 
 	# How long to wait for join messages in the membership protocol (ms)
 	join:           1000
 
 	# How long to wait for consensus to be achieved before starting a new round of membership configuration (ms)
 	consensus:      7500
 
 	# Turn off the virtual synchrony filter
 	vsftype:        none
 
 	# Number of messages that may be sent by one processor on receipt of the token
 	max_messages:   20
 
 	# Disable encryption
 	secauth:	off
 
 	# How many threads to use for encryption/decryption
 	threads:   	0
 	
 	# Limit generated nodeids to 31-bits (positive signed integers)
 	clear_node_high_bit: yes
 	
 	# Optionally assign a fixed node id (integer)
 	# nodeid:         1234
 
 	interface {
 		ringnumber: 0
 
 		# The following three values need to be set based on your environment
 		bindnetaddr: 10.0.0.1
 		mcastaddr: 226.94.1.1
 		mcastport: 5405
 	}
 }
 
 logging {
 	fileline: off
 	to_syslog: yes
 	to_stderr: no
 	syslog_facility: daemon
 	debug: on
 	timestamp: on
 }
 
 amf {
 	mode: disabled
 }

Enabling Pacemaker

Heartbeat

To instruct Heartbeat to start Pacemaker, add the following to /etc/ha.d/ha.cf

 crm yes

or, if you plan to enable STONITH

 crm respawn

CoroSync

To instruct CoroSync to start Pacemaker, create /etc/corosync/service.d/pcmk with the following fragment

 service {
 	# Load the Pacemaker Cluster Resource Manager
 	name: pacemaker
 	ver:  0
 }

A Special Note for People Switching Cluster Stacks

CoroSync and Heartbeat identify nodes differently. This is reflected in the value of 'id' for 'node' objects in the CIB.

Since 'id' is the attribute by which a node is identified, this can lead to each node having duplicate entries in the CIB's 'nodes' section and cause expected cluster behavior.

To prevent this, delete the contents of 'nodes' before starting up the alternative cluster stack (and remember to zap the .sig files in the same directory after you do so).

Starting the Cluster

Heartbeat

 /etc/init.d/heartbeat start

CoroSync

 /etc/init.d/corosync start

Next Steps

Documentation

此文章由 flyinweb 于 2010-05-26 15:00:06 编辑

本日志由 flyinweb 于 2010-05-10 14:47:38 发表,目前已经被浏览 9205 次,评论 1 次;

作者添加了以下标签: PacemakerHeartbeat

引用通告:http://www.517sou.net/Article/442/Trackback.ashx

评论订阅:http://www.517sou.net/Article/442/Feeds.ashx

评论列表

  1. Gravatar
    Yapo
    2010-10-04 22:00:09 | # | 回复
    http://docs.homelinux.org also good
(必填)
(必填,不会被公开)