Initial Configuration

From ClusterLabs

Jump to: navigation, search

Contents

Basic Stack Configuration

We also have some quickstart guides which include the steps relevant to your distribution.

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.0
 		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
 }


CMAN

The CMAN configuration lives in /etc/cluster/cluster.conf.

As can be seen in the example below, the contents are quite simple to understand. You can read more about configuring CMAN for Pacemaker in Clusters from Scratch.

 <?xml version="1.0"?>
 <cluster config_version="1" name="mycluster">
   <logging debug="off"/>
   <clusternodes>
     <clusternode name="pcmk-1" nodeid="1">
       <fence>
         <method name="pcmk-redirect">
           <device name="pcmk" port="pcmk-1"/>
         </method>
       </fence>
     </clusternode>
     <clusternode name="pcmk-2" nodeid="2">
       <fence>
         <method name="pcmk-redirect">
           <device name="pcmk" port="pcmk-2"/>
         </method>
       </fence>
     </clusternode>
   </clusternodes>
   <fencedevices>
     <fencedevice name="pcmk" agent="fence_pcmk"/>
   </fencedevices>
 </cluster>

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 load the quorum and messaging interfaces needed by pacemaker, create /etc/corosync/service.d/pcmk with the following fragment.

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

CMAN

CMAN was originally written for rgmanager and assumes the cluster should not start until the node has quorum, so before we try to start the cluster, we need to disable this behavior:

 echo "CMAN_QUORUM_TIMEOUT=0" >> /etc/sysconfig/cman

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 unexpected 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

In the past the Corosync process would launch pacemaker, this is no longer the case. Pacemaker must be launched after Corosync has successfully started.

 /etc/init.d/corosync start
 /etc/init.d/pacemaker start

CMAN

Pacemaker must be launched after CMAN has successfully started.

 /etc/init.d/cman start
 /etc/init.d/pacemaker start

Next Steps

Try checking out some of our documentation

Personal tools