<?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>Curious &#187; grid</title>
	<atom:link href="http://blogs.plexibus.com/category/grid/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.plexibus.com</link>
	<description>It&#039;s easy if you know how</description>
	<lastBuildDate>Tue, 22 Jun 2010 14:45:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Eucalyptus: Creating and Registering our first Image</title>
		<link>http://blogs.plexibus.com/2010/06/22/eucalyptus-creating-and-registering-our-first-image/</link>
		<comments>http://blogs.plexibus.com/2010/06/22/eucalyptus-creating-and-registering-our-first-image/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 14:24:24 +0000</pubDate>
		<dc:creator>roshanallan</dc:creator>
				<category><![CDATA[Appistry]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloudiq]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[EKI]]></category>
		<category><![CDATA[EMI]]></category>
		<category><![CDATA[ERI]]></category>
		<category><![CDATA[euca]]></category>
		<category><![CDATA[eucalyptus]]></category>
		<category><![CDATA[eucalyptus configuration]]></category>
		<category><![CDATA[eucalyptus kernel image]]></category>
		<category><![CDATA[eucalyptus machine image]]></category>
		<category><![CDATA[eucalyptus ramdisk image]]></category>
		<category><![CDATA[plexibus]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[roshan]]></category>
		<category><![CDATA[sequeira]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blogs.plexibus.com/2010/06/22/eucalyptus-creating-and-registering-our-first-image/</guid>
		<description><![CDATA[In our previous posts on &#8220;Building an on-premise private cloud&#8221;, we took our first steps by Installing Eucalyptus, a IaaS offering and then dove into Configuring Eucalyptus to look like an Amazon EC2 cloud.
In this post, we will take the next step and that is uploading (to Walrus) and registering a machine image (EMI) with [...]]]></description>
			<content:encoded><![CDATA[<p>In our previous posts on &#8220;Building an on-premise private cloud&#8221;, we took our first steps by <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/" target="_blank">Installing Eucalyptus</a>, a IaaS offering and then dove into <a href="http://blogs.plexibus.com/2010/05/26/eucalyptus-configuring-your-private-cloud-to-resemble-amazon-ec2/" target="_blank">Configuring Eucalyptus</a> to look like an Amazon EC2 cloud.</p>
<p>In this post, we will take the next step and that is uploading (to Walrus) and registering a machine image (EMI) with Eucalyptus. Once we have registered the image, we can then run instances of this image using either Amazon EC2 API or Euca2ools.</p>
<p>
<br/><br />
<strong><a name="emi">Eucalyptus Machine Image</a></strong>
</p>
<p>
A machine image, or more specifically, a Eucalyptus Machine Image (EMI) is a template, stored in Walrus, that can be used to create and run instances. A EMI is a combination of:</p>
<ul>
<li>a kernel image,</li>
<li>a ramdisk image, and</li>
<li>one or more virtual hard disk image</li>
</ul>
<p>The kernel image is more specifically referred to as Eucalyptus Kernel Image (EKI) and the ramdisk image is referred to as Eucalyptus Ramdisk Image (ERI).</p>
<p>Each of the images &#8211; EKI, ERI, and EMI &#8211; have associated xml files containing meta-data about the corresponding images respectively. </p>
<p>The EKIs, ERIs, and EMIs are stored in Walrus and can be referenced by a identifier, <i>Image ID</i>.</p>
<p>Now that we have some background information on EMI&#8217;s, let&#8217;s get started.
</p>
<p><br/></p>
<p>
<br/><br />
<strong><a name="download">Download Eucalyptus Certified Image</a></strong>
</p>
<p>
Start by opening a browser and connecting to <a href="https://%3Cfront-end-ip-address%3E:8443" target="_blank">https://&lt;front-end-ip-address&gt;:8443</a>. In my case, the front-end is 192.168.0.114 (see <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/" target="_blank">this</a> post). </p>
<p>Log in with your <font face="Courier New">admin</font> user and password.</p>
<p>Next, click on the <i>Extras</i> tab. And download one of the &#8220;Eucalyptus-certified Images&#8221;. I picked the CentOS 5.3 i386 image (<font face="Courier New">euca-centos-5.3-i386.tar.gz</font>). I downloaded it on my front-end machine for now. </p>
<p>For the rest of this document, I&#8217;ll be referring to the <i>CentOS 5.3 i386</i> image. Feel free to replace this with the image you downloaded as you proceed through this post.</p>
<p>Once you un-tar the file, you should see a directory structure similar to the following:</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
-rw-r&#8211;r&#8211; 1 root root 1001M Apr 23  2009 centos.5-3.x86.img<br />
drwxr-xr-x 2 root root  4.0K Oct 18  2009 kvm-kernel<br />
drwxr-xr-x 2 root root  4.0K Oct 19  2009 xen-kernel<br />
drwxr-xr-x 3 root root  4.0K May  5 14:16 ..<br />
drwxr-xr-x 6 root root  4.0K May  5 14:18 .
</div>
<p>where in my case,<br />
<i>centos.5-3.x86.img</i> &#8211; is the root disk image<br />
<i>kvm-kernel</i> &#8211; directory containing kvm-based kernel and ramdisk (<font face="Courier New">vmlinuz-2.6.28-11-server</font> and <font face="Courier New">initrd.img-2.6.28-11-server</font>)<br />
<i>xen-kernel</i> &#8211; directory containing xen-based kernel and ramdisk (<font face="Courier New">vmlinuz-2.6.24-19-xen</font> and <font face="Courier New">initrd.img-2.6.24-19-xen</font>)</p>
<p>Now we can bundle the kernel, ramdisk, and hard disk image, upload it to walrus and register each of them respectively. But before we do this, I&#8217;m going to take a small detour.
</p>
<p><br/></p>
<p>
<br/><br />
<strong><a name="resize">Detour: Resizing the disk image</a></strong>
</p>
<p>
Notice in the directory listing of <font face="Courier New">euca-centos-5.3-i386</font>, the size of the <font face="Courier New">centos.5-3.x86.img</font> is only 1 GB. If you bundle, upload and register an EMI out of this image, your instance will have only a 1 GB root partition. Which is fairly small if you plan on installing software on a running instance. For instance, if you try to install Sun Java on it, the installation will fail due to lack of space.</p>
<p>Hence this is a good time to increase the size from 1GB to say, 4GB. </p>
<p>Note: <i>Feel free to skip this step and proceed with the <a href="#bur">bundling, uploading, and registering</a> of the images.</i></p>
<p>To re-size the image, let&#8217;s start by creating a clean image file, <font face="Courier New">new_centos.5-3.x86.img</font> of size 4GB. We can do this using the <font face="Courier New">dd</font> command.</p>
<pre class="java-codeface">
dd if=/dev/zero of=new_centos.5-3.x86.img bs=1M count-4096
</pre>
<p>where,<br />
<i>if</i> &#8211; source. In this case, we are reading a stream of zeroes from (<font face="Courier New">/dev/zero</font>) device.<br />
<i>of</i> &#8211; target. Our new image file (<font face="Courier New">new_centos.5-3.x86.img</font>). The stream of zeroes are copied to this file.<br />
<i>bs</i> &#8211; read and write in blocks of 1M<br />
<i>count</i> &#8211; copy 4GB of blocks</p>
<p>The above command may take a few minutes to complete. You see output similar to this when done:</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
4096+0 records in<br />
4096+0 records out<br />
4294967296 bytes (4.3 GB) copied, 191.632 seconds, 22.4 MB/s
</div>
<p>Next, associate loop devices with each of the original (<font face="Courier New">centos.5-3.x86.img</font>) and new (<font face="Courier New">new_centos.5-3.x86.img</font>) image files. Make sure that the loop devices that you are going to use are free. You can check the next available loop device using the <font face="Courier New">losetup -f</font> command. In my case, I have <font face="Courier New">/dev/loop1</font> and <font face="Courier New">/dev/loop2</font> available.</p>
<pre class="java-codeface">
losetup /dev/loop1 centos.5-3.x86.img
losetup /dev/loop2 new_centos.5-3.x86.img
</pre>
<p>Confirm the status of the loop devices</p>
<pre class="java-codeface">
losetup /dev/loop1
losetup /dev/loop2
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
/dev/loop1: [0803]:8585221 (centos.5-3.x86.img)<br />
/dev/loop2: [0803]:8585223 (new_centos.5-3.x86.img)
</div>
<p>Next, create a ext3 file system on the new image (in our case, associated with loop device <font face="Courier New">/dev/loop2</font>) as follows:</p>
<pre class="java-codeface">
mke2fs -j /dev/loop2
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
mke2fs 1.39 (29-May-2006)<br />
Filesystem label=<br />
OS type: Linux<br />
Block size=4096 (log=2)<br />
Fragment size=4096 (log=2)<br />
524288 inodes, 1048576 blocks<br />
52428 blocks (5.00%) reserved for the super user<br />
First data block=0<br />
Maximum filesystem blocks=1073741824<br />
32 block groups<br />
32768 blocks per group, 32768 fragments per group<br />
16384 inodes per group<br />
Superblock backups stored on blocks:<br />
	32768, 98304, 163840, 229376, 294912, 819200, 884736</p>
<p>Writing inode tables: done<br />
Creating journal (32768 blocks): done<br />
Writing superblocks and filesystem accounting information: done</p>
<p>This filesystem will be automatically checked every 21 mounts or<br />
180 days, whichever comes first.  Use tune2fs -c or -i to override.
</p></div>
<p>Let&#8217;s create a couple of directories that will serve as temporary mount points for our image files. And then mount the images onto those temporary directories</p>
<pre class="java-codeface">
mkdir orig
mkdir new

mount /dev/loop1 orig
mount /dev/loop2 new
</pre>
<p>Check the list of mounts by running the mount command without any arguments. You should see the above mount points in the listing. Something similar to the following:</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
/dev/loop1 on /root/.euca/vmImages/euca-centos-5.3-i386/orig type ext3 (rw)<br />
/dev/loop2 on /root/.euca/vmImages/euca-centos-5.3-i386/new type ext3 (rw)
</div>
<p>Also, you can list the contents of the <font face="Courier New">orig</font> (original image) directory. You should see an entire linux file system.</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
total 96K<br />
drwxr-xr-x  2 root root 4.0K Mar  9  2009 sys<br />
drwxr-xr-x  2 root root 4.0K Mar  9  2009 srv<br />
drwxr-xr-x  2 root root 4.0K Mar  9  2009 selinux<br />
drwxr-xr-x  2 root root 4.0K Mar  9  2009 opt<br />
drwxr-xr-x  2 root root 4.0K Mar  9  2009 mnt<br />
drwxr-xr-x  2 root root 4.0K Mar  9  2009 media<br />
drwxr-xr-x  2 root root 4.0K Mar  9  2009 home<br />
drwx&#8212;&#8212;  2 root root  16K Apr 23  2009 lost+found<br />
drwxr-xr-x  2 root root 4.0K Apr 23  2009 proc<br />
drwxr-xr-x 17 root root 4.0K Apr 23  2009 var<br />
drwxr-xr-x 13 root root 4.0K Apr 23  2009 usr<br />
drwxr-xr-x  2 root root 4.0K Apr 23  2009 bin<br />
drwxr-xr-x  2 root root 4.0K Apr 23  2009 sbin<br />
drwxr-xr-x  8 root root 4.0K Apr 23  2009 lib<br />
drwxr-xr-x  3 root root 4.0K Apr 23  2009 boot<br />
drwxr-xr-x  2 root root 4.0K Apr 23  2009 dev<br />
-rw-r&#8211;r&#8211;  1 root root    0 Apr 23  2009 halt<br />
drwxr-xr-x 21 root root 4.0K Apr 23  2009 .<br />
drwxr-x&#8212;  2 root root 4.0K Apr 23  2009 root<br />
drwxrwxrwt  3 root root 4.0K Apr 23  2009 tmp<br />
drwxr-xr-x 38 root root 4.0K Oct 18  2009 etc<br />
drwxr-xr-x  6 root root 4.0K Jun  9 09:34 ..
</div>
<p>We can now copy the contents of the original (<font face="Courier New">centos.5-3.x86.img</font>) image to the new image <font face="Courier New">new_centos.5-3.x86.img</font>) as follows:</p>
<pre class="java-codeface">
(cd old; tar zcf - .) | (cd new; tar zxf -)
</pre>
<p>The above command will take a few minutes to complete. Once it is done you can list the contents of the <font face="Courier New">new</font> (new image) directory to confirm the copy worked ok.</p>
<p>Great we now have a new, bigger image <font face="Courier New">new_centos.5-3.x86.img</font> that we can now bundle, upload and register with Eucalyptus.</p>
<p>Before you proceed, make sure you clean up by un-mounting the images and detaching them from the loop devices</p>
<pre class="java-codeface">
umount /dev/loop1
umount /dev/loop2

losetup -d /dev/loop1
losetup -d /dev/loop2
</pre>
</p>
<p><br/></p>
<p>
<br/><br />
<strong><a name="bur">Bundle, Upload, Register</a></strong>
</p>
<p>
Now would be a good time to <a href="http://blogs.plexibus.com/2010/06/17/eucalyptus-euca2ools/" target="_blank">install Euca2ools</a> if you haven&#8217;t done so already.</p>
<p>There are 3 steps to making an EMI available:</p>
<ol>
<li>Bundling</li>
<li>Uploading</li>
<li>Registering</li>
</ol>
<p>And since an EMI is made up for a kernel image, a ramdisk image and a hard disk image, we need to perform the above 3 steps on each of the kernel, ramdisk and hard disk image.</p>
<p><strong>Eucalyptus Kernel Image</strong></p>
<p>First, we bundle the kernel image using Euca2ools <font face="Courier New">euca-bundle-image</font> command as follows:</p>
<pre class="java-codeface">
euca-bundle-image -i xen-kernel/vmlinuz-2.6.24-19-xen --kernel true --arch i386
</pre>
<p>where,<br />
<i>xen-kernel/vmlinuz-2.6.24-19-xen</i> &#8211; is the path to the kernel image<br />
<i>i386</i> &#8211; is the architecture. In our case, 32-bit architecture<br />
The other argument <font face="Courier New">&#8211;kernel true</font> tells the <font face="Courier New">euca-bundle-image</font> that this is a kernel image.</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
i386<br />
Checking image<br />
Tarring image<br />
Encrypting image<br />
Splitting image&#8230;<br />
Part: vmlinuz-2.6.24-19-xen.part.0<br />
Generating manifest /tmp/vmlinuz-2.6.24-19-xen.manifest.xml
</div>
<p>The above command packages the kernel image and generates a manifest.xml file under <font face="Courier New">/tmp</font> directory. </p>
<p>We will pass the full path to the manifest file as an argument to <font face="Courier New">euca-upload-image</font> to upload the image to Walrus: </p>
<pre class="java-codeface">
euca-upload-bundle -b kernel-bucket -m /tmp/vmlinuz-2.6.24-19-xen.manifest.xml
</pre>
<p>where,<br />
<i>kernel-bucket</i> &#8211; is the name of the bucket that the image (kernel image) will be stored under.<br />
<i>/tmp/vmlinuz-2.6.24-19-xen.manifest.xml</i> &#8211; is the manifest.xml that was generated by the <font face="Courier New">euca-bundle-image</font> command</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Checking bucket: kernel-bucket<br />
Uploading manifest file<br />
Uploading part: vmlinuz-2.6.24-19-xen.part.0<br />
Uploaded image as kernel-bucket/vmlinuz-2.6.24-19-xen.manifest.xml
</div>
<p>As you can see from the output, the kernel image was uploaded to <font face="Courier New">kernel-bucket</font> in Walrus. Note that you could replace <font face="Courier New">kernel-bucket</font> with a name of your choice.</p>
<p>Once we have uploaded the image, we need to register it so that it is available for use. We can do this using the <font face="Courier New">euca-register</font> command:</p>
<pre class="java-codeface">
euca-register kernel-bucket/vmlinuz-2.6.24-19-xen.manifest.xml
</pre>
<p>where,<br />
<i>kernel-bucket/vmlinuz-2.6.24-19-xen.manifest.xml</i> &#8211; is the path to the kernel image in walrus</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
IMAGE	eki-90461381
</div>
<p>The output of the <font face="Courier New">euca-register</font> command is an image id. We can use this image id when we bundle up the hard disk image or when we create an instance from a Eucalyptus machine image. The prefix of &#8220;<i>eki</i>&#8221; implies that the image is a kernel image, more specifically a Eucalyptus Kernel Image (EKI).</p>
<p>Verify that the EKI image is available by running euca2ools <font face="Courier New">euca-describe-images</font> command:</p>
<pre class="java-codeface">
euca-describe-images
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
IMAGE	eki-90461381	kernel-bucket/vmlinuz-2.6.24-19-xen.manifest.xml	admin	available	public		i386	kernel
</div>
<p><strong>Eucalyptus Ramdisk Image</strong></p>
<p>Bundle the ramdisk image as follows:</p>
<pre class="java-codeface">
euca-bundle-image -i xen-kernel/initrd.img-2.6.24-19-xen --ramdisk true --arch i386
</pre>
<p>where,<br />
<i>xen-kernel/initrd.img-2.6.24-19-xen</i> &#8211; is the path to the ramdisk image<br />
<i>i386</i> &#8211; is the architecture. In our case, 32-bit architecture<br />
The other argument <font face="Courier New">&#8211;ramdisk true</font> specifies that this is a ramdisk image.</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
i386<br />
Checking image<br />
Tarring image<br />
Encrypting image<br />
Splitting image&#8230;<br />
Part: initrd.img-2.6.24-19-xen.part.0<br />
Generating manifest /tmp/initrd.img-2.6.24-19-xen.manifest.xml
</div>
<p>The above command packages the ramdisk image and generates a manifest.xml file in the <font face="Courier New">/tmp</font> directory. </p>
<p>Next, we pass the path to the manifest.xml file as an argument to the <font face="Courier New">euca-upload-bundle</font> command to upload the image to Walrus.</p>
<pre class="java-codeface">
euca-upload-bundle -b ramdisk-bucket -m /tmp/initrd.img-2.6.24-19-xen.manifest.xml
</pre>
<p>where,<br />
<i>ramdisk-bucket</i> &#8211; is the name of the bucket that the ramdisk image will be stored under.<br />
<i>/tmp/initrd.img-2.6.24-19-xen.manifest.xml</i> &#8211; is the manifest.xml that was generated in the previous step</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Checking bucket: ramdisk-bucket<br />
Uploading manifest file<br />
Uploading part: initrd.img-2.6.24-19-xen.part.0<br />
Uploaded image as ramdisk-bucket/initrd.img-2.6.24-19-xen.manifest.xml
</div>
<p>Next we register the image as follows:</p>
<pre class="java-codeface">
euca-register ramdisk-bucket/initrd.img-2.6.24-19-xen.manifest.xml
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
IMAGE	eri-E85914C7
</div>
<p>The output of the above <font face="Courier New">euca_register</font> command is an image id. Again, we can use this image id when we bundle up the hard disk image or when we create an instance from a Eucalyptus machine image. The prefix &#8220;<i>eri</i>&#8221; implies that the image is a ramdisk image, more specifically a Eucalyptus Ramdisk Image (ERI).</p>
<p>Run the describe images command to verify that the ramdisk image is available:</p>
<pre class="java-codeface">
euca-describe-images
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
IMAGE	eki-90461381	kernel-bucket/vmlinuz-2.6.24-19-xen.manifest.xml	admin	available	public		i386	kernel<br />
IMAGE	eri-E85914C7	ramdisk-bucket/initrd.img-2.6.24-19-xen.manifest.xml	admin	available	public		i386	ramdisk
</div>
<p>Finally we are ready to create the Eucalyptus Machine Image.</p>
<p><strong>Eucalyptus Machine Image</strong></p>
<p>We will use the hard disk image &#8211; <font face="Courier New">new_centos.5-3.x86.img</font> &#8211; we created in the section &#8220;<a href="#resize">Resizing the disk image</a>&#8220;. If you skipped the &#8220;resize&#8221; section, you could use the base image &#8211; centos.5-3.x86.img &#8211; provided in the <a href="#download">download</a>.</p>
<p>Let&#8217;s get started with first bundling the hard disk image as follows:</p>
<pre class="java-codeface">
euca-bundle-image -i new_centos.5-3.x86.img --kernel eki-90461381 --ramdisk eri-E85914C7
</pre>
<p>where,<br />
<i>new_centos.5-3.x86.img</i> &#8211; is the path to the hard disk image</p>
<p>The other two arguments to the above command are the Eucalyptus Kernel Image (EKI) id and the Eucalyptus Ramdisk Image (ERI) id. In this case, <font face="Courier New">eki-90461381</font> and <font face="Courier New">eri-E85914C7</font> which we obtained when registering the kernel and ramdisk image respectively.</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Checking image<br />
Tarring image<br />
Encrypting image<br />
Splitting image&#8230;<br />
Part: new_centos.5-3.x86.img.part.0<br />
Part: new_centos.5-3.x86.img.part.1<br />
Part: new_centos.5-3.x86.img.part.2<br />
Part: new_centos.5-3.x86.img.part.3<br />
Part: new_centos.5-3.x86.img.part.4<br />
Part: new_centos.5-3.x86.img.part.5<br />
Part: new_centos.5-3.x86.img.part.6<br />
Part: new_centos.5-3.x86.img.part.7<br />
Part: new_centos.5-3.x86.img.part.8<br />
Part: new_centos.5-3.x86.img.part.9<br />
Part: new_centos.5-3.x86.img.part.10<br />
Part: new_centos.5-3.x86.img.part.11<br />
Part: new_centos.5-3.x86.img.part.12<br />
Part: new_centos.5-3.x86.img.part.13<br />
Part: new_centos.5-3.x86.img.part.14<br />
Part: new_centos.5-3.x86.img.part.15<br />
Part: new_centos.5-3.x86.img.part.16<br />
Part: new_centos.5-3.x86.img.part.17<br />
Part: new_centos.5-3.x86.img.part.18<br />
Part: new_centos.5-3.x86.img.part.19<br />
Part: new_centos.5-3.x86.img.part.20<br />
Part: new_centos.5-3.x86.img.part.21<br />
Part: new_centos.5-3.x86.img.part.22<br />
Part: new_centos.5-3.x86.img.part.23<br />
Part: new_centos.5-3.x86.img.part.24<br />
Part: new_centos.5-3.x86.img.part.25<br />
Part: new_centos.5-3.x86.img.part.26<br />
Part: new_centos.5-3.x86.img.part.27<br />
Part: new_centos.5-3.x86.img.part.28<br />
Part: new_centos.5-3.x86.img.part.29<br />
Part: new_centos.5-3.x86.img.part.30<br />
Part: new_centos.5-3.x86.img.part.31<br />
Part: new_centos.5-3.x86.img.part.32<br />
Part: new_centos.5-3.x86.img.part.33<br />
Part: new_centos.5-3.x86.img.part.34<br />
Part: new_centos.5-3.x86.img.part.35<br />
Part: new_centos.5-3.x86.img.part.36<br />
Part: new_centos.5-3.x86.img.part.37<br />
Part: new_centos.5-3.x86.img.part.38<br />
Generating manifest /tmp/new_centos.5-3.x86.img.manifest.xml
</div>
<p>As expected, the above command packages the disk image and generates a manifest.xml file in the <font face="Courier New">/tmp</font> directory. </p>
<p>Next, we upload the disk image to Walrus passing in the manifest.xml file path obtained from the previous command as follows:</p>
<pre class="java-codeface">
euca-upload-bundle -b image-bucket -m /tmp/new_centos.5-3.x86.img.manifest.xml
</pre>
<p>where,<br />
<i>image-bucket</i> &#8211; is the name of the bucket that the disk image will be stored under.<br />
<i>/tmp/new_centos.5-3.x86.img.manifest.xml </i> &#8211; is the manifest.xml that was generated in the previous <font face="Courier New">euca-bundle-image</font> step</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Checking bucket: image-bucket<br />
Uploading manifest file<br />
Uploading part: new_centos.5-3.x86.img.part.0<br />
Uploading part: new_centos.5-3.x86.img.part.1<br />
Uploading part: new_centos.5-3.x86.img.part.2<br />
Uploading part: new_centos.5-3.x86.img.part.3<br />
Uploading part: new_centos.5-3.x86.img.part.4<br />
Uploading part: new_centos.5-3.x86.img.part.5<br />
Uploading part: new_centos.5-3.x86.img.part.6<br />
Uploading part: new_centos.5-3.x86.img.part.7<br />
Uploading part: new_centos.5-3.x86.img.part.8<br />
Uploading part: new_centos.5-3.x86.img.part.9<br />
Uploading part: new_centos.5-3.x86.img.part.10<br />
Uploading part: new_centos.5-3.x86.img.part.11<br />
Uploading part: new_centos.5-3.x86.img.part.12<br />
Uploading part: new_centos.5-3.x86.img.part.13<br />
Uploading part: new_centos.5-3.x86.img.part.14<br />
Uploading part: new_centos.5-3.x86.img.part.15<br />
Uploading part: new_centos.5-3.x86.img.part.16<br />
Uploading part: new_centos.5-3.x86.img.part.17<br />
Uploading part: new_centos.5-3.x86.img.part.18<br />
Uploading part: new_centos.5-3.x86.img.part.19<br />
Uploading part: new_centos.5-3.x86.img.part.20<br />
Uploading part: new_centos.5-3.x86.img.part.21<br />
Uploading part: new_centos.5-3.x86.img.part.22<br />
Uploading part: new_centos.5-3.x86.img.part.23<br />
Uploading part: new_centos.5-3.x86.img.part.24<br />
Uploading part: new_centos.5-3.x86.img.part.25<br />
Uploading part: new_centos.5-3.x86.img.part.26<br />
Uploading part: new_centos.5-3.x86.img.part.27<br />
Uploading part: new_centos.5-3.x86.img.part.28<br />
Uploading part: new_centos.5-3.x86.img.part.29<br />
Uploading part: new_centos.5-3.x86.img.part.30<br />
Uploading part: new_centos.5-3.x86.img.part.31<br />
Uploading part: new_centos.5-3.x86.img.part.32<br />
Uploading part: new_centos.5-3.x86.img.part.33<br />
Uploading part: new_centos.5-3.x86.img.part.34<br />
Uploading part: new_centos.5-3.x86.img.part.35<br />
Uploading part: new_centos.5-3.x86.img.part.36<br />
Uploading part: new_centos.5-3.x86.img.part.37<br />
Uploading part: new_centos.5-3.x86.img.part.38<br />
Uploaded image as image-bucket/new_centos.5-3.x86.img.manifest.xml
</div>
<p>Finally, we register the image as follows:</p>
<pre class="java-codeface">
euca-register image-bucket/new_centos.5-3.x86.img.manifest.xml
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
IMAGE	emi-9FE813FD
</div>
<p>A quick <font face="Courier New">euca-describe-images</font> reveals the EMI that is available for use:</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
IMAGE	eki-90461381	kernel-bucket/vmlinuz-2.6.24-19-xen.manifest.xml	admin	available	public		i386	kernel<br />
IMAGE	emi-9FE813FD	image-bucket/new_centos.5-3.x86.img.manifest.xml	admin	available	public		x86_64	machine	eri-E85914C7	eki-90461381<br />
IMAGE	eri-E85914C7	ramdisk-bucket/initrd.img-2.6.24-19-xen.manifest.xml	admin	available	public		i386	ramdisk
</div>
</p>
<p><br/></p>
<p>
<br/><br />
In the next post, we will look into creating instances of the EMI that we just registered.
</p>
<p><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.plexibus.com/2010/06/22/eucalyptus-creating-and-registering-our-first-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eucalyptus: Euca2ools</title>
		<link>http://blogs.plexibus.com/2010/06/17/eucalyptus-euca2ools/</link>
		<comments>http://blogs.plexibus.com/2010/06/17/eucalyptus-euca2ools/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 15:44:53 +0000</pubDate>
		<dc:creator>roshanallan</dc:creator>
				<category><![CDATA[Appistry]]></category>
		<category><![CDATA[Build]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloudiq]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[appistry cloudiq]]></category>
		<category><![CDATA[euca2ools]]></category>
		<category><![CDATA[eucalyptus]]></category>
		<category><![CDATA[eucalyptus install]]></category>
		<category><![CDATA[eucalyptus setup]]></category>
		<category><![CDATA[plexibus]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blogs.plexibus.com/2010/06/17/eucalyptus-euca2ools/</guid>
		<description><![CDATA[In this series of posts on &#8220;Building an on-premise private cloud&#8221; we have so far:

Installed Eucalyptus, an Infrastructure-as-a-Service offering, and
Configured Eucalyptus to start VMs with IP addresses from a private VLAN

Before we jump into bundling, uploading, and registering images, let&#8217;s first download and install Euca2ools.


Euca2ools


Euca2ools are command-line utilities to help:

Manage Images (bundle, upload, register, delete, [...]]]></description>
			<content:encoded><![CDATA[<p>In this series of posts on &#8220;Building an on-premise private cloud&#8221; we have so far:</p>
<ul>
<li><a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/" target="_blank">Installed Eucalyptus</a>, an <i>Infrastructure-as-a-Service</i> offering, and</li>
<li><a href="http://blogs.plexibus.com/2010/05/26/eucalyptus-configuring-your-private-cloud-to-resemble-amazon-ec2/" target="_blank">Configured Eucalyptus</a> to start VMs with IP addresses from a private VLAN</li>
</ul>
<p>Before we jump into bundling, uploading, and registering images, let&#8217;s first download and install <a href="http://open.eucalyptus.com/wiki/Euca2oolsGuide_v1.1" target="_blank">Euca2ools</a>.</p>
<p>
<br/><br />
<strong><a name="intro">Euca2ools</a></strong>
</p>
<p>
Euca2ools are command-line utilities to help:</p>
<ul>
<li>Manage Images (bundle, upload, register, delete, etc.)</li>
<li>Manage Instances (start, reboot, terminate, list, etc.)</li>
<li>Manage Volumes &amp; Snapshots (attach, detach, list, create, delete, etc.)</li>
<li>Manage IP addresses (associate, disassociate, list, etc.)</li>
<li>Manage SSH key pairs (add, delete, list)</li>
<li>Manage Security groups (add, delete, list, add rules)</li>
<li>Query availability zones (clusters)</li>
</ul>
<p>Euca2ools is compatible with Amazon EC2 and S3 web services. In fact, Euca2ools is modeled after Amazon <a href="https://developer.amazonwebservices.com/connect/entry.jspa?externalID=351" target="_blank">EC2 API</a> and <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=368" target="_blank">EC2 AMI</a> tools.
</p>
<p>
<br/><br />
<strong><a name="install">Download &amp; Install</a></strong>
</p>
<p>
Since I have been using CentOS 5 32-bit, I&#8217;ll describe the tar ball install process for CentOS 5. Also, in my case I&#8217;ll install euca2ools on my <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/" target="_blank">front-end machine</a> (192.168.0.114)</p>
<p><i>Note:</i> You may choose to go the <font face="Courier New">yum</font> (you will need to add the <font face="Courier New">http://www.eucalyptussoftware.com/downloads/repo/euca2ools/$VERSION/yum/centos/</font> repo first) route instead of the tar ball. </p>
<p><i>Note:</i> If you are using a Debian-based distro, feel free to install using apt-get (<font face="Courier New">apt-get install euca2ools</font>)</p>
<p>First download the tar.gz package for CentOS 5 32-bit &#8211; in this case, <font face="Courier New">euca2ools-1.2-centos-i386.tar.gz</font></p>
<p>Next un-tar the above package</p>
<pre class="java-codeface">
tar zxvf euca2ools-1.2-centos-i386.tar.gz
</pre>
<p>Before you install the rpm packages in the <font face="Courier New">euca2ools-1.2-centos-i386</font> directory, you need to install <font face="Courier New">swig</font> as follows:</p>
<pre class="java-codeface">
yum update
yum install swig
</pre>
<p>Next, go into <font face="Courier New">euca2ools-1.2-centos-i386</font> directory and install the rpm packages as follows:</p>
<pre class="java-codeface">
cd euca2ools-1.2-centos-i386
rpm -Uvh python25-2.5.1-bashton1.i386.rpm python25-libs-2.5.1-bashton1.i386.rpm euca2ools-1.2-1.i386.rpm
</pre>
<p>Confirm that euca2ools is install as follows:</p>
<pre class="java-codeface">
rpm -qa euca2ools
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
euca2ools-1.2-1
</div>
</p>
<p>
<br/><br />
<strong><a name="test">Testing Euca2ools</a></strong>
</p>
<p>
In the <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/#test" target="_blank">first post</a> I used Amazon EC2 API tools to test the Eucalyptus install. To be precise I had used the <font face="Courier New">ec2-describe-availability-zones</font> command.</p>
<p>Now that we have Euca2ools installed we can use the <font face="Courier New">euca-describe-availability-zones</font> command instead. <i>Remember to <font face="Courier New">source</font> in the <font face="Courier New">eucarc</font> file first</i>.</p>
<pre class="java-codeface">
cd .euca
source eucarc
euca-describe-availability-zones verbose
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
AVAILABILITYZONE	rosh-cluster1	192.168.0.114<br />
AVAILABILITYZONE	|- vm types	free / max   cpu   ram  disk<br />
AVAILABILITYZONE	|- m1.small	0004 / 0004   1    128     2<br />
AVAILABILITYZONE	|- c1.medium	0004 / 0004   1    256     5<br />
AVAILABILITYZONE	|- m1.large	0002 / 0002   2    512    10<br />
AVAILABILITYZONE	|- m1.xlarge	0000 / 0000   2   1024    20<br />
AVAILABILITYZONE	|- c1.xlarge	0000 / 0000   4   2048    20
</div>
<p>Nice!
</p>
<p>
Feel free to play around with some of the other commands. You can get a list of commands by typing &#8220;euca&#8221; and pressing the <font face="Courier New">TAB</font> button twice. You could also run the command <font face="Courier New">ls /usr/bin | grep euca</font></p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
euca-add-group<br />
euca_conf<br />
euca-delete-volume<br />
euca-describe-keypairs<br />
euca_killall<br />
euca-run-instances<br />
euca-add-keypair<br />
euca-confirm-product-instance<br />
euca-deregister<br />
euca-describe-regions<br />
eucalyptus-cloud<br />
euca_sync_key<br />
euca-allocate-address<br />
euca-create-snapshot<br />
euca-describe-addresses<br />
euca-describe-snapshots<br />
euca-modify-image-attribute<br />
euca-terminate-instances<br />
euca-associate-address<br />
euca-create-volume<br />
euca-describe-availability-zones<br />
euca-describe-volumes<br />
euca-reboot-instances<br />
euca-unbundle<br />
euca-attach-volume<br />
euca-delete-bundle<br />
euca-describe-groups<br />
euca-detach-volume<br />
euca-register<br />
euca-upload-bundle<br />
euca-authorize<br />
euca-delete-group<br />
euca-describe-image-attribute<br />
euca-disassociate-address<br />
euca-release-address<br />
euca-version<br />
euca-bundle-image<br />
euca-delete-keypair<br />
euca-describe-images<br />
euca-download-bundle<br />
euca-reset-image-attribute<br />
euca-bundle-vol<br />
euca-delete-snapshot<br />
euca-describe-instances<br />
euca-get-console-output<br />
euca-revoke
</div>
<p>To get more information on a particular command, type in the command name following by the argument <font face="Courier New">&#8211;help</font>. For instance:</p>
<pre class="java-codeface">
euca-describe-availability-zones --help
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
<p>Shows information about availability zones.</p>
<p>euca-describe-availability-zones [--region region] [-h, --help] [--version] [--debug] [zone1 zone2...zoneN]</p>
<p>OPTIONAL PARAMETERS</p>
<p>&#8211;region			region to describe availability zones for</p>
<p>zone1 zone2&#8230;zoneN		zones to describe. </p>
<p>-a, &#8211;access-key		User&#8217;s Access Key ID.</p>
<p>-s, &#8211;secret-key		User&#8217;s Secret Key.</p>
<p>-U, &#8211;url			URL of the Cloud to connect to.</p>
<p>&#8211;config			Read credentials and cloud settings from the<br />
				specified config file (defaults to $HOME/.eucarc or /etc/euca2ools/eucarc).</p>
<p>-h, &#8211;help			Display this help message.</p>
<p>&#8211;version 			Display the version of this tool.</p>
<p>&#8211;debug 			Turn on debugging.</p>
<p>Euca2ools will use the environment variables EC2_URL, EC2_ACCESS_KEY, EC2_SECRET_KEY, EC2_CERT, EC2_PRIVATE_KEY, S3_URL, EUCALYPTUS_CERT by default.
</p></div>
</p>
<p>
As we continue these series, we will see more and more of the <font face="Courier New">Euca2ools</font> commands.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.plexibus.com/2010/06/17/eucalyptus-euca2ools/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Eucalyptus: Configuring your private cloud to resemble Amazon EC2</title>
		<link>http://blogs.plexibus.com/2010/05/26/eucalyptus-configuring-your-private-cloud-to-resemble-amazon-ec2/</link>
		<comments>http://blogs.plexibus.com/2010/05/26/eucalyptus-configuring-your-private-cloud-to-resemble-amazon-ec2/#comments</comments>
		<pubDate>Wed, 26 May 2010 19:54:27 +0000</pubDate>
		<dc:creator>roshanallan</dc:creator>
				<category><![CDATA[Appistry]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloudiq]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[Amazon EC2]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[datacenter]]></category>
		<category><![CDATA[eucalyptus]]></category>
		<category><![CDATA[eucalyptus centos install]]></category>
		<category><![CDATA[eucalyptus install]]></category>
		<category><![CDATA[infrastructure as a service]]></category>
		<category><![CDATA[MANAGED]]></category>
		<category><![CDATA[managed networking]]></category>
		<category><![CDATA[plexibus]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[private cloud]]></category>
		<category><![CDATA[private IP address]]></category>
		<category><![CDATA[public]]></category>
		<category><![CDATA[public cloud]]></category>
		<category><![CDATA[public IP address]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.plexibus.com/2010/05/26/eucalyptus-configuring-your-private-cloud-to-resemble-amazon-ec2/</guid>
		<description><![CDATA[You can reduce your hardware infrastructure expenditure by using Eucalyptus to efficiently run and manage your virtual machines on existing hardware. This in turn effectively leads to larger energy savings &#8211; less physical machines equals less power needed to run the hardware. 

In my previous post on setting up a private cloud, we looked at [...]]]></description>
			<content:encoded><![CDATA[<p>You can reduce your hardware infrastructure expenditure by using <a href="http://www.eucalyptus.com/" target="_blank">Eucalyptus</a> to efficiently run and manage your virtual machines on existing hardware. This in turn effectively leads to larger energy savings &#8211; less physical machines equals less power needed to run the hardware. </p>
<p>
In my <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/">previous</a> post on setting up a private cloud, we looked at getting Eucalyptus &#8220;Infrastructure-as-a-Service&#8221; platform installed and running. If you recall, we stated to keep things simple but still practical enough such that you could use this as a reference guide to &#8220;Building and running a private cloud&#8221;. Hence in this post we will look at tweaking the default configuration &#8211; primarily changing the default out-of-the-box enabled networking to something similar to Amazon EC2.
</p>
</p>
<p>
<br/><br />
<strong><a name="networking">Networking in Eucalyptus</a></strong>
</p>
<p>
Eucalyptus comes with 4 <a href="http://open.eucalyptus.com/wiki/EucalyptusNetworking_v1.6" target="_blank">networking</a> modes.
</p>
<ul>
<li>SYSTEM</li>
<li>STATIC</li>
<li>MANAGED</li>
<li>MANAGED-NOVLAN</li>
</ul>
<p>
<br/><br />
<strong><a name="systemnetworking">SYSTEM networking mode</a></strong>
</p>
<p>
SYSTEM networking mode is the default &#8220;<i>no-frills</i>&#8221; networking that is offered as part of an <i>out-of-the-box</i> Eucalyptus install.<br />
In this networking mode, Eucalyptus relies on the existence of a DHCP server (<i>non-Eucalyptus controlled</i>) located on the LAN. Virtual machines obtain their IP address from this DHCP server the same way other machines (such as your desktop, laptop, etc.) on the LAN do.<br />
In this mode, you cannot set up create VLANs or isolate network traffic. There is only one IP address that gets assigned to the VMs i.e. the IP address obtained from the DHCP server setup by your administrator.<br />
This mode is useful when you are just <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/" target="_blank">getting started</a> with Eucalyptus. If you have only a single machine (server/laptop/desktop) to try out Eucalyptus, then SYSTEM (or STATIC) networking mode is the way to go.
</p>
</p>
<p>
As described in my <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/" target="_blank">previous</a> post, I had setup Eucalyptus with 1 Cluster Controller (CC), 2 Node Controllers (NC) and SYSTEM networking mode. But we will tweak this to use MANAGED mode.
</p>
</p>
<p>
<br/><br />
<strong><a name="managednetworking">MANAGED networking mode</a></strong>
</p>
<p>
This mode <i>almost</i> resembles the networking setup of Amazon EC2 cloud in that you can define:</p>
<ul>
<li>a large private VLAN from which VMs can obtain IP addresses</li>
<li>a pool of public IP addresses that can be assigned to VMs. Similar to Amazon&#8217;s <i>elastic IP addresses</i></li>
<li>define security groups where users can define ingress rules that apply to the VM that runs within that security group</li>
</ul>
<p>In this mode, Eucalyptus maintains a DHCP server, fully manages the local VM instance network and provides all the networking features Eucalyptus currently supports.</p>
<p>Before we jump into configuring Eucalyptus for MANAGED networking there are some requirements that need to be met. Namely:</p>
<ul>
<li>Available range of IP addresses unused on the network. These IP addresses will be used to create private VLANs.</li>
<li>Any switch ports that the Eucalyptus components are connected to allow and forward VLAN tagged packets</li>
<li>There is either no firewall running on the Cluster Controller or the firewall is compatible with dynamic changes Eucalyptus will make to the front-end netfilter rules</li>
</ul>
</p>
<p>
<br/><br />
<strong><a name="checklist1">Checklist #1: Available range of IP addresses for private VLAN</a></strong>
</p>
<p>
Before you start configuring Eucalyptus for MANAGED networking mode, you need to find a range of IP addresses that is unused on the network. We will configure Eucalyptus to use this range to create a private VLAN. </p>
<p>When Eucalyptus boots a virtual machine instance it will assign the instance a private IP address from this range. This is similar to the private IP address assigned to an instance running on Amazon EC2.</p>
<p>In my case, I have <font face="Courier New">10.10.0.0 &#8211; 10.10.255.255</font> unused as an example.
</p>
</p>
<p>
<br/><br />
<strong><a name="checklist2">Checklist #2: Allow/forward VLAN tagged packets</a></strong>
</p>
<p>
Next we need to verify that the local network will allow/forward VLAN tagged packets between machines running Eucalyptus components.<br />
To test this, we will create, on the front-end and Nodes, virtual ethernet devices assigned with an IP address from the above range of IP addresses. And then attempt to ping them. </p>
<p>Let&#8217;s start with the front-end. In my case, <font face="Courier New">192.168.0.114</font> if you have been following this series (see post on <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/" target="_blank">Setting up a private cloud using Eucalyptus</a> for list of machines involved).</p>
<pre class="java-codeface">
vconfig add eth0 10
</pre>
<p>where,<br />
<i>eth0</i> &#8211; is the value of the VNET_PRIVINTERFACE in my <font face="Courier New">eucalyptus.conf</font> on my front-end</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Added VLAN with VID == 10 to IF -:eth0:-
</div>
<p>We can verify we created a VLAN device on eth0 by checking <font face="Courier New">/proc/net/vlan/config</font></p>
<pre class="java-codeface">
cat /proc/net/vlan/config
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
VLAN Dev name	 | VLAN ID<br />
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD<br />
eth0.10        | 10  | eth0
</div>
<p>We could also run the following command to verify that the VLAN device was created</p>
<pre class="java-codeface">
ip a sh eth0.10
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
4: eth0.10@eth0: <broadcast,multicast /> mtu 1500 qdisc noop<br />
    link/ether 00:01:80:65:d2:5b brd ff:ff:ff:ff:ff:ff<br />
</broadcast,multicast></div>
<p>Next let&#8217;s pick an IP from the &#8220;<i>Available range of IP addresses for private VLAN</i>&#8220;, 10.10.0.0 &#8211; 10.10.255.255 (in my case). Let&#8217;s pick 10.10.1.2</p>
<pre class="java-codeface">
ifconfig eth0.10 10.10.1.2 up
</pre>
<p>Let&#8217;s verify that the virtual ethernet device <font face="Courier New">eth0.10</font> is up</p>
<pre class="java-codeface">
ip a sh eth0.10
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
4: eth0.10@eth0: &lt;broadcast,multicast,up,lower_up /&gt; mtu 1500 qdisc noqueue<br />
    link/ether 00:01:80:65:d2:5b brd ff:ff:ff:ff:ff:ff<br />
    inet 10.10.1.2/8 brd 10.255.255.255 scope global eth0.10<br />
    inet6 fe80::201:80ff:fe65:d25b/64 scope link<br />
       valid_lft forever preferred_lft forever
</div>
<p>Excellent. Now let&#8217;s do the same on the Nodes with the exception that we will pick a different IP address, say <font face="Courier New">10.10.1.3</font> and <font face="Courier New">10.10.1.5</font> for each of my two Nodes, <font face="Courier New">192.168.0.19</font> and <font face="Courier New">192.168.5.7</font>.</p>
<p>For the sake of brevity, I&#8217;ve detailed the steps on one of my Nodes.</p>
<pre class="java-codeface">
vconfig add eth0 10
</pre>
<p>where,<br />
<i>eth0</i> &#8211; is the value of the VNET_PRIVINTERFACE (and VNET_PUBINTERFACE) in my <font face="Courier New">eucalyptus.conf</font> on my Nodes</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Added VLAN with VID == 10 to IF -:eth0:-
</div>
<p>Verify that the virtual ethernet device has been created on the Node:</p>
<pre class="java-codeface">
cat /proc/net/vlan/config
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
VLAN Dev name	 | VLAN ID<br />
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD<br />
eth0.10        | 10  | eth0
</div>
<p>Next assign the virtual ethernet device <font face="Courier New">eth0.10</font> IP address <font face="Courier New">10.10.1.3</font> and bring it up</p>
<pre class="java-codeface">
ifconfig eth0.10 10.10.1.3 up
ip a sh eth0.10
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
14: eth0.10@eth0: &lt;broadcast,multicast,up,lower_up /&gt; mtu 1500 qdisc noqueue<br />
    link/ether 00:01:80:66:18:78 brd ff:ff:ff:ff:ff:ff<br />
    inet 10.10.1.3/8 brd 10.255.255.255 scope global eth0.10<br />
    inet6 fe80::201:80ff:fe66:1878/64 scope link<br />
       valid_lft forever preferred_lft forever
</div>
<p>Now comes the test. From the above Node, let&#8217;s ping the front-end&#8217;s virtual ethernet device <font face="Courier New">10.10.1.2</font>:</p>
<pre class="java-codeface">
ping 10.10.1.2
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
PING 10.10.1.2 (10.10.1.2) 56(84) bytes of data.<br />
64 bytes from 10.10.1.2: icmp_seq=1 ttl=64 time=2.80 ms<br />
64 bytes from 10.10.1.2: icmp_seq=2 ttl=64 time=0.691 ms<br />
64 bytes from 10.10.1.2: icmp_seq=3 ttl=64 time=1.13 ms<br />
64 bytes from 10.10.1.2: icmp_seq=4 ttl=64 time=0.576 ms<br />
64 bytes from 10.10.1.2: icmp_seq=5 ttl=64 time=1.01 ms<br />
64 bytes from 10.10.1.2: icmp_seq=6 ttl=64 time=0.326 ms<br />
64 bytes from 10.10.1.2: icmp_seq=7 ttl=64 time=0.901 ms<br />
64 bytes from 10.10.1.2: icmp_seq=8 ttl=64 time=0.344 ms<br />
64 bytes from 10.10.1.2: icmp_seq=9 ttl=64 time=0.788 ms<br />
64 bytes from 10.10.1.2: icmp_seq=10 ttl=64 time=0.228 ms<br />
64 bytes from 10.10.1.2: icmp_seq=11 ttl=64 time=0.672 ms<br />
64 bytes from 10.10.1.2: icmp_seq=12 ttl=64 time=1.11 ms<br />
64 bytes from 10.10.1.2: icmp_seq=13 ttl=64 time=0.565 ms</p>
<p>&#8212; 10.10.1.2 ping statistics &#8212;<br />
13 packets transmitted, 13 received, 0% packet loss, time 12002ms<br />
rtt min/avg/max/mdev = 0.228/0.858/2.807/0.629 ms
</p></div>
<p>Next, from the front-end machine, <font face="Courier New">192.168.0.114</font>, let&#8217;s ping the Node&#8217;s virtual ethernet device, <font face="Courier New">10.10.1.3</font></p>
<pre class="java-codeface">
ping 10.10.1.3
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
PING 10.10.1.3 (10.10.1.3) 56(84) bytes of data.<br />
64 bytes from 10.10.1.3: icmp_seq=1 ttl=64 time=2.24 ms<br />
64 bytes from 10.10.1.3: icmp_seq=2 ttl=64 time=1.33 ms<br />
64 bytes from 10.10.1.3: icmp_seq=3 ttl=64 time=0.748 ms<br />
64 bytes from 10.10.1.3: icmp_seq=4 ttl=64 time=1.15 ms</p>
<p>&#8212; 10.10.1.3 ping statistics &#8212;<br />
4 packets transmitted, 4 received, 0% packet loss, time 3001ms<br />
rtt min/avg/max/mdev = 0.748/1.369/2.242/0.547 ms
</p></div>
<p>Super cool! This proves that my switch allows/forwards VLAN tagged packets. If for some reason, your results do not resemble mine, then your switch, perhaps, needs to be configured to allow/forward VLAN tagged packets. A little bit of googling on your switch may help.</p>
<p>For cleanup sake, you could go ahead and remove the above test vlan devices. You could do this as follows on the front-end and Node:</p>
<pre class="java-codeface">
ip link set eth0.10 down
vconfig rem eth0.10
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Removed VLAN -:eth0.10:-
</div>
<pre class="java-codeface">
cat /proc/net/vlan/config
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
VLAN Dev name	 | VLAN ID<br />
Name-Type: VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
</div>
<pre class="java-codeface">
ip a sh eth0.10
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Device &#8220;eth0.10&#8243; does not exist.
</div>
</p>
<p>
<br/><br />
<strong><a name="checklist3">Checklist #3: Firewall configuration on front-end</a></strong>
</p>
<p>
Finally in the list of things to check, we need to make sure the firewall on the front-end does not interfere with Eucalyptus which will dynamically update the <font face="Courier New">nat</font> and <font face="Courier New">filter</font> rules. In my case my <font face="Courier New">iptables</font> on the front-end reveal the following:</p>
<pre class="java-codeface">
iptables -L
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Chain INPUT (policy ACCEPT)<br />
target     prot opt source               destination         </p>
<p>Chain FORWARD (policy ACCEPT)<br />
target     prot opt source               destination         </p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination
</p></div>
<pre class="java-codeface">
iptables -L -t nat
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Chain PREROUTING (policy ACCEPT)<br />
target     prot opt source               destination         </p>
<p>Chain POSTROUTING (policy ACCEPT)<br />
target     prot opt source               destination         </p>
<p>Chain OUTPUT (policy ACCEPT)<br />
target     prot opt source               destination
</p></div>
<p>Ok. Now we are ready to proceed with the MANAGED networking configuration.
</p>
</p>
<p>
<br/><br />
<strong><a name="managednetworkingFrontend">Front-end configuration &#8211; MANAGED networking mode</a></strong>
</p>
<p>
Presently to configure Eucalyptus networking, you need to edit <font face="Courier New">eucalyptus.conf</font>. In my installation, this file is located under <font face="Courier New">/etc/eucalyptus</font>.</p>
<p>All of the options that we plan on configuring are located under the &#8220;Networking options&#8221; section in <font face="Courier New">eucalyptus.conf</font> namely options starting with &#8220;<i>VNET_</i>&#8221;</p>
<p>We, first, start by configuring <font face="Courier New">VNET_PRIVINTERFACE</font> and <font face="Courier New">VNET_PUBINTERFACE</font>. VNET_PRIVINTERFACE should be set to the ethernet device that is attached to the same physical ethernet as the Nodes. In my case, <font face="Courier New">eth0</font>.</p>
<pre class="java-codeface">
VNET_PRIVINTERFACE="eth0"
</pre>
<p>Next, if your front-end has a second ethernet device, say <font face="Courier New">eth1</font>, which is used to access the public network, you could configure <font face="Courier New">VNET_PUBINTERFACE</font> to this. In my case, I have only one ethernet device <font face="Courier New">eth0</font>. Therefore I set <font face="Courier New">VNET_PUBINTERFACE</font> to <font face="Courier New">eth0</font> </p>
<pre class="java-codeface">
VNET_PUBINTERFACE="eth0"
</pre>
<p><i>Ignore</i> the <font face="Courier New">VNET_BRIDGE</font> since it is only valid for the Nodes. </p>
<p>In MANAGED configuration, Eucalyptus maintains a DHCP server that it uses to dole out IP addresses to virtual machine instances. Therefore it needs the location of <font face="Courier New">dhcp</font> daemon. In my case this is <font face="Courier New">/usr/sbin/dhcpd</font> and in my CentOS OS it is configured to run as <font face="Courier New">root</font> user. Therefore I leave the <font face="Courier New">VNET_DHCPUSER</font> commented out since by default Eucalyptus will setup the DHCPD configuration files/directories to be owned by <font face="Courier New">root</font> user.</p>
<pre class="java-codeface">
VNET_DHCPDAEMON="/usr/sbin/dhcpd"
#VNET_DHCPUSER="root"
</pre>
<p>If your DHCP daemon is set to run as a non-root user (for example, in Ubuntu it is set to run under <font face="Courier New">dhcpd</font> user), then un-comment <font face="Courier New">VNET_DHCPUSER</font> and update this value accordingly.</p>
<p>Next, comment out <font face="Courier New">VNET_MODE=SYSTEM</font> (<i>out-of-the-box</i> networking mode) since our objective is to use MANAGED networking.</p>
<p>So, let un-comment out the line <font face="Courier New">VNET_MODE=&#8221;MANAGED&#8221;</font>.</p>
<p>Next, let&#8217;s set the values for <font face="Courier New">VNET_SUBNET</font> and <font face="Courier New">VNET_NETMASK</font>. In my case, according to &#8220;<a href="#checklist1">Checklist #1: Available range of IP addresses for private VLAN</a>&#8220;, we define these values as follows:</p>
<pre class="java-codeface">
VNET_SUBNET="10.10.0.0"
VNET_NETMASK="255.255.0.0"
</pre>
<p>Update your values accordingly. This makes 65536 (<i>256 * 256 = 65536</i>) IP addresses available to Eucalyptus to assign as private IP addresses to virtual machine instances.</p>
<p>Next, I set the number of IP addresses allowed per network (security group per user) to 32 i.e. the option <font face="Courier New">VNET_ADDRSPERNET</font>:</p>
<pre class="java-codeface">
VNET_ADDRSPERNET="32"
</pre>
<p>The setting above allows for 2048 (<i>65536 / 32 = 2048</i>) networks to be <i>active</i> simultaneously. Depending on your <font face="Courier New">VNET_SUBNET</font>, <font face="Courier New">VNET_NETMASK</font>, and <font face="Courier New">VNET_ADDRSPERNET</font> values, the number of concurrent active networks will be different that mine.</p>
<p>Also, in my case if I end up having, say, 100 users, then each user will have a maximum of 20 networks (<i>2048 / 100 = 20.48</i>) in operation at any given point in time.</p>
<p>Next, we set the VNET_DNS to the same DNS server used by my front-end machine. You can find your DNS server by looking in the <font face="Courier New">/etc/resolv.conf</font> file as follows:</p>
<pre class="java-codeface">
cat /etc/resolv.conf
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
; generated by /sbin/dhclient-script<br />
search wave.local<br />
nameserver 192.168.0.2
</div>
<p>So I set VNET_DNS with:</p>
<pre class="java-codeface">
VNET_DNS="192.168.0.2"
</pre>
<p>Next, you will want to assign public IP addresses to your instances &#8211; very much like Amazon EC2 instances. This gives users the ability to log into their instances from outside the cluster/front-end. But first you must find a set of public IP addresses that are not in use.</p>
<p><i>Note:</i> Talk to your LAN administrator at this point to see if he can give you a bunch of IP addresses (a range will be great) that Eucalyptus can use to assign to instances at boot or dynamically at instance run time.</p>
<p>The public IP addresses you pick must be capable of being assigned to the front-end. In my case, I have 192.168.3.1 &#8211; 192.168.3.255 addresses available on my LAN network. I confirm that the IP addresses can be assigned to the front-end NIC <font face="Courier New">eth0</font> as follows:<br />
For example, for IP address 192.168.3.1</p>
<pre class="java-codeface">
ip a add 192.168.3.1/32 dev eth0
ping 192.168.3.1
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.<br />
64 bytes from 192.168.3.1: icmp_seq=1 ttl=64 time=0.099 ms<br />
64 bytes from 192.168.3.1: icmp_seq=2 ttl=64 time=0.054 ms<br />
64 bytes from 192.168.3.1: icmp_seq=3 ttl=64 time=0.062 ms</p>
<p>&#8212; 192.168.3.1 ping statistics &#8212;<br />
3 packets transmitted, 3 received, 0% packet loss, time 2010ms<br />
rtt min/avg/max/mdev = 0.054/0.071/0.099/0.021 ms
</p></div>
<p>Perfect. I now configure VNET_PUBLICIPS as follows:</p>
<pre class="java-codeface">
VNET_PUBLICIPS="192.168.3.1-192.168.3.31"
</pre>
<p><i>Note:</i> I&#8217;ve deliberately, for no particular reason, configured the range to be only allow for 31 public IP addresses. </p>
<p>If you have individual IP addresses instead of range, then separate each IP address with a space.</p>
<p>Next, comes <font face="Courier New">VNET_CLOUDIP</font> and <font face="Courier New">VNET_LOCALIP</font>. Since my Cloud Controller and Cluster Controller are running on the same machine, <font face="Courier New">192.168.0.114</font>, I leave <font face="Courier New">VNET_CLOUDIP</font> commented out.<br />
Also, since I&#8217;m running a single Cluster Controller I leave <font face="Courier New">VNET_LOCALIP</font> commented out as well.</p>
<pre class="java-codeface">
#VNET_LOCALIP="your-public-interface's-ip"
#VNET_CLOUDIP="your-cloud-controller's-ip"
</pre>
<p>If your installation has multiple Cluster Controllers, and you wish to specify the IP of the Cluster Controller that all other Cluster Controllers can reach, you can set <font face="Courier New">VNET_LOCALIP</font> to that Cluster Controller&#8217;s IP address.</p>
<p>That&#8217;s all with configuring Eucalyptus to use MANAGED networking mode on the front-end. To summarize my settings on the front-end are as follows:</p>
<pre class="java-codeface">
VNET_PUBINTERFACE="eth0"
VNET_PRIVINTERFACE="eth0"
...
...
VNET_DHCPDAEMON="/usr/sbin/dhcpd"
#VNET_DHCPUSER="root"
...
...
VNET_MODE="MANAGED"
VNET_SUBNET="10.10.0.0"
VNET_NETMASK="255.255.0.0"
VNET_DNS="192.168.0.2"
VNET_ADDRSPERNET="32"
VNET_PUBLICIPS="192.168.3.1-192.168.3.31"
#VNET_LOCALIP="your-public-interface's-ip"
#VNET_CLOUDIP="your-cloud-controller's-ip"
...
...
#VNET_MODE="SYSTEM"
</pre>
</p>
<p>
<br/><br />
<strong><a name="managednetworkingNode">Node configuration &#8211; MANAGED networking mode</a></strong>
</p>
<p>
Next, we need to configure the Nodes for MANAGED networking mode. In my case, my Nodes are <font face="Courier New">192.168.0.19</font> and <font face="Courier New">192.168.5.7</font>. </p>
<p>Again, all the options that we plan on configuring are located under the &#8220;Networking options&#8221; section in <font face="Courier New">eucalyptus.conf</font>. We are mainly concerned with options <font face="Courier New">VNET_PRIVINTERFACE</font>, <font face="Courier New">VNET_PUBINTERFACE</font>, and <font face="Courier New">VNET_MODE</font>.</p>
<p>Let&#8217;s start with VNET_PRIVINTERFACE and VNET_PUBINTERFACE. Both these options should be set to the ethernet device that is attached to the same physical ethernet as the Cluster Controller. In my case, <font face="Courier New">eth0</font>. </p>
<pre class="java-codeface">
VNET_PUBINTERFACE="eth0"
VNET_PRIVINTERFACE="eth0"
</pre>
<p>We also un-comment the line <font face="Courier New">VNET_MODE=&#8221;MANAGED&#8221;</font> and comment <font face="Courier New">VNET_MODE=&#8221;SYSTEM&#8221;</font></p>
<p>That&#8217;s all with configuring Eucalyptus to use MANAGED networking mode on the Nodes. To summarize my settings on the Nodes are as follows:</p>
<pre class="java-codeface">
VNET_PUBINTERFACE="eth0"
VNET_PRIVINTERFACE="eth0"
...
...
VNET_MODE="MANAGED"
#VNET_MODE="SYSTEM"
</pre>
<p>Now we are ready to restart Eucalyptus on both front-end and Nodes.
</p>
</p>
<p>
<br/><br />
<strong><a name="restartEucalyptus">Restart Eucalyptus with MANAGED networking mode</a></strong>
</p>
<p>
On the front-end, first do a &#8220;clean&#8221; start of the Cluster Controller as follows:</p>
<pre class="java-codeface">
/etc/init.d/eucalyptus-cc cleanstart
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Starting Eucalyptus cluster controller: done.
</div>
<p><i>Note:</i> A clean start of the Cluster Controller is necessary when you update any Eucalyptus settings for the changes to take effect.</p>
<p>Next, start the Cloud Controller:</p>
<pre class="java-codeface">
/etc/init.d/eucalyptus-cloud start
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
Starting Eucalyptus services: walrus sc cloud done.
</div>
<p>Verify that Eucalyptus (Cloud Controller, Cluster Controller) is started on the front-end:</p>
<pre class="java-codeface">
ps auxww | grep euca | grep -v euca
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
root      3583  0.0  0.1   9840  1484 ?        Ss   10:49   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />
500       3584  0.0  0.3  13480  3160 ?        S    10:49   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />
500       3585  0.0  0.3  13480  3160 ?        S    10:49   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />
500       3586  0.0  0.3  13480  3160 ?        S    10:49   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />
500       3587  0.0  0.3  13480  3160 ?        S    10:49   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />
500       3588  0.0  0.3  13480  3160 ?        S    10:49   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />
root      3667  0.0  0.0   1852   220 ?        Ss   10:49   0:00 eucalyptus-cloud &#8211;remote-dns &#8211;disable-iscsi -h / -u eucalyptus &#8211;pidfile //var/run/eucalyptus/eucalyptus-cloud.pid -f -L console-log<br />
root      3668  124 16.0 812212 164964 ?       Rl   10:49   0:29 eucalyptus-cloud &#8211;remote-dns &#8211;disable-iscsi -h / -u eucalyptus &#8211;pidfile //var/run/eucalyptus/eucalyptus-cloud.pid -f -L console-log
</div>
<p>Moving on to the Nodes, start the Node Controllers as follows:</p>
<pre class="java-codeface">
/etc/init.d/eucalyptus-nc start
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
You should have at least 32 loop devices<br />
Starting Eucalyptus services:<br />
Enabling bridge netfiltering for eucalyptus.<br />
done.
</div>
<p>Verify that Eucalyptus (Node Controller) is started on the Nodes:</p>
<pre class="java-codeface">
ps auxww | grep euca | grep -v euca
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
root      4375  0.0  0.1   9856  1484 ?        Ss   10:55   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-nc.conf<br />
500       4376  0.0  0.3  15376  3448 ?        S    10:55   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-nc.conf
</div>
</p>
<p>
<br/><br />
<strong><a name="test">Testing our Eucalyptus MANAGED networking</a></strong>
</p>
<p>
Recall in our post on <a href="http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/#test" target="_blank">Setting up a private cloud using Eucalyptus</a>, we had installed the Amazon EC2 API Tools. Let&#8217;s run a few commands to test Eucalyptus MANAGED networking, especially some of the settings such as the public IP addresses that we set in the Eucalyptus configuration on the front-end:</p>
<pre class="java-codeface">
ec2-describe-availability-zones verbose
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
[Deprecated] Xalan: org.apache.xml.res.XMLErrorResources_en_US<br />
AVAILABILITYZONE	rosh-cluster1	192.168.0.114<br />
AVAILABILITYZONE	|- vm types	free / max   cpu   ram  disk<br />
AVAILABILITYZONE	|- m1.small	0002 / 0004   1    128     2<br />
AVAILABILITYZONE	|- c1.medium	0002 / 0004   1    256     5<br />
AVAILABILITYZONE	|- m1.large	0001 / 0002   2    512    10<br />
AVAILABILITYZONE	|- m1.xlarge	0000 / 0000   2   1024    20<br />
AVAILABILITYZONE	|- c1.xlarge	0000 / 0000   4   2048    20
</div>
<p>You will notice in the above output that it seems like I have some instances running &#8211; <i>free < max</i>. Infact I did start an instance (using <font face="Courier New">ec2-run-instances</font> command) so we could see MANAGED networking in action.</p>
<pre class="java-codeface">
ec2-describe-instances
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
[Deprecated] Xalan: org.apache.xml.res.XMLErrorResources_en_US<br />
RESERVATION	r-352406B2	admin	default<br />
INSTANCE	i-4BAA0834	emi-839A0EC7	192.168.3.1	10.10.1.2	running	test2_key	0		m1.large	2010-05-26T18:20:47+0000	rosh-cluster1	eki-9065137F	eri-E86014C4		monitoring-false
</div>
<p>As you can see my instance <font face="Courier New">i-4BAA0834</font> has a public IP address of <font face="Courier New">192.168.3.1</font> and a private IP address of <font face="Courier New">10.10.1.2</font>. </p>
<p>When Eucalyptus booted up my instance it assigned the instance <font face="Courier New">192.168.3.1</font> from the list of public IP addresses (see <font face="Courier New">VNET_PUBLICIPS</font> in section <a href="#managednetworkingFrontend">Front-end configuration &#8211; MANAGED networking mode</a>). Eucalyptus also assigned the instance a private IP address <font face="Courier New">10.10.1.2</font> from the range of unused IP addresses (see <font face="Courier New">VNET_SUBNET</font> in section <a href="#managednetworkingFrontend">Front-end configuration &#8211; MANAGED networking mode</a>).</p>
<p>Also, if you run ec2-describe-addresses you will see the public IP addresses (VNET_PUBLICIPS) that are in use and available.</p>
<pre class="java-codeface">
ec2-describe-addresses
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
[Deprecated] Xalan: org.apache.xml.res.XMLErrorResources_en_US<br />
ADDRESS	192.168.3.1	i-4BAA0834 (eucalyptus)<br />
ADDRESS	192.168.3.10	nobody<br />
ADDRESS	192.168.3.11	nobody<br />
ADDRESS	192.168.3.12	nobody<br />
ADDRESS	192.168.3.13	nobody<br />
ADDRESS	192.168.3.14	nobody<br />
ADDRESS	192.168.3.15	nobody<br />
ADDRESS	192.168.3.16	nobody<br />
ADDRESS	192.168.3.17	nobody<br />
ADDRESS	192.168.3.18	nobody<br />
ADDRESS	192.168.3.19	nobody<br />
ADDRESS	192.168.3.2	nobody<br />
ADDRESS	192.168.3.20	nobody<br />
ADDRESS	192.168.3.21	nobody<br />
ADDRESS	192.168.3.22	nobody<br />
ADDRESS	192.168.3.23	nobody<br />
ADDRESS	192.168.3.24	nobody<br />
ADDRESS	192.168.3.25	nobody<br />
ADDRESS	192.168.3.26	nobody<br />
ADDRESS	192.168.3.27	nobody<br />
ADDRESS	192.168.3.28	nobody<br />
ADDRESS	192.168.3.29	nobody<br />
ADDRESS	192.168.3.3	nobody<br />
ADDRESS	192.168.3.30	nobody<br />
ADDRESS	192.168.3.31	nobody<br />
ADDRESS	192.168.3.4	nobody<br />
ADDRESS	192.168.3.5	nobody<br />
ADDRESS	192.168.3.6	nobody<br />
ADDRESS	192.168.3.7	nobody<br />
ADDRESS	192.168.3.8	nobody<br />
ADDRESS	192.168.3.9	nobody
</div>
</p>
<p>
<br/><br />
So now when Eucalyptus boots up instances, the instances will be assigned a private address and a public address, similar to Amazon EC2 instances.</p>
<p>So you are now running a <i>Amazon EC2-like</i> cloud in your datacenter using Eucalyptus!</p>
<p>In up-coming posts in this series of &#8220;Building a private Cloud&#8221;, we will look how to bundle/register images, run instances, and more importantly how Platform-as-a-Service complements Infrastructure-as-a-Service.
</p></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.plexibus.com/2010/05/26/eucalyptus-configuring-your-private-cloud-to-resemble-amazon-ec2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Eucalyptus: Setting up a private infrastructure cloud</title>
		<link>http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/</link>
		<comments>http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/#comments</comments>
		<pubDate>Wed, 19 May 2010 22:18:57 +0000</pubDate>
		<dc:creator>roshanallan</dc:creator>
				<category><![CDATA[Appistry]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloudiq]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[eucalyptus]]></category>
		<category><![CDATA[eucalyptus centos install]]></category>
		<category><![CDATA[eucalyptus configuration]]></category>
		<category><![CDATA[eucalyptus install]]></category>
		<category><![CDATA[eucalyptus setup]]></category>
		<category><![CDATA[eucalyptus tutorial]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[IaaS]]></category>
		<category><![CDATA[infrastructure as a service]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[installing eucalyptus]]></category>
		<category><![CDATA[opennebula]]></category>
		<category><![CDATA[plexibus]]></category>
		<category><![CDATA[private]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/</guid>
		<description><![CDATA[There are a few Infrastructure-as-a-Service offerings that available to download and use. Eucalyptus and OpenNebula are two such offerings. I ended up installing and experimenting with both Eucalyptus and OpenNebula. In this blog post, I&#8217;ll detail my experience of installing and setting up Eucalyptus 1.6.2 on CentOS.
For the sake of keeping things simple but still [...]]]></description>
			<content:encoded><![CDATA[<p>There are a few Infrastructure-as-a-Service offerings that available to download and use. <a href="http://www.eucalyptus.com/" target="_blank">Eucalyptus</a> and <a href="http://www.opennebula.org/" target="_blank">OpenNebula</a> are two such offerings. I ended up installing and experimenting with both Eucalyptus and OpenNebula. In this blog post, I&#8217;ll detail my experience of installing and setting up Eucalyptus 1.6.2 on CentOS.</p>
<p>For the sake of keeping things simple but still practical enough, we will have:</p>
<ul>
<li>1 front-end machine. This will house the Cloud Controller (CLC) and  Walrus. Since we intend to keep things fairly simple we will limit ourselves to a single cluster and setup the Cluster Controller (CC) and Storage Controller (SC) on this same machine. In my case, this machine has one network interface (NIC) with an IP address of 192.168.0.114.</li>
<p>
<li>2 machines (Nodes) that will serve as hosts running <a href="http://www.xen.org/" target="_blank">Xen</a> hypervisor for the virtual machines i.e. each machine will have a Node Controller (NC) installed. In my case, each machine has a single NIC and the IP addresses are 192.168.0.19 and 192.168.5.7 respectively. </li>
<p></ul>
<p>Before we install Eucalyptus we need to first prep these machines. </p>
<p><i>Note:</i> For the rest of this document, run the commands as <font face="Courier New">root</font> user. 
</p>
<p></p>
<p>
This document is organized as below. Feel free to skip any sections if you have already implemented the steps in that section. <br/></p>
<table>
<tr>
<td><a href="#prepwork">Prepare the machines</a></td>
</tr>
<tr>
<td><a href="#download">Download Eucalyptus</a></td>
</tr>
<tr>
<td><a href="#installfront">Install Eucalyptus on the Front-end</a></td>
</tr>
<tr>
<td><a href="#installnode">Install Eucalyptus on the Nodes</a></td>
</tr>
<tr>
<td><a href="#run">Run Eucalyptus</a></td>
</tr>
<tr>
<td><a href="#register">Register Eucalyptus components</a></td>
</tr>
<tr>
<td><a href="#configure">First-time Configuration</a></td>
</tr>
<tr>
<td><a href="#test">Test your Eucalyptus install</a></td>
</tr>
</table>
<p><br/>
</p>
<p></p>
<p>
<br />
<strong><a name="prepwork">Prep work</a></strong></p>
<p>
On the front-end machine, we first install <a href="http://java.sun.com/" target="_blank">Java</a> and <a href="http://ant.apache.org" target="_blank">Ant</a>. You can download Sun JDK from <a href="http://java.sun.com/javase/downloads/widget/jdk6.jsp" target="_blank">here</a> and Ant from <a href="http://ant.apache.org/bindownload.cgi" target="_blank">here</a> . I&#8217;m using JDK version 1.6u20 (jdk-6u20-linux-i586-rpm.bin) and Ant version 1.8.0 (apache-ant-1.8.0-bin.tar.gz).</p>
<p>Once you have downloaded Sun JDK to a directory, install it as follows:</p>
<pre class="java-codeface">
chmod +x jdk-6u20-linux-i586-rpm.bin
./jdk-6u20-linux-i586-rpm.bin
</pre>
<p>You can confirm that java is on the PATH by running the following command:</p>
<pre class="java-codeface">java -version</pre>
<p>You should output similar to:
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">java version &#8220;1.6.0_19&#8243;<br />Java(TM) SE Runtime Environment (build 1.6.0_19-b04)<br />Java HotSpot(TM) Client VM (build 16.2-b04, mixed mode, sharing)</div>
<p>Next, install Ant under <font face="Courier New">/opt</font> directory as follows:</p>
<pre class="xml-codeface">
cd /opt
mkdir ant
cd ant
tar zxvf ~/apache-ant-1.8.0-bin.tar.gz
ln -s apache-ant-1.8.0 latest
</pre>
<p>
Next, we need to add an environment variable ANT_HOME that points to <font face="Courier New">/opt/ant/latest</font> and append the <font face="Courier New">$ANT_HOME/bin</font> to the PATH environment variable. Add this to the <font face="Courier New">/etc/profile</font> file as follows:</p>
<pre class="java-codeface">
cd /etc
cp profile profile.ORIG
echo "export ANT_HOME=/opt/ant/latest" &gt;&gt; profile
echo "export PATH=\$PATH:\$ANT_HOME/bin" &gt;&gt; profile
</pre>
<p>Next we need to install a few dependencies (dhcp, bridge-utils, httpd, xen-libs, ntp) and synchronize the system clock on the front-end machine. You can do this as follows:</p>
<pre class="java-codeface">
yum update
yum install dhcp xen-libs httpd bridge-utils ntp
ntpdate pool.ntp.org
</pre>
<p>I have the following versions installed:</p>
<pre class="java-codeface">
yum list dhcp xen-libs httpd bridge-utils
</pre>
<p></p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">Loaded plugins: fastestmirror<br />Loading mirror speeds from cached hostfile<br /> * addons: mirror.fdcservers.net<br /> * base: mirrors.ecvps.com<br /> * extras: mirror.ubiquityservers.com<br /> * updates: mirror.ubiquityservers.com<br />Installed Packages<br />bridge-utils.i386                                                                                       1.1-2                                                                                                           installed<br />dhcp.i386                                                                                               12:3.0.5-21.el5_4.1                                                                                             installed<br />httpd.i386                                                                                              2.2.3-31.el5.centos.4                                                                                           installed<br />xen-libs.i386                                                                                           3.0.3-94.el5_4.3                                                                                                installed<br />Available Packages<br />dhcp.i386                                                                                               12:3.0.5-23.el5                                                                                                 base     <br />httpd.i386                                                                                              2.2.3-43.el5.centos                                                                                             base     <br />xen-libs.i386                                                                                           3.0.3-105.el5                                                                                                   base     
</div>
<p>We also allow the front-end machine to forward IP packets as follows:</p>
<pre class="java-codeface">
cd /etc
cp sysctl.conf sysctl.conf.ORIG
sed -i "s/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/" sysctl.conf
</pre>
<p>
To change this value immediately without rebooting, run the following command:</p>
<pre class="java-codeface">
sysctl -p /etc/sysctl.conf
</pre>
<p>Next, we need to configure firewall rules to permit the various Eucalyptus communicate with each other. Since we are planning on using security groups in Eucalyptus, let&#8217;s start with disabling SELinux on the front-end machine as follows:</p>
<pre class="java-codeface">
cd /etc/selinux
cp config config.ORIG
sed -i "s/SELINUX=permissive/SELINUX=disabled/" config
</pre>
<p>Let&#8217;s reboot the front-end machine at this point.</p>
<p>Next, we need to prep the two Nodes. We start by installing xen hypervisor and also synchronize the system clock on each Node as follows:</p>
<pre class="java-codeface">
yum update
yum install xen ntp
ntpdate pool.ntp.org
</pre>
<p>I have the following versions of xen installed:</p>
<pre class="java-codeface">
yum list xen
</pre>
<p></p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">Loaded plugins: fastestmirror<br />Loading mirror speeds from cached hostfile<br /> * addons: mirror.ash.fastserv.com<br /> * base: mirror.ubiquityservers.com<br /> * extras: mirror.steadfast.net<br /> * updates: hpc.arc.georgetown.edu<br />Installed Packages<br />xen.i386                                                                                                3.0.3-94.el5_4.3                                                                                                installed<br />Available Packages<br />xen.i386                                                                                                3.0.3-105.el5                                                                                                   base     
</div>
<p>Once we have Xen installed we need to configure it to allow for the hypervisor to be controlled via HTTP from localhost. We can do this by editing <font face="Courier New">/etc/xen/xend-config.sxp</font> file and then restart xen daemon as follows:</p>
<pre class="java-codeface">
cd /etc/xen
cp xend-config.sxp xend-config.sxp.ORIG
sed -i "s/#(xend-http-server no)/(xend-http-server yes)/" xend-config.sxp
sed -i "s/#(xend-address localhost)/(xend-address localhost)/" xend-config.sxp
/etc/init.d/xend restart
</pre>
<p>Next we need to make sure the correct kernel with xen enabled is started at boot. We do this by editing the GRUB configuration file (<font face="Courier New">grub.conf</font>) under <font face="Courier New">/boot/grub</font>. If grub.conf is not available, then edit <font face="Courier New">menu.lst</font> which should be a file instead of a symlink to <font face="Courier New">grub.conf</font>. <br />In my case, <font face="Courier New">/boot/grub/grub.conf</font> is:</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);"># grub.conf generated by anaconda<br />#<br /># Note that you do not have to rerun grub after making changes to this file<br /># NOTICE:  You have a /boot partition.  This means that<br />#          all kernel and initrd paths are relative to /boot/, eg.<br />#          root (hd0,0)<br />#          kernel /vmlinuz-version ro root=/dev/sda3<br />#          initrd /initrd-version.img<br />#boot=/dev/sda<br />default=1<br />timeout=5<br />splashimage=(hd0,0)/grub/splash.xpm.gz<br />hiddenmenu<br />title CentOS (2.6.18-164.15.1.el5xen)<br />	root (hd0,0)<br />	kernel /xen.gz-2.6.18-164.15.1.el5<br />	module /vmlinuz-2.6.18-164.15.1.el5xen ro root=LABEL=/<br />	module /initrd-2.6.18-164.15.1.el5xen.img<br />title CentOS (2.6.18-164.15.1.el5)<br />	root (hd0,0)<br />	kernel /vmlinuz-2.6.18-164.15.1.el5 ro root=LABEL=/<br />	initrd /initrd-2.6.18-164.15.1.el5.img<br />title CentOS (2.6.18-164.el5)<br />	root (hd0,0)<br />	kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/<br />	initrd /initrd-2.6.18-164.el5.img</div>
<p>The <i>default</i> line is the line we want to change. The first <i>title</i> is 0. Since we want <i>title</i> <b>CentOS (2.6.18-164.15.1.el5xen)</b> to be the default kernel we would set <i>default</i> to 0.<br />
We can do this as follows:</p>
<pre class="java-codeface">
cd /boot/grub
cp grub.conf grub.conf.ORIG
sed -i "default=1/default=0/" grub.conf
</pre>
<p>
Next, we disable SELinux on the Node machines as follows:</p>
<pre class="java-codeface">
cd /etc/selinux
cp config config.ORIG
sed -i "s/SELINUX=permissive/SELINUX=disabled/" config
</pre>
<p>Let&#8217;s reboot both Node machines at this point. We are not ready to proceed with the installation of Eucalyptus.<br />

</p>
<p></p>
<p>
<br />
<strong><a name="download">Download Eucalyptus</a></strong></p>
<p>You could choose to install Eucalyptus via <font face="Courier New">yum</font> if needed which is easier that <br />You can downloaded Eucalyptus from <a href="http://open.eucalyptus.com/downloads" target="_blank">here</a>. I picked the 32-bit CentOS 5 rpms that come bundled in a <a href="http://open.eucalyptus.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://eucalyptussoftware.com/downloads/releases/eucalyptus-1.6.2-centos-i386.tar.gz&amp;nid=1346" target="_blank">gzip compressed tar</a> file.</p>
<p><i>Note:</i> Different Eucalyptus components need to be installed on the front-end and each of the Node machines. The aforementioned tar.gz file contains all Eucalyptus components though. Therefore download it once on the front-end and then copy this file over to each of the Node machines.<br />

</p>
<p></p>
<p>
<br />
<strong><a name="installfront">Install Eucalyptus on the front-end</a></strong></p>
<p>
Once you have downloaded Eucalyptus (in my case, <font face="Courier New">eucalyptus-1.6.2-centos-i386.tar.gz</font>) on the front-end, untar it to root&#8217;s home folder <font face="Courier New">/root</font>.</p>
<pre class="java-codeface">
tar zxvf eucalyptus-1.6.2-centos-i386.tar.gz
cd eucalyptus-1.6.2-centos-i386
</pre>
<p>We are ready to install. Let&#8217;s start by installing the 3rd-party dependency RPMs included in the <font face="Courier New">eucalyptus-1.6.2-rpm-deps-i386</font> directory. Install all the rpms in this directory as follows: </p>
<pre class="java-codeface">
cd eucalyptus-1.6.2-rpm-deps-i386
rpm -Uvh aoetools-21-1.el4.i386.rpm euca-axis2c-1.6.0-1.i386.rpm euca-rampartc-1.3.0-1.i386.rpm vblade-14-1mdv2008.1.i586.rpm groovy-1.6.5-1.noarch.rpm vtun-3.0.2-1.el5.rf.i386.rpm lzo2-2.02-3.el5.rf.i386.rpm
cd ..
</pre>
<p>
Note the above &#8220;<font face="Courier New">rpm -Uvh&#8230;</font>&#8221; command might fail with an error about &#8220;<i>Failed dependencies&#8230;java-sdk &gt; 1.6.0 is needed&#8230;.</i>&#8220;. To get past this error, run the above <font face="Courier New">rpm -Uvh&#8230;</font> with <b>&#8211;nodeps</b>. The error is because it is trying to look for Openjdk during installation. But we have installed Sun Java instead. Adding <font face="Courier New">&#8211;nodeps</font> will get us past this error message. Don&#8217;t worry, the Eucalyptus components will start up fine when the time comes to run them. </p>
<p>Next, let&#8217;s install the Cloud Controller, Walrus, Cluster Controller, Storage Controller, and a few other dependencies on the front-end machine as follows:</p>
<pre class="java-codeface">
rpm -Uvh eucalyptus-1.6.2-1.i386.rpm eucalyptus-common-java-1.6.2-1.i386.rpm eucalyptus-cloud-1.6.2-1.i386.rpm eucalyptus-walrus-1.6.2-1.i386.rpm eucalyptus-sc-1.6.2-1.i386.rpm eucalyptus-cc-1.6.2-1.i386.rpm eucalyptus-gl-1.6.2-1.i386.rpm
</pre>
<p>Now let&#8217;s move on the installing Eucalyptus components on the Node.<br />

</p>
<p></p>
<p>
<br />
<strong><a name="installnode">Install Eucalyptus on the Nodes</a></strong></p>
<p>
First, copy (or download) the Eucalyptus tar.gz file on each Node. Untar it to root&#8217;s home folder <font face="Courier New">/root</font>. </p>
<p><i>Note:</i> The steps in this section need to be performed on each Node (in my case on each of the two Nodes).</p>
<p>Let&#8217;s begin by installing a few 3rd-party dependency RPMs. </p>
<pre class="java-codeface">
tar zxvf eucalyptus-1.6.2-centos-i386.tar.gz
cd eucalyptus-1.6.2-centos-i386
cd eucalyptus-1.6.2-rpm-deps-i386
rpm -Uvh aoetools-21-1.el4.i386.rpm euca-axis2c-1.6.0-1.i386.rpm euca-rampartc-1.3.0-1.i386.rpm
cd ..
</pre>
<p>Next, we install the Node Controller (and a couple of dependencies) on each Node as follows:</p>
<pre class="java-codeface">
rpm -Uvh eucalyptus-1.6.2-1.i386.rpm eucalyptus-gl-1.6.2-1.i386.rpm eucalyptus-nc-1.6.2-1.i386.rpm
</pre>
<p>Next, confirm that the user <font face="Courier New">eucalyptus</font> can connect with the hypervisor through <font face="Courier New">libvirt</font>.</p>
<pre class="java-codeface">
su eucalyptus -c "virsh list"
</pre>
<p>
The output of the above command should look something like:</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);"> Id Name                 State<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />  0 Domain-0             running</div>
<p><i>Note:</i> If you don&#8217;t have <font face="Courier New">libvirt</font> installed/running on the Nodes, you could install it: <font face="Courier New">yum install libvirt</font></p>
<p>That&#8217;s it with the installation!<br />

</p>
<p></p>
<p>
<br />
<strong><a name="run">Running Eucalyptus</a></strong></p>
<p>
You are now ready to start Eucalyptus up. </p>
<p>SSH to the front-end machine and start the Cluster Controller and Cloud Controller as follows:</p>
<pre class="java-codeface">
/etc/init.d/eucalyptus-cc start
/etc/init.d/eucalyptus-cloud start
</pre>
<p>Run ps command to confirm Eucalyptus is running on the front-end:</p>
<pre class="java-codeface">
ps auxww | grep euca
</pre>
<p></p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">root     30499  0.0  0.1   9840  1480 ?        Ss   May13   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />500      30500  0.3  4.7 1103496 48552 ?       S    May13  33:14 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />500      30501  0.3  4.7 1103496 48704 ?       S    May13  33:26 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />500      30502  0.3  7.3 1136720 75808 ?       R    May13  33:22 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />500      30503  0.3  3.9 1103484 40232 ?       S    May13  32:56 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />500      30504  0.3  5.0 1103568 51416 ?       S    May13  32:55 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />root     30586  0.0  0.0   1852   224 ?        Ss   May13   0:00 eucalyptus-cloud &#8211;remote-dns &#8211;disable-iscsi -h / -u eucalyptus &#8211;pidfile //var/run/eucalyptus/eucalyptus-cloud.pid -f -L console-log<br />500      30587  6.5 39.3 937236 403344 ?       Sl   May13 569:24 eucalyptus-cloud &#8211;remote-dns &#8211;disable-iscsi -h / -u eucalyptus &#8211;pidfile //var/run/eucalyptus/eucalyptus-cloud.pid -f -L console-log<br />500      30840  0.1  0.4 1137232 4824 ?        S    May13  12:53 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />500      31612  0.3  3.9 1103636 40556 ?       S    May13  32:50 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />500      31676  0.3  3.9 1103568 40400 ?       S    May13  33:09 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf<br />500      31678  0.3  4.7 1103636 48628 ?       S    May13  32:54 /usr/sbin/httpd -f //etc/eucalyptus/httpd-cc.conf
</div>
<p>
Next, SSH to each Node and start Node Controller as follows:</p>
<pre class="java-codeface">
/etc/init.d/eucalyptus-nc start
</pre>
<p>Confirm eucalyptus is running on the Nodes:</p>
<pre class="java-codeface">
ps auxww | grep euca
</pre>
<p></p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">root     20637  0.0  0.3   9856  1488 ?        Ss   May13   0:00 /usr/sbin/httpd -f //etc/eucalyptus/httpd-nc.conf<br />500      20639  0.9 10.2  80688 50904 ?        Sl   May13  78:15 /usr/sbin/httpd -f //etc/eucalyptus/httpd-nc.conf
</div>
<p>
</p>
<p></p>
<p>
<br />
<strong><a name="register">Registering Eucalyptus components</a></strong></p>
<p>
Now that you have started all components, you will need to register them so that they can talk to each other.</p>
<p>SSH to the front-end machine (in my case, 192.168.0.114) and run the following commands:</p>
<pre class="java-codeface">
euca_conf --register-walrus 192.168.0.114
euca_conf --register-cluster rosh-cluster1 192.168.0.114
euca_conf --register-sc rosh-cluster1 192.168.0.114
</pre>
<p>where,<br />
<i>192.168.0.114</i> &#8211; is the IP address of my front-end machine which has CLC, Walrus, CC and SC installed/running. Replace this with the IP address of your front-end machine in all the above commands.<br />
<i>rosh-cluster1</i> &#8211; is the cluster name that I used. Replace it with your own cluster name.</p>
<p>Next, we need to register the 2 Nodes. On the front-end machine, run the following command:</p>
<pre class="java-codeface">
euca_conf --register-nodes "192.168.0.19 192.168.5.7"
</pre>
<p>where,<br />
<i>192.168.0.19, 192.168.5.7</i> &#8211; are the 2 Nodes in my case. Replace the above IP addresses with the IP addresses of your Nodes. Add additional Nodes separated with a space.</p>
<p>You can verify that the nodes are registered by verifying that value of the <font face="Courier New">NODES</font> element in the <font face="Courier New">eucalyptus.conf</font> file on the front-end reflects the node IP addresses added via the above <font face="Courier New">euca_conf &#8211;register-nodes</font> command. In my case:</p>
<pre class="java-codeface">
grep NODES /etc/eucalyptus/eucalyptus.conf
</pre>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
NODES=&#8221; 192.168.0.19 192.168.5.7&#8243;
</div>
<p>We are done with registering the Eucalyptus components.<br />

</p>
<p></p>
<p>
<br />
<strong><a name="configure">First-time Configuration</a></strong></p>
<p>
We are now ready to perform some quick configuration. </p>
<p>Using a browser, browse to <a href="https://&lt;front-end-ip-address&gt;:8443" target="_blank">https://&lt;front-end-ip-address&gt;:8443</a>. In my case, https://192.168.0.114:8443. You will get a warning page stating that the &#8220;<i>site&#8217;s security certificate is not trusted</i>&#8220;. Since Eucalyptus is using a self-signed certificate which is not verified by a third-party that the browser trusts, shows you this warning. Accept the certificate and you will be prompted for a user_id/password. Enter <font face="Courier New">admin</font> for both.</p>
<p>Once you have logged in for the first time, you will be asked to change the password, set the admin email address, etc. Enter the relevant details and hit &#8220;Submit&#8221;.</p>
<p>On the &#8220;Configuration&#8221; web page you will see Cloud Configuration, Walrus Configuration, Clusters, etc. These should all be pre-populated. You could make changes to the configurations if you wish. I left these unchanged for now.</p>
<p>Next, browse to &#8220;Credentials&#8221; web page and click the &#8220;Download Credentials&#8221; zip file. Save the &#8220;euca2-admin-x509.zip&#8221; to a directory. You will need these credentials when you use client tools such as <font face="Courier New">euca2ools</font> to manage virtual machines, images, etc.<br />Create a <font face="Courier New">.euca</font> folder and unzip the contents of this file in this folder. Run the following command from under <font face="Courier New">.euca</font> folder:</p>
<pre class="java-codeface">
unzip euca2-admin-x509.zip
</pre>
<p>
Once you have unzipped the contents, you will find a <font face="Courier New">.eucarc</font> file that exports some variables. The <font face="Courier New">EC2_URL</font> in this case will point to your front-end machine. In my case, 192.168.0.114.</p>
<pre class="java-codeface">
cat .eucarc
</pre>
<p></p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">
EUCA_KEY_DIR=$(dirname $(readlink -f ${BASH_SOURCE}))<br />export S3_URL=http://192.168.0.114:8773/services/Walrus<br />export EC2_URL=http://192.168.0.114:8773/services/Eucalyptus<br />&#8230;<br />&#8230;
</div>
<p>Before you run any client tools, you will need to <font face="Courier New">source</font> this file.<br />

</p>
<p></p>
<p>
<br />
<strong><a name="test">Testing our Eucalyptus install</a></strong></p>
<p>
To keep things simple and quickly test our Eucalyptus installation, download <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351" target="_blank">Amazon EC2 API Tools</a>. Unzip the downloaded <font face="Courier New">ec2-api-tools.zip</font> to under the <font face="Courier New">.euca</font> folder that you created in the &#8220;First-time Configuration&#8221; section.</p>
<pre class="java-codeface">
unzip ec2-api-tools.zip
</pre>
<p>Next <font face="Courier New">source</font> the .eucarc file under and run the <font face="Courier New">ec2-describe-availability-zones</font> command provided by the <font face="Courier New">ec2-api-tools</font>. From under <font face="Courier New">.euca</font> folder run the following commands:</p>
<pre class="java-codeface">
cd .euca
source .eucarc
cd ec2-api-tools-1.3-46266/bin
ec2-describe-availability-zones verbose
</pre>
<p>You should see output <i>similar</i> to the following:</p>
<div style="width: 90%; border: 1px solid black; background-color: rgb(0, 0, 0); font-size: 11px; color: rgb(255, 255, 255);">[Deprecated] Xalan: org.apache.xml.res.XMLErrorResources_en_US<br />AVAILABILITYZONE	rosh-cluster1	192.168.0.114		<br />AVAILABILITYZONE	|- vm types	free / max   cpu   ram  disk		<br />AVAILABILITYZONE	|- m1.small	0004 / 0004   1    128     2		<br />AVAILABILITYZONE	|- c1.medium	0004 / 0004   1    256     5		<br />AVAILABILITYZONE	|- m1.large	0002 / 0002   2    512    10		<br />AVAILABILITYZONE	|- m1.xlarge	0000 / 0000   2   1024    20		<br />AVAILABILITYZONE	|- c1.xlarge	0000 / 0000   4   2048    20		
</div>
<p>where,<br />
<i>rosh-cluster1</i> &#8211; is the cluster I registered using euca_conf and in my case, it corresponds to the Cluster Controller running on my front-end machine (192.168.0.114)</p>
<p>If you see something like the above, give yourself a pat on the back!<br />

</p>
<p></p>
<p>You are now ready to bundle images and create instances from those images on your own private infrastructure cloud!<br />
</p>
</p>
<p>
<br />
<strong>Related Articles:</strong><br />
<a href="http://blogs.plexibus.com/2010/05/26/eucalyptus-configuring-your-private-cloud-to-resemble-amazon-ec2/">Configuring your private cloud</a><br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.plexibus.com/2010/05/19/eucalyptus-setting-up-a-private-infrastructure-cloud/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Appistry CloudIQ on Ubuntu</title>
		<link>http://blogs.plexibus.com/2010/01/04/appistry-cloudiq-on-ubuntu/</link>
		<comments>http://blogs.plexibus.com/2010/01/04/appistry-cloudiq-on-ubuntu/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 14:26:39 +0000</pubDate>
		<dc:creator>roshanallan</dc:creator>
				<category><![CDATA[Appistry]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloudiq]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[appistry cloud platform]]></category>
		<category><![CDATA[cloudiq engine]]></category>
		<category><![CDATA[cloudiq manager]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blogs.plexibus.com/2010/01/04/appistry-cloudiq-on-ubuntu/</guid>
		<description><![CDATA[
In this post, I have laid out instructions on installing Appistry CloudIQ on Ubuntu. Since Appistry does not provide a .deb package on it&#8217;s download site, I composed these instructions once I converted and installed the .rpm on my Ubuntu OS.
The various steps detailed below are available as a script that you can download and [...]]]></description>
			<content:encoded><![CDATA[<p>
In this post, I have laid out instructions on installing Appistry CloudIQ on Ubuntu. Since Appistry does not provide a .deb package on it&#8217;s download site, I composed these instructions once I converted and installed the .rpm on my Ubuntu OS.<br />
The various steps detailed below are available as a script that you can download and run. See &#8220;Download&#8221; section below.</p>
<p>Note: <i>These instructions should work with other Debian flavors as well.</i>
</p>
<div style="float: right; margin: 10px 0 10px 30px; padding: 10px 20px 20px 20px; width: 33%; border: 1px solid black; background-color: #F4F4F4; font-size: 11px;">
<strong>What is Appistry CloudIQ</strong>?</p>
<p>
<a href="http://www.appistry.com/">Appistry</a> <a href="http://www.appistry.com/products">CloudIQ</a> is a Cloud Platform that can be installed on-premise in your lab/datacenter OR on public infrastructure cloud offerings such as Amazon EC2, RackSpace cloud, GoGrid, etc.</p>
<p>Appistry CloudIQ not only enables enterprises to deploy/manage applications onto physical or virtualized infrastructure but also provides an environment that allows applications to scale linearly and reliably.
</p>
</div>
<p>
<strong>Download Appistry-CloudIQ</strong><br />
Download the rpm package for Appistry-CloudIQ from the Community site. The <a href="http://www.appistry.com/community/content/downloads">free Community edition</a> is great to start building a small enterprise cloud on-premise. For the purpose of this post, I&#8217;m Appistry-CloudIQ Platform 4.2 Community edition for RHEL 5.x, x86 32-bit version.
</p>
<p>
After you have downloaded, you should see something like this:</p>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
roshan@ubuntuWorkerB:~$ ls -l<br />
total 44988<br />
-rw-r&#8211;r&#8211; 1 roshan roshan 46015607 2009-12-17 14:57 appistry-cloudiq-4.2.1.2-rhel5.rpm
</div>
</p>
<p>
<strong>Create .deb package</strong><br />
Once you have the package downloaded, use <font face="Courier New">alien</font> to convert the rpm to a .deb package using the commands below. The package <font face="Courier New">alien</font> allows you to convert rpm packages to debian packages and then install them via <font face="Courier New">dpkg</font>. See <a href="http://blogs.plexibus.com/2010/01/04/install-rpms-packages-on-ubuntu-using-alien-2/">how-to</a> install <font face="Courier New">alien</font>how-to</font>.</p>
<p>Convert the rpm package to the debian package using the following command:</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ sudo alien -kc appistry-cloudiq-4.2.1.2-rhel5.rpm
</pre>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
appistry-cloudiq_4.2.1.2-rhel5_i386.deb generated
</div>
</p>
<p>
<strong>Install the .deb pacakge</strong><br />
Now that you have the .deb package, install it using <font face="Courier New">dpkg</font>.</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ sudo dpkg -i appistry-cloudiq_4.2.1.2-rhel5_i386.deb
</pre>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
(Reading database &#8230; 47465 files and directories currently installed.)<br />
Unpacking appistry-cloudiq (from appistry-cloudiq_4.2.1.2-rhel5_i386.deb) &#8230;<br />
Setting up appistry-cloudiq (4.2.1.2-rhel5) &#8230;<br />
Adding group &#8216;fabricuser&#8217;<br />
Adding user &#8216;fabricuser&#8217;<br />
Usage: useradd [options] LOGIN</p>
<p>Options:<br />
  -b, &#8211;base-dir BASE_DIR       base directory for the new user account<br />
                                home directory<br />
  -c, &#8211;comment COMMENT         set the GECOS field for the new user account<br />
  -d, &#8211;home-dir HOME_DIR       home directory for the new user account<br />
  -D, &#8211;defaults                print or save modified default useradd<br />
                                configuration<br />
  -e, &#8211;expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE<br />
  -f, &#8211;inactive INACTIVE       set password inactive after expiration<br />
                                to INACTIVE<br />
  -g, &#8211;gid GROUP               force use GROUP for the new user account<br />
  -G, &#8211;groups GROUPS           list of supplementary groups for the new<br />
                                user account<br />
  -h, &#8211;help                    display this help message and exit<br />
  -k, &#8211;skel SKEL_DIR           specify an alternative skel directory<br />
  -K, &#8211;key KEY=VALUE           overrides /etc/login.defs defaults<br />
  -l,                           do not add the user to the lastlog and<br />
                                faillog databases<br />
  -m, &#8211;create-home             create home directory for the new user<br />
                                account<br />
  -N, &#8211;no-user-group           do not create a group with the same name as<br />
                                the user<br />
  -o, &#8211;non-unique              allow create user with duplicate<br />
                                (non-unique) UID<br />
  -p, &#8211;password PASSWORD       use encrypted password for the new user<br />
                                account<br />
  -r, &#8211;system                  create a system account<br />
  -s, &#8211;shell SHELL             the login shell for the new user account<br />
  -u, &#8211;uid UID                 force use the UID for the new user account<br />
  -U, &#8211;user-group              create a group with the same name as the user</p>
<p>chown: invalid user: `fabricuser:fabricuser&#8217;
</p></div>
</p>
<p>
The install fails to create the user &#8220;fabricuser&#8221;. So let&#8217;s create it and add it to group &#8220;fabricuser&#8221;.</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ sudo useradd -s /bin/bash -g fabricuser fabricuser
</pre>
<p>You can confirm that the user was created by running the following command:</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ cat /etc/passwd | grep fabricuser
</pre>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
fabricuser:x:1001:1001::/home/fabricuser:/bin/bash
</div>
</p>
<p>
<strong>Change ownership of /usr/local/appistry/cloudiq to fabricuser</strong><br />
Change ownership of the /usr/local/appistry/cloudiq directory recursively to fabricuser using the following command:</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ sudo chown -R fabricuser:fabricuser /usr/local/appistry/cloudiq
</pre>
</p>
<p>
<strong>Update scripts and create <font face="Courier New">/bin/arch</font> script</strong><br />
First, update the start-up scripts &#8211; fabric_keeper and fabric_system_service to explicitly use the <font face="Courier New">/bin/bash</font> interpreter. These two scripts are located under <font face="Courier New">/etc/init.d</font> directory.</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ sudo sed -ie 's/\/bin\/sh/\/bin\/bash/g' /etc/init.d/fabric_system_service
roshan@ubuntuWorkerB:~$ sudo sed -ie 's/\/bin\/sh/\/bin\/bash/g' /etc/init.d/fabric_keeper
</pre>
<p>The reason for doing this is because of the <i><a href="http://blogs.plexibus.com/2010/01/04/bashisms-and-ubuntu/">bashisms</a></i> that exist in the two scripts. </p>
<div style="float: right; margin: 10px 0 10px 30px; padding: 10px 20px 20px 20px; width: 33%; border: 1px solid black; background-color: #F4F4F4; font-size: 11px;">
<strong>Bashisms</strong></p>
<p>
<i>Bashisms</i> are bash extensions that are not strictly POSIX compliant. Using some of these extensions can lead to portability issues between different shells.
</p>
<p>
Appsitry CloudIQ start-up scripts contain some <i>bashisms</i> such as <font face="Courier New">let</font> which cause the scripts to fail when <font face="Courier New">dash</font> runs them. Therefore the explicit change from <font face="Courier New">/bin/sh</font> to <font face="Courier New">/bin/bash</font>. A cleaner approach would be to remove these <i>bashisms</i> which perhaps the Appistry CloudIQ developers will get around to doing so sometime in the near future. If you have a few more minutes on your hand, feel free to remove the <i>bashisms</i>
</p>
</div>
<p>Next, we need to create an executable script <font face="Courier New">arch</font> under the <font face="Courier New">/bin</font> directory.</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ echo "uname -m" &gt; arch
roshan@ubuntuWorkerB:~$ sudo mv arch /bin/.; sudo chmod +x /bin/arch
</pre>
<p>The reason for doing this is because the start-up scripts <font face="Courier New">source</font> in <font face="Courier New">/etc/fabric_env</font> references <font face="Courier New">/bin/arch</font> which does not exist in Ubuntu since version 7.10. This causes the start-up scripts to fail. See <a href="https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/148511">https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/148511</a> for more information.
</p>
<p>
<strong>Set up symlinks for libssl.so.6 and libcrypto.so.6 shared libraries</strong><br />
Since the start up scripts attempt to load the libssl.so.6 and libcrypto.so.6 shared libraries, create symlinks with these names under <font face="Courier New">/usr/lib</font> directory.</p>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
roshan@ubuntuWorkerB:~$ cd /usr/lib<br />
roshan@ubuntuWorkerB:~$ ls -l libss*<br />
lrwxrwxrwx 1 root root 20 2009-11-30 15:28 /usr/lib/libssl.so.0.9.8 -> /lib/libssl.so.0.9.8<br />
roshan@ubuntuWorkerB:/usr/lib$ ls -l libcrypto*<br />
lrwxrwxrwx 1 root root 23 2009-11-30 15:28 libcrypto.so.0.9.8 -> /lib/libcrypto.so.0.9.8
</div>
<pre class="java-codeface">
roshan@ubuntuWorkerB:/usr/lib$ sudo ln -s libssl.so.0.9.8 libssl.so.6
roshan@ubuntuWorkerB:/usr/lib$ sudo ln -s libcrypto.so.0.9.8 libcrypto.so.6
</pre>
<p>If you do not create the above symlinks you will get errors like:</p>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
Starting Appistry Fabric System Service: ./fabric_system_service: error while loading shared libraries: libssl.so.6: cannot open shared object file: No such file or directory
</div>
<p>and</p>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
Starting Appistry Fabric System Service: ./fabric_system_service: error while loading shared libraries: libcrypto.so.6: cannot open shared object file: No such file or directory
</div>
</p>
<p>
<strong>Set up init script links to start Appistry CloudIQ at boot</strong><br />
Next, we need to set up init scripts links to have Appistry CloudIQ start up at boot. We do this as follows:</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ sudo update-rc.d fabric_system_service start 99 2 3 4 5 . stop 01 0 1 6 .
roshan@ubuntuWorkerB:~$ sudo update-rc.d fabric_keeper start 99 2 3 4 5 . stop 01 0 1 6 .
</pre>
</p>
<p>
<strong>Reboot to start Appistry CloudIQ</strong><br />
Reboot Ubuntu. You should see the following messages when Ubuntu is restarting.</p>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
Starting Appistry Fabric Keeper:<br />
Starting Appistry Fabric System Service:
</div>
<p>Also, start <font face="Courier New">log_monitor</font>. You should see heartbeat messages.</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ . /etc/fabric_env
roshan@ubuntuWorkerB:~$ log_monitor 239.255.0.1
</pre>
<div style="width: 90%; border: 1px solid black; background-color: #000; font-size: 11px; color: #FFF">
Monitor listening on: 239.255.0.1:4000<br />
Jan 02 15:03:49 10.0.2.15 RegionService[I:8011] Location: 10.0.2.15 Region: 239.255.0.1:32000 Heartbeat size: 1<br />
Jan 02 15:03:53 10.0.2.15 RegionService[I:8011] Location: 10.0.2.15 RegionLeaderRegion:  Heartbeat size: 1<br />
Jan 02 15:03:56 10.0.2.15 RegionService[I:8011] Location: 10.0.2.15 Region: 239.255.0.1:32000 Heartbeat size: 1<br />
Jan 02 15:04:02 10.0.2.15 RegionService[I:8011] Location: 10.0.2.15 Region: 239.255.0.1:32000 Heartbeat size: 1<br />
Jan 02 15:04:04 10.0.2.15 RegionService[I:8011] Location: 10.0.2.15 RegionLeaderRegion:  Heartbeat size: 1<br />
Jan 02 15:04:08 10.0.2.15 RegionService[I:8011] Location: 10.0.2.15 Region: 239.255.0.1:32000 Heartbeat size: 1
</div>
<p>You now have the world&#8217;s best cloud platform &#8211; Appistry CloudIQ &#8211; running on Ubuntu.
</p>
<p>
In future posts, we will see how to create/migrate/manage infrastructure and applications to the &#8220;cloud&#8221; using Appistry CloudIQ
</p>
<p>
<strong>Downloads</strong><br />
Download the following script and place it alongside the appistry-cloudiq-X.x.rpm that you downloaded from the Appistry Community website. </p>
<p><a href='http://blogs.plexibus.com/wp-content/uploads/2010/01/cloudiq-ubuntu-install.sh'>cloudiq-ubuntu-install.sh</a></p>
<p>Next, run the script as follows:</p>
<pre class="java-codeface">
roshan@ubuntuWorkerB:~$ sudo sh cloudiq-ubuntu-install.sh appistry-cloudiq-4.2.1.2-rhel5.rpm
</pre>
<p>where, appistry-cloudiq-4.2.1.2-rhel5.rpm is the version that I downloaded.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.plexibus.com/2010/01/04/appistry-cloudiq-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cloud series &#8211; Part 1: What is the cloud, really?</title>
		<link>http://blogs.plexibus.com/2009/02/03/cloud-series-part-1-what-is-the-cloud-really/</link>
		<comments>http://blogs.plexibus.com/2009/02/03/cloud-series-part-1-what-is-the-cloud-really/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 20:45:10 +0000</pubDate>
		<dc:creator>roshanallan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[Appistry]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[EAF]]></category>
		<category><![CDATA[fabric]]></category>
		<category><![CDATA[load balance]]></category>
		<category><![CDATA[platform]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blogs.plexibus.com/?p=49</guid>
		<description><![CDATA[I ran across this post on DZone recently where the author of the post posed a bunch of questions related to &#8220;cloud&#8221;. I decided the only way to attempt to answer these questions would be in a series of blog posts. So here goes&#8230;
What is the Cloud, really?
As the author of the above post noted [...]]]></description>
			<content:encoded><![CDATA[<p>I ran across this <a href="http://java.dzone.com/news/what-cloud">post</a> on DZone recently where the author of the post posed a bunch of questions related to &#8220;cloud&#8221;. I decided the only way to attempt to answer these questions would be in a series of blog posts. So here goes&#8230;</p>
<h3>What is the Cloud, really?</h3>
<p>As the author of the above post noted &#8211; it is certainly a buzz word (when you add <i>computing</i> to it) and according to the New Oxford American Dictionary you could even call it &#8220;vapor&#8221; <img src='http://blogs.plexibus.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>
noun</p>
<p>1. a visible mass of condensed water vapor floating in the atmosphere, typically high above the ground.
</p></blockquote>
<p>But what is the cloud, <em>really</em>? I&#8217;m going to plagiarize the following definition from an <a href="http://www.cio.com/article/print/439814">article</a> on CIO.com</p>
<blockquote><p>
&#8220;a pool of abstracted, highly-scalable, and managed compute infrastructure capable of hosting end-customer applications and billed by consumption&#8221;
</p></blockquote>
<p>But, IMHO, the above definition does not give the term cloud computing enough justice. But it comes close! Therefore let&#8217;s look at this definition a little closer:</p>
<p><strong>pool</strong> &#8211; 2 or more<br />
<strong>compute infrastructure (read <i>machines</i>)</strong> &#8211; could be commodity ($200 workstations &#8211; Ugly Betty style) or high-end multi-processor, multi-core (Paris Hilton style) machines. I&#8217;ll leave it at that for now and not elaborate further on infrastructure (it&#8217;s a loaded word).</p>
<p>Hmmm&#8230;so far we have 2 or more machines (starting to look like a cluster or group to me)</p>
<p>Now let&#8217;s understand the other words in this context:<br />
<strong>abstract</strong> &#8211; meaning the complexity of the infrastructure is taken away or hidden from the user.<br />
Or in other words, the user does not care whether the machines (hardware) are commodity or expensive, OR what flavor of Operating Systems (OSes) (could be one of the many Linux, Linux or Windows distros) are being used, or whether machines are runing single OSes or housing guest OSes (software) </p>
<p>This leaves us with: A cluster of abstract hardware/software (we&#8217;ll call it machines so it&#8217;s not a mouthful) hosting end-customer applications. </p>
<p>Going back to a few more words in the definition:<br />
<strong>scalable</strong> &#8211; the ability to expand and handle additional load without having to change the software or business applications. In &#8220;Infrastructure Clouds&#8221; (another buzz word &#8211; I&#8217;ll touch on this in a future post), this means adding more machines or more images (using virtualization) to meet growing demands on the end-customer applications.</p>
<p><strong>managed</strong> &#8211; select, plan, organize, control<br />
i.e. some effort is required in supporting the infrastructure &#8211; a system or network administrator in most cases.</p>
<p>Again, this leaves us with:<br />
A cluster of select machines hosting end-customer applications capable of growing when load on the customer applications increases.</p>
<p><em>Holy potatoes!</em> Does this mean have we been using cloud computing all this while? To a certain extent, <em>yes</em>.</p>
<p>For example, when web-based email first came out you and I hopped happily on-board. Little did (and even today) we care about how many machines or what flavor of OS was (and still is) servicing our requests. All we care is that it is available 24/7. Perhaps we should add &#8220;<strong>Highly Available</strong>&#8221; the above definition. </p>
<p>Or how about that application that your company built in-house and then deployed on one server only to add another server and another and so on as the application got more and more popular. The application users do not know or care if there is 1 or more servers housing your application. Again, all they care about is that it meets their business needs.</p>
<p>Of course we all know that clustering means having something load-balance the load across each server based on some algorithm such as round-robin, cpu load per server, etc.</p>
<p>So is cloud computing plain old clustering front-ended with a load-balancer? Partly true &#8211; Clustering with load-balancing is only <strong>one aspect</strong> of the cloud. And it comes packaged with the cloud!</p>
<h3>An integrated clustering solution</h3>
<p>Certain cloud products such as <a href="http://www.appistry.com/products/eaf/index.html">Appistry EAF</a> or cloud providers such as <a href="http://aws.amazon.com/ec2/">Amazon EC2</a> offer a <strong>load-balancing solution out of the box</strong>.</p>
<p>
In traditional clustering/load-balancing, you would need to setup and configure a load-balancer to spread the load across the machines. This generally proves cumbersome if you are new to the load-balancer product/solution. In other words, you are spending: </p>
<ul>
<li>time &#8211; researching, configuring, setting up, managing a load balancer</li>
<li>optionally, money &#8211; if you have purchased one or planning on purchasing one</li>
</ul>
<p>By using a cloud product or cloud provider, you could save time and costs. And therefore, time and cost to market your business application is drastically reduced.
</p>
<p>
Another key point that separates cloud computing from traditional clustering is how <u>static traditional load-balancing/clustering</u> is. Imagine needing a physical or virtual machine to scale out your business application as it gets popular. But not being able to do it <strong><u>quickly</u></strong> because:</p>
<ol>
<li>you have to procure a machine or create an image</li>
<li>provision the machine/image with your business application</li>
<li>configure the load-balancer to recognize this machine as a part of the cluster and start spreading requests to it</li>
</ol>
<p>Using a cloud product or cloud provider alleviates such issues since you will have machines/images at your disposal right away. And when you provision and deploy your machine/image the load-balancing solution that is provided out of the box will recognize the new machine/image and start spraying client/application requests to it.</p>
<p><strong>Food for thought:</strong> Imagine the situation where your application does not need the machine/image you just added and you want to take a machine out of the cluster and add it to a different cluster of machines serving another business application? <em>Elasticity</em>, anyone?</p>
<p>I&#8217;ll stop here for now on traditional clustering vs cloud computing. A more detailed pros and cons in another post perhaps.</p>
<h3>So let&#8217;s see who can benefit from this right away?</h3>
<ul>
<li>Companies who do not have the time and resources to invest in a IT department to manage their applications/data. Such companies could either use Amazon EC2 or some other public cloud (another buzz word &#8211; more on this in a later post) offering.</li>
<li>Software-as-a-Service (more buzz words) or business application vendors who want to stay focussed on their core business and want to have a hassle-free option of hosting their applications. Like the above, such companies stand to benefit quickly from cloud offerings.</li>
<li>Businesses who are spending huge amounts of money out-sourcing the management of their data centers to old fashioned IT Consulting firms who either host the data/applications off-site or place pricey consultants on-site. Such companies could also go with a public cloud or private cloud offering.</li>
<li>What about developers? As a developer I&#8217;ve worked on prototypes &#8211; for customer demonstrations, proof of concepts, test some theory. And during this time, if I needed multiple machines, it was generally hard to find or I would need to jump through hoops to get my hands on these resources. Suddenly having a cloud of resources certainly sounds appealing, doesn&#8217;t it! And not having to deal with load-balancers is a bonus.</li>
<p>In this post I talked about about only one aspect of cloud &#8211; clustering with load-balancing which isn&#8217;t anything new. But what separates traditional clustering from <u>cloud level clustering is the <strong>dynamic nature</strong></u>:</p>
<ul>
<li>The ability to add/remove machines and provision applications easily and quickly</li>
<li>The luxury of not having to deal with the complexities of a load-balancer but still have a load-balancing solution underneath the covers</li>
</ul>
<p>
So for companies not wanting to invest time in researching, setting up clusters and managing load-balancers, but still wanting to quickly market their products, cloud is a great solution.</p>
<p>In the next post in this series, I&#8217;ll talk how another characteristic of cloud &#8211; scalability made easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.plexibus.com/2009/02/03/cloud-series-part-1-what-is-the-cloud-really/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fabric/grid enable Spring beans with Appistry EAF</title>
		<link>http://blogs.plexibus.com/2008/06/21/code-example-using-spring-beans-with-appistry-eaf-38/</link>
		<comments>http://blogs.plexibus.com/2008/06/21/code-example-using-spring-beans-with-appistry-eaf-38/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 05:13:57 +0000</pubDate>
		<dc:creator>roshanallan</dc:creator>
				<category><![CDATA[Build]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[Appistry EAF]]></category>
		<category><![CDATA[AppistryEAF]]></category>
		<category><![CDATA[fabric]]></category>
		<category><![CDATA[grid computing]]></category>
		<category><![CDATA[maven2]]></category>
		<category><![CDATA[plexibus]]></category>
		<category><![CDATA[roshan]]></category>
		<category><![CDATA[sequeira]]></category>
		<category><![CDATA[spring]]></category>
		<category><![CDATA[xtp]]></category>

		<guid isPermaLink="false">http://blogs.plexibus.com/2008/06/21/code-example-using-spring-beans-with-appistry-eaf-38/</guid>
		<description><![CDATA[The following is a guide to fabric-enabling (or grid-enabling) your existing Spring beans using Appistry EAF.  We will use Maven for build configuration.
Pre-requisites to running the code sample provided:

JDK 1.5+
Appistry EAF 3.8 Release

Maven 2.0.7+.

An IDE to write/edit code. I use Eclipse 3.3.2 and the code in the zip file has eclipse-related files. But you [...]]]></description>
			<content:encoded><![CDATA[<p><big><span style="font-family: verdana;"><small>The following is a guide to fabric-enabling (or grid-enabling) your existing Spring beans using <a href="http://www.appistry.com">Appistry</a> <a href="http://www.appistry.com/products/eaf/index.html">EAF</a>.  We will use Maven for build configuration.</small></span></big></p>
<p><big><span style="font-family: verdana;"><small>Pre-requisites to running the code sample provided:</small></span></big></p>
<ul>
<li><big><span style="font-family: verdana;"><a href="http://java.sun.com/javase/downloads/index.jsp" target="_blank"><small>JDK 1.5+</small></a></span></big></li>
<li><big><span style="font-family: verdana;"><small><a href="http://www.appistry.com/developers/content/downloads/download" target="_blank">Appistry EAF 3.8 Release<br />
</a></small></span></big></li>
<li><big><span style="font-family: verdana;"><small><a href="http://maven.apache.org/download.html" target="_blank">Maven 2.0.7+.<br />
</a></small></span></big></li>
<li><big><span style="font-family: verdana;"><small>An IDE to write/edit code. I use <a href="http://www.eclipse.org/downloads" target="_blank">Eclipse</a> 3.3.2 and the code in the zip file has eclipse-related files. But you could easily download the code and use it with an IDE of your choice.</small></span></big></li>
<li><big><span style="font-family: verdana;"><small><a href="http://m2eclipse.codehaus.org" target="_blank">m2eclipse plugin</a> &#8211; maven integration for Eclipse. <em>*This is optional*, but if you are using Eclipse as your IDE, I recommend using it.</em><br />
</small></span></big></li>
</ul>
<p><span style="font-family: sans-serif;"><strong>Installing the above software<br />
</strong>See <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/Software+Development+Kit+CentOS%2C+RHEL%2C+and+SuSE+installation" target="_blank">here</a> on how to install Appistry EAF 3.8 Release on Cent OS, RHEL, and SuSE.<br />
See <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/Software+Development+Kit+Windows+Installation" target="_blank">here</a> on how to install Appistry EAF 3.8 Release on Cent OS, RHEL, and SuSE.<br />
</span></p>
<p>Installation instructions for Java, Maven and Eclipse are provided on their respective web sites.</p>
<p><strong>Creating the Maven project</strong><br />
This example is based on the tutorial samples (spring_hello_world &#8211; see tutorial_samples.zip or tutorial_samples.tgz) provided on <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/Hello+World+with+Spring+Beans" target="_blank">this</a> page.<br />
Allright, let&#8217;s get started by designing some components:</p>
<blockquote><p><em><span style="font-family: 'Courier New';">HelloWorldSpringService</span> &#8211; interface that exposes a single &#8220;greet&#8221; method. Remember &#8211; program to interfaces!</em></p>
<p><em><span style="font-family: 'Courier New';">HelloWorldSpringServiceBean</span> &#8211; provides the implementation for HelloWorldSpringService.</em></p>
<p><em><span style="font-family: 'Courier New';">HelloWorldSpringClient</span> &#8211; client that calls the HelloWorldSpringService.greet method<br />
</em></p></blockquote>
<p>Since <span style="font-family: 'Courier New';">HelloWorldSpringService</span> interface is implemented by <span style="font-family: 'Courier New';">HelloWorldSpringServiceBean</span> and is used by <span style="font-family: 'Courier New';">HelloWorldSpringClient</span>, let&#8217;s put <span style="font-family: 'Courier New';">HelloWorldSpringService</span><small><big> into a common module, say HelloWorldCommon.<br />
</big><span style="font-family: 'Courier New';"><br />
<big>HelloWorldSpringServiceBean</big></span><big> could go into a HelloWorldService module while <span style="font-family: 'Courier New';">HelloWorldSpringClient</span> could go into a HelloWorldClient module.</big></small><small><big>The above structure provides a clean separation between the interface, implementation(s), and the client.</big></small><small><big>Now that we have the structure laid out, let&#8217;s start by creating these maven modules. I&#8217;m not going to use the m2eclipse plugin to create a multi-module project in eclipse, but instead will use <a href="http://blogs.plexibus.com/2007/12/02/maven-guide-part-one/"><span style="font-family: 'Courier New';">mvn</span> from the command line</a> to create the modules. You are free to use the m2eclipse plugin to create the project and modules. <em>Usage of m2eclipse is beyond the scope of this article.</em></big></small><small><big>First, let&#8217;s create a project, HelloWorldSpring, that will be the parent of HelloWorldCommon, HelloWorldService, and HelloWorldClient. Open a shell, change to your eclipse workspace directory, type in the following command and hit enter:</big></small></p>
<blockquote><p><big><span style="font-family: 'Courier New';"><small>mvn archetype:create<br />
-DgroupId=com.appistry.samples<br />
-DartifactId=HelloWorldSpring</small></span><br />
</big></p></blockquote>
<p>The above command will create a HelloWorldSpring maven project.<br />
* Non m2eclipse plugin users: <em>If you do not plan on using m2eclipse, from the command line change directory to HelloWorldSpring directory, type the following command and hit enter:</em></p>
<blockquote><p><big><span style="font-family: 'Courier New';"><small>mvn eclipse:eclipse</small></span><br />
</big></p></blockquote>
<p>Since we want this to be the parent project, go ahead and delete the &#8220;src&#8221; directory under HelloWorldSpring. Next, edit the HelloWorldSpring&#8217;s <span style="font-family: 'Courier New';">pom.xml</span> &#8211; change the <span style="font-family: 'Courier New';">packaging</span> element&#8217;s value from <span style="font-family: 'Courier New';">jar</span> to <span style="font-family: 'Courier New';">pom</span>.</p>
<p>Next we need to create the HelloWorldCommon, HelloWorldService, and HelloWorldClient modules. Go back to your command line, and change directory to &lt;workspace&gt;/HelloWorldSpring. Type the following commands and hit enter:</p>
<blockquote><p><big><span style="font-family: 'Courier New';"><small>mvn archetype:create -DgroupId=com.appistry.samples -DartifactId=HelloWorldCommon</small></span><br />
<span style="font-family: 'Courier New';"><small>mvn archetype:create -DgroupId=com.appistry.samples -DartifactId=HelloWorldService</small></span><br />
<span style="font-family: 'Courier New';"><small>mvn archetype:create -DgroupId=com.appistry.samples -DartifactId=HelloWorldClient</small></span><br />
</big></p></blockquote>
<p>The above 3 commands create the HelloWorldCommon, HelloWorldService, and HelloWorldClient modules under &lt;workspace&gt;/HelloWorldSpring directory.<br />
* Non m2eclipse plugin users: <em>If you do not plan on using m2eclipse, from the command line change directory to HelloWorldSpring directory, type the following command and hit enter:</em></p>
<blockquote><p><big><span style="font-family: 'Courier New';"><small>mvn eclipse:eclipse</small></span><br />
</big></p></blockquote>
<p>Next, fire up Eclipse and select the workspace that you created the above maven project under. Now, create a new Project by clicking &#8220;File -&gt; New -&gt; Project&#8230;&#8221;. Select &#8220;General -&gt; Project&#8221; and hit &#8220;Next&#8221;. Type &#8220;HelloWorldSpring&#8221; for Project Name and click &#8220;Finish&#8221;.<br />
You should see, a HelloWorldSpring project with HelloWorldCommon, HelloWorldService, and HelloWorldClient under it.<br />
If you plan on using m2eclipse plugin, now would be a good time to right-click on the project and select &#8220;Maven -&gt; Enable Dependency Management&#8221; and then right-click again on the project and select &#8220;Maven -&gt; Enable Nested Modules&#8221;<big>.<br />
</big>* Non m2eclipse plugin users: <em>Right-click &#8220;java&#8221; (under HelloWorldSpring -&gt; HelloWorldCommon -&gt; src -&gt; main), select &#8220;Build Path -&gt; Use as Source Folder&#8221;. Do the same for &#8220;java&#8221; under </em><em>HelloWorldSpring -&gt; HelloWorldService -&gt; src -&gt; main</em> and <small><big><em>HelloWorldSpring -&gt; HelloWorldClient -&gt; src -&gt; main.</em></big></small><small><big><em>Now you have the HelloWorldSpring multi-module project configured under Eclipse! See Figure 1<br />
</em></big></small></p>
<p align="center"><small><img style="float: none; max-width: 800px" src="http://blogs.plexibus.com/wp-content/uploads/2008/06/appistryexamplemvnproject.png" alt="" /></small></p>
<p align="center"><small>Figure 1</small></p>
<p><small><br />
<big>Next we need to update the poms.</big><br />
<big><strong><br />
HelloWorldSpring pom.xml</strong></big></small><big><br />
</big></p>
<blockquote><p><span style="font-family: verdana;"><em>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;project xmlns=&#8221;http://maven.apache.org/POM/4.0.0&#8243; xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221; xsi:schemaLocation=&#8221;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd&#8221;&gt;<br />
&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br />
&lt;groupId&gt;com.appistry.samples&lt;/groupId&gt;<br />
&lt;artifactId&gt;HelloWorldSpring&lt;/artifactId&gt;<br />
&lt;packaging&gt;pom&lt;/packaging&gt;<br />
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;<br />
&lt;name&gt;HelloWorldSpring&lt;/name&gt;&lt;properties&gt;<br />
&lt;!&#8211; Default JDK Level &#8211;&gt;<br />
&lt;jdkLevel&gt;1.5&lt;/jdkLevel&gt;<br />
&lt;/properties&gt;</em></span><span style="font-family: verdana;"><em>&lt;modules&gt;<br />
&lt;module&gt;HelloWorldService&lt;/module&gt;<br />
&lt;module&gt;HelloWorldClient&lt;/module&gt;<br />
&lt;module&gt;HelloWorldCommon&lt;/module&gt;<br />
&lt;/modules&gt;</em></span><span style="font-family: verdana;"><em>&lt;dependencyManagement&gt;<br />
&lt;dependencies&gt;<br />
&lt;dependency&gt;<br />
&lt;groupId&gt;${project.groupId}&lt;/groupId&gt;<br />
&lt;artifactId&gt;HelloWorldCommon&lt;/artifactId&gt;<br />
&lt;version&gt;${project.version}&lt;/version&gt;<br />
&lt;/dependency&gt;<br />
&lt;/dependencies&gt;<br />
&lt;/dependencyManagement&gt;</em></span><span style="font-family: verdana;"><em>&lt;dependencies&gt;<br />
&lt;dependency&gt;<br />
&lt;groupId&gt;junit&lt;/groupId&gt;<br />
&lt;artifactId&gt;junit&lt;/artifactId&gt;<br />
&lt;version&gt;4.4&lt;/version&gt;<br />
&lt;scope&gt;test&lt;/scope&gt;<br />
&lt;/dependency&gt;<br />
&lt;/dependencies&gt;</em></span><span style="font-family: verdana;"><em>&lt;build&gt;<br />
&lt;pluginManagement&gt;<br />
&lt;plugins&gt;<br />
&lt;plugin&gt;<br />
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;<br />
&lt;!&#8211;&lt;version&gt;2.0.2&lt;/version&gt;&#8211;&gt;<br />
&lt;executions&gt;<br />
&lt;execution&gt;<br />
&lt;id&gt;compile&lt;/id&gt;<br />
&lt;phase&gt;compile&lt;/phase&gt;<br />
&lt;goals&gt;<br />
&lt;goal&gt;compile&lt;/goal&gt;<br />
&lt;/goals&gt;<br />
&lt;/execution&gt;<br />
&lt;execution&gt;<br />
&lt;id&gt;unit-test-compile&lt;/id&gt;<br />
&lt;goals&gt;<br />
&lt;goal&gt;testCompile&lt;/goal&gt;<br />
&lt;/goals&gt;<br />
&lt;/execution&gt;<br />
&lt;/executions&gt;<br />
&lt;configuration&gt;<br />
&lt;source&gt;${jdkLevel}&lt;/source&gt;<br />
&lt;target&gt;${jdkLevel}&lt;/target&gt;<br />
&lt;/configuration&gt;<br />
&lt;/plugin&gt;</em></span><span style="font-family: verdana;"><em>&lt;plugin&gt;<br />
&lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;<br />
&lt;version&gt;2.4.2&lt;/version&gt;<br />
&lt;configuration&gt;<br />
&lt;excludes&gt;<br />
&lt;exclude&gt;**/*$*&lt;/exclude&gt;<br />
&lt;/excludes&gt;<br />
&lt;/configuration&gt;<br />
&lt;/plugin&gt;</em></span><span style="font-family: verdana;"><em>&lt;plugin&gt;<br />
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br />
&lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;<br />
&lt;version&gt;1.1&lt;/version&gt;<br />
&lt;/plugin&gt;</em></span></p>
<p><span style="font-family: verdana;"><em>&lt;plugin&gt;<br />
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br />
&lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;<br />
&lt;version&gt;2.0&lt;/version&gt;<br />
&lt;/plugin&gt;<br />
&lt;/plugins&gt;<br />
&lt;/pluginManagement&gt;<br />
&lt;/build&gt;</em></span></p>
<p><span style="font-family: verdana;"><em>&lt;/project&gt;</em></span></p></blockquote>
<p><strong>HelloWorldService pom.xml</strong><br />
Add HelloWorldCommon dependency to HelloWorldService</p>
<blockquote><p><em>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;project&gt;<br />
&lt;parent&gt;<br />
&lt;artifactId&gt;HelloWorldSpring&lt;/artifactId&gt;<br />
&lt;groupId&gt;com.appistry.samples&lt;/groupId&gt;<br />
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;<br />
&lt;/parent&gt; </em><em>&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br />
&lt;artifactId&gt;HelloWorldService&lt;/artifactId&gt;<br />
&lt;name&gt;HelloWorldService&lt;/name&gt;</em><em>&lt;dependencies&gt;<br />
&lt;dependency&gt;<br />
&lt;groupId&gt;${project.groupId}&lt;/groupId&gt;<br />
&lt;artifactId&gt;HelloWorldCommon&lt;/artifactId&gt;<br />
&lt;version&gt;${project.version}&lt;/version&gt;<br />
&lt;/dependency&gt;<br />
&lt;/dependencies&gt;<br />
&lt;/project&gt;</em></p></blockquote>
<p><strong>HelloWorldClient pom.xml<br />
</strong>Add HelloWorldCommon dependency to HelloWorldClient. You will also need to add Spring as a dependency. I&#8217;m using Spring 2.5.4.<big><br />
</big></p>
<blockquote><p><em>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;project&gt;<br />
&lt;parent&gt;<br />
&lt;artifactId&gt;HelloWorldSpring&lt;/artifactId&gt;<br />
&lt;groupId&gt;com.appistry.samples&lt;/groupId&gt;<br />
&lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;<br />
&lt;/parent&gt;&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br />
&lt;artifactId&gt;HelloWorldClient&lt;/artifactId&gt;<br />
&lt;name&gt;HelloWorldClient&lt;/name&gt;</em><em>&lt;dependencies&gt;<br />
&lt;dependency&gt;<br />
&lt;groupId&gt;${project.groupId}&lt;/groupId&gt;<br />
&lt;artifactId&gt;HelloWorldCommon&lt;/artifactId&gt;<br />
&lt;version&gt;${project.version}&lt;/version&gt;<br />
&lt;/dependency&gt;<br />
&lt;dependency&gt;<br />
&lt;groupId&gt;org.springframework&lt;/groupId&gt;<br />
&lt;artifactId&gt;spring&lt;/artifactId&gt;<br />
&lt;version&gt;2.5.4&lt;/version&gt;<br />
&lt;/dependency&gt;<br />
&lt;dependency&gt;<br />
&lt;groupId&gt;commons-logging&lt;/groupId&gt;<br />
&lt;artifactId&gt;commons-logging&lt;/artifactId&gt;<br />
&lt;version&gt;1.1.1&lt;/version&gt;<br />
&lt;/dependency&gt;<br />
&lt;/dependencies&gt;<br />
&lt;/project&gt;</em></p></blockquote>
<p><big><br />
<span style="font-family: 'Courier New';"><small></small></span></big></p>
<p><big><span style="font-family: 'Courier New';"><small></small></span></big>Now we are ready to code the <span style="font-family: 'Courier New';">HelloWorldSpringService</span>, <span style="font-family: 'Courier New';">HelloWorldSpringServiceBean</span>, and <span style="font-family: 'Courier New';">HelloWorldSpringClient</span>.</p>
<p><strong>HelloWorldSpringService</strong><br />
The <span style="font-family: 'Courier New';">HelloWorldSpringService</span> has one method <span style="font-family: 'Courier New';">greet</span> which takes a <span style="font-family: 'Courier New';">String</span> parameter<span style="font-family: 'Courier New';">.<br />
</span></p>
<pre class="java-codeface">package com.appistry.samples.spring.helloworld;

public interface HelloWorldSpringService {
    String greet(String name);
}</pre>
<p>This interface goes under the HelloWorldCommon module under HelloWorldCommon/src/main/java.</p>
<p><strong>HelloWorldSpringServiceBean</strong><br />
The <span style="font-family: 'Courier New';">HelloWorldSpringServiceBean</span> class implements <span style="font-family: 'Courier New';">HelloWorldSpringService</span> interface. It goes under the HelloWorldService/src/main/java.</p>
<pre class="java-codeface">package com.appistry.samples.spring.helloworld.impl;

import com.appistry.samples.spring.helloworld.HelloWorldSpringService;

public class HelloWorldSpringServiceBean implements HelloWorldSpringService {

	public String greet(String name) {
		return "Hello World, " + name;
	}
}</pre>
<p><strong>HelloWorldSpringClient</strong><br />
Next, add the client that calls <span style="font-family: 'Courier New';">HelloWorldSpringService.greet</span>. <span style="font-family: 'Courier New';">HelloWorldSpringClient</span> class goes under HelloWorldClient/src/main/java.</p>
<pre class="java-codeface">package com.appistry.samples.spring.helloworld;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class HelloWorldSpringClient {

    public static void main(String[] args) {
	ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("helloWorldClient-appContext.xml");

        HelloWorldSpringService localHWS = (HelloWorldSpringService) appContext.getBean("localHelloWorldBean");
System.out.println(localHWS.greet("locally."));

    }
}</pre>
<p><span style="font-family: 'Courier New';">helloWorldClient-appContext.xml</span> is detailed below and it goes under HelloWorldClient/src/main/resources (add the &#8220;resources&#8221; directory under HelloWorldClient/src/main as a &#8220;source&#8221; folder in Eclipse):</p>
<blockquote><p><span style="font-family: 'Courier New';"><em>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;!DOCTYPE beans PUBLIC &#8220;-//SPRING//DTD BEAN//EN&#8221; &#8220;http://www.springframework.org/dtd/spring-beans.dtd&#8221;&gt;</em></span><span style="font-family: 'Courier New';"><em>&lt;beans&gt;<br />
&lt;bean id=&#8221;localHelloWorldBean&#8221; class=&#8221;com.appistry.samples.spring.helloworld.impl.HelloWorldSpringServiceBean&#8221;/&gt;<br />
&lt;/beans&gt;</em></span></p></blockquote>
<p><span style="font-family: 'Courier New';"><br />
</span>Let&#8217;s package, install and run HelloWorldSpring. From the command, type the following command from under &lt;workspace&gt;/HelloWorldSpring to package and install HelloWorldSpring artifacts to your local maven repository.</p>
<blockquote><p><big><span style="font-family: 'Courier New';"><small>mvn clean install</small></span><br />
</big></p></blockquote>
<p>From Eclipse, run <span style="font-family: 'Courier New';">HelloWorldSpringClient</span> as a Java Application. You should see an output like this:<big><br />
</big></p>
<blockquote><p><big><span style="font-family: arial;">&#8230;<br />
&#8230;<br />
<small>Jun 20, 2008 4:35:26 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons</small><br />
<small>INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@18a7efd: defining beans [localHelloWorldBean,fabricHelloWorldBean,fabric]; root of factory hierarchy</small><br />
<strong><small>Hello World, locally.</small></strong><br />
</span></big></p></blockquote>
<p>The HelloWorldSpringClient application loads the <span style="font-family: 'Courier New';">helloWorldClient-appContext.xml</span> spring application context, gets a reference to the HelloWorldSpringServiceBean and calls the greet method on it. So far we have seen nothing with regards to the fabric/grid. <big></big><big></big>If you would like to take a break, now would be a good time to do so. Go on. I&#8217;ll be right here.</p>
<p><strong>Exposing the HelloWorldSpringServiceBean as a fabric bean</strong><br />
To expose our existing HelloWorldSpringServiceBean in the fabric, we need to package and deploy the HelloWorldSpringServiceBean into the fabric.<br />
Let&#8217;s begin by first defining the HelloWorldSpringServiceBean in a spring application context (<span style="font-family: 'Courier New';">spring_hello_world_bean.xml</span>).</p>
<blockquote><p><span style="font-family: 'Courier New';"><em>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;!DOCTYPE beans PUBLIC &#8220;-//SPRING//DTD BEAN//EN&#8221; &#8220;http://www.springframework.org/dtd/spring-beans.dtd&#8221;&gt;</em></span><span style="font-family: 'Courier New';"><em>&lt;beans&gt;<br />
&lt;bean id=&#8221;HelloWorldBean&#8221; class=&#8221;com.appistry.samples.spring.helloworld.impl.HelloWorldSpringServiceBean&#8221;/&gt;<br />
&lt;/beans&gt;</em></span></p></blockquote>
<p><small><big>Place this file under HelloWorldService/src/main/resources</big></small><br />
<small><big><strong>Note:</strong> Do we <em>need</em> to expose this in the fabric as a spring bean? No. We could have exposed it as a regular POJO. But the purpose of this example is to show Spring integration with Appistry EAF.</big></small><br />
<small><big>Now that we have wired the HelloWorldSpringServiceBean in a spring container, we need to define this bean as a Fabric Java Component. This is accomplished using the <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/Component+Definition+XML" target="_blank">EAF Component Definition XML</a>.</big></small></p>
<p><strong>springHWSvc-component-defn.xml</strong></p>
<blockquote><p><span style="font-family: 'Courier New';"><em>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br />
&lt;java-components xmlns=&#8221;http://www.appistry.com/ns/component&#8221; xmlns:xsi=&#8221;http://www.w3.org/2001/XMLSchema-instance&#8221; xsi:schemaLocation=&#8221;http://www.appistry.com/ns/component eaf-component.xsd&#8221;&gt;</em></span><span style="font-family: 'Courier New';"><em>&lt;component name=&#8221;mvnSpringHWSvcComponent&#8221; default-timeout=&#8221;5&#8243;&gt;<br />
&lt;spring-bean name=&#8221;HelloWorldBean&#8221;/&gt;<br />
&lt;/component&gt;<br />
&lt;/java-components&gt;</em></span></p></blockquote>
<p><big><br />
</big>where,<br />
the name attribute of the spring-bean element should<strong> match</strong> the bean id defined in the <span style="font-family: 'Courier New';">spring_hello_world_bean.xml</span> spring application context. In this case, HelloWorldBean.<br />
The default-timeout specifies how long to wait for a call (to a method) to return before timing out. In this case, we have specified 5 seconds.</p>
<p>Place this file under HelloWorldService/src/main/scripts for now.</p>
<p><small><big>So how does the EAF tie the component definition file and the spring application context? This is done via the <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/Fabric+Application+Definition+XML" target="_blank">EAF Fabric Application Definition XML</a>.</big></small><small><big>The fabric application definition file describes the various files that comprise a EAF fabric application. This file is used by the <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/fabric_pkg" target="_blank">Fabric Package</a> (which we will encounter momentarily) to bundle these files into &#8220;<em>.fabric</em>&#8221; package.</big></small></p>
<p><strong>springHWSvc-fabric-app-defn.xml</strong></p>
<blockquote><p><span style="font-family: 'Courier New';"><em>&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;!DOCTYPE app SYSTEM &#8220;FabricApp.dtd&#8221;&gt;&lt;app name=&#8221;mvnSpringHelloWorldSvc&#8221; version=&#8221;1.0.0&#8243;&gt;<br />
&lt;spring&gt;<br />
&lt;bean-factory-locator bean=&#8221;myBeanFactory&#8221; resource-location=&#8221;beanRefFactory.xml&#8221;/&gt;<br />
&lt;/spring&gt;</em></span><span style="font-family: 'Courier New';"><em>&lt;components&gt;<br />
&lt;file name=&#8221;springHWSvc-component-defn.xml&#8221;/&gt;<br />
&lt;/components&gt;</em></span><span style="font-family: 'Courier New';"><em>&lt;java-libs&gt;<br />
&lt;file name=&#8221;HelloWorldCommon.jar&#8221;/&gt;<br />
&lt;file name=&#8221;HelloWorldService.jar&#8221;/&gt;<br />
&lt;file name=&#8221;spring.jar&#8221;/&gt;<br />
&lt;file name=&#8221;commons-logging.jar&#8221;/&gt;<br />
&lt;/java-libs&gt;<br />
&lt;/app&gt;<big><br />
</big></em></span></p></blockquote>
<p>where,<br />
components, file &#8211; is component definition file that we defined earlier<br />
java-libs &#8211; dependant java libraries that will be included in the <span style="font-family: 'Courier New';">.fabric</span> application.</p>
<p>Place this file under HelloWorldService/src/main/scripts</p>
<p>The interesting element in this file is the . The bean-factory-locator element provides the Fabric with an implementation of Spring <span style="font-family: 'Courier New';">BeanFactory</span> to enable it to access spring bean containers / application contexts. The <span style="font-family: 'Courier New';">BeanFactory</span> (provided to the Fabric) is itself described in a spring application context. In this case, <span style="font-family: 'Courier New';">beanRefFactory.xml</span>.</p>
<p><strong>beanRefFactory.xml</strong><br />
<small><br />
</small></p>
<blockquote><p><span style="font-family: 'Courier New';"><big><small><em>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;!DOCTYPE beans PUBLIC &#8220;-//SPRING//DTD BEAN//EN&#8221; &#8220;http://www.springframework.org/dtd/spring-beans.dtd&#8221;&gt;&lt;beans&gt;<br />
&lt;bean id=&#8221;myBeanFactory&#8221; class=&#8221;org.springframework.context.support.ClassPathXmlApplicationContext&#8221;&gt;<br />
&lt;constructor-arg value=&#8221;spring_hello_world_bean.xml&#8221;/&gt;<br />
&lt;/bean&gt;<br />
&lt;/beans&gt;</em></small></big></span></p></blockquote>
<p>The bean id in <span style="font-family: 'Courier New';">beanRefFactory.xml</span> should match the &#8220;bean&#8221; attribute of bean-factory-locator in the fabric application definition xml. In this case, myBeanFactory.<br />
In the above application context, we have configured the ClassPathXmlApplicationContext (a super set of the BeanFactory) and pass it the name of the application context, <span style="font-family: 'Courier New';">spring_hello_world_bean.xml</span>, that contains our HelloWorldSpringServiceBean.</p>
<p>Place the <span style="font-family: 'Courier New';">beanRefFactory.xml</span> under HelloWorldService/src/main/resources</p>
<p>Now we are ready to package our HelloWorldSpringServiceBean, so we can deploy it on the fabric. As you can see we have not modified the java code at all. All we have done so far is configure the HelloWorldSpringServiceBean POJO in a spring application context, describe the bean as a fabric Java component, and tie these elements (along with the BeanFactory) together using a fabric definition file. <em>Non-intrusive, eh?</em></p>
<p><strong>Build and Package HelloWorldSpringServiceBean</strong><br />
Packaging the application into <span style="font-family: 'Courier New';">.fabric</span> file can be accomplished using the <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/fabric_pkg" target="_blank">fabric pkg</a> command. The fabric package command takes a fabric application definition file as input and bundles the application files into a single package (<span style="font-family: 'Courier New';">.fabric</span>). We can configure the fabric package in the HelloWorldService pom.xml. But before we do this, we need to first download the dependant jars listed in the java-libs section of the fabric application definition xml (<small><big><span style="font-family: 'Courier New';">springHWSvc-fabric-app-defn.xml</span>) to a particular directory. This can be defined in the HelloWorldService pom.xml as well. Add the following snippet (after the <span style="font-family: 'Courier New';">dependencies</span> element and before the closing <span style="font-family: 'Courier New';">project</span> tag) to the HelloWorldService <span style="font-family: 'Courier New';">pom.xml</span>:</big></small><small> </small></p>
<blockquote><p><span style="font-family: 'Courier New';"><big><small><em>&lt;build&gt;<br />
&lt;plugins&gt;<br />
&lt;plugin&gt;<br />
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br />
&lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;<br />
&lt;version&gt;2.0&lt;/version&gt;<br />
&lt;executions&gt;<br />
&lt;execution&gt;<br />
&lt;id&gt;copy-required-dependencies&lt;/id&gt;<br />
&lt;phase&gt;install&lt;/phase&gt;<br />
&lt;goals&gt;<br />
&lt;goal&gt;copy&lt;/goal&gt;<br />
&lt;/goals&gt;<br />
&lt;configuration&gt;<br />
&lt;stripVersion&gt;true&lt;/stripVersion&gt;<br />
&lt;artifactItems&gt;<br />
&lt;artifactItem&gt;<br />
&lt;groupId&gt;${project.groupId}&lt;/groupId&gt;<br />
&lt;artifactId&gt;HelloWorldCommon&lt;/artifactId&gt;<br />
&lt;version&gt;${project.version}&lt;/version&gt;<br />
&lt;/artifactItem&gt;<br />
&lt;artifactItem&gt;<br />
&lt;groupId&gt;${project.groupId}&lt;/groupId&gt;<br />
&lt;artifactId&gt;${project.artifactId}&lt;/artifactId&gt;<br />
&lt;version&gt;${project.version}&lt;/version&gt;<br />
&lt;/artifactItem&gt;<br />
&lt;artifactItem&gt;<br />
&lt;groupId&gt;org.springframework&lt;/groupId&gt;<br />
&lt;artifactId&gt;spring&lt;/artifactId&gt;<br />
&lt;version&gt;2.5.4&lt;/version&gt;<br />
&lt;/artifactItem&gt;<br />
&lt;artifactItem&gt;<br />
&lt;groupId&gt;commons-logging&lt;/groupId&gt;<br />
&lt;artifactId&gt;commons-logging&lt;/artifactId&gt;<br />
&lt;version&gt;1.1.1&lt;/version&gt;<br />
&lt;/artifactItem&gt;<br />
&lt;/artifactItems&gt;<br />
&lt;outputDirectory&gt;${project.build.directory}/fabric-package&lt;/outputDirectory&gt;<br />
&lt;/configuration&gt;<br />
&lt;/execution&gt;<br />
&lt;/executions&gt;<br />
&lt;/plugin&gt;<br />
&lt;/plugins&gt;<br />
&lt;/build&gt;</em></small></big><br />
</span></p></blockquote>
<p>This directs Maven (at <span style="font-family: 'Courier New';">install</span> phase) to copy the HelloWorldCommon, HelloWorldService, spring and commons-logging jar files (with the versions stripped) from the local maven repository to the <span style="font-family: 'Courier New';">fabric-package</span> directory under HelloWorldService/target directory. Since I&#8217;ve listed the jar files without version numbers in the element (in <span style="font-family: 'Courier New';">springHWSvc-fabric-app-defn.xml</span> file), I tell Maven to strip the version numbers from the jar files while it&#8217;s performing the copy.</p>
<p>Now that we have addressed the jar dependencies, we are ready to configure the <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/fabric_pkg" target="_blank"><span style="font-family: 'Courier New';">fabric_pkg</span></a> command. Let&#8217;s configure the fabric package in ant build file target and call the ant build file from maven.<br />
<strong>Note:</strong> <em>You don&#8217;t have to necessarily configure the fabric_pkg in an ant build file. You could have configured it within the pom itself.</em></p>
<p>First let&#8217;s check out the ant build file.</p>
<p><strong>build.xml</strong> (goes under HelloWorldService/src/main/scripts) &#8211; just displaying the necessary snippets. The attached HelloWorldSpring-source.zip contains all the source code listed here.</p>
<blockquote><p><span style="font-family: 'Courier New';"><em>&lt;!&#8211; copy the fabric application defn xml and component defn xml to fabric-package directory &#8211;&gt;<br />
&lt;target name=&#8221;init&#8221;&gt;<br />
&lt;copy todir=&#8221;target/fabric-package&#8221;&gt;<br />
&lt;fileset dir=&#8221;src/main/scripts&#8221;&gt;<br />
&lt;include name=&#8221;**/*-defn.xml&#8221;/&gt;<br />
&lt;/fileset&gt;<br />
&lt;/copy&gt;<br />
&lt;/target&gt;</em></span><span style="font-family: 'Courier New';"><em>&lt;!&#8211; execute fabric-pkg command &#8211;&gt;<br />
&lt;target name=&#8221;fabric-package&#8221; depends=&#8221;init&#8221;&gt;<br />
&lt;exec executable=&#8221;fabric_pkg&#8221;&gt;<br />
&lt;arg line=&#8221;target/fabric-package/springHWSvc-fabric-app-defn.xml&#8221; /&gt;<br />
&lt;/exec&gt;<br />
&lt;/target&gt;</em></span></p></blockquote>
<p>Now we need to update the HelloWorldService pom.xml to call the above ant build file. Add the following snippet (after the previous plugin definition and before the closing <span style="font-family: 'Courier New';">plugins</span> tag) to the HelloWorldService <span style="font-family: 'Courier New';">pom.xml</span>.<span style="font-family: 'Courier New';"> </span></p>
<blockquote><p><span style="font-family: 'Courier New';"><em>&lt;plugin&gt;<br />
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br />
&lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt;<br />
&lt;version&gt;1.1&lt;/version&gt;<br />
&lt;executions&gt;<br />
&lt;execution&gt;<br />
&lt;id&gt;fabric-package&lt;/id&gt;<br />
&lt;phase&gt;install&lt;/phase&gt;<br />
&lt;goals&gt;<br />
&lt;goal&gt;run&lt;/goal&gt;<br />
&lt;/goals&gt;<br />
&lt;/execution&gt;<br />
&lt;/executions&gt;<br />
&lt;configuration&gt;<br />
&lt;tasks&gt;<br />
&lt;ant antfile=&#8221;src/main/scripts/build.xml&#8221; target=&#8221;fabric-package&#8221; /&gt;<br />
&lt;/tasks&gt;<br />
&lt;/configuration&gt;<br />
&lt;/plugin&gt;</em><br />
</span></p></blockquote>
<p><big><span style="font-family: 'Courier New';"><br />
</span></big>Here we direct Maven (again, at install phase) to call the &#8220;fabric-package&#8221; target of <span style="font-family: 'Courier New';">build.xml</span>. The fabric-package target first copies the <span style="font-family: 'Courier New';">springHWSvc-fabric-app-defn.xml</span> and <span style="font-family: 'Courier New';">springHWSvc-component-defn.xml</span> files to the HelloWorldService/target/fabric-package directory and then calls the <span style="font-family: 'Courier New';"><a href="http://www.appistry.com/developers/wiki/display/eaf38dev/fabric_pkg" target="_blank">fabric_pkg</a></span> executable to bundle the application files into &#8220;<span style="font-family: 'Courier New';">mvnSpringHelloWorldSvc.fabric</span>&#8221; file. You will notice that the name of the fabric file is the same as the <span style="font-family: 'Courier New';">name</span> attribute of the <span style="font-family: 'Courier New';">app</span> element in <span style="font-family: 'Courier New';">springHWSvc-fabric-app-defn.xml</span>.</p>
<p>We are done with the package configuration. Now, open a command shell, change directory to /HelloWorldSpring, type the following command and hit enter:</p>
<blockquote><p><span style="font-family: 'Courier New';">mvn clean install</span><big><br />
</big></p></blockquote>
<p>The above command will compile the sources, the application jars, install the application jars to the local maven repository on your local machine, and then create the <span style="font-family: 'Courier New';">mvnSpringHelloWorldSvc.fabric</span><small><big> under the HelloWorldSpring/HelloWorldService directory.<br />
</big><br />
<big>Now you are ready to deploy the </big></small><span style="font-family: 'Courier New';">mvnSpringHelloWorldSvc.fabric</span><small><big> to the EAF fabric.<br />
</big><br />
</small><big><strong><small>Deploy HelloWorldSpringServiceBean</small></strong><br />
</big>Let&#8217;s use the instructions detailed on the Appistry EAF wiki page &#8211; <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/Building%2C+Packaging%2C+and+Deploying+a+Fabric+Application" target="_blank">Building, Packaging, and Deploying a Fabric application</a>. The <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/fabric_ctl" target="_blank">fabric_ctl</a> command can be used to deploy a fabric application.</p>
<p>To deploy the <span style="font-family: 'Courier New';">HelloWorldSpringServiceBean</span> bundled in the <span style="font-family: 'Courier New';">mvnSpringHelloWorldSvc.fabric</span>, type the following command (from under &lt;workspace&gt;/HelloWorldSpring/HelloWorldService) with the correct fabric adminstrative user, password, and fabric address. If you have stuck with the defaults, the command is:</p>
<blockquote><p><span style="font-family: 'Courier New';">fabric_ctl -d 239.255.0.1:30000 -u fabric-admin/fabric-admin deploy </span><big><span style="font-family: 'Courier New';"><small>mvnSpringHelloWorldSvc.fabric</small></span><br />
</big></p></blockquote>
<p>You can verify if the deployment is successful or not by following the instructions on <a href="http://www.appistry.com/developers/wiki/display/eaf38dev/Building%2C+Packaging%2C+and+Deploying+a+Fabric+Application" target="_blank">this</a> wiki page.</p>
<p>If the above command didn&#8217;t throw any errors, you have successfully deployed the <span style="font-family: 'Courier New';">HelloWorldSpringServiceBean</span>, <em>without any code changes</em>, to the fabric.</p>
<p>Now that we have <span style="font-family: 'Courier New';">HelloWorldSpringServiceBean</span> deployed to the fabric, how do we call the greet method on it from HelloWorldSpringClient?</p>
<p><strong>Call HelloWorldSpringServiceBean remotely</strong><br />
Calling <span style="font-family: 'Courier New';">HelloWorldSpringServiceBean</span> from <span style="font-family: 'Courier New';">HelloWorldSpringClient</span> is achieved by a simple configuration in <span style="font-family: 'Courier New';">helloWorldClient-appContext.xml</span>. And adding Appistry EAF provided fabric.jar as a dependency to the HelloWorldClient pom.xml</p>
<p>Since Appistry EAF fabric.jar is not available on a public maven repository as of yet, we need to install it to our local maven repository on our local machine. To do this, open a command shell, change directory to $FABRIC_HOME/classes, type the following command and hit enter:</p>
<blockquote><p><span style="font-family: 'Courier New';">mvn install:install-file -Dfile=fabric.jar -DgroupId=com.appistry -DartifactId=fabric -Dversion=3.8.0.15 -Dpackaging=jar</span><big><br />
</big></p></blockquote>
<p>The above command will install fabric.jar to your local maven repository.</p>
<p>Next we need to add fabric.jar as a dependency to HelloWorldClient&#8217;s <span style="font-family: 'Courier New';">pom.xml:</span></p>
<blockquote><p><span style="font-family: 'Courier New';"><em>&lt;dependency&gt;<br />
&lt;groupId&gt;com.appistry&lt;/groupId&gt;<br />
&lt;artifactId&gt;fabric&lt;/artifactId&gt;<br />
&lt;version&gt;3.8.0.15&lt;/version&gt;<br />
&lt;/dependency&gt;</em><br />
</span></p></blockquote>
<p>Now we are ready to configure <span style="font-family: 'Courier New';">helloWorldClient-appContext.xml.</span><big><br />
</big>Append the following bean definitions to <span style="font-family: 'Courier New';">helloWorldClient-appContext.xml</span> located under &lt;workspace&gt;/HelloWorldSpring/HelloWorldClient:<span style="font-family: 'Courier New';"> </span></p>
<blockquote><p><span style="font-family: 'Courier New';"><em>&lt;bean id=&#8221;fabricHelloWorldBean&#8221; class=&#8221;com.appistry.spring.FabricProxyFactoryBean&#8221;&gt;<br />
&lt;property name=&#8221;serviceInterface&#8221; value=&#8221;com.appistry.samples.spring.helloworld.HelloWorldSpringService&#8221;/&gt;<br />
&lt;property name=&#8221;fabric&#8221;&gt;<br />
&lt;ref local=&#8221;fabric&#8221;/&gt;<br />
&lt;/property&gt;<br />
&lt;property name=&#8221;applicationName&#8221; value=&#8221;mvnSpringHelloWorldSvc&#8221;/&gt;<br />
&lt;property name=&#8221;componentName&#8221; value=&#8221;mvnSpringHWSvcComponent&#8221;/&gt;<br />
&lt;/bean&gt;&lt;bean id=&#8221;fabric&#8221; class=&#8221;com.appistry.fabric.Fabric&#8221;&gt;<br />
&lt;constructor-arg value=&#8221;239.255.0.116&#8243;/&gt;<br />
&lt;constructor-arg value=&#8221;31000&#8243;/&gt;<br />
&lt;/bean&gt;<br />
</em></span></p></blockquote>
<p><big></big>The bean fabricHelloWorldBean defines a <span style="font-family: 'Courier New';">com.appistry.spring.FabricProxyFactoryBean</span> which proxies any calls made on HelloWorldSpringService to an instance of HelloWorldSpringService on the fabric. The concept behind <span style="font-family: 'Courier New';">FabricProxyFactoryBean</span> is very similar to Spring Remoting. Infact <span style="font-family: 'Courier New';">FabricProxyFactoryBean</span> uses Spring Remoting classes to proxy requests to the fabric.<br />
The <span style="font-family: 'Courier New';">FabricProxyFactoryBean</span> requires:</p>
<ul>
<li>the interface on which methods will be called,</li>
<li>a reference to <span style="font-family: 'Courier New';">com.appistry.fabric.Fabric</span>,</li>
<li>an applicationName which should match the <span style="font-family: 'Courier New';">name</span> attribute of the <span style="font-family: 'Courier New';">app</span> element in the fabric application definition xml (<span style="font-family: 'Courier New';">springHWSvc-fabric-app-defn.xml</span>),</li>
<li>a componentName which should match the <span style="font-family: 'Courier New';">name</span> attribute of the <span style="font-family: 'Courier New';">component</span> element in the component definition xml (springHWSvc-component-defn.xml).</li>
</ul>
<p>Let&#8217;s now add some code to <span style="font-family: 'Courier New';">HelloWorldSpringClient</span> to call the <span style="font-family: 'Courier New';">fabricHelloWorldBean</span> that we just defined above<big>.<br />
</big><br />
Let&#8217;s append the following two lines to the HelloWorldSpringClient&#8217;s main method:</p>
<pre class="java-codeface">HelloWorldSpringService fabricHWS = (HelloWorldSpringService) appContext.getBean("fabricHelloWorldBean");
System.out.println(fabricHWS.greet("from the fabric."));</pre>
<p>Now we are ready to run HelloWorldSpringClient once again.</p>
<p>From Eclipse, run <span style="font-family: 'Courier New';">HelloWorldSpringClient</span> as a Java Application. You should see an output like this:<big><br />
</big></p>
<blockquote><p><span style="font-family: arial;"><big>&#8230;<br />
&#8230;<br />
</big>Jun 20, 2008 4:35:26 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons<big><br />
</big>INFO:<br />
Pre-instantiating singletons in<br />
org.springframework.beans.factory.support.DefaultListableBeanFactory@18a7efd:<br />
defining beans [localHelloWorldBean,fabricHelloWorldBean,fabric]; root<br />
of factory hierarchy<big><br />
</big>Hello World, locally.<strong><small><big><br />
Hello World, from the fabric.</big><br />
</small></strong></span></p></blockquote>
<p>The HelloWorldSpringClient application loads the <span style="font-family: 'Courier New';">helloWorldClient-appContext.xml</span> spring application context, gets a reference to the <span style="font-family: 'Courier New';">fabricHelloWorldBean</span> and calls the greet method on it. The FabricProxyFactoryBean proxies the greet request to the fabric. An instance of HelloWorldSpringServiceBean on the fabric executes the greet method and returns the results to the HelloWorldSpringClient which prints the result to the standard out.</p>
<p>As you can see, we haven&#8217;t changed any code on the client either. Just a little bit of configuration and that was it.</p>
<p><strong>Download</strong></p>
<p>Extract the contents of the zip into your eclipse workspace. This will create a HelloWorldSpring folder under your workspace.</p>
<p><small><a title="HelloWorldSpring-source.zip" href="http://blogs.plexibus.com/wp-content/uploads/2008/06/helloworldspring-source.zip">HelloWorldSpring-source.zip</a><br />
</small></p>
<p><strong>Appistry EAF Developer Portal</strong></p>
<p>To learn more visit the <a href="http://www.appistry.com/developers/">Appistry EAF Developer Portal</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.plexibus.com/2008/06/21/code-example-using-spring-beans-with-appistry-eaf-38/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.848 seconds -->
