<?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>Source Allies Blog &#187; Infrastructure</title>
	<atom:link href="http://blogs.sourceallies.com/category/infrastructure/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.sourceallies.com</link>
	<description>Technical and process thinking from Source Allies employees</description>
	<lastBuildDate>Mon, 26 Jul 2010 15:01:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How RAID 5 Works at a Bitwise Level</title>
		<link>http://blogs.sourceallies.com/2010/05/how-raid-5-works-at-a-bitwise-level/</link>
		<comments>http://blogs.sourceallies.com/2010/05/how-raid-5-works-at-a-bitwise-level/#comments</comments>
		<pubDate>Fri, 28 May 2010 11:01:56 +0000</pubDate>
		<dc:creator>Max  Kuipers</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[raid]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=1386</guid>
		<description><![CDATA[RAID 5 is a pretty magical thing overall, though a large portion of its magic lies in how it works on a bitwise level.  But before I get into the bitwise sorcery, I&#8217;d like to briefly explain what RAID5 is. RAID stands for Redundant Array of Inexpensive (or Independent) Disks. There are a number of [...]]]></description>
			<content:encoded><![CDATA[<p>RAID 5 is a pretty magical thing overall, though a large portion of its magic lies in how it works on a bitwise level.  But before I get into the bitwise sorcery, I&#8217;d like to briefly explain what RAID5 is. RAID stands for Redundant Array of Inexpensive (or Independent) Disks. There are a number of different types of RAID such as RAID0, RAID1, RAID5 and RAID6 which each store data in different ways and have different space efficiencies and fault tolerances.<br />
<span id="more-1386"></span></p>
<blockquote><p>Space efficiency is given as amount of storage space available in an array of n disks, in multiples of the capacity of a single drive. For example if an array holds n=5 drives of 250GB and efficiency is n-1 then available space is 4 times 250GB or roughly 1TB.</p></blockquote>
<p>The space efficiency of RAID5 is n-1 and the fault tolerance allows for one disk to go down at a time.  What this means is that if you have a RAID5 array set up, you lose one of your disk&#8217;s worth of space in the array, yet if any one of the disks in the array goes down, you do not lose any data.  Compared to something like RAID1 which simply mirrors all data so that what is stored on one disk is also stored on another, RAID5 has a much better space efficiency.</p>
<p>Now if you&#8217;re like me, you probably wondered, &#8220;How the hell is RAID5 possible? Where do they fit the data? If you back up data, shouldn&#8217;t it all be duplicated somewhere? How is it possible to have space efficiency less than 1/2 n?  Isn&#8217;t there some conservation of mass law that prevents such a preposterously awesome thing from happening?&#8221;   To understand the answer to the question, we have to look at the bitwise level of RAID5, or how the data is really stored in 1&#8217;s and 0&#8217;s. And this, my friend, is where the mysterious and beautiful Exclusive Or (XOR) operator comes in.<!--more--></p>
<p>Many of you are familiar with AND and OR operators, AND only evaluates to true when both inputs are true, while OR only evaluates to false when both inputs are false.  The mathematical miscreant we know as &#8220;XOR&#8221; only evaluates to true when both of its inputs are opposite.  So, to quickly summarize the XOR function, take a look at the following truth table:</p>
<div id="attachment_1495" class="wp-caption aligncenter" style="width: 173px"><a href="http://ozark.hendrix.edu/~burch/logisim/docs/2.1.0/guide/tutorial/"><img class="size-full wp-image-1495" title="xor-table" src="http://blogs.sourceallies.com/wp-content/uploads/2010/04/xor-table.png" alt="An Exclusive Or Truth Table" width="163" height="131" /></a><p class="wp-caption-text">An Exclusive Or Truth Table</p></div>
<p>Got it? Good.</p>
<p>XOR has a few other interesting properties as well, the most important of which is that it is reversible.  That is, if you XOR A and B to get result C, then you can get A back by doing B XOR C, or get B back by doing A XOR C.  This can be extended so that if you do (A XOR B) XOR C = D, then you can do the same thing to get back any of the data stored in A, B, or C, by applying the exclusive or operator to D and the other two inputs.  Don&#8217;t believe me? Let&#8217;s do an example:</p>
<p>Let&#8217;s say A = 0010, B = 0101, and C = 1100.  So D would be equal to the XOR of all three:</p>
<pre>  (A XOR B XOR C)
= (0010 XOR 0101) XOR C
= 0111 XOR C
= 0111 XOR 1100
= 1101
= D</pre>
<p>So now if for some reason we lost one of the inputs, (A, B, or C), we can use D and two of the other inputs to get that one back.   So let&#8217;s say we lose B, we can get the data it contained back by XOR-ing the other three parts together:</p>
<pre>  A XOR C XOR D
= 0010 XOR 1100 XOR D
= 1110 XOR 1011
= 0101
= B</pre>
<p>Did I just blow your mind?  Some people call it &#8220;math.&#8221;  Others call it &#8220;logic.&#8221;  I call it like I see it and that XOR is straight up witchcraft.</p>
<p>Well all fantasy aside, the above example has some very practical applications for data storage. RAID5 uses this unique property of XOR to sort of stack data on top of each other into a storage unit called the &#8220;parity block&#8221; or &#8220;parity drive&#8221; (datum D in the example above would be considered the parity datum.) But the concept of RAID5 is a little more complicated than just abstracting the A, B, C, and D example from above to apply to whole drives instead of just 4-bit numbers.  RAID5 uses something called &#8220;striping&#8221; to store data. Each drive in a RAID5 array is &#8220;striped&#8221; into parts so that when you store data, you store it across all the drives in the array.  The concept of &#8220;striping&#8221; is probably best described the aid of the following picture:</p>
<div id="attachment_1488" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-1488" title="500px-RAID_5.svg" src="http://blogs.sourceallies.com/wp-content/uploads/2010/04/500px-RAID_5.svg-300x222.png" alt="4 - Disk Array in RAID5 format" width="300" height="222" /><p class="wp-caption-text">4 - Disk Array in RAID5 format</p></div>
<p>Each of the four drives in the picture above is divided into four blocks, each belonging to a stripe on the same level across each drive.  Each drive and each stripe have a parity block which is the XOR of the other three blocks. In the picture this is denoted by the subscript &#8220;p.&#8221; The fault tolerance for this set up with striping works just like the example above but repeated for every stripe.  So say you lost drive 3, you would XOR A<sub>1</sub> with A<sub>2</sub> and A<em><sub>p</sub></em> to get the remaining A<sub>3</sub> for the A stripe, B<sub>1</sub> with B<sub>2 </sub>and B<sub>3<strong> </strong></sub>to get your parity block, and then the same with C and D to get those bits of data back.</p>
<p>And that, in short, is how RAID5 works.</p>
<p>Sources:</p>
<p>http://en.wikipedia.org/wiki/RAID</p>
<p>http://www.scottklarr.com/topic/23/how-raid-5-really-works/</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/05/how-raid-5-works-at-a-bitwise-level/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loadbalancing and its benefits</title>
		<link>http://blogs.sourceallies.com/2010/03/loadbalancing-and-its-benefits/</link>
		<comments>http://blogs.sourceallies.com/2010/03/loadbalancing-and-its-benefits/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 15:05:25 +0000</pubDate>
		<dc:creator>Ryan  Day</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Anycast]]></category>
		<category><![CDATA[Balancing]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Fail over]]></category>
		<category><![CDATA[Failover]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[IP Address]]></category>
		<category><![CDATA[Load]]></category>
		<category><![CDATA[Load Balancing]]></category>
		<category><![CDATA[Loadbalancing]]></category>
		<category><![CDATA[routing protocol]]></category>
		<category><![CDATA[Servers]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=1387</guid>
		<description><![CDATA[What is load balancing?
Load balancing is the practice of distributing a workload across multiple computers for improved performance. Load balancing distributes work among resources in such a way that no one resource should be overloaded and each resource can have improved performance, depending on the load balancing algorithm. Items such as network traffic, SSL requests, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>What is load balancing?</strong><br />
Load balancing is the practice of distributing a workload across multiple computers for improved performance. Load balancing distributes work among resources in such a way that no one resource should be overloaded and each resource can have improved performance, depending on the load balancing algorithm. Items such as network traffic, SSL requests, database queries, or even hardware resources such as memory can be load balanced. This practice is commonly used in server farms where multiple physical boxes are coordinated to fulfill the requests of many end users.</p>
<p><span id="more-1387"></span></p>
<p><strong>How to accomplish load balancing?</strong><br />
Load balancing can be accomplished through software but is usually achieved with the help of a dedicated hardware appliance due to the speed requirements. A load balancer can use many different algorithms. The most basic method is round-robin, which sends a request to each server in the cluster successively. More sophisticated techniques make decisions based on CPU usage, number of requests queued, average response time or even number of lost packets. One problem with load balancing is that a user&#8217;s session is likely not replicated across the the whole server cluster so typically a single user&#8217;s requests will be &#8220;sticky&#8221; and always be routed to the same backend server.</p>
<p>Another, more global, method of load balancing is Anycast. Anycast is an addressing strategy often used in DNS where hosts in multiple geographical locations represent the same IP address. This balances workload because any request is routed to the closest host (as determined by the routing protocol). In the event of one of the hosts going offline the request is then routed to the next closest available host.  Routing requests to the nearest host has the added benefits of increasing response time and reliability.</p>
<p><strong>Why load balance?</strong><br />
Simply put, work gets done more efficiently when resources are not used to their capacity and as a result user response times are generally better. The best reason, however, is often times failover. Failover refers to the ability of a system to remain operational while one or more components have failed or gone down. Say your clumsy friend trips over a power cord, eliminating one of three nodes in a cluster hosting a website. People opening a new connection to your website will not notice because the load balancer will realize that the one node is not responding and will route all requests to the other two nodes until the first one is responsive again. The only users who might notice would have been sticky to that one node. Failover is also useful for maintenance. If something has to be upgraded across all nodes, then one node can be taken down at a time to be upgraded without any downtime for whatever service the cluster may be hosting.</p>
<p>Load balancing and failover are powerful concepts which allow network administrators to have some peace of mind and users to keep on working.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/03/loadbalancing-and-its-benefits/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Easiest Way to Organize Zimbra Email</title>
		<link>http://blogs.sourceallies.com/2010/02/the-easiest-way-to-organize-zimbra-email/</link>
		<comments>http://blogs.sourceallies.com/2010/02/the-easiest-way-to-organize-zimbra-email/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 18:06:57 +0000</pubDate>
		<dc:creator>Matt Vincent</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[email productivity]]></category>
		<category><![CDATA[personal productivity]]></category>
		<category><![CDATA[Zimbra]]></category>
		<category><![CDATA[zimbra filters]]></category>
		<category><![CDATA[zimbra saved searches]]></category>
		<category><![CDATA[zimbra tags]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=1131</guid>
		<description><![CDATA[If you&#8217;re like me, receiving 30-40 emails is par for the day.  Because Source Allies provides consulting services for companies wishing to implement or better take advantage of Zimbra, it is also the mail server we use at our company.  Zimbra has incredible search capabilities, but my OCD tendencies still require that my [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me, receiving 30-40 emails is par for the day.  Because Source Allies provides consulting services for companies wishing to implement or better take advantage of <a href="http://www.zimbra.com/">Zimbra</a>, it is also the mail server we use at our company.  Zimbra has <a href="http://wiki.zimbra.com/index.php?title=Search_Tips">incredible search capabilities</a>, but my <a href="http://en.wikipedia.org/wiki/Obsessive%E2%80%93compulsive_disorder">OCD</a> tendencies still require that my email is nicely filed away in it&#8217;s designated folder.  However, if statisticians say we spend an average of 3 years of our lives waiting at red stop lights, I certainly don&#8217;t want to spent that much time or more, dragging emails from my inbox into my IMAP folders.</p>
<p>This blog post lets you manage all of your email in OCD detail, with just (2) keyboard shortcuts:  <strong>u</strong> and <strong>s</strong>.<span id="more-1131"></span>  Explaining how, requires a quick overview of Zimbra&#8217;s features:</p>
<p><strong>Overview</strong></p>
<p><strong>Zimbra Filters</strong>:  The great part of Zimbra Filters is that they may be run <strong>on the server</strong>.  (After spending a couple of years using Apple Mail and <a href="http://indev.ca/MailTags.html">MailTags</a>, this feature means that my iPhone, <a href="http://www.zimbra.com/products/desktop.html">Zimbra Desktop</a>, and Zimbra Web Client are all finally synchronized).</p>
<p>My favorite <a href="http://www.zimbra.com/products/whats_new.html">new feature of Zimbra version 6.0</a> is the ability to run filters on email that is already in your inbox.</p>
<p><img src="http://blogs.sourceallies.com/wp-content/uploads/2010/02/zimbra-filters-now-300x91.png" alt="Run filters on existing email with Zimbra 6.0" title="zimbra-filters-now" width="300" height="91" class="size-medium wp-image-1136" /></p>
<p><strong>Zimbra Tags</strong>:  We&#8217;re going for simplicity, so I recommend only using a single tag called:  Unread (but Filed).</p>
<p><img src="http://blogs.sourceallies.com/wp-content/uploads/2010/02/zimbra-tag.png" alt="Using a Zimbra Tag:  Unread (but filed)" title="zimbra-tag" width="146" height="22" class="size-full wp-image-1139" /></p>
<p><strong>Zimbra Saved Searches:</strong>:  You can make a complex query and return to it&#8217;s search results at any time.  Saved searches tie into this blog post as they allow us to view all of our email tagged with &#8220;Unread (but Filed)&#8221;.<br />
<img src="http://blogs.sourceallies.com/wp-content/uploads/2010/02/Picture-2-291x300.png" alt="Zimbra Saved Searches" title="Zimbra Saved Searches" width="291" height="300" class="alignnone size-medium wp-image-1145" /></p>
<p>With that overview of a few Zimbra features, here are the 5 simple <strong>Setup Steps</strong> to managing your email with just two keyboard shortcuts:</p>
<p><strong>1.  Create a Zimbra Tag called &#8220;Unread (but Filed)&#8221;</strong></p>
<ul>
<li>Press &#8216;t&#8217;</li>
<li>Press the &#8216;New&#8217; button</li>
<li>Type &#8216;Unread (but Filed)&#8217;</li>
<li>Pick a color and press &#8216;OK&#8217;</li>
</ul>
<p><strong>2.  Create a Zimbra Saved Search</strong></p>
<ul>
<li>Type into the search box &#8216;in:inbox OR tag:&#8221;Unread (but filed)&#8221;&#8216;</li>
<li>Press &#8216;Save&#8217;</li>
<li>Type &#8216;Inbox OR Unread (but filed)&#8217;</li>
<li>Press &#8216;OK&#8217;</li>
</ul>
<p><img src="http://blogs.sourceallies.com/wp-content/uploads/2010/02/Picture-6-300x39.png" alt="Search box" title="Search box" width="300" height="39" class="alignnone size-medium wp-image-1150" /><br />
<strong>3.  Start creating Zimbra Filters for emails as you receive them</strong></p>
<ul>
<li>Right click on the email you want to filter</li>
<li>Click &#8216;New Filter&#8217;</li>
<li>On Perform the following actions, use these actions:</li>
<ul>
<li>Tag with: &#8216;Unread (but Filed)&#8217;</li>
<li>File into Folder: <em>YourFolderName</em></li>
</ul>
</ul>
<p><img src="http://blogs.sourceallies.com/wp-content/uploads/2010/02/Picture-21-260x300.png" alt="Create a filter that both tags and files the email" title="email filter" width="260" height="300" class="size-medium wp-image-1149" /></p>
<p><strong>4.  Set your Default Mail Search</strong></p>
<ul>
<li>4.  Goto Preferences &#8211;> Mail</li>
<li>Set your <strong>Default Mail Search</strong> to &#8216;in:inbox OR tag:&#8221;Unread (but filed)&#8221;&#8216;</li>
<li>This will make your normal &#8220;Inbox&#8221; view goto this search even on the Mobile Interface!</li>
</ul>
<p><img src="http://blogs.sourceallies.com/wp-content/uploads/2010/02/Picture-3-300x60.png" alt="Default Mail Search" title="Default Mail Search" width="300" height="60" class="alignnone size-medium wp-image-1154" /></p>
<p><strong>5.  You&#8217;re done!  Now just use your keyboard shortcuts!</strong></p>
<ul>
<li>Gradually create filters for your email as it arrives (run the filters against your inbox for immediate feedback)</li>
<li><em>When new email arrives, it will be automatically filed away, but will still appear in your &#8220;inbox&#8221; until you remove your custom tag.</em></li>
<li><strong>Simply press &#8217;s&#8217;</strong> to select a saved search &#8216;Unread (but Filed)&#8217;</li>
<ul>
<li>Tip:  If you&#8217;re using the web interface, simply press &#8216;=&#8217; as this will refresh your Default Mail Search</li>
</ul>
<li><strong>Simply press &#8216;u&#8217;</strong> to remove the tag, when you want to remove the email from your inbox (because it&#8217;s already been filed away for you!)</li>
</ul>
<p><img src="http://blogs.sourceallies.com/wp-content/uploads/2010/02/Picture-4-300x17.png" alt="Tagged email" title="Tagged email" width="300" height="17" class="alignnone size-medium wp-image-1162" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/02/the-easiest-way-to-organize-zimbra-email/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Live Network Boot using PXE</title>
		<link>http://blogs.sourceallies.com/2010/02/ubuntu-live-network-boot-using-pxe/</link>
		<comments>http://blogs.sourceallies.com/2010/02/ubuntu-live-network-boot-using-pxe/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 16:00:06 +0000</pubDate>
		<dc:creator>Erik  Hill</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=945</guid>
		<description><![CDATA[Requirements

Linux server with NFS (or compatible)
TFTP server
DHCP server
syslinux / pxelinux files

To simplify these instructions we are going to make the following assumptions.

DHCP server is 10.0.0.2
TFTP server is 10.0.0.3
NFS is a Ubuntu server at 10.0.0.4

In reality it&#8217;s likely your TFTP and NFS server are going to be the same server, however because we go by IP [...]]]></description>
			<content:encoded><![CDATA[<h2>Requirements</h2>
<ul>
<li>Linux server with NFS (or compatible)</li>
<li>TFTP server</li>
<li>DHCP server</li>
<li>syslinux / pxelinux files</li>
</ul>
<p>To simplify these instructions we are going to make the following assumptions.</p>
<ul>
<li>DHCP server is 10.0.0.2</li>
<li>TFTP server is 10.0.0.3</li>
<li>NFS is a Ubuntu server at 10.0.0.4</li>
</ul>
<p>In reality it&#8217;s likely your TFTP and NFS server are going to be the same server, however because we go by IP in this, it is hopefully easier to understand.<br />
<span id="more-945"></span></p>
<h2>Basic working of PXE</h2>
<p>When a client attempts to boot by PXE, it makes a DHCP request. The DHCP server responds with an IP address and the IP of the TFTP server as well as a file to request.</p>
<p>The PXE client connects to the given IP and requests the file (pxelinux)</p>
<p>The system then looks for a configuration file.</p>
<h2>Setting up NFS</h2>
<p>Installing NFS</p>
<pre> sudo apt-get install nfs-kernel-server nfs-common portmap</pre>
<h3>Setting up NFS for Ubuntu Live Network Boot</h3>
<p>In this we will assume that we are going to mount the NFS at /srv/nfs/ubuntu.<br />
Download Ubuntu ISO<br />
Mount the ISO:</p>
<pre> sudo mount -o loop ubuntu-x,xx-desktop.iso /mnt</pre>
<p>Copy the contents of the CD:</p>
<pre> sudo cp -a /mnt /srv/nfs/ubuntu</pre>
<p>Edit /etc/exports:</p>
<pre> /srv/nfs/ubuntu 10.0.0.0/255.255.255.0(async,no_root_squash,no_subtree_check,ro)</pre>
<p>Restart NFS</p>
<pre> sudo /etc/init.d/nfs-kernel-server restart</pre>
<h2>Setting up TFTP</h2>
<p>There are windows TFTP servers, but for this we are going to use the Ubuntu box.</p>
<p>To Install:</p>
<pre> sudo apt-get install xinetd tftpd tftp</pre>
<p>Configuration:<br />
Edit/Create /etc/xinetd.d/tftp to:</p>
<pre>service tftp{
 protocol = udp
 port = 69
 socket_type = dgram
 wait = yes
 user = nobody
 server = /usr/sbin/in.tftpd
 server_args = /tftpboot
 disable = no
}</pre>
<p>Start TFTP</p>
<pre> sudo /etc/init.d/xinetd start</pre>
<h3>Setting up TFTP for PXE</h3>
<p>Download PXELinux (preferably) or SysLinux.<br />
Extract the contents into the /tftpboot boot directory<br />
Copy Ubuntu&#8217;s Kernel &amp; initrd.gz</p>
<pre>mkdir /tftpboot/casper
sudo mount 10.0.0.4:/srv/nfs/ubuntu /mnt
sudo cp /mnt/casper/initrd.gz /tftpboot/casper
sudo cp /mnt/casper/vmlinuz /tftpboot/casper</pre>
<p>Create the config directory:</p>
<pre>mkdir /tftpboot/pxelinux.cfg</pre>
<p>Create the default config for PXE</p>
<pre>vi /tftpboot/pxelinux.cfg/default</pre>
<p>with the contents:</p>
<pre>default menu.c32
prompt 0
LABEL ^Boot Live Ubuntu
kernel casper/vmlinuz
append root=/dev/nfs boot=casper netboot=nfs nfsroot=10.0.0.4:/srv/nfs/ubuntu initrd=casper/initrd.gz quiet splash --</pre>
<h2>Setting up DHCP</h2>
<h3>Windows Server</h3>
<p>Open the DHCP Manager, edit expand your scope<br />
Select Scope Options<br />
Add the following options:</p>
<pre>067   Boot File Name                            pxelinux.0
066    Boot Server Hostname             10.0.0.3</pre>
<h3>Linux</h3>
<p>Edit dhcpd.conf to include:</p>
<pre>allow booting;
allow bootp;</pre>
<p>Add the dhcp.conf group:</p>
<pre>next-server 10.0.0.3;
filename "pxelinux.0";</pre>
<p>Boot Ubuntu</p>
<p>With a bit of luck you can now boot any PXE compatable PC on the network into a network booted Ubuntu Live CD.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/02/ubuntu-live-network-boot-using-pxe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating Services using SMF in OpenSolaris</title>
		<link>http://blogs.sourceallies.com/2010/01/creating-services-using-smf-in-opensolaris/</link>
		<comments>http://blogs.sourceallies.com/2010/01/creating-services-using-smf-in-opensolaris/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 14:00:30 +0000</pubDate>
		<dc:creator>Paris Holley</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[OpenSolaris]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=997</guid>
		<description><![CDATA[OpenSolaris has by far, one of the best service management interfaces that I have used. Below I am going to go over a simple way to turn in shell script into a service managed by the OS.

Step 1: Create the Service Manifest

&#60;?xml version='1.0'?&#62;;
&#60;!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'&#62;
&#60;service_bundle type='manifest' name='mynewservices'&#62;
        [...]]]></description>
			<content:encoded><![CDATA[<p>OpenSolaris has by far, one of the best service management interfaces that I have used. Below I am going to go over a simple way to turn in shell script into a service managed by the OS.<br />
<span id="more-997"></span></p>
<h1>Step 1: Create the Service Manifest</h1>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1.0'</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>;
<span style="color: #00bbdd;">&lt;!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service_bundle</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'manifest'</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'mynewservices'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'application/service1'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'service'</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;method_context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;method_credential</span> <span style="color: #000066;">user</span>=<span style="color: #ff0000;">'root'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;method_environment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>;
                                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;envvar</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;MY_VAR&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;--flag1 --flag2&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/method_environment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/method_context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec_method</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'start'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'method'</span> <span style="color: #000066;">exec</span>=<span style="color: #ff0000;">'/opt/myscript.sh start'</span> <span style="color: #000066;">timeout_seconds</span>=<span style="color: #ff0000;">'0'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec_method</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">'stop'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'method'</span> <span style="color: #000066;">exec</span>=<span style="color: #ff0000;">'/opt/myscript.sh stop'</span> <span style="color: #000066;">timeout_seconds</span>=<span style="color: #ff0000;">'120'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service_bundle<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2>Service Bundle</h2>
<p>A service bundle is just a collection of services which can be very useful if you have a suite of applications that you wish to manage within on manifest.xml file.</p>
<h2>Service</h2>
<p>The attributes you define on your service can be anything and are only useful for when you invoke administrative commands on them ( start, stop, etc ).</p>
<h2>Method Context</h2>
<p>The method context allows you to define the environment in which the executed methods will be called within. The example above shows the ability to define what user will be used to execute the method and the environment variables available to the script. This can be very handy when you want to leave an installation directory&#8217;s bin alone, and configure everything through the service. Keep in mind that what you see is a global method context and will apply to all executed methods. You may also customize the context per method by moving the tags out of <strong>service</strong> and into the <strong>exec_method</strong> tags.</p>
<h2>Executable Method</h2>
<p>Its purpose is self explanatory. Note that in one entry, the timeout is 0 and the other is 120 seconds. A timeout with a value of 0 will wait indefinitely for the script to start-up, however the service manager will always assume that it is online when in fact it could be hanging.</p>
<p>Also, there are three common commands used when invoking the service manager; enable, disable, and restart.</p>
<ul>
<li>When enabled, the start method will be executed.</li>
<li>When disabled, the stop method will be executed.</li>
<li>When restarted/refreshed, both the stop and the start method will be executed unless there is a method named restart/refresh.</li>
</ul>
<h1>Step 2: Import the Manifest</h1>
<p>Once you have your manifest xml file completed and ready to import, all you need to do is run the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svccfg validate manifest.xml</pre></div></div>

<p>That will run the configuration through validation and make sure you didn&#8217;t make any typo&#8217;s.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svcfg import manifest.xml</pre></div></div>

<h1>Step 3: Enable the Service</h1>
<p>Now that your manifest has been imported, it is available to be enabled within the service admin.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svcadm enable service1</pre></div></div>

<h1>Step 4: Testing the Service</h1>
<p>After the service has started the run, you need to make sure it is executing properly and can handle a machine restart and/or service restart.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svcs -x</pre></div></div>

<p>That command will tell you which services are currently broken and the log files to view the errors. Make sure that your service is not in that list. You may also do the following:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svcs service1
svcs -x service1</pre></div></div>

<p>to determine the state of that particular service. If it isn&#8217;t working, I suggest taking a look at the log files and fix it <img src='http://blogs.sourceallies.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h1>Step 5: Updating the Service</h1>
<p>Say that while testing, you noticed that you passed the wrong parameter to your shell script or maybe in the future you need to add additional environment variables to your service, its the same process. Even if you no longer have the manifest xml file, SMF will give you a copy when you ask for it so that you can modify it and re-import.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">svccfg export myservices &gt; manifest.xml</pre></div></div>

<p>After you have made your changes, validate and import the xml file and restart your service.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/01/creating-services-using-smf-in-opensolaris/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building Perl modules on OpenSolaris</title>
		<link>http://blogs.sourceallies.com/2010/01/building-perl-modules-on-opensolaris/</link>
		<comments>http://blogs.sourceallies.com/2010/01/building-perl-modules-on-opensolaris/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 14:00:02 +0000</pubDate>
		<dc:creator>Scott Peshak</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[OpenSolaris]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=846</guid>
		<description><![CDATA[Anyone that&#8217;s worked with Perl is probably familiar with CPAN.pm.  CPAN.pm is the bundled module that handles downloading and installing modules from the CPAN repository.  It usually works flawlessly but I&#8217;ve noticed that on OpenSolaris the process can be a bit more spotty.

Let&#8217;s try installing Mason as an example:

perl -MCPAN -e &#34;install HTML::Mason&#34;

Generally [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone that&#8217;s worked with Perl is probably familiar with CPAN.pm.  CPAN.pm is the bundled module that handles downloading and installing modules from the CPAN repository.  It usually works flawlessly but I&#8217;ve noticed that on OpenSolaris the process can be a bit more spotty.<br />
<span id="more-846"></span><br />
Let&#8217;s try installing <a href="http://www.masonhq.com">Mason</a> as an example:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">perl -MCPAN -e &quot;install HTML::Mason&quot;</pre></div></div>

<p>Generally the first thing I notice is that all (or a large number) of the tests are failing.  For example here is the output of one of the tests:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">t/20-plugins.......................Can't locate HTML/Entities.pm in @INC (@INC
 contains: /root/.cpan/build/HTML-Mason-1.42/blib/lib /root/.cpan/build/H
TML-Mason-1.42/blib/arch t/lib inc /usr/perl5/5.8.4/lib/i86pc-solaris-64int
 /usr/perl5/5.8.4/lib/i86pc-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_
perl/5.8.4/i86pc-solaris-64int /usr/perl5/site_perl/5.8.4/i86pc-solaris-64int
 /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl/5.8.4/i86pc-solaris-64int /u
sr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/i8
6pc-solaris-64int /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int /usr/per
l5/vendor_perl/5.8.4 /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int /usr
/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl . /usr/perl5/5.8.4/lib/i86pc
-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/i86pc-solaris-6
4int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.
8.4/i86pc-solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl 
.) at /root/.cpan/build/HTML-Mason-1.42/blib/lib/HTML/Mason/Escapes.pm
 line 14.</pre></div></div>

<p>Hmm, because we&#8217;re not installing HTML::Entities this means that it should have been brought in when CPAN.pm was building the dependencies.  I trust CPAN.pm got this right, if for no other reason than that I remember it prompting to install that module.  After digging around in the sea of output eventually I find that installing Digest::SHA1 failed because of this error:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">cc -c   -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -xO3 -xspace -xildoff   -DVERSION=\&quot;2.12\&quot; -DXS_VERSION=\&quot;2.12\&quot; -KPIC &quot;-I/usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE&quot;   SHA1.c
cc: unrecognized option `-KPIC'
cc: language ildoff not recognized
cc: SHA1.c: linker input file unused because linking not done</pre></div></div>

<p>Our C compiler isn&#8217;t happy with how it&#8217;s being called.  Now we need to find out which compiler we&#8217;re using:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;"> bash-3.2$ which cc
/usr/gnu/bin/cc</pre></div></div>

<p>While the GCC compiler is a fine fine compiler, the way CPAN.pm tries to build things on OpenSolaris involves params that only SunStudio understands.  At this point there are two options. We can either patch the generated Makefile so that it doesn&#8217;t include stuff GCC can&#8217;t understand or we can switch the compiler to SunStudio.  I prefer the latter because it is easiest:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">pkg install sunstudio  # Install it if not already done
export PATH=&quot;/opt/SUNWspro/bin:$PATH&quot; # Put it first on the path</pre></div></div>

<p>Now that we&#8217;re using the correct compiler the build goes slightly less awful.  We get a new error.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">/usr/bin/perl &quot;-Iblib/arch&quot; &quot;-Iblib/lib&quot; Build.PL Build
Too early to specify a build action 'Build'.  Do 'Build Build' instead.</pre></div></div>

<p>This is caused by the ExtUtils::MakeMaker module not being installed.  I don&#8217;t know how my system got into such a state, but it is easy enough to fix:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">perl -MCPAN -e &quot;install 'ExtUtils::MakeMaker' &quot;</pre></div></div>

<p>Let&#8217;s try one more time:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">perl -MCPAN -e &quot;install HTML::Mason&quot;
...Huge Snip...
 /usr/gnu/bin/make install  -- OK</pre></div></div>

<p>Success!</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/01/building-perl-modules-on-opensolaris/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Who Bound Port 8080</title>
		<link>http://blogs.sourceallies.com/2010/01/who-bound-port-8080/</link>
		<comments>http://blogs.sourceallies.com/2010/01/who-bound-port-8080/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 14:00:21 +0000</pubDate>
		<dc:creator>Jordan  Nelson</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Infrastructure]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=614</guid>
		<description><![CDATA[&#8220;Port 8080 required by Tomcat v6.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).&#8221;
I have been seeing this error from Tomcat [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>&#8220;Port 8080 required by Tomcat v6.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).&#8221;</p></blockquote>
<p>I have been seeing this error from Tomcat every time I reboot my Windows development box.<br />
<span id="more-614"></span><br />
It is easy enough to track down the process holding onto the port:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">netstat -a -o</pre></div></div>

<p><img class="alignnone size-full wp-image-780" src="http://blogs.sourceallies.com/wp-content/uploads/2009/12/netstat_screen1.jpg" alt="netstat_screen" width="708" height="24" /></p>
<p>Now I know that the process PLEX760&#8230; is listening to port 8080. It is trivial to kill the process using Task Manager now that I know the process ID (3832), but I really want to know what this thing is, and why it is getting started. This brings me to my favorite Windows utility program, <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">Process Explorer</a>.</p>
<p>Using Process Explorer I can see where the actual exe lives on the local disk:</p>
<p><img class="alignnone size-full wp-image-781" src="http://blogs.sourceallies.com/wp-content/uploads/2009/12/process_exp_01.jpg" alt="process_exp_01" width="441" height="517" /></p>
<p>Under the services tab I can see that this is associated with a Windows service:</p>
<p><img class="alignnone size-full wp-image-782" src="http://blogs.sourceallies.com/wp-content/uploads/2009/12/process_exp_02.jpg" alt="process_exp_02" width="437" height="511" /></p>
<p>Going to:</p>
<p>Control Panel -&gt; Administrative Tools -&gt; Services</p>
<p>Lets me stop the service, and set it to manual start-up.</p>
<p>This little example does not even begin to scratch the surface in what information Process Explorer can provide about currently running applications. I highly encourage you to try it out next time you are trying to nail down what is going on with  a windows application.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2010/01/who-bound-port-8080/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unplugging an LVM partitioned USB drive</title>
		<link>http://blogs.sourceallies.com/2009/12/unplugging-an-lvm-partitioned-usb-drive/</link>
		<comments>http://blogs.sourceallies.com/2009/12/unplugging-an-lvm-partitioned-usb-drive/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 14:00:57 +0000</pubDate>
		<dc:creator>Sudhakar Ramasamy</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[usb drive]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=829</guid>
		<description><![CDATA[Recently I had the heartbreaking experience of having to reboot a Linux server. Normal usage should almost never require you to reboot the OS like you have to so frequently in Windows. In this case I had an external USB drive partitioned with LVM humming along on a Linux server. I needed to pull the [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had the heartbreaking experience of having to reboot a Linux server. Normal usage should almost never require you to reboot the OS like you have to so frequently in Windows. In this case I had an external USB drive partitioned with <a href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)">LVM</a> humming along on a Linux server. I needed to pull the drive, so like I&#8217;ve done with other drives I unmounted all partitions on the drive. Then proceeded to unplug it from the USB port. All well and good. But when I plugged it back in, the <a href="http://linux.die.net/man/8/lvs">lvs</a> command was showing error messages on the partitions and I was unable to mount them.</p>
<p>Some Google searches later I found that when it comes to LVM partitions the OS keeps references to it unless you explicitly tell it to unhook them. Only then can you tell the OS to hook the LVM partitions back up when you&#8217;ve plugged the drive back in. In my case I had to resort to rebooting the server in order for the OS to hook all the pieces together for the LVM partitions. Short of this I would have to manually delete certain files and move things around to get the LVM partitions to work again. So here are the magic incantations that will save you the headache.</p>
<p>Before you unplug an LVM partitioned USB drive, you must run the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
lvchange <span style="color: #660033;">-an</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>your_volume_group_name
vgexport <span style="color: #660033;">-a</span></pre></div></div>

<p>Use the man command to explore what these commands do.</p>
<p>Now you should be able to unplug the drive. When you are ready to plug it back in, stick it back in the USB port and run the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
vgimport <span style="color: #660033;">-a</span>
lvchange <span style="color: #660033;">-ay</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>your_volume_group_name</pre></div></div>

<p>You should now be able to run lvs and see you LVM partitions on the USB drive without any errors and proceed to mount the partitions.</p>
<p>Hope you found this useful. Are there other or different ways of doing this? Please add your comments below and Happy Holidays! </p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2009/12/unplugging-an-lvm-partitioned-usb-drive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apache/Tomcat with Failover and Load Balancing in 20 minutes or less&#8230;</title>
		<link>http://blogs.sourceallies.com/2009/12/apachetomcat-with-failover-and-load-balancing-in-20-minutes-or-less/</link>
		<comments>http://blogs.sourceallies.com/2009/12/apachetomcat-with-failover-and-load-balancing-in-20-minutes-or-less/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 14:00:04 +0000</pubDate>
		<dc:creator>Jim Chrystal</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=662</guid>
		<description><![CDATA[In order to get this done, you&#8217;ll need Apache, Tomcat, and the MOD_JK connector library.  I&#8217;ve included the Windows binaries below, as I&#8217;m writing this blog post from a Windows machine.  Feel free to swap out these downloads with whatever RPM, YAST, APT, etc. commands you want.  Also, you&#8217;ll need to have [...]]]></description>
			<content:encoded><![CDATA[<p>In order to get this done, you&#8217;ll need Apache, Tomcat, and the MOD_JK connector library.  I&#8217;ve included the Windows binaries below, as I&#8217;m writing this blog post from a Windows machine.  Feel free to swap out these downloads with whatever RPM, YAST, APT, etc. commands you want.  Also, you&#8217;ll need to have a Java JDK installed, and your JAVA_HOME pointing to it.  Make sure your path contains %JAVA_HOME%/bin.</p>
<p>Download and Apache from here:<br />
<a href="http://apache.mirrors.tds.net/httpd/binaries/win32/apache_2.2.14-win32-x86-no_ssl.msi">http://apache.mirrors.tds.net/httpd/binaries/win32/apache_2.2.14-win32-x86-no_ssl.msi</a></p>
<p>Download and extract Tomcat from here:<br />
<a href="http://mirrors.axint.net/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.zip">http://mirrors.axint.net/apache/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.zip</a></p>
<p>Download MOD_JK from here:<br />
<a href="http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/mod_jk-1.2.28-httpd-2.2.3.so">http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/mod_jk-1.2.28-httpd-2.2.3.so</a></p>
<ol>
<li>Install Apache.</li>
<li>Copy the mod_jk-1.2.28-httpd-2.2.3.so file to your apache/modules directory.</li>
<li>
Add the following to your apache/conf/httpd.conf</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">LoadModule</span> jk_module modules/mod_jk-1.2.28-httpd-2.2.3.so
&nbsp;
JkWorkersFile          conf/workers.properties
JkLogFile              logs/jk.log
JkLogLevel             debug
&nbsp;
JkMount                /*            router
JkMount                /jk_status    status</pre></div></div>

</li>
<li>
Create a workers.properties file in your apache/conf directory.  The file should contain the following:</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">worker.list=router,status
&nbsp;
worker.worker1.<span style="color: #00007f;">port</span>=<span style="color: #ff0000;">8109</span>
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=<span style="color: #ff0000;">1</span>
worker.worker1.local_worker=<span style="color: #ff0000;">1</span>
worker.worker1.sticky_session=<span style="color: #ff0000;">0</span>
&nbsp;
worker.worker2.<span style="color: #00007f;">port</span>=<span style="color: #ff0000;">8209</span>
worker.worker2.host=localhost
worker.worker2.type=ajp13
worker.worker2.lbfactor=<span style="color: #ff0000;">1</span>
worker.worker2.local_worker=<span style="color: #ff0000;">0</span>
worker.worker2.sticky_session=<span style="color: #ff0000;">0</span>
&nbsp;
worker.worker3.<span style="color: #00007f;">port</span>=<span style="color: #ff0000;">8309</span>
worker.worker3.host=localhost
worker.worker3.type=ajp13
worker.worker3.lbfactor=<span style="color: #ff0000;">1</span>
worker.worker3.local_worker=<span style="color: #ff0000;">0</span>
worker.worker3.sticky_session=<span style="color: #ff0000;">0</span>
&nbsp;
worker.router.type=lb
worker.router.balanced_workers=worker1,worker2,worker3
worker.router.local_worker_only=<span style="color: #ff0000;">1</span>
&nbsp;
worker.status.type=status</pre></div></div>

</li>
<li>
Extract the Tomcat installation ZIP archive to three different directories, as we&#8217;re going to load balance three instances of Tomcat.  You&#8217;ll be replacing the server.xml file in each of the Tomcat conf/ directories with the following:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Server</span> <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;8100&quot;</span> <span style="color: #000066;">shutdown</span>=<span style="color: #ff0000;">&quot;SHUTDOWN&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;GlobalNamingResources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Resource</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;UserDatabase&quot;</span> <span style="color: #000066;">auth</span>=<span style="color: #ff0000;">&quot;Container&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.UserDatabase&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;User database that can be updated and saved&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">factory</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.users.MemoryUserDatabaseFactory&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">pathname</span>=<span style="color: #ff0000;">&quot;conf/tomcat-users.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/GlobalNamingResources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Service</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Catalina&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Connector</span> <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;8180&quot;</span> <span style="color: #000066;">protocol</span>=<span style="color: #ff0000;">&quot;HTTP/1.1&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">connectionTimeout</span>=<span style="color: #ff0000;">&quot;20000&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">redirectPort</span>=<span style="color: #ff0000;">&quot;8443&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
   <span style="color: #808080; font-style: italic;">&lt;!-- Define an AJP 1.3 Connector --&gt;</span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Connector</span> <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;8109&quot;</span> <span style="color: #000066;">protocol</span>=<span style="color: #ff0000;">&quot;AJP/1.3&quot;</span> <span style="color: #000066;">redirectPort</span>=<span style="color: #ff0000;">&quot;8443&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Engine</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Catalina&quot;</span> <span style="color: #000066;">defaultHost</span>=<span style="color: #ff0000;">&quot;localhost&quot;</span> <span style="color: #000066;">jvmRoute</span>=<span style="color: #ff0000;">&quot;jvm1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Realm</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.realm.UserDatabaseRealm&quot;</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">resourceName</span>=<span style="color: #ff0000;">&quot;UserDatabase&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Host</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;localhost&quot;</span>  <span style="color: #000066;">appBase</span>=<span style="color: #ff0000;">&quot;webapps&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">unpackWARs</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">autoDeploy</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">xmlValidation</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">xmlNamespaceAware</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Cluster</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.tcp.SimpleTcpCluster&quot;</span></span>
<span style="color: #009900;">            <span style="color: #000066;">channelSendOptions</span>=<span style="color: #ff0000;">&quot;8&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Manager</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.session.DeltaManager&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">expireSessionsOnShutdown</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">notifyListenersOnReplication</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Channel</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.group.GroupChannel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Membership</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.membership.McastService&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;228.0.0.4&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;45564&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">frequency</span>=<span style="color: #ff0000;">&quot;500&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">dropTime</span>=<span style="color: #ff0000;">&quot;3000&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Receiver</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.transport.nio.NioReceiver&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">address</span>=<span style="color: #ff0000;">&quot;auto&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">port</span>=<span style="color: #ff0000;">&quot;4000&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">autoBind</span>=<span style="color: #ff0000;">&quot;100&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">selectorTimeout</span>=<span style="color: #ff0000;">&quot;5000&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">maxThreads</span>=<span style="color: #ff0000;">&quot;6&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Sender</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.transport.ReplicationTransmitter&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Transport</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.transport.nio.PooledParallelSender&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Sender<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Interceptor</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.group.interceptors.TcpFailureDetector&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Interceptor</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Channel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Valve</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.tcp.ReplicationValve&quot;</span> <span style="color: #000066;">filter</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Valve</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.session.JvmRouteBinderValve&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Deployer</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.deploy.FarmWarDeployer&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">tempDir</span>=<span style="color: #ff0000;">&quot;/tmp/war-temp/&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">deployDir</span>=<span style="color: #ff0000;">&quot;/tmp/war-deploy/&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">watchDir</span>=<span style="color: #ff0000;">&quot;/tmp/war-listen/&quot;</span></span>
<span style="color: #009900;">               <span style="color: #000066;">watchEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ClusterListener</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ClusterListener</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.ha.session.ClusterSessionListener&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Cluster<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Host<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Engine<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Server<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Looking into the XML above, there are three ports we&#8217;re concerned with: 8100, 8180, and 8109.  These are the server, HTTP, and AJP13 ports, respectively.  We&#8217;ll need each instance of Tomcat to run on it&#8217;s own ports.  So, you can use this file as is in your first folder containing Tomcat, however, you&#8217;ll need to change the port numbers to: 8200, 8280, and 8209 for you 2nd installation.  The third installation will use the ports, 8300, 8380, and 8309.
</li>
<li>Start (or Restart) Apache</li>
<li>Start each instance of Tomcat (use the startup script in the Tomcat /bin directory) &#8211;  you should see no errors.</li>
<li>
Verify each Tomcat is working by opening a browser window to each Tomcat instance &#8211; if you&#8217;ve followed my instructions, the links are:  <a href="http://localhost:8180/examples/servlets/">http://localhost:8180/examples/servlets/</a>, <a href="http://localhost:8280/examples/servlets/">http://localhost:8280/examples/servlets/</a>, and <a href="http://localhost:8380/examples/servlets/">http://localhost:8380/examples/servlets/</a>.
</li>
<li>
If Tomcat started correctly, start Apache.  You should be able to access the Tomcat example pages via the following URL: <a href="http://localhost/examples/servlets/">http://localhost/examples/servlets/</a>
</li>
<li>
You&#8217;re done.  Using my configuration, you can access a page to control the JK connector here:  <a href="http://localhost/jk_status">http://localhost/jk_status</a>, I&#8217;d recommending hiding and protecting this should you want to put this configuration into production.  Try experimenting with the configuration by stopping instance of Tomcat&#8230; as long as one instance of Tomcat is running, you should be able to see the examples.
</li>
</ol>
<p>-Jim</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2009/12/apachetomcat-with-failover-and-load-balancing-in-20-minutes-or-less/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>GlusterFS Replication for Clustering</title>
		<link>http://blogs.sourceallies.com/2009/12/glusterfs-replication-for-clustering/</link>
		<comments>http://blogs.sourceallies.com/2009/12/glusterfs-replication-for-clustering/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 14:00:08 +0000</pubDate>
		<dc:creator>Shawn Siefkas</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=624</guid>
		<description><![CDATA[I recently was searching for a way to simulate shared physical storage in a VPS environment for clustering purposes.  In an enterprise data center we can expect some type of SAN available to provide shared physical storage.  GFS is a simple solution in this case to create a shared file system that can be used [...]]]></description>
			<content:encoded><![CDATA[<p>I recently was searching for a way to simulate shared physical storage in a <a title="Virtual Private Server" href="http://en.wikipedia.org/wiki/Virtual_private_server">VPS</a> environment for clustering purposes.  In an enterprise data center we can expect some type of SAN available to provide shared physical storage.  GFS is a simple solution in this case to create a shared file system that can be used as a resource in a cluster.  GlusterFS allows us to provide this type of functionality to multiple nodes when we have no means of providing access to the same physical storage.</p>
<p>The gluster community site will be a great resource for anyone wanting to implement the file system and is located at <a title="Gluster Community" href="http://www.gluster.org">http://www.gluster.org</a>.</p>
<p>For the remainder of this post I will be referring to an environment consisting of two CentOS <a title="Virtual Private Server" href="http://en.wikipedia.org/wiki/Virtual_private_server">VPS</a> nodes.</p>
<h3>Preparing Ext3 File System for Sharing</h3>
<p>Gluster will not share raw devices but instead will use an already mounted file system.  I will be assuming the use of a complete ext3 file system on the mount point /replicator.  If you can&#8217;t provide a unique storage device for this purpose you can just use a directory on the root file system for testing.</p>
<h3>Installing GlusterFS Server and Client</h3>
<p>The following commands need to be executed on each node to grab and install the necessary RPMs.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">wget -r -l 1 http://ftp.gluster.com/pub/gluster/glusterfs/3.0/3.0.0/CentOS/
cd ftp.gluster.com/pub/gluster/glusterfs/3.0/3.0.0/CentOS/
rpm -Uvh glusterfs-*-3.0.0-1.x86_64.rpm</pre></div></div>

<p>Execute the following on either node to generate the necessary configuration files in the current working directory.  This will create a client configuration along the lines of replicator-tcp.vol.  A server configuration file will be created for each node and begin with the appropriate node hostname.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">glusterfs-volgen --name replicator --raid 1 node1:/replicator node2:/replicator</pre></div></div>

<p>Move the client file to /etc/glusterfs/glusterfs.vol on each node.  Also move the appropriate server file to /etc/glusterfs/glusterfsd.vol for each node.</p>
<h3>Mounting GlusterFS Volumes</h3>
<p>The simplest way to configure mounting of the volumes is via /etc/fstab.  Place a line in fstab on each node.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">/etc/glusterfs/glusterfs.vol    /data   glusterfs   defaults  0 0</pre></div></div>

<p>This will mount the shared volumes to /data.  Try writing a file to one node and watch it appear on the other!</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">cd /data
dd if=/dev/zero of=/data/test bs=1M count=32</pre></div></div>

<h3>High Availability Implications</h3>
<p>At this point I am still vetting gluster&#8217;s reliability as a HA solution.  It will most definitely keep data intact during planned maintenance.  If we properly stop the client/server on any node then changes can continue to occur on the other.  Also we can join a node to active shared storage and synchronization is automatic.</p>
<p>The real test is whether gluster will hold up in the not so routine situations.  Some crude tests involving yanking network connectivity from a node that is replicating changes seems to cause some issues.  For example, if I start the dd operation above on node1 and kill the connection to node2, one way or another, before it finishes then node1 still completes the operation fine.  When I reattach node2 even the active mount on /data seems to synchronize with node1 just fine.  Where some differences start to appear is in the /replicator directory on node2.  It seems that this does get out of whack and neither client pays attention to this server any longer.</p>
<p>If gluster can hold up to software and hardware failures without data corruption it can certainly be used as shared storage for clustering.  I&#8217;ll continue to explore these options and report back later.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2009/12/glusterfs-replication-for-clustering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
