{"id":487,"date":"2014-10-21T11:03:08","date_gmt":"2014-10-21T09:03:08","guid":{"rendered":"http:\/\/192.168.0.118\/wp\/?p=487"},"modified":"2019-11-01T20:39:43","modified_gmt":"2019-11-01T20:39:43","slug":"simple-ip-failover-cluster-with-centos-6-5","status":"publish","type":"post","link":"https:\/\/doc.zumbrunnen.ch\/index.php\/2014\/10\/21\/simple-ip-failover-cluster-with-centos-6-5\/","title":{"rendered":"Simple IP Failover Cluster with Centos 6"},"content":{"rendered":"<p>for purpose of a more likely HA Icecast Cluster with two nodes I followed the steps below :<br \/>\n<strong>Prerequisites<\/strong><br \/>\n1. Install Centos 6.5 with all the necessary applications &#8211; running on a KVM VM. Call this first installation node 1 (m1.dmd2.local)<br \/>\n2. Clone the first node and modify everything necessary to fire the 2nd VM up.<\/p>\n<p>for the Installation of the Cluster Software I followed this instruction : <a title=\"Cluster Labs - The Home of Pacemaker\" href=\"http:\/\/clusterlabs.org\/quickstart-redhat.html\" target=\"_blank\" rel=\"noopener noreferrer\">Cluster Labs &#8211; The Home of Pacemaker<\/a>.<br \/>\nAll examples assume two nodes that are reachable by their short name and IP address:<\/p>\n<p>node1 &#8211; 192.168.0.1<br \/>\nnode2 &#8211; 192.168.0.2<\/p>\n<p>The convention followed is that [ALL] # denotes a command that needs to be run on all cluster machines, and [ONE] # indicates a command that only needs to be run on one cluster host.<br \/>\nNext we use yum to install pacemaker and some other necessary packages we will need:<\/p>\n<pre class=\"lang:default decode:true \">[ALL] # yum install pacemaker cman pcs ccs resource-agents<\/pre>\n<p><strong>Configure Cluster Membership and Messaging<\/strong><\/p>\n<p>The supported stack on RHEL6 is based on CMAN, so thats what Pacemaker uses too.<\/p>\n<p>We now create a CMAN cluster and populate it with some nodes. Note that the name cannot exceed 15 characters (we&#8217;ll use &#8216;pacemaker1&#8217;).<\/p>\n<pre class=\"lang:default decode:true \">[ONE] # ccs -f \/etc\/cluster\/cluster.conf --createcluster pacemaker1 \n[ONE] # ccs -f \/etc\/cluster\/cluster.conf --addnode node1 \n[ONE] # ccs -f \/etc\/cluster\/cluster.conf --addnode node2<\/pre>\n<p>Next we need to teach CMAN how to send it&#8217;s fencing requests to Pacemaker. We do this regardless of whether or not fencing is enabled within Pacemaker.<\/p>\n<pre class=\"lang:default decode:true \">[ONE] # ccs -f \/etc\/cluster\/cluster.conf --addfencedev pcmk agent=fence_pcmk [ONE] # ccs -f \/etc\/cluster\/cluster.conf --addmethod pcmk-redirect node1 \n[ONE] # ccs -f \/etc\/cluster\/cluster.conf --addmethod pcmk-redirect node2 \n[ONE] # ccs -f \/etc\/cluster\/cluster.conf --addfenceinst pcmk node1 pcmk-redirect port=node1 \n[ONE] # ccs -f \/etc\/cluster\/cluster.conf --addfenceinst pcmk node2 pcmk-redirect port=node2<\/pre>\n<p>Now copy<\/p>\n<pre class=\"lang:default decode:true \">\/etc\/cluster\/cluster.conf<\/pre>\n<p>to all the other nodes that will be part of the cluster.<\/p>\n<p><strong>Start the Cluster<\/strong><br \/>\nCMAN 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:<\/p>\n<pre class=\"lang:default decode:true \">[ALL] # echo \"CMAN_QUORUM_TIMEOUT=0\" &gt;&gt; \/etc\/sysconfig\/cman<\/pre>\n<p>Now, on each machine, run:<\/p>\n<pre class=\"lang:default decode:true \">[ALL] # service cman start \n[ALL] # service pacemaker start<\/pre>\n<p><strong>A note for users of prior RHEL versions<\/strong><br \/>\nThe original cluster shell (crmsh) is no longer available on RHEL. To help people make the transition there is a quick reference guide for those wanting to know what the pcs equivalent is for various crmsh commands.<\/p>\n<p><strong>Set Cluster Options<\/strong><br \/>\nWith so many devices and possible topologies, it is nearly impossible to include Fencing in a document like this. For now we will disable it.<\/p>\n<pre class=\"lang:default decode:true \">[ONE] # pcs property set stonith-enabled=false<\/pre>\n<p>One of the most common ways to deploy Pacemaker is in a 2-node configuration. However quorum as a concept makes no sense in this scenario (because you only have it when more than half the nodes are available), so we&#8217;ll disable it too.<\/p>\n<pre class=\"lang:default decode:true \">[ONE] # pcs property set no-quorum-policy=ignore<\/pre>\n<p>For demonstration purposes, we will force the cluster to move services after a single failure:<\/p>\n<pre class=\"lang:default decode:true \">[ONE] # pcs resource defaults migration-threshold=1<\/pre>\n<p><strong>Add a Resource<\/strong><br \/>\nVirtual IP address :<br \/>\nThe next step is to actually let our cluster do something. We will add a virtual IP to our cluster. This virtual IP is the IP address that which will be contacted to reach the services (the icecast Server in our case). A virtual IP is a resource. To add the resource:<\/p>\n<pre class=\"lang:default decode:true \">[node1]$ pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.0.100 cidr_netmask=32 op monitor interval=1s\n[node1]$ pcs status resources\nvirtual_ip (ocf::heartbeat:IPaddr2): Started<\/pre>\n<p><strong><span style=\"color: #ff0000;\">UPGRADE OS :<\/span><\/strong><br \/>\n<span style=\"color: #000000;\">before upgrading to antother OS Level:<\/span><br \/>\n<span style=\"color: #000000;\">1. move resource to another node<\/span> :<\/p>\n<pre class=\"lang:default decode:true\">pcs resource move virtual_ip m2 #oder m1<\/pre>\n<p><span style=\"color: #000000;\">2. put the passive node into standy mode<\/span><\/p>\n<pre class=\"lang:default decode:true \">this is it :\npcs cluster standby m2\n------------------------------------\n# pcs resource standby virtual_ip m2<\/pre>\n<p><span style=\"color: #000000;\">3. stop pacemaker and corosync service<\/span><\/p>\n<pre class=\"lang:default decode:true\">service cman stop &amp;&amp; service pacemaker stop<\/pre>\n<p>4. upgrade Node<br \/>\n5. reboot Node<br \/>\n6. put the upgraded passive node back into the quorum (unstandby)<\/p>\n<pre class=\"lang:default decode:true \">pcs cluster unstandby m2<\/pre>\n<p>7. move the resource from the currently active node to the upgraded passive node<\/p>\n<pre class=\"lang:default decode:true \">pcs resource move virtual_ip m1 #oder m2<\/pre>\n<p>8. for the second node follow the same steps 2. -6.<\/p>\n<p>&nbsp;<\/p>\n<p>Other helpfull links :<br \/>\n<a title=\"quick reference guide for PCS\" href=\"https:\/\/github.com\/ClusterLabs\/pacemaker\/blob\/master\/doc\/pcs-crmsh-quick-ref.md#modify-a-resource\" target=\"_blank\" rel=\"noopener noreferrer\">quick reference guide for PCS<\/a><br \/>\n<a title=\"Building a high-available failover cluster with Pacemaker, Corosync &amp; PCS\" href=\"http:\/\/jensd.be\/?p=156\" target=\"_blank\" rel=\"noopener noreferrer\">Building a high-available failover cluster with Pacemaker, Corosync &amp; PCS<\/a><br \/>\n<a title=\"Active\/Passive Cluster with Pacemaker, Corosync\" href=\"http:\/\/zeldor.biz\/2010\/12\/activepassive-cluster-with-pacemaker-corosync\/\" target=\"_blank\" rel=\"noopener noreferrer\">Active\/Passive Cluster with Pacemaker, Corosync<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>for purpose of a more likely HA Icecast Cluster with two nodes I followed the steps below : Prerequisites 1. Install Centos 6.5 with all the necessary applications &#8211; running on a KVM VM. Call this first installation node 1 (m1.dmd2.local) 2. Clone the first node and modify everything necessary to fire the 2nd VM [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,10],"tags":[31,38,48],"class_list":["post-487","post","type-post","status-publish","format-standard","hentry","category-centos","category-kvm","tag-custer","tag-failover-ip","tag-icecast"],"_links":{"self":[{"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/posts\/487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/comments?post=487"}],"version-history":[{"count":2,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/posts\/487\/revisions"}],"predecessor-version":[{"id":686,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/posts\/487\/revisions\/686"}],"wp:attachment":[{"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/media?parent=487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/categories?post=487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doc.zumbrunnen.ch\/index.php\/wp-json\/wp\/v2\/tags?post=487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}