<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RoAkSoAx's Weblog &#187; stonith</title>
	<atom:link href="http://www.roaksoax.com/tag/stonith/feed" rel="self" type="application/rss+xml" />
	<link>http://www.roaksoax.com</link>
	<description>My Personal Blog</description>
	<lastBuildDate>Tue, 07 Sep 2010 14:17:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>My Thesis&#8230;</title>
		<link>http://www.roaksoax.com/2009/03/my-thesis</link>
		<comments>http://www.roaksoax.com/2009/03/my-thesis#comments</comments>
		<pubDate>Fri, 13 Mar 2009 16:28:21 +0000</pubDate>
		<dc:creator>roaksoax</dc:creator>
				<category><![CDATA[Planet]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[DRBD]]></category>
		<category><![CDATA[heartbeat]]></category>
		<category><![CDATA[meatware]]></category>
		<category><![CDATA[stonith]]></category>
		<category><![CDATA[ubuntu in my thesis]]></category>

		<guid isPermaLink="false">http://roaksoax.wordpress.com/?p=190</guid>
		<description><![CDATA[For all of you who wanted to take a look to my thesis (Design of a model to implement High Availability Web Servers, an overview here)&#8230; you can donwload it from here: http://roaksoax.files.wordpress.com/2009/03/thesis.pdf Btw&#8230; it is in Spanish.]]></description>
			<content:encoded><![CDATA[<p>For all of you who wanted to take a look to my thesis (Design of a model to implement High Availability Web Servers, an overview <a href="http://roaksoax.wordpress.com/2008/07/17/ubuntu-in-my-thesis-part-2/">here</a>)&#8230; you can donwload it from <a href="http://roaksoax.files.wordpress.com/2009/03/thesis.pdf">here:</a> http://roaksoax.files.wordpress.com/2009/03/thesis.pdf</p>
<p>Btw&#8230; it is in Spanish. <img src='http://www.roaksoax.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.roaksoax.com/2009/03/my-thesis/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Installing DRBD on Hardy Part 2.</title>
		<link>http://www.roaksoax.com/2008/08/installing-drbd-on-hardy-part-2</link>
		<comments>http://www.roaksoax.com/2008/08/installing-drbd-on-hardy-part-2#comments</comments>
		<pubDate>Mon, 04 Aug 2008 05:58:01 +0000</pubDate>
		<dc:creator>roaksoax</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Planet]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[DRBD]]></category>
		<category><![CDATA[heartbeat]]></category>
		<category><![CDATA[meatware]]></category>
		<category><![CDATA[stonith]]></category>
		<category><![CDATA[ubuntu hardy]]></category>

		<guid isPermaLink="false">http://roaksoax.wordpress.com/?p=82</guid>
		<description><![CDATA[As you know, in a previous post I showed how to install DRBD in Hardy Heron, in an active/passive configuration. Now, I&#8217;m gonna show you how to install and configure Heartbeat to automatically monitor this active/passive configuration, and provide High Availability. This means I&#8217;ll show you how to integrate DRBD in a simple Heartbeat V1 [...]]]></description>
			<content:encoded><![CDATA[<p>As you know, in a <a href="http://roaksoax.wordpress.com/2008/07/31/installing-drbd-on-hardy/">previous post</a> I showed <a href="http://roaksoax.wordpress.com/2008/07/31/installing-drbd-on-hardy/">how to install DRBD in Hardy Heron</a>, in an active/passive configuration. Now, I&#8217;m gonna show you how to install and configure <a href="http://www.linux-ha.org">Heartbeat</a> to automatically monitor this active/passive configuration, and provide High Availability. This means I&#8217;ll show you how to integrate <a href="http://www.drbd.org">DRBD</a> in a simple <a href="http://www.linux-ha.org">Heartbeat</a> V1 configuration, and as a plus, I&#8217;ll show you how to use the meatware software provided by <a href="http://www.linux-ha.org/STONITH">STONITH</a>.</p>
<p>To do this, we have to install <a href="http://www.linux-ha.org">Heartbeat</a> and make changes in three files, which are<strong><em> /etc/ha.d/ha.cf</em></strong>, <em><strong>/etc/ha.d/haresources</strong></em> and <em><strong>/etc/ha.d/authkeys</strong></em>. First of all we install <a href="http://www.linux-ha.org">Heartbeat</a> as follows, in both nodes:</p>
<blockquote><p><code>sudo apt-get install heartbeat-2</code></p></blockquote>
<p>After the installation is completed, the first file we need to configure, in both nodes, is <em><strong>/etc/ha.d/ha.cf</strong></em> as follows:</p>
<blockquote><p><code>logfile /var/log/ha-log<br />
keepalive 2<br />
deadtime 30<br />
udpport 695<br />
bcast eth0<br />
auto_failback off<br />
node drbd1 drbd2</code></p></blockquote>
<p><strong>Note: </strong>Notice that the <em><strong>auto_failback</strong></em> option is in <strong><em>off</em></strong>. This means that if the drbd1 fails, drbd2 will take control over the service, and if <em><strong>drbd1</strong></em> comes back online, <strong><em>drbd2</em></strong> will not failback to <strong><em>drbd1</em></strong> and <strong><em>drbd2</em></strong> will remain as the active node.</p>
<p>Now, as you know this is an active/passive configuration, so we have to decide which node is going to be the primary and which node is going to be the secondary one, for the <a href="http://www.linux-ha.org">Heartbeat</a> configuration. (If you have followed my previous post, the<strong><em> drbd1</em></strong> node is going to be our primary node, and <em><strong>drbd2</strong></em> will be our secondary node). We also have to consider here is where are we going to mount the DRBD resource in our filesystem, and which IP address is going to used as the VIP (The Virtual IP is going to be used to access a service, or a DRBD resource, over the network, since we are going to use <a href="http://www.drbd.org">DRBD</a> for NFS and/or MySQL).</p>
<p>So, assuming <strong><em>drbd1</em></strong> is the primary node, the VIP is <strong><em>172.16.0.135</em></strong> and we are going to mount the <a href="http://www.drbd.org">DRBD</a> resource in <strong><em>/data</em></strong> (so create the directory in both nodes), we edit <strong><em>/etc/ha.d/haresources</em></strong> as follows, in both nodes:</p>
<blockquote><p><code>drbd1  IPaddr::172.16.0.135/24/eth0 drbddisk::testing Filesystem::/dev/drbd0::/data::ext3</code></p></blockquote>
<p><strong>Note: </strong>Notice that we are specifying the <a href="http://www.drbd.org">DRBD</a> resource with the <strong><em>drbddisk</em></strong> option.</p>
<p>Then, we have to edit the <strong><em>/etc/ha.d/authkeys</em></strong> file, which is going to be used by <a href="http://www.linux-ha.org">Heartbeat</a> to authenticate with the other node. So, we edit it as follows in both nodes:</p>
<blockquote><p><code>auth 3<br />
3 md5 DesiredPassword</code></p></blockquote>
<p>Finally, we change file permissions to this last file as follows:</p>
<blockquote><p><code>sudo chmod 600 /etc/ha.d/authkeys</code></p></blockquote>
<p>Now that we have both nodes configured, I recommend you to power off both nodes and boot the node we want to have as primary. In our case, it is <strong><em>drbd1</em></strong>. After booting up this node, we need to verify that Heartbeat has started the <a href="http://www.drbd.org">DRBD</a> resource (we can see this with <em><strong>cat</strong></em> <strong><em>/proc/drbd</em></strong>) and mounted it in /data. If it has, start the secondary node and verify that it is the secondary one.</p>
<p>If everything has gone right, try the failover process powering off the primary node. You will notice that the node that had the <a href="http://www.drbd.org">DRBD</a> resource as secondary, it&#8217;s now the primary one and it has control over the service. Also verify is the VIP address is working (should appear as eth0:0 issuing ifconfig).</p>
<p>After verifying everything is working as expected, it is always recommendable to have a Fencing device to ensure data integrity. This fencing device will prevent an Split-Brain condition. A well-known Fencing mechanism is known as<a href="http://www.linux-ha.org/STONITH"> STONITH</a> (Shoot the Other Node in the Head). This mechanism will basically power off or reset a node which is supposed to be dead. This means that if <strong><em>drbd1</em></strong> is supposed to be dead, <strong><em>drbd2</em></strong> will take control of the service or, in this case, the <a href="http://www.drbd.org">DRBD</a> resource. But, if <strong><em>drbd1</em></strong> is not actually dead and <strong><em>drbd2</em></strong> tries to take control over the shared <a href="http://www.drbd.org">DRBD</a> resource, an Split-Brain condition will occur. So <a href="http://www.linux-ha.org/STONITH">STONITH</a> will ensure that <strong><em>drbd1</em></strong> has been reseted or powered off so that <strong><em>drbd2</em></strong> can take control of the <a href="http://www.drbd.org">DRBD</a> resource.</p>
<p>To do this, there is an <strong><em>stonith</em></strong> package that is used to work with <a href="http://www.linux-ha.org/STONITH">STONITH</a>/Fencing devices in Heartbeat. But, since we don&#8217;t have a real Fencing device, we will use meatware. Meatware is a software provided by <a href="http://www.linux-ha.org/STONITH">STONITH</a>, that simulates the use of a <a href="http://www.linux-ha.org/STONITH">STONITH</a>/Fencing device, by not allowing the secondary node (<strong><em>drbd2</em></strong>) to take control over the shared resources If there has not been a confirmation that the primary node (<em><strong>drbd1</strong></em>) has been powered off or rebooted. This requires operator intervention. So to integrate the meatware software with Heartbeat we do as follows:</p>
<blockquote><p><code>sudo apt-get install stonith</code></p></blockquote>
<p>Then, we have to modify <strong><em>/etc/ha.d/ha.cf</em></strong> like this (in both nodes):</p>
<blockquote><p><code>... [Output Ommitted]<br />
auto_failback off<br />
<em><strong>stonith_host drbd1 meatware drbd2<br />
stonith_host drbd2 meatware drbd1</strong></em><br />
node drbd1 drbd2</code></p></blockquote>
<p>Then we power off the primary node (in this case <strong><em>drbd1</em></strong>) and reboot secondary node (<strong><em>drbd2</em></strong>). After reboot, take a look at <strong><em>/var/log/ha-log</em></strong> until you see something like this:</p>
<div class="mceTemp mceIEcenter">
<dl class="wp-caption aligncenter">
<dt class="wp-caption-dt"><a href="http://roaksoax.files.wordpress.com/2008/08/ha-log.png"><img class="size-medium wp-image-85" src="http://roaksoax.files.wordpress.com/2008/08/ha-log.png?w=300" alt="ha-log" width="300" height="28" /></a></dt>
</dl>
</div>
<p>As you can see, STONITH is sending a message that says that we need to confirm that <strong><em>drbd1</em></strong> has been rebooted so that <strong><em>drbd2</em></strong> can take control over the service. So, take a look at <strong><em>/proc/drbd</em></strong> and you will see that the DRBD resource is still as secondary. So, we do as follows:</p>
<blockquote><p><code>sudo meatclient -c drbd1</code></p></blockquote>
<p>And we will see something like this:</p>
<div class="mceTemp mceIEcenter">
<dl class="wp-caption aligncenter">
<dt class="wp-caption-dt"><a href="http://roaksoax.files.wordpress.com/2008/08/meatclient1.png"><img class="size-medium wp-image-87" src="http://roaksoax.files.wordpress.com/2008/08/meatclient1.png?w=300" alt="meatclient" width="300" height="78" /></a></dt>
</dl>
</div>
<p>Now, we confirm that it has been rebooted and we can now see that <em><strong>drbd2</strong></em> will take control of the resource by setting the DRBD resource as primary (<strong><em>cat /proc/drbd</em></strong>).</p>
<p>So we can now start <strong><em>drbd1</em></strong>. Everytime the primary node fails, the secondary node will display a message on <strong><em>/var/log/ha-log</em></strong> saying that we should confirm that the primary has been rebooted so that the secondary can take control of the service and become the new primary.</p>
<p>In a next post I&#8217;ll cover how to make NFS make use of DRBD. Any comments, suggestions, etc, you know where to find me <img src='http://www.roaksoax.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.roaksoax.com/2008/08/installing-drbd-on-hardy-part-2/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
