<?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>*.hosting &#187; Hosting</title>
	<atom:link href="http://www.stardothosting.com/blog/category/hosting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stardothosting.com/blog</link>
	<description>Star Dot Hosting : Technology, Security, Virtualization and Cloud Computing</description>
	<lastBuildDate>Fri, 03 Feb 2012 21:43:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Checking and repairing mysql replication automatically</title>
		<link>http://www.stardothosting.com/blog/2012/02/02/checking-and-repairing-mysql-replication-automatically/</link>
		<comments>http://www.stardothosting.com/blog/2012/02/02/checking-and-repairing-mysql-replication-automatically/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 17:15:02 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql replication]]></category>
		<category><![CDATA[systems administration]]></category>

		<guid isPermaLink="false">http://www.stardothosting.com/blog/?p=486</guid>
		<description><![CDATA[Hello! MySQL replication has been known to easily break, as a result of a large multitude of potential causes. Sometimes the replication can even break if an erroneous query is executed on the master server. With all the potential issues that may break replication, we thought it prudent to write an automated check script that [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello!</p>
<p>MySQL replication has been known to easily break, as a result of a large multitude of potential causes.</p>
<p>Sometimes the replication can even break if an erroneous query is executed on the master server.</p>
<p>With all the potential issues that may break replication, we thought it prudent to write an automated check script that can run on a scheduled basis (i.e. every 10-15 minutes), check the Slave status, report on any errors if applicable and attempt to repair replication.</p>
<p>We have built this script to exit and send mail alerts if any step of the checking and repairing process fails or generates an error in itself.</p>
<p>The script also generates a lock file to ensure that no more than one check process can run at any given time. We feel this script could be best used for scenarios for remote MySQL slaves, for example. Adding this extra layer may ensure a more reliable replication. </p>
<p>The repair process is simply 3 MySQL Commands :</p>
<pre>
stop slave;
reset slave;
slave start;
</pre>
<p>The above directives assume that you have a master.info with the mysql master server information statically set. No CHANGE MASTER commands have to be executed as a result. Resetting the slave clears the error and resumes replication, and all the queries missed during the time it failed should be queued and applied after it starts again.</p>
<p>Here is the script : </p>
<pre>
#!/bin/sh
# Slave replication auto recovery and alert
# Star Dot Hosting 2012

currentmonth=`date "+%Y-%m-%d"`
lock_file=/tmp/slave_alert.lck

echo "MySQL Replication Check Script" > /var/log/replication_check.log 2>&#038;1
echo "------------------------------" >> /var/log/replication_check.log 2>&#038;1
echo "$currentmonth" >> /var/log/replication_check.log 2>&#038;1
echo "" >> /var/log/replication_check.log 2>&#038;1

# Check if lock file exists
if [ -f $lock_file ];
then
        echo "Lock file exists! Possible conflict!" >> /var/log/replication_check.log 2>&#038;1
        mail_alert
        exit 1
else
        touch $lock_file
fi

# Fix slave
function fix_replication () {
        mysql -u root --password="XXXXX" -Bse "stop slave" >> /var/log/replication_check.log 2>&#038;1
        if [ "$?" -eq 0 ];
        then
                echo "Stop slave succeeded..." >> /var/log/replication_check.log 2>&#038;1
        else
                echo "Slave recover function failed" >> /var/log/replication_check.log 2>&#038;1
                mail_alert
                exit 1
        fi
        mysql -u root --password="XXXXX" -Bse "reset slave" >> /var/log/replication_check.log 2>&#038;1
        if [ "$?" -eq 0 ];
        then
                echo "Reset slave succeeded..." >> /var/log/replication_check.log 2>&#038;1
        else
                echo "Slave recover function failed" >> /var/log/replication_check.log 2>&#038;1
                mail_alert

                exit 1
        fi
        mysql -u root --password="XXXXX" -Bse "slave start" >> /var/log/replication_check.log 2>&#038;1
        if [ "$?" -eq 0 ];
        then
                echo "Slave start succeeded." >> /var/log/replication_check.log 2>&#038;1
        else
                echo "Slave recover function failed" >> /var/log/replication_check.log 2>&#038;1
                mail_alert
                exit 1
        fi
}

# Alert function
function mail_alert () {
        cat /var/log/replication_check.log | mail -s "Replication check errors!" kkutzko@n49.com
}

# Check if Slave is running properly
Slave_IO_Running=`mysql -u root --password="XXXXX" -Bse "show slave status\G" | grep Slave_IO_Running | awk '{ print $2 }'`
Slave_SQL_Running=`mysql -u root --password="XXXXX" -Bse "show slave status\G" | grep Slave_SQL_Running | awk '{ print $2 }'`
Last_error=`mysql -u root --password="XXXXX" -Bse "show slave status\G" | grep Last_error | awk -F \: '{ print $2 }'`

# If no values are returned, slave is not running
if [ -z $Slave_IO_Running -o -z $Slave_SQL_Running ];
then
        echo "Replication is not configured or you do not have the required access to MySQL"
        exit 1
fi

# If everythings running, remove lockfile if it exists and exit
if [ $Slave_IO_Running == 'Yes' ] &#038;&#038; [ $Slave_SQL_Running == 'Yes' ];
then
        rm $lock_file
        echo "Replication slave is running" >> /var/log/replication_check.log 2>&#038;1
        echo "Removed Alert Lock" >> /var/log/replication_check.log 2>&#038;1
elif [ $Slave_SQL_Running == 'No' ] || [ $Slave_IO_Running == 'No' ];
then
        echo "SQL thread not running on server `hostname -s`!" >> /var/log/replication_check.log 2>&#038;1
        echo "Last Error:" $Last_error >> /var/log/replication_check.log 2>&#038;1
        fix_replication
        mail_alert
        rm $lock_file
fi

echo "Script complete!" >> /var/log/replication_check.log 2>&#038;1
exit 0
</pre>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F&amp;linkname=Checking%20and%20repairing%20mysql%20replication%20automatically" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F&amp;linkname=Checking%20and%20repairing%20mysql%20replication%20automatically" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F&amp;linkname=Checking%20and%20repairing%20mysql%20replication%20automatically" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F&amp;linkname=Checking%20and%20repairing%20mysql%20replication%20automatically" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2012%2F02%2F02%2Fchecking-and-repairing-mysql-replication-automatically%2F&amp;title=Checking%20and%20repairing%20mysql%20replication%20automatically" id="wpa2a_2"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2012/02/02/checking-and-repairing-mysql-replication-automatically/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clone a XEN VPS server that resides on a LVM / Logical Volume Manager</title>
		<link>http://www.stardothosting.com/blog/2011/08/25/clone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager/</link>
		<comments>http://www.stardothosting.com/blog/2011/08/25/clone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 20:38:35 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[systems administration]]></category>
		<category><![CDATA[vps backup]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[xen backup]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=467</guid>
		<description><![CDATA[Hello! We thought it would be important to share this information as it might be interesting to someone who wants to replicate the same VPS across many instances in order to create a farm of web servers (for example). This uses very similar concepts to our LVM XEN backup post a while back. Step 1: [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello!</p>
<p>We thought it would be important to share this information as it might be interesting to someone who wants to replicate the same VPS across many instances in order to create a farm of web servers (for example).</p>
<p>This uses very similar concepts to our <A href="http://blog.stardothosting.com/2010/03/19/how-to-backup-xen-with-logical-volume-mounts-works-with-hypervm-solusvm-fluidvm-and-more/">LVM XEN backup</a> post a while back.</p>
<p><big><b>Step 1: Take a snapshot of the current VPS</b></big></p>
<p>This is simple. Use the <b>lvcreate</b> command with the <b>-s</b> option to create a snapshot of the running VPS. We assume your VPS is 5GB in size, so just replace that with however large your VPS is :</p>
<pre>
lvcreate -s -L 5GB -n snapshot_name /dev/VolGroup00/running_vps_image
</pre>
<p><big><b>Step 2: Create your new VPS</b></big></p>
<p>This is important. You want to create a new vps, assign a MAC and IP address first and let the creation process fully finish. Then shut the VPS down.</p>
<p><big><b>Step 3: Copy the snapshot to the new VPS</b></big></p>
<p>All you have to do is use the <b>dd</b> command to transfer the snapshot image to the newly created VPS image :</p>
<pre>
dd if=/dev/VolGroup00/snapshot_name of=/dev/VolGroup00/new_vps_image
</pre>
<p>All done! Dont forget to remove the snapshot after your done with it :</p>
<pre>
lvremove -f /dev/VolGroup00/snapshot_name
</pre>
<p>Start up the new vps and you should have a carbon copy of the previous vps!</p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F&amp;linkname=Clone%20a%20XEN%20VPS%20server%20that%20resides%20on%20a%20LVM%20%2F%20Logical%20Volume%20Manager" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F&amp;linkname=Clone%20a%20XEN%20VPS%20server%20that%20resides%20on%20a%20LVM%20%2F%20Logical%20Volume%20Manager" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F&amp;linkname=Clone%20a%20XEN%20VPS%20server%20that%20resides%20on%20a%20LVM%20%2F%20Logical%20Volume%20Manager" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F&amp;linkname=Clone%20a%20XEN%20VPS%20server%20that%20resides%20on%20a%20LVM%20%2F%20Logical%20Volume%20Manager" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F25%2Fclone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager%2F&amp;title=Clone%20a%20XEN%20VPS%20server%20that%20resides%20on%20a%20LVM%20%2F%20Logical%20Volume%20Manager" id="wpa2a_4"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2011/08/25/clone-a-xen-vps-server-that-resides-on-a-lvm-logical-volume-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux VPS, Virtual Hosting, XEN VPS Hosting, CPanel VPS Hosting or Managed Hosting Services</title>
		<link>http://www.stardothosting.com/blog/2011/08/16/linux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services/</link>
		<comments>http://www.stardothosting.com/blog/2011/08/16/linux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 07:13:26 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Company Announcements]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[linux vps]]></category>
		<category><![CDATA[managed hosting services]]></category>
		<category><![CDATA[star dot hosting]]></category>
		<category><![CDATA[vps hosting]]></category>
		<category><![CDATA[web hosting]]></category>
		<category><![CDATA[xen vps]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=462</guid>
		<description><![CDATA[Hey there, Before I update regarding my continued experiences with Xen, KVM, Varnish, FreeBSD and all the other (exciting) things that I do, I thought I&#8217;d remind anyone here who is looking for linux vps hosting, virtual hosting or specifically xen vps hosting or even cpanel vps hosting to check out our company website : [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hey there,</p>
<p>Before I update regarding my continued experiences with Xen, KVM, Varnish, FreeBSD and all the other (exciting) things that I do, I thought I&#8217;d remind anyone here who is looking for linux vps hosting, virtual hosting or specifically xen vps hosting or even cpanel vps hosting to check out our company website : <a href="http://www.stardothosting.com" target="_new">www.stardothosting.com</a></p>
<p>If you&#8217;re looking for managed hosting services, dedicated hosting or anything along those lines, feel free to fill out our managed hosting quotation form here : <a href="http://www.stardothosting.com/managed-hosting/" target="_new">www.stardothosting.com/managed-hosting</a></p>
<p>Thanks!</p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F&amp;linkname=Linux%20VPS%2C%20Virtual%20Hosting%2C%20XEN%20VPS%20Hosting%2C%20CPanel%20VPS%20Hosting%20or%20Managed%20Hosting%20Services" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F&amp;linkname=Linux%20VPS%2C%20Virtual%20Hosting%2C%20XEN%20VPS%20Hosting%2C%20CPanel%20VPS%20Hosting%20or%20Managed%20Hosting%20Services" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F&amp;linkname=Linux%20VPS%2C%20Virtual%20Hosting%2C%20XEN%20VPS%20Hosting%2C%20CPanel%20VPS%20Hosting%20or%20Managed%20Hosting%20Services" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F&amp;linkname=Linux%20VPS%2C%20Virtual%20Hosting%2C%20XEN%20VPS%20Hosting%2C%20CPanel%20VPS%20Hosting%20or%20Managed%20Hosting%20Services" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F16%2Flinux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services%2F&amp;title=Linux%20VPS%2C%20Virtual%20Hosting%2C%20XEN%20VPS%20Hosting%2C%20CPanel%20VPS%20Hosting%20or%20Managed%20Hosting%20Services" id="wpa2a_6"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2011/08/16/linux-vps-virtual-hosting-xen-vps-hosting-cpanel-vps-hosting-or-managed-hosting-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Varnish Caching with Joomla</title>
		<link>http://www.stardothosting.com/blog/2011/08/08/varnish-caching-with-joomla/</link>
		<comments>http://www.stardothosting.com/blog/2011/08/08/varnish-caching-with-joomla/#comments</comments>
		<pubDate>Mon, 08 Aug 2011 21:05:50 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Load Balancing]]></category>
		<category><![CDATA[Varnish Cache]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[systems administration]]></category>
		<category><![CDATA[varnish cache]]></category>
		<category><![CDATA[varnish joomla]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=437</guid>
		<description><![CDATA[Hello There! One of the exciting new technologies to come out in the last few years is a tremendously efficient and dynamic caching system called Varnish (see : http://www.varnish-cache.org). We have been employing the use of Varnish for high traffic websites for the purposes of user experience improvements as well as for redundancy and load [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello There!</p>
<p>One of the exciting new technologies to come out in the last few years is a tremendously efficient and dynamic caching system called Varnish (see : <a href="http://www.varnish-cache.org" target="_new">http://www.varnish-cache.org</a>).</p>
<p>We have been employing the use of Varnish for high traffic websites for the purposes of user experience improvements as well as for redundancy and load balancing purposes.</p>
<p>Varnish can do it all &#8211; complex load balancing and polling based on many different weighting methodologies for fail over, as well as holding on to a &#8220;stale&#8221; cache in the event of a back end web server outage, or perhaps for geographic redundancy (holding a stale cache in a secondary data center).</p>
<p>One of the challenges we have faced in the many different implementations of varnish into web stacks, is dealing with dynamic and user session (i.e. &#8220;logged in&#8221;) content. </p>
<p>If the Internet was full of only static (see 1995) html files, varnish would work beautifully out of the box. Unfortunately the web is a complicated mess of session based authentication, POSTS, GETS and query strings among a few things.</p>
<p>One of our recent accomplishments was getting the Joomla 1.5 content management system to work with Varnish 2.1.</p>
<p>The biggest challenge for Joomla was that it creates a session cookie for all users. This means the session is created and established for any guest visiting the site, and if they decide to log in , that same session is used to establish a logged in session through authentication. This is an apparent effort to deter or avoid session hijacking.</p>
<p>The problem with this is that Varnish ends up caching all the logged in session content, as well as the anonymous front page content. </p>
<p>I spent a significant amount of time fine tuning my VCL (varnish configuration language) to play nice with Joomla. Unfortunately it became apparent that some minor modifications to the Joomla code was necessary in order for it to communicate properly with Varnish.</p>
<p><big><u><b>Step 1 : Move the login form off the front page</big></u></b></p>
<p>I realize this might be a hard decision. I cant offer an alternative. If you have an integrated login form on the front page of your site, and you wish to cache that page with varnish, you will likely have to chose one or the other. It would probably be ideal to replace that login form with a button to bring the user to a secondary page off the main page. </p>
<p>For the sake of argument, lets call our site &#8220;example.com&#8221; and the login page url within Joomla should look like the following :</p>
<p><b>http://www.example.com/index.php?option=com_user&#038;view=login</b></p>
<p>Take note of <b>login</b> URI in this string.</p>
<p>The reason we need the login form on a secondary page is because we need an almost &#8220;sandboxed&#8221; section of the site where the anonymous session cookie can be established, and passed through the authentication process to a logged in session. We will tell varnish to essentially ignore this page.</p>
<p><big><u><b>Step 2 : Modify Joomla to send HTTP headers for user/guest sessions</big></u></b></p>
<p>This isn&#8217;t that hard. In the Joomla code, there is a section where it defines the HTTP headers it sends to the browser for cache variables such as expire times and whatnot. I&#8217;m going to assume you have turned off the built-in Joomla caching system. </p>
<p>What you need to do is tell Joomla to send a special HTTP header that will give either a True or False value if the user is logged in or not. This is useful information. It will allow varnish to not cache any logged in content such as &#8220;Welcome back, USERNAME&#8221; after the user is passed back to the front page from logging in.</p>
<p>In my joomla installation, I modified the following file :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">libraries/joomla/environment/response.php</div></div>
<p>The parent folder being the public_html / root folder for your Joomla installation. In this file, please find the line that determines if the Joomla caching system is disabled :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">if (JResponse::allowCache() === false)</div></div>
<p>After this line, you will see about 5 HTTP header declarations (expires, last-modified, cache-control, cache-control again and pragma). Above those declarations , add the following 6 lines of code :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$user =&amp; JFactory::getUser();<br />
if (!$user-&gt;guest) {<br />
JResponse::setHeader( 'X-Logged-In', 'True', true);<br />
} else {<br />
JResponse::setHeader( 'X-Logged-In', 'False', true );<br />
}</div></div>
<p>If you read the above code, its fairly straight forward. I do a check to see if the user is a guest (aka anonymous) or not. If they are logged in I send an HTTP header called &#8220;X-Logged-In&#8221;, and assign a &#8220;True&#8221; value to it. If the user is not logged in, it sets it to &#8220;False&#8221;.</p>
<p>Pretty easy, right?</p>
<p>This will allow varnish to avoid caching a logged in user&#8217;s page.</p>
<p><big><u><b>Step 3 : Configure Varnish</big></u></b></p>
<p>This is the part that took the most time during this entire process. Mind you patching the Joomla code and whatnot took some time as well, this process took a lot of experimentation and long hours examining session cookies and host headers. </p>
<p>What I will do is break down the generalized configuration directives into two groups : VCL_RECV and VCL_FETCH.</p>
<p><big><b>VCL_RECV</big></b></p>
<p>In here, I set a bunch of IF statement directives to tell varnish what it should look up in the cache and what it should pipe to the backend and what it should pass. This could probably be optimized and improved upon, but it works for me :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># If user sends an http POST, pipe to backend<br />
if (req.request == &quot;POST&quot;) {<br />
set req.backend = iamloggedin;<br />
return(pipe);<br />
}<br />
<br />
# http authenticated sessions are piped<br />
if (req.http.Authenticate || req.http.Authorization) {<br />
set req.backend = iamloggedin;<br />
return(pipe);<br />
}<br />
<br />
# if the user is coming FROM the login page, pipe to backend <br />
if (req.http.referer ~ &quot;(?i)(com_user|login)&quot;) {<br />
set req.backend = iamloggedin;<br />
return(pipe);<br />
}</div></div>
<p><big><b>VCL_FETCH</big></b></p>
<p>The fetch section is a little bit easier. I only have about 5 directives. The first one is the most important one you want to look at. It &#8220;unsets&#8221; the cookie from any page on the site, EXCEPT the login page. This allows varnish to properly establish the logged in session. The subsequent rules determine what to deliver and what to pass based on URI or HTTP header checks :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># discard backend setcookie unless it equals the following<br />
if (!req.url ~ &quot;(?i)(login|com_user|user|logout)&quot;) {<br />
unset beresp.http.Set-Cookie;<br />
}<br />
<br />
if (req.http.referer ~ &quot;(?i)(com_user|login|logout)&quot;) {<br />
set req.backend = iamloggedin;<br />
return(pass);<br />
}<br />
<br />
if (beresp.http.x-logged-in ~ &quot;False&quot;){<br />
set req.backend = webfarm;<br />
return(deliver);<br />
}<br />
<br />
if (beresp.http.x-logged-in ~ &quot;True&quot;){<br />
set req.backend = iamloggedin;<br />
return(pass);<br />
}<br />
<br />
if (req.http.Authenticate || req.http.Authorization) {<br />
set req.backend = iamloggedin;<br />
return(pass);<br />
}</div></div>
<p>Thats it! I just saved you many sleepless nights (I hope!). Hopefully your headers will look something like this after you implement varnish in front of Joomla :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Set-Cookie&nbsp; example_auth_129bf15asdfasdf52f3afaafawef; path=/<br />
P3P CP=&quot;NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM&quot;<br />
X-Logged-In False<br />
Expires Mon, 1 Jan 2001 00:00:00 GMT<br />
Last-Modified &nbsp; Mon, 08 Aug 2011 20:49:37 GMT<br />
Cache-Control &nbsp; post-check=0, pre-check=0<br />
Pragma&nbsp; no-cache<br />
Content-Type&nbsp; &nbsp; text/html; charset=utf-8<br />
Content-Length&nbsp; 85898<br />
Date&nbsp; &nbsp; Mon, 08 Aug 2011 21:01:52 GMT<br />
X-Varnish &nbsp; 761778669 761751685<br />
Age 735<br />
Via 1.1 varnish<br />
Connection&nbsp; keep-alive<br />
X-Cache-Svr cache.example.com<br />
X-Cache HIT<br />
X-Cache-Hits&nbsp; &nbsp; 121</div></div>
<p><b><big><u>UPDATE : 12/08/2011</b></big></u></p>
<p>I realize I made a mistake and have corrected this post. In vcl_fetch, i had the following :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># discard backend setcookie unless it equals the following<br />
if (!req.url ~ &quot;(?i)(login|com_user|user|logout)&quot;) {<br />
unset req.http.Set-Cookie;<br />
}</div></div>
<p>Well I realize I should be unsetting the response cookie, not the set cookie. For some reason, the above (erroneous) directive works only right after you login. If you start clicking around the site, your logged in session disappears. I suspect this is because either joomla or varnish is mistakenly unsetting a logged in session.</p>
<p>This is the correct entry (I have fixed it in my original post as well) :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># discard backend setcookie unless it equals the following<br />
if (!req.url ~ &quot;(?i)(login|com_user|user|logout)&quot;) {<br />
unset beresp.http.Set-Cookie;<br />
}</div></div>
<p>After making the above change, I can login and browse the site and my session stays intact. Mind you, the Joomla site I am testing with is definitely not a vanilla Joomla installation. </p>
<p>I&#8217;d love to hear from anyone who has accomplished the above scenario either way!</p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;linkname=Varnish%20Caching%20with%20Joomla" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;linkname=Varnish%20Caching%20with%20Joomla" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;linkname=Varnish%20Caching%20with%20Joomla" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;linkname=Varnish%20Caching%20with%20Joomla" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2011%2F08%2F08%2Fvarnish-caching-with-joomla%2F&amp;title=Varnish%20Caching%20with%20Joomla" id="wpa2a_8"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2011/08/08/varnish-caching-with-joomla/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>50% off any hosting plan for the first THREE months!</title>
		<link>http://www.stardothosting.com/blog/2010/12/13/50-off-any-hosting-plan-for-the-three-months/</link>
		<comments>http://www.stardothosting.com/blog/2010/12/13/50-off-any-hosting-plan-for-the-three-months/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 21:17:52 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Company Announcements]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[coupon]]></category>
		<category><![CDATA[deal]]></category>
		<category><![CDATA[stardothosting]]></category>
		<category><![CDATA[web hosting deal]]></category>
		<category><![CDATA[web hosting discount]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=420</guid>
		<description><![CDATA[We are excited about a new promotion for our web hosting catalog here at *.hosting. We are offering a 50% discount for ANY of our SHARED or VPS hosting plans for the first 3 (thats THREE) months!!!! Simply enter the following promotional code during the signup process : SDH50OFF2010 It&#8217;s that simple! The 50% discount [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>We are excited about a new promotion for our web hosting catalog here at *.hosting.</p>
<p><b><big>We are offering a 50% discount for ANY of our SHARED or VPS hosting plans for the first 3 (thats THREE) months!!!!</big></b></p>
<p>Simply enter the following promotional code during the signup process :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">SDH50OFF2010</div></div>
<p>It&#8217;s that simple! The 50% discount will then be immediately applied to the first three months of hosting &#8212; no matter what the hosting plan you chose!</p>
<p><center><b><big><a href="http://www.stardothosting.com" target="_new">View our hosting plans here</a></big></b></center></p>
<p>Happy Holidays from Star Dot Hosting! </p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F&amp;linkname=50%25%20off%20any%20hosting%20plan%20for%20the%20first%20THREE%20months%21" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F&amp;linkname=50%25%20off%20any%20hosting%20plan%20for%20the%20first%20THREE%20months%21" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F&amp;linkname=50%25%20off%20any%20hosting%20plan%20for%20the%20first%20THREE%20months%21" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F&amp;linkname=50%25%20off%20any%20hosting%20plan%20for%20the%20first%20THREE%20months%21" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F12%2F13%2F50-off-any-hosting-plan-for-the-three-months%2F&amp;title=50%25%20off%20any%20hosting%20plan%20for%20the%20first%20THREE%20months%21" id="wpa2a_10"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/12/13/50-off-any-hosting-plan-for-the-three-months/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Migrate from Linux to Xen with Rsync</title>
		<link>http://www.stardothosting.com/blog/2010/11/11/migrate-from-linux-to-xen-with-rsync/</link>
		<comments>http://www.stardothosting.com/blog/2010/11/11/migrate-from-linux-to-xen-with-rsync/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 17:30:06 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[systems administration]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=410</guid>
		<description><![CDATA[I decided to write this little guide to provide the relatively simple steps needed to migrate your linux system to a Xen (HVM) virtual instance. It is assumed that on your source and destination boxes, that you only have one root &#8220;/&#8221; partition. If you partitioned out your file system differently, you will have to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I decided to write this little guide to provide the relatively simple steps needed to migrate your linux system to a Xen (HVM) virtual instance.</p>
<p>It is assumed that on your source and destination boxes, that you only have one root &#8220;/&#8221; partition. If you partitioned out your file system differently, you will have to accommodate that based on these instructions.</p>
<p>The following steps walk you through the process of migrating linux to Xen from start to finish :</p>
<p><big><b>1. Install the exact same version of linux on your destination server</b></big><br />
This isn&#8217;t really 100% necessary, obviously. You could always boot into Finnix, partition your disk and install Grub. If you are uncomfortable doing that, install the distribution from start to finish. The file system will be overwritten anyways.</p>
<p><big><b>2. Boot into finnix on the destination system</b></big><br />
If you have never used  <a href="http://www.finnix.org/" target="_new">Finnix</a>, it is a &#8220;self contained, bootable linux distribution&#8221;. I like it alot actually and have used it for similar purposes, rescue operations and the like.</p>
<p><big><b>3. Setup networking on both destination and source systems</b></big><br />
If both systems are on the same network, you could assign local IP addresses to ensure the process of synchronisation is speedy and unobstructed.</p>
<p>Ensure you configure networking either way and that you set a root password and start ssh :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">passwd<br />
/etc/init.d/ssh start</div></div>
<p><big><b>4. Mount the partition that you want to copy to on the destination server</b></big><br />
Remember, so far everything you are doing has been on the destination server. Mount the destination partition within finnix :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mount /dev/xvdb</div></div>
<p><big><b>5. On the source server, rsync all the files of the source partition to the destination partition</big></b><br />
When logged into the source server, simply issue the following rsync command and direct it to the destination server&#8217;s partition you just mounted :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rsync -aHSKDvz -e ssh / root@12.34.56.78:/mnt/xvdb/</div></div>
<p>The rsync process will complete and the partition on the destination server should be ready to boot into. Remember to change the networking configuration if you dont want any IP conflicts to happen.</p>
<p>I hope this helps!</p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F&amp;linkname=Migrate%20from%20Linux%20to%20Xen%20with%20Rsync" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F&amp;linkname=Migrate%20from%20Linux%20to%20Xen%20with%20Rsync" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F&amp;linkname=Migrate%20from%20Linux%20to%20Xen%20with%20Rsync" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F&amp;linkname=Migrate%20from%20Linux%20to%20Xen%20with%20Rsync" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F11%2F11%2Fmigrate-from-linux-to-xen-with-rsync%2F&amp;title=Migrate%20from%20Linux%20to%20Xen%20with%20Rsync" id="wpa2a_12"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/11/11/migrate-from-linux-to-xen-with-rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Foundry Load Balancers HTTP sticky sessions</title>
		<link>http://www.stardothosting.com/blog/2010/08/30/foundry-load-balancers-http-sticky-sessions/</link>
		<comments>http://www.stardothosting.com/blog/2010/08/30/foundry-load-balancers-http-sticky-sessions/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 19:15:06 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Load Balancing]]></category>
		<category><![CDATA[foundry]]></category>
		<category><![CDATA[load balancers]]></category>
		<category><![CDATA[sticky sessions]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=401</guid>
		<description><![CDATA[This post is intended to be a general guide for configuring &#8220;stickied&#8221; load balanced HTTP servers. Whether it&#8217;s F5 load balancers, foundry load balancers or open source based load balancers (keepalived/lvs), the concepts are the same and can be migrated across said platforms. If you have a paid of foundry&#8217;s and are looking to configure [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>This post is intended to be a general guide for configuring &#8220;stickied&#8221; load balanced HTTP servers. Whether it&#8217;s F5 load balancers, foundry load balancers or open source based load balancers (keepalived/lvs), the concepts are the same and can be migrated across said platforms.</p>
<p>If you have a paid of foundry&#8217;s and are looking to configure stickied load balanced HTTP servers, hopefully this guide will provide some assistance.</p>
<ul>
<strong>Logging into the load balancer</strong></ul>
<p>Telnet to the box and &#8216;enable&#8217; to allow admin access. The first thing you want to do is show the current configuration to view the existing setup for other working boxes :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&gt; telnet 192.x.x.x<br />
Trying 192.x.x.x...<br />
Connected to 10.x.x.x.<br />
Escape character is '^]'.<br />
<br />
User Access Verification<br />
<br />
Please Enter Login Name: admin<br />
Please Enter Password: <br />
<br />
User login successful.<br />
<br />
SLB-telnet@XXXX&gt;enable<br />
Enable Password:<br />
Error - Incorrect username or password.<br />
SLB-telnet@XXXX&gt;enable<br />
Enable Password:<br />
SLB-telnet@XXXX#</div></div>
<ul>
<strong>Real servers : defining the multiple load balanced boxes</strong></ul>
<p>Show the existing configuration on the foundary :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sh config</div></div>
<p>Take a look at the configuration of two &#8220;real&#8221; servers, which are the two servers that are behind the load balancer that will have balanced sticky connections :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server real serverposapp01-tomcat01 192.168.1.141<br />
&nbsp;port default disable<br />
&nbsp;port 8001<br />
! &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
!<br />
server real serverposapp03-tomcat01 192.168.1.143<br />
&nbsp;port default disable<br />
&nbsp;port 8001</div></div>
<p>The above example is balancing TCP 8001 traffic, which is for TOMCAT. Here are entries for two servers doing simple HTTP traffic :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server real serverapp01-vhost01 192.168.1.195<br />
&nbsp;port default disable &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;port http<br />
&nbsp;port http keepalive<br />
&nbsp;port http url &quot;HEAD /&quot;<br />
!<br />
server real serverapp02-vhost01 192.168.1.196<br />
&nbsp;port default disable<br />
&nbsp;port http<br />
&nbsp;port http keepalive<br />
&nbsp;port http url &quot;HEAD /&quot;</div></div>
<p>This example is similar to the tomcat example, except you have several options. &#8220;port default disable&#8221; disables all other ports. &#8220;port http keepalive&#8221; and &#8220;port http url &#8220;HEAD /&#8221;" define the http checks that take place to ensure apache is running on that box. If not , it will fail over to the second box and stop sending traffic to it.</p>
<ul>
<strong>SSL Connections</strong></ul>
<p>SSL incoming connections are handled by the load balancer initially, then passed off to the actual server as regular http / port 80 traffic. The internal box configuration would be similar to the above configuration examples :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">server virtual portal 192.168.1.104<br />
&nbsp;port default disable<br />
&nbsp;port ssl sticky<br />
&nbsp;port ssl ssl-terminate portal<br />
&nbsp;bind ssl serverapp01-portal01 http<br />
<br />
Notice how instead of &quot;port http sticky&quot; , its &quot;port ssl sticky&quot;. First of all, the sticky option is only set on the &quot;virtual&quot; configuration directives. Secondly, the SSL traffic is bound to the real servers via http in the last line of this example. Its pretty self explanatory.<br />
[edit] Regular HTTP Sticky Connections<br />
<br />
If no SSL Is being used on the site at all, then all you need is to set an HTTP virtual configuration :<br />
<br />
&lt;code&gt;<br />
server virtual serverapp-vhost01 192.168.1.106<br />
&nbsp;port default disable<br />
&nbsp;port http sticky &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;bind http serverapp02-vhost01 http</div></div>
<ul>
<strong>Configuring the external IP to NAT to the internal virtual</strong></ul>
<p>Typically, you will have a firewall in front of the load balancer that actaully holds the external ip addresses. The traffic is filtered initially by the firewall, then NAT&#8217;d to the virtual ip (VIP) of the load balancer, which then handles balancing the traffic.</p>
<p>You will need to either establish a new external ip , or use an existing one (for instance, if you are moving from 1 web server to 2 web servers , and want to balance the traffic using the load balancer). You need to setup the external IP address, and NAT it to the internal VIP.</p>
<ul>
<strong>Verifying the configuration works</strong></ul>
<p>Once everything is setup properly, and the external IP is being NAT&#8217;d to the load balancer, it is time to ensure the load balancer is seeing the connections. You could do this before doing the switchover on the firewall as well, just to ensure everything looks right before actually doing the switchover.</p>
<p>To see the active connections being load balanced, issue the following command (replacing the servername for whichever one you want to check) :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sh server real serverapp02-vhost01</div></div>
<p>That should display information similar to this :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Real Servers Info<br />
========================<br />
State(St) - ACT:active, ENB:enabled, FAL:failed, TST:test, DIS:disabled,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UNK:unknown, UNB:unbind, AWU:await-unbind, AWD:await-delete<br />
<br />
Name: serverapp02-vhost01 &nbsp; &nbsp; State: Active &nbsp; &nbsp; &nbsp; Cost: 0 &nbsp;IP:192.168.1.196: &nbsp; 1<br />
Mac: 0012.7990.d06a &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Weight: 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MaxConn: 2000000<br />
SrcNAT: not-cfg, not-op &nbsp; &nbsp; &nbsp;DstNAT: not-cfg, not-op &nbsp; &nbsp;Serv-Rsts: 0<br />
tcp conn rate:udp conn rate = 1:0, max tcp conn rate:max udp conn rate = 8:0<br />
BP max local conn configured No: 0 0 0 0 0 0 <br />
BP max conn percentage configured No: 0 0 0 0 0 0 <br />
Use local conn : No<br />
<br />
Port &nbsp; &nbsp;St &nbsp;Ms ServerConn TotConn &nbsp; &nbsp;Rx-pkts &nbsp; Tx-pkts &nbsp; Rx-octet &nbsp; Tx-octet &nbsp; Reas<br />
---- &nbsp; &nbsp;-- &nbsp;-- ------- ------- &nbsp; &nbsp;------- &nbsp; ------- &nbsp; -------- &nbsp; -------- &nbsp; ----<br />
default DIS 0 &nbsp;0 &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp;<br />
http &nbsp; &nbsp;ACT 0 &nbsp;104 &nbsp; &nbsp; 13094 &nbsp; &nbsp; &nbsp;181671 &nbsp; &nbsp;150813 &nbsp; &nbsp;162364862 &nbsp;20325115 &nbsp; 0 &nbsp;<br />
<br />
Server &nbsp;Total &nbsp;104 &nbsp; &nbsp; 13094 &nbsp; &nbsp; &nbsp;181671 &nbsp; &nbsp;150813 &nbsp; &nbsp;162364862 &nbsp;20325115 &nbsp; 0</div></div>
<p>The above is displaying the specific connection details for a single real server. To check the VIP / Virtual server :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sh server virtual tomcat</div></div>
<p>Which will display the following :</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Virtual Servers Info<br />
<br />
Name: tomcat &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; State: Enabled &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IP:192.168.1.101: &nbsp; 1<br />
Pred: least-conn &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ACL-Id: 0 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;TotalConn: 149959<br />
<br />
Port &nbsp; &nbsp;State &nbsp; &nbsp; Sticky &nbsp;Concur &nbsp;Proxy &nbsp;DSR &nbsp; ServerConn &nbsp;TotConn &nbsp;PeakConn &nbsp;<br />
---- &nbsp; &nbsp;----- &nbsp; &nbsp; ------ &nbsp;------ &nbsp;----- &nbsp;--- &nbsp; ------- &nbsp;------- &nbsp;-------- &nbsp;<br />
<br />
default disabled &nbsp;NO &nbsp; &nbsp; &nbsp;NO &nbsp; &nbsp; &nbsp;NO &nbsp; &nbsp; NO &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; &nbsp; <br />
ssl &nbsp; &nbsp; enabled &nbsp; YES &nbsp; &nbsp; NO &nbsp; &nbsp; &nbsp;NO &nbsp; &nbsp; NO &nbsp; &nbsp;46 &nbsp; &nbsp; &nbsp; 149959 &nbsp; 443</div></div>
<p>You can see that &#8220;ServerConn&#8221; is displaying 46 connections. Thats it! </p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;linkname=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;linkname=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;linkname=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;linkname=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F08%2F30%2Ffoundry-load-balancers-http-sticky-sessions%2F&amp;title=Foundry%20Load%20Balancers%20HTTP%20sticky%20sessions" id="wpa2a_14"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/08/30/foundry-load-balancers-http-sticky-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hosting Coupon : 60% off the first month for ANY plan!</title>
		<link>http://www.stardothosting.com/blog/2010/07/15/hosting-coupon-60-off-the-first-month-for-any-plan/</link>
		<comments>http://www.stardothosting.com/blog/2010/07/15/hosting-coupon-60-off-the-first-month-for-any-plan/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 17:02:16 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Company Announcements]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[coupon]]></category>
		<category><![CDATA[star dot hosting]]></category>
		<category><![CDATA[web hosting]]></category>
		<category><![CDATA[web hosting discount]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=380</guid>
		<description><![CDATA[Hello there, Just thought I&#8217;d share an exclusive coupon / discount for all of our shared / vps hosting plans that allows for 60% off the first month of hosting fee&#8217;s : COUPON CODE : SDHTWT2010 Take a look at our main site for plan details. This coupon expires and there is only a limited [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello there,</p>
<p>Just thought I&#8217;d share an exclusive coupon / discount for all of our shared / vps hosting plans that allows for 60% off the first month of hosting fee&#8217;s :</p>
<p><big><b>COUPON CODE : SDHTWT2010</big></b></p>
<p>Take a look at our <a href="http://www.stardothosting.com" target="_new">main site</a> for plan details. This coupon expires and there is only a limited number of them available!</p>
<p>Don&#8217;t say we never gave you nothin&#8217; <img src='http://www.stardothosting.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a class="a2a_button_digg" href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F&amp;linkname=Hosting%20Coupon%20%3A%2060%25%20off%20the%20first%20month%20for%20ANY%20plan%21" title="Digg" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a><a class="a2a_button_twitter" href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F&amp;linkname=Hosting%20Coupon%20%3A%2060%25%20off%20the%20first%20month%20for%20ANY%20plan%21" title="Twitter" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a><a class="a2a_button_reddit" href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F&amp;linkname=Hosting%20Coupon%20%3A%2060%25%20off%20the%20first%20month%20for%20ANY%20plan%21" title="Reddit" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a><a class="a2a_button_delicious" href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F&amp;linkname=Hosting%20Coupon%20%3A%2060%25%20off%20the%20first%20month%20for%20ANY%20plan%21" title="Delicious" rel="nofollow" target="_blank"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a><!--[if IE]><iframe frameborder="0" allowTransparency="true" class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><![endif]--><!--[if !IE]><!--><iframe class="addtoany_special_service google_plusone" src="https://plusone.google.com/u/0/_/%2B1/fastbutton?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F&amp;size=medium&amp;count=false" scrolling="no" style="border:none;overflow:hidden;width:32px;height:20px"></iframe><!--<![endif]--><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F07%2F15%2Fhosting-coupon-60-off-the-first-month-for-any-plan%2F&amp;title=Hosting%20Coupon%20%3A%2060%25%20off%20the%20first%20month%20for%20ANY%20plan%21" id="wpa2a_16"><img src="http://www.stardothosting.com/blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/07/15/hosting-coupon-60-off-the-first-month-for-any-plan/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to backup Xen with Logical Volume Mounts ; Works with HyperVM, SolusVM, FluidVM and More</title>
		<link>http://www.stardothosting.com/blog/2010/03/19/how-to-backup-xen-with-logical-volume-mounts-works-with-hypervm-solusvm-fluidvm-and-more/</link>
		<comments>http://www.stardothosting.com/blog/2010/03/19/how-to-backup-xen-with-logical-volume-mounts-works-with-hypervm-solusvm-fluidvm-and-more/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 19:19:43 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Shell Scripting]]></category>
		<category><![CDATA[fluidvm]]></category>
		<category><![CDATA[hypervm]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[solusvm]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[xen backup]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=282</guid>
		<description><![CDATA[Through our research and implementation of many Xen environments, it has become necessary to develop a reliable and secure method for backing up our Xen instances that are mounted on Logical Volumes (LVM).]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F03%2F19%2Fhow-to-backup-xen-with-logical-volume-mounts-works-with-hypervm-solusvm-fluidvm-and-more%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F03%2F19%2Fhow-to-backup-xen-with-logical-volume-mounts-works-with-hypervm-solusvm-fluidvm-and-more%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Through our research and implementation of many Xen environments, it has become necessary to develop a reliable and secure method for backing up our Xen instances that are mounted on Logical Volumes (LVM).</p>
<p>The underlying problem is that the logical volume is usually a live file system that cannot be directly mounted / backed up or imaged safely.</p>
<p>We have written a script that processes all running Xen logical volumes, creates a <b>snapshot</b> of the volume and through that snapshot , uses <b>dd</b> to image the snapshot to another server over <b>ssh</b>.</p>
<p>You would be surprised at how well these dd images compress. Piping dd to bzip2 then to ssh to receive the image produces a very substantial compression ratio.</p>
<p>The initial trouble was writing the logic in the script to properly go through each Xen LV , create the snapshot, image and then remove the snapshot. Obviously extensive testing had to be completed to ensure reliability and proper error reporting. </p>
<p>This script should work with any 3rd party Xen control panel implementation (HyperVM, FluidVM, SolusVM to name a few). They all use the same underlying technology / framework. Since our script is a simple bash / shell script, it will run on any linux based system with little modification. </p>
<p>If you are using a LV for another purpose on the same box, it is probably a good idea to modify the script to ignore that so it doesn&#8217;t inadvertently get backed up.</p>
<p>Before implementing the script, it is probably a good idea to go through the motions manually just to see how it performs :</p>
<pre>
lvcreate -s -L 5G -n vm101_img_snapshot /dev/vps/vm101_img
dd if=/dev/vps/vm101_img_snapshot | bzip2 | ssh xenbackup@x.x.x.x "dd of=vm101_img.bz2"
</pre>
<p>One thing that you cant get around is space &#8212; you need to leave as much room as the largest Xen image on your logical volume &#8212; otherwise the script will fail at the snapshot creation process.</p>
<p>Find the script below. Hopefully it will help make your life easier (as well as being able to sleep at night) :</p>
<pre>
#!/bin/bash
# XEN Backup script
# Written by Star Dot Hosting

todaysdate=`date "+%Y-%m-%d"`

echo "XEN Backup Log: " $currentmonth > /var/log/backup.log
echo -e "------------------------------------" >> /var/log/backup.log
echo -e "" >> /var/log/backup.log

for obj0 in $(lvs --noheadings --separator ',' -o lv_name,lv_size | grep -v "swap" | awk -F "," '{printf "%s\n", $1}');
do

#grab the snapshot size
snapsize=`lvs --noheadings --separator ',' -o lv_name,lv_size | grep -v "swap" | grep $obj0 | awk -F "," '{printf "%s", $2}'`

#create the snapshot
lvcreate -s -L $snapsize -n $obj0_snapshot /dev/xenlvm/$obj0 >> /var/log/backup.log 2>&#038;1

#dd piped to bzip2 to compress the stream before piping it over the network via ssh to the destination box
dd if=/dev/xenlvm/$obj0_snapshot | bzip2 | ssh xenbackup@0.0.0.0 "dd of=/home/xenbackup/xen-backups/$obj0.$todaysdate.bz" >> /var/log/backup.log 2>&#038;1

if [ "$?" -eq 1 ]
then
        echo -e "***SCRIPT FAILED, THERE WERE ERRORS***" >> /var/log/backup.log 2>&#038;1
        cat /var/log/backup.log | mail -s "XEN Backup Job failed" admin@yourdomain.com
        lvremove -f /dev/xenlvm/$obj0_snapshot
        exit 1
else
        echo -e "Backup of $obj0 Completed Successfully!" >> /var/log/backup.log 2>&#038;1
fi

# remove the snapshot
lvremove -f /dev/xenlvm/$obj0_snapshot

done

cat /var/log/backup.log | mail -s "XEN Backup Job Completed" admin@yourdomain.com
</pre>
<p>If you plan on automating this script in a cronjob, it may be a good idea to utilize <a href="http://blog.stardothosting.com/2009/06/02/ssh-key-based-authentication/">ssh key authentication</a> between your destination server and your Xen server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/03/19/how-to-backup-xen-with-logical-volume-mounts-works-with-hypervm-solusvm-fluidvm-and-more/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Migrate FreeBSD to Xen</title>
		<link>http://www.stardothosting.com/blog/2010/03/04/migrate-freebsd-to-xen/</link>
		<comments>http://www.stardothosting.com/blog/2010/03/04/migrate-freebsd-to-xen/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 19:55:26 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://blog.stardothosting.com/?p=273</guid>
		<description><![CDATA[There seems to be a lot of tutorials with respect to how you can dump/restore FreeBSD implementations. However, none of them appear to be all encompassing what is actually required from <b>start to finish</b> during the entire process.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F03%2F04%2Fmigrate-freebsd-to-xen%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.stardothosting.com%2Fblog%2F2010%2F03%2F04%2Fmigrate-freebsd-to-xen%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>There seems to be a lot of tutorials with respect to how you can dump/restore FreeBSD implementations. However, none of them appear to be all encompassing what is actually required from <b>start to finish</b> during the entire process.</p>
<p>The one thing that I think is lacking in proper documentation is utilizing FreeBSD in a LiveCD scenario (LiveFS) within a network capacity (necessary for migration).</p>
<p>We decided to write this tutorial so that people could have one place to establish all the necessary things required for this type of migration from start to finish.</p>
<p>In this scenario we actually migrated a FreeBSD implementation on VMWARE to XEN HVM. In the end, there were no technical problems with FreeBSD actually running after it was migrated &#8212; it ran beautifully actually.</p>
<p>I should note that this was tested with FreeBSD 7.2-RELEASE disc images. </p>
<p>Please find the guide below : </p>
<p><big><b><u>Prepare OLD Instance</big></b></u></p>
<p>1. Boot into old operating system</p>
<p>2. Take note of partition slices / slice names / sizes / etc</p>
<p>3. Reboot with FreeBSD LiveFS disc</p>
<p><big><b><u>Prepare NEW Xen</b></u></big></p>
<p>1. Boot Xen instance with FreeBSD Disc 1 ISO</p>
<p>2. Partition / install boot loader exactly the same slices as the old instance. To be extra careful, give your slices a bit more disc space than the old implementation.</p>
<p>3. Write changes &#038; reboot with FreeBSD LiveFS disc</p>
<p><big><b><u>Establish FreeBSD LiveFS environment</big></b></u></p>
<p>You need to establish a few things to get SSH / DUMP / RESTORE to work properly on both the &#8221;&#8217;old&#8221;&#8217; and &#8221;&#8217;new&#8221;&#8217; instances</p>
<p>1. Boot into FreeBSD LiveFS (Fixit > livefs)</p>
<p>2. Create the following folders :</p>
<pre>
/etc/ssh
/usr/sbin
/usr/bin
/root
/root/.ssh
</pre>
<p>3. Copy the following files :</p>
<pre>
cp /mnt2/bin/ps /bin
cp /mnt2/sbin/sysctl /sbin
cp /mnt2/etc/ssh/* /etc/ssh
cp /mnt2/bin/csh /bin
cp /mnt2/bin/cat > /bin
cp /mnt2/sbin/restore > /sbin
</pre>
<p>4. Set an IP address on both old and new instances:</p>
<p>new :</p>
<pre>ifconfig eth0 10.0.0.50 netmask 255.255.255.0</pre>
<p>old :</p>
<pre>ifconfig eth0 10.0.0.60 netmask 255.255.255.0</pre>
<p>5. Start sshd :</p>
<pre>
/mnt2/etc/rc.d/sshd forcestart
</pre>
<p><big><b><u>Start transferring slices</big></u></b></p>
<p>1. To allow for transferring of partitions properly, the /tmp partition should be mounted on the new Xen instance :</p>
<pre>mount -t ufs /dev/ad0s1e /tmp</pre>
<p>2. For the first partition you wish to transfer, mount the empty slice on the new xen instance :</p>
<pre>mount -t ufs /dev/ad0s1a /mnt/ufs.1</pre>
<p>Sometimes you have to fsck mark the filesystem clean to mount it :</p>
<pre>fsck /dev/ad0s1a</pre>
<p>3. On the old instance :</p>
<pre>dump -0aLf - /dev/ad0s1a | ssh 10.0.0.50 "cd /mnt/ufs.1 &#038;&#038; cat | restore -rf -"</pre>
<p>That should dump/restore the slice from old > new.</p>
<p><big><b><u>Final things on the new Xen instance</big></b></u></p>
<p>Dont forget to boot the new instance in single user mode and modify &#8221;&#8217;fstab&#8221;&#8217; to reflect the new slice names (if applicable), as well as &#8221;&#8217;rc.conf&#8221;&#8217; for any hard coded interface names, etc. FreeBSD won&#8217;t boot if the right slice names / interface names aren&#8217;t present. Or at least cause problems. </p>
<p>You can mount the /etc slice while still in the LiveFS for the new FreeBSD instance.</p>
<p>Hopefully this was helpful! Obviously this has nothing to do with Xen, other than the fact that we were migrating the FreeBSD vmware instance to Xen. </p>
<p>You can do this on &#8220;real&#8221; machines, or from xen to vmware or anywhere. As long as the hardware is compatible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stardothosting.com/blog/2010/03/04/migrate-freebsd-to-xen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

