Professional Documents
Culture Documents
Debian Lenny HowTo Cluster
Debian Lenny HowTo Cluster
From ClusterLabs
Jump to: navigation, search This page will guide you trough installing a Corosync+ Pacemaker two node cluster which is later extended and worked with. The aim is to provide you with a working example of such a cluster. Once you get up to speed using this HowTo you can dive into the more advanced configuration and documentation.
Contents
[hide]
1 Introduction 2 Installation 2.1 Backports.org and the Madkiss-repository 2.2 How to enable the repository
2.3 Install the packages 3.1 Create authkey 3.2 Edit configfile 3.3 Enabling corosync 3.4 Deal with firewall 4.1 Check the status
3 Initial Configuration
4 Running corosync
6.1 Put a node in standby and back online again 6.1.1 Put node1 in standby
6.2 Migrate the resource to the other node 6.3 Stop the resource
Introduction
In this example we will first use these names and IP adresses for example code:
node1 - ip 10.0.0.11 - first node node2 - ip 10.0.0.12 - second node virt1 - ip 10.0.0.21 - virtual IP adress
Disclaimer: We assume that you can work with debian linux already and know the security implications of working as root and so on. If you get stuck using this HowTo you might try your luck on the #linux-ha irc channel on freenode.net
Installation
First of all, please install two servers (node1 and node2) with Debian GNU/Linux 5.0 (alias Lenny) and set them both up the way you want them -- finish any non-cluster related changes before fiddling with Pacemaker.
If you use the Madkiss repo, you want to add the Madkiss key to you package system:
apt-key adv --keyserver pgp.mit.edu --recv-key 1CFA3E8CD7145E30
Installing the package pacemaker will install pacemaker with corosync, if you need openais later on, you could install that as a plugin in corosync. OpenAIS is need for example for DLM or CLVM, but thats beyond the scope of this howto.
aptitude install pacemaker
If you want to run pacemaker on top of Heartbeat 3 instead of Corosync, please use the following command:
aptitude install pacemaker heartbeat
Please note that Corosync will still be installed as dependency; however, if you set up Heartbeat properly, Corosync can remain unused.
Initial Configuration
Create authkey
To create an authkey for corosync communication between your two nodes do this on the first node:
node1~: sudo corosync-keygen
This creates a key in /etc/corosync/authkey You need to copy this file to the second node and put it in the /etc/corosync directory with the right permissions. So on the first node:
node1~: scp /etc/corosync/authkey node2:
Edit configfile
Most of the options in the /etc/corosync/corosync.conf file are ok to start with, you must however make sure that it can communicate so make sure to adjust this section:
interface { # The following values need to be set based on your environment ringnumber: 0 bindnetaddr: 192.168.2.0 mcastaddr: 226.94.1.1 mcastport: 5405 }
Change your bindnetaddr to your local subnet so if you have configured the IP 10.0.0.23 for the first node and 10.0.0.24 for the second node, adjust your bindnetaddr to 10.0.0.0.
Enabling corosync
Corosync is disabled by default and starting it with the initscript will not work. To enable corosync you need to replace START=no with START=yes in /etc/default/corosync
Running corosync
Now that you have configured both nodes you can start the cluster on both sides:
node1~: sudo /etc/init.d/corosync start Starting corosync daemon: corosync. node2~: sudo /etc/init.d/corosync start Starting corosync daemon: corosync.
And you can issue the crm_mon tool to get info about the current status of the cluster. We use -V for extra information.
node1~: sudo crm_mon --one-shot -V crm_mon[7363]: 2009/07/26_22:05:40 ERROR: unpack_resources: No STONITH resources have been defined crm_mon[7363]: 2009/07/26_22:05:40 ERROR: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option crm_mon[7363]: 2009/07/26_22:05:40 ERROR: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity ============ Last updated: Fri Nov 6 21:03:51 2009 Stack: openais Current DC: node1 - partition with quorum Version: 1.0.6-cebe2b6ff49b36b29a3bd7ada1c4701c7470febe 2 Nodes configured, 2 expected votes 0 Resources configured. ============ Online: [ node1 node2 ]
As you can see the setup is complaining about STONITH, but that is since we have not configured that part of the cluster.
Configure an IP resource
We are now going to configure the Configuration Information Base or CIB using the Cluster Resouce Manager or CRM command line tool. First we start the crm commandline tool:
Then we create a copy of the current configuration to edit in, we will commit this copy when we are done editing:
crm(live)# cib new config20090726 INFO: config20090726 shadow CIB created crm(config20090726)#
We now turn off STONITH since we don't need it in this example configuration:
crm(config20090726)configure# property stonith-enabled=false
And lastly we check if our configuration is valid and then commit it to the cluster and quit the configuration tool:
crm(config20090726)configure# verify crm(config20090726)configure# end There are changes pending. Do you want to commit them? y crm(config20090726)# crm(config20090726)# cib use live crm(live)# cib commit config20090726 INFO: commited 'config20090726' shadow CIB to the cluster crm(live)# quit bye
Resource operations
There are quite some things you can do with a resource, here are a few examples:
You can see that it actually failed to the other node with crm_mon:
node1~: sudo crm_mon --one-shot ============ Last updated: Fri Nov 6 21:04:31 2009 Stack: openais Current DC: node1 - partition with quorum Version: 1.0.6-cebe2b6ff49b36b29a3bd7ada1c4701c7470febe 2 Nodes configured, 2 expected votes 1 Resources configured. ============ Node node1: standby Online: [ node2 ] failover-ip (ocf::heartbeat:IPaddr): Started node2
Now you can see that the resource has failed back again to node1:
node1~: sudo crm_mon --one-shot ============ Last updated: Fri Nov 6 21:08:22 2009 Stack: openais Current DC: node1 - partition with quorum Version: 1.0.6-cebe2b6ff49b36b29a3bd7ada1c4701c7470febe 2 Nodes configured, 2 expected votes 1 Resources configured. ============ Online: [ node1 node2 ] failover-ip (ocf::heartbeat:IPaddr): Started node1
node1~: sudo crm crm(live)# resource crm(live)resource# list failover-ip (ocf::heartbeat:IPaddr) Started crm(live)resource# migrate failover-ip node2 crm(live)resource# bye bye
You can now see that it is running on the other node using crm_mon:
node1~: sudo crm_mon --one-shot
============ Last updated: Fri Nov 6 21:09:45 2009 Stack: openais Current DC: node1 - partition with quorum Version: 1.0.6-cebe2b6ff49b36b29a3bd7ada1c4701c7470febe 2 Nodes configured, 2 expected votes 1 Resources configured. ============ Online: [ node1 node2 ] failover-ip (ocf::heartbeat:IPaddr): Started node2
============ Last updated: Fri Nov 6 21:11:56 2009 Stack: openais Current DC: node1 - partition with quorum Version: 1.0.6-cebe2b6ff49b36b29a3bd7ada1c4701c7470febe 2 Nodes configured, 2 expected votes 1 Resources configured. ============ Online: [ node1 node2 ]
Note that there is no resource listed here, but you can see that there is one configured resource.
First install an extra node as described above under 'Installation' and add it to the cluster by adding the authkey and the configuration and possibly configure the firewall. Then check if it all worked:
node1~: crm_mon --one-shot ============ Last updated: Fri Nov 6 21:18:14 2009 Stack: openais Current DC: node1 - partition with quorum Version: 1.0.6-cebe2b6ff49b36b29a3bd7ada1c4701c7470febe 2 Nodes configured, 2 expected votes 1 Resources configured. ============ Online: [ node1 node2 node3 ] failover-ip (ocf::heartbeat:IPaddr): Started node1