<?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>Abbas &#124; Bassu</title>
	<atom:link href="http://bashukhan.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bashukhan.com</link>
	<description>Life&#039;s having zeros and ones all over</description>
	<lastBuildDate>Tue, 09 Mar 2010 20:11:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>More Raid tidbits &#8211; Monitoring all raid events and changing default email template</title>
		<link>http://bashukhan.com/more-raid-tidbits-monitoring-all-raid-events-and-changing-default-email-template/</link>
		<comments>http://bashukhan.com/more-raid-tidbits-monitoring-all-raid-events-and-changing-default-email-template/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 19:27:41 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[customize default raid mdadm email template]]></category>
		<category><![CDATA[mdadm monitor warning level events]]></category>
		<category><![CDATA[Monitoring all raid events]]></category>
		<category><![CDATA[photoblog]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=157</guid>
		<description><![CDATA[A geek really knows the importance of his or her data and backups that just avoids pulling the hair off! When one of my hard drives on a server just died after having a well served 6000+ hours of life span, I found myself really lucky as other array component of RAID1 came to the [...]]]></description>
			<content:encoded><![CDATA[<p>A geek really knows the importance of his or her data and backups that just avoids pulling the hair off! When one of my hard drives on a server just died after having a well served 6000+ hours of life span, I found myself really lucky as other array component of RAID1 came to the rescue. Reason was a perhaps a short circuit which could have cost me the biggest loss of my data ever, I had in my life, so a blazing smile was well deserved. Electric power is one of the infinite things that doesn&#8217;t work here like it always (oh, its a long story &#8211; I should tell some of it sometime later)!</p>
<p>I got an email from mdmonitor telling me about DegradedArray event. So, when I was rebuilding the array, I noticed I got no alerts about rebuild process or  array status updates which I really wanted to investigate. Till that time, I wasn&#8217;t event knowing that &#8216;mdadm &#8211;monitor&#8217; only sends you the critical updates. So, I pulled up man pages and saw these are critical events:</p>
<ul>
<li>DeviceDisappeared</li>
<li> Fail</li>
<li> FailSpare</li>
<li> DegradedArray</li>
</ul>
<p>Rest of the events are not reported at all! Also, that RHEL5&#8217;s mdadm package has pre-compiled template of email that mdadm sends upon occurrence of a critical event which I wanted to change from as well cause it looks pretty immature:</p>
<pre class="brush: bash;">
This is an automatically generated mail message from mdadm running on HOSTNAME
A DegradedArray event had been detected on md device /dev/md1.
Faithfully yours, etc.

P.S. The /proc/mdstat file currently contains the following:
bla bla bla
</pre>
<p>Seriously, it says &#8220;faithfully&#8221;&#8230; wth? Lol. We know that all machines are faithful to a human unless they&#8217;re not broken or gay! <img src='http://bashukhan.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  It definitely needed to be changed. Checking /etc/init.d/mdmonitor at least gave an idea that its not something changeable but it uses default template when MAILADDR is specified while it doesn&#8217;t when PROGRAM parameter is used in /etc/mdadm.conf by passing on RAID array as arguments to the script which is used, instead.</p>
<p>I did this then.</p>
<pre class="brush: bash;">

# mdadm --detail --scan &gt;&gt; /etc/mdadm.conf

# echo &quot;PROGRAM /etc/raidalerter&quot; &gt;&gt; /etc/mdadm.conf
# sed -e '1i\DEVICE partitions' -i  /etc/mdadm.conf
# cat /etc/raidalerter    (create this file with below script)

#!/bin/bash
echo -e &quot;Likely an unfavourable or a bad thing just happened to your RAID. Even if its recovering, it was a bad thing which caused this! \n\n\n&quot; $(cat -A /proc/mdstat | sed 's/\$/\\n/g') | mail -s &quot;$1 on $2 $3 at $HOSTNAME&quot; some-mail-address@example.com

# chmod +x /etc/raidalerter
# service mdmonitor restart
</pre>
<p>Provided that you&#8217;ve an MTA working fine, mails would be delivered upon any of RAID incidents to the maximum verbosity possible. I don&#8217;t think that any of the hardware raids does so?!<br />
I then tested it on a small array to make sure that alerts are deliverable.</p>
<pre class="brush: bash;">

# mdadm /dev/md0 -f /dev/sdb1 -r /dev/sdb1
mdadm: set /dev/sdb1 faulty in /dev/md0
mdadm: hot removed /dev/sdb1
# mdadm /dev/md0 -a /dev/sdb1
mdadm: re-added /dev/sdb1
</pre>
<p><a href="http://bashukhan.com/wp-content/uploads/2010/03/Mdmonitor-Report-all-mdadm-monitor-events-.png" rel="lightbox[157]"><img class="aligncenter size-full wp-image-165" title="Mdmonitor - Report all mdadm monitor events" src="http://bashukhan.com/wp-content/uploads/2010/03/Mdmonitor-Report-all-mdadm-monitor-events-.png" alt="" width="693" height="292" /></a></p>
<p><strong>Preview: </strong></p>
<p>Subject: RebuildFinished on /dev/md0 at ToughGuy<br />
Likely an unfavorable or a bad thing just happened to your RAID. Even if its recovering, it was a bad thing which caused this!   Personalities :</p>
<p>[raid1]<br />
md1 : active<br />
raid1 sdb3[1] sda3[0]<br />
724555520 blocks [2/2] [UU]<br />
md0 : active<br />
raid1 sdb1[1] sda1[0]<br />
4008064 blocks [2/2] [UU]<br />
unused devices: &lt;none&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/more-raid-tidbits-monitoring-all-raid-events-and-changing-default-email-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux System Variables</title>
		<link>http://bashukhan.com/linux-system-variables/</link>
		<comments>http://bashukhan.com/linux-system-variables/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 15:53:50 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash environment variables]]></category>
		<category><![CDATA[linux built-in variables]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=155</guid>
		<description><![CDATA[Ever wanted to list down all of system built-in global or local variables stored for your shell? Well, it can be with &#8216;env&#8216; and &#8216;set&#8216; commands.
The env lists global variables and set lists local ones. Difference between the two is that, global variables are built-in into any shell while local variables include the ones which [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to list down all of system built-in global or local variables stored for your shell? Well, it can be with &#8216;<strong>env</strong>&#8216; and &#8216;<strong>set</strong>&#8216; commands.<br />
The env lists global variables and set lists local ones. Difference between the two is that, global variables are built-in into any shell while local variables include the ones which are set by different applicatons. Such as MAILCHECK (which controls mail checking frequency and informs shell prompt when new mail arrives), only appears in &#8217;set&#8217; command&#8217;s output.</p>
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/linux-system-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arabian Beer Goggles</title>
		<link>http://bashukhan.com/arabian-beer-goggles/</link>
		<comments>http://bashukhan.com/arabian-beer-goggles/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 15:58:34 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Baribcan a good name]]></category>
		<category><![CDATA[photoblog]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=148</guid>
		<description><![CDATA[Lol, just kidding. Its about a new beer I&#8217;ve &#8216;discovered&#8217; after being in search for an alternative to Arabian Moose Beer for a long time since  it had gone missing speaking of scarcity of brewery brands no more than few available here, at the place I live!
Its called Barbican and keeps some history with [...]]]></description>
			<content:encoded><![CDATA[<p>Lol, just kidding. Its about a new beer I&#8217;ve &#8216;discovered&#8217; after being in search for an alternative to Arabian Moose Beer for a long time since  it had gone missing speaking of scarcity of brewery brands no more than few available here, at the place I live!<br />
Its called <a href="http://www.aujan.com/web/" target="_blank">Barbican</a> and keeps some history with it!</p>
<p>Its pretty awesome and a friend of mine just made it more awesome. She said, &#8220;<span style="color: #00ff00;"><strong>Barbi Can!</strong></span>&#8220;.<br />
Lol, what a name!</p>
<p><a href="http://bashukhan.com/wp-content/uploads/2010/03/Barbican.jpg" rel="lightbox[148]"><img class="aligncenter size-medium wp-image-149" title="Barbican" src="http://bashukhan.com/wp-content/uploads/2010/03/Barbican-300x225.jpg" alt="" width="300" height="225" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/arabian-beer-goggles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Expanding the C: drive (system boot partition)</title>
		<link>http://bashukhan.com/expanding-the-c-drive-system-boot-partition/</link>
		<comments>http://bashukhan.com/expanding-the-c-drive-system-boot-partition/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 14:39:20 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[enlarge system partition]]></category>
		<category><![CDATA[expand boot parition in xenserver windows vm]]></category>
		<category><![CDATA[expanding c; drive]]></category>
		<category><![CDATA[photoblog]]></category>
		<category><![CDATA[windows diskpart]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=130</guid>
		<description><![CDATA[So, I ran out of space on system partition in one of my primary xen virtual machines. Yea, things like this happen quite often when I literally underestimate myself. Unlike Linux, in this case there&#8217;s no power of init which lets you expand an LVM or move a system partition to new disk even without [...]]]></description>
			<content:encoded><![CDATA[<p>So, I ran out of space on system partition in one of my primary xen virtual machines. Yea, things like this happen quite often when I literally underestimate myself. Unlike Linux, in this case there&#8217;s no power of init which lets you expand an LVM or move a system partition to new disk even without going through any reboots. I guess Microsoft realised that its an important option Windows should have so they provided in Windows Server 2008 and Windows 7 under Disk Management with an on the fly ability to either shrink or expand a system volume. But still its a painful risky process in XP or Server 2003. I&#8217;m familiar with third party softwares that help in resizing the partitions including GParted but like always I like to follow vendor supported methodologies on production machines. And it was &#8216;diskpart&#8217; here. Booting the system from a Server 2008 / Vista DVD&#8217;s recovery tools or from WinPE, you can use diskpart. But first things first &#8211; there are three requirements you must have before going ahead.</p>
<ol>
<li>Free space should exist contiguous right after the system partition</li>
<li>That free space partition must be of &#8216;primary&#8217; type and must not be a logical partition.</li>
<li>It should also be in &#8216;unallocated&#8217; or deleted form without an existence of a &#8216;drive&#8217; on it.</li>
</ol>
<p>I had 10Gig C: and D: drive on a 20Gig of a disk. Added 10 more from XenCenter totalling into 30. As I needed a primary unallocated partition after C: drive so I had to use robocopy to backup the D: drive&#8217;s data into a network samba share, format and then split it into one primary and one extended partition.</p>
<p style="text-align: left;"><a href="http://bashukhan.com/wp-content/uploads/2010/03/Expanding-C-Drive.png" rel="lightbox[130]"><img class="size-medium wp-image-131    aligncenter" title="Expanding-C-Drive" src="http://bashukhan.com/wp-content/uploads/2010/03/Expanding-C-Drive-300x278.png" alt="" width="300" height="278" /></a></p>
<p style="text-align: left; padding-left: 120px; font-size: x-small;">Legends:</p>
<p style="padding-left: 120px; text-align: left; font-size: x-small;">Red = Total system drive space before and after the expand<br />
Blue = Total free space on disk before and after expand<br />
Green = Commands issued.</p>
<p style="text-align: center; font-size: x-small;">
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/expanding-the-c-drive-system-boot-partition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error Logging to Console</title>
		<link>http://bashukhan.com/logging-to-console/</link>
		<comments>http://bashukhan.com/logging-to-console/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 12:09:21 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=127</guid>
		<description><![CDATA[Sometimes when some applications start logging to console, it can really bleed your eyes when something wrong happens. Not mentioning about standard output or standard errors which are rather easily controllable but it could be anything else invoked by kernel such as iptables logging when you  would like to log any rules to a log [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes when some applications start logging to console, it can really bleed your eyes when something wrong happens. Not mentioning about standard output or standard errors which are rather easily controllable but it could be anything else invoked by kernel such as iptables logging when you  would like to log any rules to a log file or default syslog. But &#8220;hideously&#8221; such applications log to system console too and can surprise you when you plug monitor and see a messy mesh of error loggings all the way back and forth, specifically when a machine is virtual &#8211; of course in that case VM would be unresponsive <img src='http://bashukhan.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I was trying to look into syslog.conf to control but found out that this is not what a syslog daemon has dominance over; in fact, needs kernel-level  logging modified. And this can be done through either of these ways.</p>
<p><span style="text-decoration: underline;"><span style="color: #800000;"><em><strong>Instruct kernel to log only &#8220;errors&#8221; instead of informational notifications.</strong></em></span></span></p>
<p>Controlled by &#8216;printk&#8217; kernel parameter. Defaults are:</p>
<pre class="brush: bash;">
# sysctl -a | grep printk
kernel.printk_ratelimit_burst = 10
kernel.printk_ratelimit = 5
kernel.printk = 6    4    1    7
# find /proc -name '*printk*' -exec cat {} \;
6    4    1    7
</pre>
<p>Just change &#8216;6 4 1 7&#8242; to &#8216;3 4 1 7&#8242;.</p>
<pre class="brush: bash;">
# echo &quot;kernel.printk = 3 4 1 7&quot; &gt;&gt; /etc/sysctl.conf
# sysctl -p
</pre>
<p>Documentation goes over here, if you&#8217;re intrested /usr/share/doc/kernel-doc-2.6.18/Documentation/sysctl/kernel.txt</p>
<pre class="brush: bash;">
printk:

The four values in printk denote:
 console_loglevel,
 default_message_loglevel,
 minimum_console_loglevel and
 default_console_loglevel respectively.

These values influence printk() behavior when printing or
 logging error messages. See 'man 2 syslog' for more info on
 the different loglevels.

- console_loglevel: messages with a higher priority than this will be printed to the console
 - default_message_level: messages without an explicit priority will be printed with this priority
 - minimum_console_loglevel: minimum (highest) value to which console_loglevel can be set
 - default_console_loglevel: default value for console_loglevel
</pre>
<p>Definitions of kernel logging numbers, from Syslog&#8217;s manual:</p>
<pre class="brush: bash;">
#define KERN_EMERG    &quot;&lt;0&gt;&quot;  /* system is unusable               */
 #define KERN_ALERT    &quot;&lt;1&gt;&quot;  /* action must be taken immediately */
 #define KERN_CRIT     &quot;&lt;2&gt;&quot;  /* critical conditions              */
 #define KERN_ERR      &quot;&lt;3&gt;&quot;  /* error conditions                 */
 #define KERN_WARNING  &quot;&lt;4&gt;&quot;  /* warning conditions               */
 #define KERN_NOTICE   &quot;&lt;5&gt;&quot;  /* normal but significant condition */
 #define KERN_INFO     &quot;&lt;6&gt;&quot;  /* informational                    */
 #define KERN_DEBUG    &quot;&lt;7&gt;&quot;  /* debug-level messages             */
</pre>
<p><span style="color: #800000;"><span style="text-decoration: underline;"><em><strong>Change kernel ring buffer logging level</strong></em></span></span></p>
<p>Just keep in mind, using this approach only limits console logging and issuing dmesg would still print the over all logs.</p>
<pre class="brush: bash;">
# dmesg -n 3
or
# dmesg -n 4
</pre>
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/logging-to-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HA LB Cluster on CentOS5 &#8211; Without actual heartbeat :P</title>
		<link>http://bashukhan.com/ha-lb-cluster-on-centos5-without-actual-heartbeat-p/</link>
		<comments>http://bashukhan.com/ha-lb-cluster-on-centos5-without-actual-heartbeat-p/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 18:13:19 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos5 cluster]]></category>
		<category><![CDATA[ha lb cluster with ipvsadm an heartbeat-ldirectord without actual "heartbeat"]]></category>
		<category><![CDATA[ipvsadm and ldirectord on centos5]]></category>
		<category><![CDATA[old load balance cluster centos5]]></category>
		<category><![CDATA[quick dirty centos5 apache load balance cluster]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=118</guid>
		<description><![CDATA[Last month I wrote a howto for highly available load balanced Piranha cluster using Red Hat&#8217;s cluster suite. Until then it was quite not obvious why one should use the Debian styled network load balanced cluster in the production environment when actual &#8220;heartbeat&#8221; package and service creates a lot of havoc on Red Hat machines. [...]]]></description>
			<content:encoded><![CDATA[<p>Last month I <a href="http://bashukhan.com/tag/piranha-tutorial/" target="_blank">wrote a howto</a> for highly available load balanced Piranha cluster using Red Hat&#8217;s cluster suite. Until then it was quite not obvious why one should use the Debian styled network load balanced cluster in the production environment when actual &#8220;heartbeat&#8221; package and service creates a lot of havoc on Red Hat machines. But my reckoning of doing classic things more manually kept me interrogative and I found the flexible way of doing load balanced clustering without needing the actual heartbeat service. Reasons why I&#8217;m so much against of having it are numerous:<br />
- Running heartbeat snatches the independence of managing virtual IP addresses on load balancer by hand.<br />
- Thus restricting expansion of the pools!<br />
- Ldirector&#8217;s daemon must be managed by heartbeat when its running.<br />
- Waste of resources in utilization; such with a sheer restart of heartbeat service and it just sits on waiting and waiting,&#8230;<br />
- And above all, I don&#8217;t need a &#8220;second&#8221; load balancer for a failover. All that glitters is one load balancer running ldirectord in a simple environment and as for the job, it does most of heartbeat&#8217;s when acting as a divider and a monitor for distributing requests between web servers.</p>
<p><strong><em>Environment</em><br />
</strong></p>
<p>Requirements: At least three systems, each with a minimum of one IP (CentOS in my case). Packages &#8216;heartbeat&#8217;, &#8216;heartbeat-ldirector&#8217; for <a href="http://www.linux-ha.org/" target="_blank">load balancing</a> and &#8216;ipvsadm&#8217; for Linux <a href="http://www.linuxvirtualserver.org/" target="_blank">IP Virtual Server</a>. I know you&#8217;re thinking that why the &#8216;heartbeat&#8217; when actually we&#8217;re not going to run it. In fact, we&#8217;re not going to run it; its just for a dependency resolution, rather a service startup requirement &#8211; I should say (/etc/ha.d/shellfuncs is the file needed)! And I swear we won&#8217;t run it <img src='http://bashukhan.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ! So these are the packages which shape into a project <a href="http://www.ultramonkey.org/" target="_blank">Ultramonkey</a> when combined and it describes the different topologies of a functional HA LB cluster but that&#8217;s not our concern, anyway <img src='http://bashukhan.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  (perhaps yours if you think you&#8217;ve a bit of free time)</p>
<p>Virtual IP<strong>: </strong>12.12.12.60<br />
Load Balancer: 12.12.12.61 aka VM1.<br />
Cluster Nodes/Real Servers:<br />
Web Server1: 12.12.12.62 aka VM2<br />
Web Server2: 12.12.12.63 aka VM3.</p>
<p>And we&#8217;ll be using LVS-DR (direct routing) approach for clustering; its most widely used and has lesser downsides.<br />
Lets start by configuring the web servers first.</p>
<p><em><strong>Cluster Nodes  Configurations</strong></em></p>
<p><strong>1. </strong>On both web servers VM2 and VM3, apache should be running having a common serving file (for purpose of get checked by ldirectord).</p>
<pre class="brush: bash;">
# yum install httpd -y
# echo foo &gt; /var/www/html/test.html
# service httpd start
# chkconfig httpd on
</pre>
<p>And to distinguish both of the web servers during test loading, create at least a one unique file on each of web servers.</p>
<pre class="brush: bash;">
[root@VM2 ~]# echo &quot;This is VM2&quot; &gt; /var/www/html/index.html
[root@VM3 ~]# echo &quot;This is VM3&quot; &gt; /var/www/html/index.html
</pre>
<p><strong>2.</strong> Virtual IP needs to be terminated on both web servers so we&#8217;ll create a second network interface on each of it. Because eventually all three NICs on all three servers would have to have the same VIP so this would cause a problem with ARP as it resolves MACs against IPs. There are different solutions to this problem. Some may refer to use iptables or arptables_jf. Many would recommend changing default gateway route or hiding the network interface (by the way don&#8217;t use iptables or change default gateway for this; Red Hat discourages both of these methods as they cause a lot of overhead). But the most flexible approach I&#8217;ve found is:</p>
<p style="padding-left: 30px;"><strong>a. </strong>create a loopback interface so it doesn&#8217;t communicate with your network gateway/router directly.<br />
<strong>b.</strong> instruct Linux kernel to announce ARP requests with preference to be taken from local address when matching for communication instead preference from the destination address.<br />
<strong>c. </strong>instruct Linux kernel to send ARP responses only to the requests originating from same sender address to same local addresses&#8217; subnet. Details <a href="http://kb.linuxvirtualserver.org/wiki/Using_arp_announce/arp_ignore_to_disable_ARP" target="_blank">here</a>, if you&#8217;re really curious about it.</p>
<pre class="brush: bash;">
# vi /etc/sysconfig/network-scripts/ifcfg-lo:0
DEVICE=lo:0
IPADDR=12.12.12.60
NETMASK=255.255.255.255
ONBOOT=yes
NAME=loopback
#
# vi /etc/sysctl.conf
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.eth0.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.eth0.arp_announce = 2
# sysctl -p
# ifup lo:0
</pre>
<p><em><strong>Load Balancer Configuration</strong></em></p>
<p>We&#8217;ll be going through:</p>
<p><strong>a. </strong>installing required packages<br />
<strong>b.</strong> enabling IP forwarding,</p>
<pre class="brush: bash;">
# yum install heartbeat heartbeat-ldirector ipvsadm -y
# chkconfig --add ldirectord
# chkconfig --del heartbeat
# sed -i 's/net.ipv4.ip_forward = 1/net.ipv4.ip_forward = 0' /etc/sysctl.conf

# sysctl -p
</pre>
<p><strong>c.</strong> configure secondary eth0 for VIP as its going to be exposed to outside world or your local gateway and</p>
<pre class="brush: bash;">
# vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0:0
BOOTPROTO=none
ONBOOT=yes
HWADDR=3a:5d:71:ad:67:47
NETMASK=255.255.255.0
IPADDR=12.12.12.60
GATEWAY=12.12.12.1
TYPE=Ethernet
</pre>
<p><strong>d.</strong> then creating ldirector.cf, the configuration file of our load balancer, respectively!!</p>
<pre class="brush: bash;">
# vi /etc/ha.d/ldirectord.cf
checktimeout=10
checkinterval=2
autoreload=no
logfile=&quot;/var/log/ldirectord.log&quot;
quiescent=no
virtual=12.12.12.60:80
 real=12.12.12.62:80 gate
 real= 12.12.12.63:80 gate
 service=http
 request=&quot;test.html&quot;
 receive=&quot;foo&quot;
 scheduler=wrr
 protocol=tcp
 checktype=negotiate

# service ldirectord start
</pre>
<p>Option &#8216;quiescent&#8217; just removes the real server from ipvs table whom ldirectord doesn&#8217;t recieve any response from, when querying for test.html within ten seconds, marking that real server as dead; until its available again. Note that the &#8220;gate&#8221; switch in &#8216;real&#8217; server&#8217;s parameter value which testifies the usage of LVS Direct Routing method. The rest of the two methods are masq and ipip the details of which along with the other options available, particularly the scheduler parameters, for this configuration file can be found in &#8216;man ldirectord&#8217;.</p>
<p><em><strong>Testing</strong></em></p>
<p><em><strong></strong></em>Use &#8216;ipvsadm&#8217; to list down current statistics of ldirectord. Make sure that both real servers IPs are listed there and have non-zero value in weight (since we&#8217;ve this default setup, it should be 1). If not, then try checking the log file, tcpdump on ldirector and apache logs on real servers.<br />
If everything works good, you&#8217;ll see changing content when browsing to http://12.12.12.60/ multiple times (from another system outside these cluster nodes). Then stop httpd on one web server, browse to the URL again and all requests should now be served from the other web server.</p>
<pre class="brush: bash;">
[root@VM1 ~]# ipvsadm -l
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-&gt; RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  12.12.12.60:http wrr
-&gt; 12.12.12.63:http             Route   1      0          0
-&gt; 12.12.12.62:http             Route   1      0          0
</pre>
<p>For a more meaningful testing</p>
<pre class="brush: bash;">
$ for i in $(seq 6); do curl http://12.12.12.60/index.html; done
 This is VM3
 This is VM2
 This is VM3
 This is VM2
 This is VM3
 This is VM2
</pre>
<p>I&#8217;ll be posting a couple of optimizations techniques soon when I&#8217;ll be getting some more free time. Stay tuned and take care <img src='http://bashukhan.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 1388px; width: 1px; height: 1px;">checktimeout=10<br />
checkinterval=2<br />
autoreload=no<br />
logfile=&#8221;/var/log/ldirectord.log&#8221;<br />
quiescent=yes<br />
virtual=12.12.12.60:80<br />
real=12.12.12.62:80 gate<br />
real= 12.12.12.63:80 gate<br />
service=http<br />
request=&#8221;index.html&#8221;<br />
receive=&#8221;hi&#8221;<br />
scheduler=wlc<br />
protocol=tcp<br />
checktype=negotiate</div>
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/ha-lb-cluster-on-centos5-without-actual-heartbeat-p/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Total Rsync Progress</title>
		<link>http://bashukhan.com/total-rsync-progress/</link>
		<comments>http://bashukhan.com/total-rsync-progress/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 14:13:30 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[live rsync stats]]></category>
		<category><![CDATA[measure total progress of rsync]]></category>
		<category><![CDATA[overall rsync progress]]></category>
		<category><![CDATA[photoblog]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=113</guid>
		<description><![CDATA[If you use rsync frequently, you might be aware of the fact that rsync doesn&#8217;t show overall or total transfer statistics when you&#8217;re syncing directories recursively. Even options like &#8216;&#8211;progress&#8217;, &#8216;&#8211;stats&#8217; and &#8216;-vv&#8217; won&#8217;t do that. I was searching for that, was about to write a script to run in dry-run mode and measure an [...]]]></description>
			<content:encoded><![CDATA[<p>If you use rsync frequently, you might be aware of the fact that rsync doesn&#8217;t show overall or total transfer statistics when you&#8217;re syncing directories recursively. Even options like &#8216;&#8211;progress&#8217;, &#8216;&#8211;stats&#8217; and &#8216;-vv&#8217; won&#8217;t do that. I was searching for that, was about to write a script to run in dry-run mode and measure an overall rsync progress but found a patch <a href="https://bugzilla.samba.org/attachment.cgi?id=3390" target="_blank">here</a> written by Graeme Humphries. This patch later was incorporated into latest dev version 3.1dev downloadable here at<a href="http://samba.anu.edu.au/ftp/rsync/dev/nightly/" target="_blank"> http://samba.anu.edu.au/ftp/rsync/dev/nightly/</a> with an option invokable by &#8216;&#8211;info=progress2&#8242;.</p>
<blockquote><p>Excerpts from the man pages:</p>
<pre class="brush: bash;">
There is also a --info=progress2 option that outputs statistics based on the whole transfer, rather than individual files.  Use this flag without outputting a filename (e.g. avoid -v or specify --info=name0 if you want to see how the transfer is doing without scrolling the screen with a lot of names.  (You don't need to specify the --progress option in order to use --info=progress2.)
 </pre>
</blockquote>
<p>So, I downloaded, compiled and installed this dev version and guess what now, there&#8217;s no creepy scrolls in shell console filling up the screen with individual file progress.<br />
Yea, I know Red Hat and CentOS are slow in updating their packages repository but lets hope when this build is final, Dag&#8217;s repo may have an rpm for it.</p>
<p><a href="http://bashukhan.com/wp-content/uploads/2009/12/rsync3.png" rel="lightbox[113]"><img class="aligncenter size-medium wp-image-115" title="rsync3" src="http://bashukhan.com/wp-content/uploads/2009/12/rsync3-300x144.png" alt="" width="300" height="144" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/total-rsync-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easiest way to create selfsigned certificates</title>
		<link>http://bashukhan.com/easiest-way-to-create-selfsigned-certificates/</link>
		<comments>http://bashukhan.com/easiest-way-to-create-selfsigned-certificates/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 06:22:23 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[easiest way to create selfsigned certificates]]></category>
		<category><![CDATA[photoblog]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=107</guid>
		<description><![CDATA[For Linux its going to be with tool &#8216;genkey&#8217; &#8211; a part of crypto-utils package available in Red Hat distros.

# genkey servername

And for Windows, easiest way to do is with SelfSSL available in IIS 6.x Resource Tools.

]]></description>
			<content:encoded><![CDATA[<p>For Linux its going to be with tool &#8216;genkey&#8217; &#8211; a part of crypto-utils package available in Red Hat distros.</p>
<pre class="brush: bash;">
# genkey servername
</pre>
<p>And for Windows, easiest way to do is with SelfSSL available in IIS 6.x Resource Tools.</p>
<p><a href="http://bashukhan.com/wp-content/uploads/2009/12/genkey1.png" rel="lightbox[107]"><img class="aligncenter size-medium wp-image-108" title="Genkey - crypto-utils" src="http://bashukhan.com/wp-content/uploads/2009/12/genkey1-300x149.png" alt="" width="300" height="149" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/easiest-way-to-create-selfsigned-certificates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASCII Art in Linux</title>
		<link>http://bashukhan.com/ascii-art-in-linux/</link>
		<comments>http://bashukhan.com/ascii-art-in-linux/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 20:03:21 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[asci art in linux]]></category>
		<category><![CDATA[convert text into ascii art tool]]></category>
		<category><![CDATA[figlet]]></category>
		<category><![CDATA[linux_logo]]></category>
		<category><![CDATA[photoblog]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=95</guid>
		<description><![CDATA[I&#8217;m fond of two ascii art tools in Linux.
- linux_logo
- figlet
Both of these are available in RPMForge/Dag&#8217;s repository. Second one, figlet draws the ascii art for any text that is input. It has a lot of font options available (see man for figlet and figlist).


]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m fond of two ascii art tools in Linux.</p>
<p>- linux_logo<br />
- figlet</p>
<p>Both of these are available in RPMForge/Dag&#8217;s repository. Second one, figlet draws the ascii art for any text that is input. It has a lot of font options available (see man for figlet and figlist).</p>
<p style="text-align: center;"><a href="http://bashukhan.com/wp-content/uploads/2009/12/ascii-art.png" rel="lightbox[95]"><img class="aligncenter size-medium wp-image-100" title="ascii-art" src="http://bashukhan.com/wp-content/uploads/2009/12/ascii-art-300x197.png" alt="" width="300" height="197" /></a></p>
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/ascii-art-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing HPLIP 3.9.10 on CentOS 5.4 for newer printers (HP LaserJet M1120 MFP)</title>
		<link>http://bashukhan.com/installing-hplip-3-9-10-on-centos-5-4-for-newer-printers-hp-laserjet-m1120-mfp/</link>
		<comments>http://bashukhan.com/installing-hplip-3-9-10-on-centos-5-4-for-newer-printers-hp-laserjet-m1120-mfp/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 13:34:41 +0000</pubDate>
		<dc:creator>Abbas</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[CentOS hplip drivers with scanner support]]></category>
		<category><![CDATA[fixing hplip dependency errors]]></category>
		<category><![CDATA[HP LaserJet M1120]]></category>
		<category><![CDATA[HP LaserJet M1120 Red Hat]]></category>
		<category><![CDATA[install hplip on CentOS 5]]></category>
		<category><![CDATA[latest hplip 3.9 on CentOS 5.5]]></category>
		<category><![CDATA[photoblog]]></category>

		<guid isPermaLink="false">http://bashukhan.com/?p=84</guid>
		<description><![CDATA[CentOS 5&#8217;s base repository has an older version of HPLIP, something about &#8216;1.6.7&#8242; or so which of course is not adequate to get newer HP printers specially the LaserJet series, to get to work. Now the natural way to have this installed, you may think is to compile it from source &#8211; if you&#8217;re thinking [...]]]></description>
			<content:encoded><![CDATA[<p>CentOS 5&#8217;s base repository has an older version of HPLIP, something about &#8216;1.6.7&#8242; or so which of course is not adequate to get newer HP printers specially the LaserJet series, to get to work. Now the natural way to have this installed, you may think is to compile it from <em><strong><a title="HPLIP installation from source" href="http://hplipopensource.com/hplip-web/install/manual/distros/centos.html" target="_blank">source</a></strong></em> &#8211; if you&#8217;re thinking that then no, that won&#8217;t help out! Even after fulfilling all of the required dependencies. I got about almost 14 errors when running hp-check utility after compiling, got&#8217;em reduced to 10 but no far lesser than that if you know what I mean.</p>
<pre class="brush: bash;">
error: NOT FOUND! This is a REQUIRED/RUNTIME ONLY dependency. Please make sure that this dependency is installed before installing or running HPLIP.
error: NOT FOUND! This is a REQUIRED/RUNTIME ONLY dependency. Please make sure that this dependency is installed before installing or running HPLIP.
warning: NOT FOUND! This is an OPTIONAL/RUNTIME ONLY dependency. Some HPLIP functionality may not function properly.
warning: NOT FOUND! This is an OPTIONAL/RUNTIME ONLY dependency. Some HPLIP functionality may not function properly.
error: NOT FOUND! This is a REQUIRED/COMPILE TIME ONLY dependency. Please make sure that this dependency is installed before installing or running HPLIP.
error: Could not access file: No such file or directory
error: 10 errors and/or warnings.
-----------
| SUMMARY |
-----------
Please refer to the installation instructions at:

http://hplip.sourceforge.net/install/index.html
</pre>
<p>Pretty insane though, many of these dependencies were already installed. I would assume that this would be the reason why hplip is not under active development for CentOS and why its not current under CentOS as I saw quite a few HP&#8217;s devs and techs saying a big &#8220;no&#8221; to this community based distribution when people complained on their Launchpad about these compilation errors. Plus, the relative hplip installation issues I found on CentOS&#8217; forum.</p>
<p>After being in disappointed (oops wth) situation, I tried running the RHEL5&#8217;s rpm (can be downloaded from hplip&#8217;s site) on it after removing the source installed version, but it too gave the dependency errors which I hoped I would resolve and I did later on.</p>
<p><em><strong>Installing&#8230;&#8230;</strong></em></p>
<pre class="brush: bash;">
# rpm -ivh /Raid/hplip-3.9.10_rhel-5.0.i386.rpm
Preparing...                ########################################### [100%]
 file /usr/bin/hpijs from install of hplipfull-3.9.10-0.i386 conflicts with file from package hpijs-1.6.7-4.1.el5.4.i386
 file /usr/lib/libhpip.so.0.0.1 from install of hplipfull-3.9.10-0.i386 conflicts with file from package hpijs-1.6.7-4.1.el5.4.i386
 file /usr/lib/sane/libsane-hpaio.so.1.0.0 from install of hplipfull-3.9.10-0.i386 conflicts with file from package libsane-hpaio-1.6.7-4.1.el5.4.i386
</pre>
<p><em><strong>So, I decided to remove problematic hpijs</strong></em></p>
<pre class="brush: bash;">

 Package                 Arch       Version          Repository        Size

Removing:
 hpijs                   i386       1:1.6.7-4.1.el5.4  installed         588 k
Removing for dependencies:
 libsane-hpaio           i386       1.6.7-4.1.el5.4  installed          94 k
 sane-backends           i386       1.0.18-5.el5     installed         3.1 M
 sane-backends-devel     i386       1.0.18-5.el5     installed          27 k
 sane-backends-libs      i386       1.0.18-5.el5     installed         5.2 M
 xsane                   i386       0.991-5.el5      installed         4.5 M

Transaction Summary
Install      0 Package(s)
Update       0 Package(s)
Remove       6 Package(s)
</pre>
<p><em><strong>But realised soon that it also removed libsane sub-dependency as well.</strong></em></p>
<pre class="brush: bash;">
# rpm -ivh /Raid/hplip-3.9.10_rhel-5.0.i386.rpm
error: Failed dependencies:
 libsane.so.1 is needed by hplipfull-3.9.10-0.i386
 </pre>
<p><em><strong>Because installing sane would also install hpijs and other conflicting stuff as well so the solution here was to remove problematic packages without &#8216;removing&#8217; any dependencies needed.</strong></em></p>
<pre class="brush: bash;">
[root@ToughGuy ~]# rpm -ivh /Raid/hplip-3.9.10_rhel-5.0.i386.rpm
Preparing...                ########################################### [100%]
 file /usr/bin/hpijs from install of hplipfull-3.9.10-0.i386 conflicts with file from package hpijs-1.6.7-4.1.el5.4.i386
 file /usr/lib/libhpip.so.0.0.1 from install of hplipfull-3.9.10-0.i386 conflicts with file from package hpijs-1.6.7-4.1.el5.4.i386
 file /usr/lib/sane/libsane-hpaio.so.1.0.0 from install of hplipfull-3.9.10-0.i386 conflicts with file from package libsane-hpaio-1.6.7-4.1.el5.4.i386
#
# rpm -ev --nodeps libsane-hpaio
# rpm -ivh /Raid/hplip-3.9.10_rhel-5.0.i386.rpm
Preparing...                ########################################### [100%]
 file /usr/bin/hpijs from install of hplipfull-3.9.10-0.i386 conflicts with file from package hpijs-1.6.7-4.1.el5.4.i386
 file /usr/lib/libhpip.so.0.0.1 from install of hplipfull-3.9.10-0.i386 conflicts with file from package hpijs-1.6.7-4.1.el5.4.i386
#
# rpm -ev --nodeps hpijs
#
# rpm -ivh /Raid/hplip-3.9.10_rhel-5.0.i386.rpm
Preparing...                ########################################### [100%]
 1:hplipfull              ########################################### [100%]
#
</pre>
<p><em><strong>Concluding the overall steps:</strong></em></p>
<pre class="brush: bash;">
# yum install cups cups-devel ghostscript* PyQt xsane -y
# Download and install hplip-3.9.10_rhel-5.0.i386.rpm from http://hplipopensource.com/hplip-web/install_wizard/index.html choosing RHEL5.
# rpm -ev --nodeps libsane-hpaio
# rpm -ev --nodeps hpijs
# rpm -ivh hplip-3.9.10_rhel-5.0.i386.rpm
# Reboot the system if you're lucky enough, you'll see no errors
# reboot
# system-config-printer
</pre>
<p>And configure the printer now as usual. Just out of curiosity, this was my XenServer where I installed it (yea I know it would sound funny) and I got scanner (LaserJet M1120 is dual scanner and printer) working fine as well with xsane. Check it out <img src='http://bashukhan.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<div id="attachment_85" class="wp-caption aligncenter" style="width: 310px"><a href="http://bashukhan.com/wp-content/uploads/2009/12/Scan_test.png" rel="lightbox[84]"><img class="size-medium wp-image-85" title="Scan Test HP LaserJet M1120 MFP" src="http://bashukhan.com/wp-content/uploads/2009/12/Scan_test-300x293.png" alt="" width="300" height="293" /></a><p class="wp-caption-text">Scan Test HP LaserJet M1120 MFP</p></div>
<p><strong><span style="color: #000000;">NOTE: </span></strong><span style="color: #000000;">If this post helped you out or provided you with ways of troubleshooting, feel free to say a little thanks <img src='http://bashukhan.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://bashukhan.com/installing-hplip-3-9-10-on-centos-5-4-for-newer-printers-hp-laserjet-m1120-mfp/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
