<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Sandeep Sidhu&#039;s Blog</title>
	<atom:link href="http://sandeepsidhu.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sandeepsidhu.wordpress.com</link>
	<description>are you sanely insane or insanely sane</description>
	<lastBuildDate>Wed, 22 Feb 2012 19:02:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sandeepsidhu.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Sandeep Sidhu&#039;s Blog</title>
		<link>http://sandeepsidhu.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sandeepsidhu.wordpress.com/osd.xml" title="Sandeep Sidhu&#039;s Blog" />
	<atom:link rel='hub' href='http://sandeepsidhu.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Rackspace Cloud Files and php</title>
		<link>http://sandeepsidhu.wordpress.com/2011/10/06/rackspace-cloud-files-and-php/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/10/06/rackspace-cloud-files-and-php/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 00:21:31 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[Cloud Files]]></category>
		<category><![CDATA[cloud servers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[cloud files]]></category>
		<category><![CDATA[cloud files API]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=275</guid>
		<description><![CDATA[This article will explain how to use the Rackspace Cloud Files API with php using the php-cloudfiles bindings. All this information is available online, some on Rackspace KB articles, github, API docs. But for somebody who is just now starting with cloud files, it&#8217;s not possible to gather all this information without wasting few days [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=275&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This article will explain how to use the Rackspace Cloud Files API with php using the php-cloudfiles bindings. All this information is available online, some on Rackspace KB articles, github, API docs. But for somebody who is just now starting with cloud files, it&#8217;s not possible to gather all this information without wasting few days time here and there. So, the objective of this article is to provide :</p>
<ul>
<li>All the available links to Cloud Files documentation, API, and PHP bindings.</li>
<li>PHP Cloud Files binding installation</li>
<li>PHP Cloud Files binding coding examples</li>
</ul>
<p><strong>Cloud Files Documentation links:</strong></p>
<ul>
<li>Cloud Files FAQ:  for answer to questions like, what is cloud files, what you can and you cannot do with cloud files. <a href="http://www.rackspace.com/knowledge_center/index.php/Cloud_Files_FAQ" target="_blank">http://www.rackspace.com/knowledge_center/index.php/Cloud_Files_FAQ</a></li>
<li>API Introduction:  API Introduction pdf file explains about Cloud Files product and it&#8217;s use cases, features.  <a href="http://docs.rackspace.com/files/api/cf-intro-latest.pdf" target="_blank">http://docs.rackspace.com/files/api/cf-intro-latest.pdf </a></li>
<li>API Developer Guide:   API Developer Guide lists RESTful API of cloud files, means how to query/store/retrive data from cloud files using a programming language, like php, asp, .NET, python, etc.  <a href="http://docs.rackspace.com/files/api/cf-devguide-latest.pdf" target="_blank">http://docs.rackspace.com/files/api/cf-devguide-latest.pdf</a></li>
</ul>
<p>In addition to all above Rackspace also have different language bindings which allows to interact with API easy. In this article we will concentrate on using php-cloudfiles language bindings.</p>
<p>PHP Cloud Files bindings on github.com <a href="https://github.com/rackspace/php-cloudfiles" target="_blank">https://github.com/rackspace/php-cloudfiles</a></p>
<p><strong>PHP Cloud Files binding installation</strong></p>
<p>Download a package from there using the Download link to your cloud server, and then extract it.</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 ~]# ls -la | grep cloudfiles
-rw-r--r--  1 root   root   496476 Oct  1 16:09 rackspace-php-cloudfiles-v1.7.9-0-gb5e5481.zip
[root@web01 ~]#
[root@web01 ~]# unzip rackspace-php-cloudfiles-v1.7.9-0-gb5e5481.zip
[root@web01 ~]#
[root@web01 ~]# ls -la | grep cloudfiles
drwxr-xr-x  6 root   root     4096 Oct  1 16:36 rackspace-php-cloudfiles-b5e5481
-rw-r--r--  1 root   root   496476 Oct  1 16:09 rackspace-php-cloudfiles-v1.7.9-0-gb5e5481.zip
[root@web01 ~]#
</pre></p>
<p>Once extracted, the folder should look something like this:</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 rackspace-php-cloudfiles-b5e5481]# ls
AUTHORS    cloudfiles_exceptions.php  cloudfiles.php  debian  phpdoc.ini   README  tests
Changelog  cloudfiles_http.php        COPYING         docs    phpunit.xml  share
[root@web01 rackspace-php-cloudfiles-b5e5481]#
</pre></p>
<p>Now we need to copy the cloudfiles API files to a place where they can be included in your php files, means source code files of API should be in PHP Include path.</p>
<p>As per the README file, following are the requirements for using API source code files:</p>
<p><pre class="brush: bash; toolbar: false;">
Requirements
;; ------------------------------------------------------------------------
;;   [mandatory] PHP version 5.x (developed against 5.2.0)
;;   [mandatory] PHP's cURL module
;;   [mandatory] PHP enabled with mbstring (multi-byte string) support
;;   [suggested] PEAR FileInfo module (for Content-Type detection)
;;
</pre></p>
<p>You can check all these with the following commands:</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 ~]# php -v
PHP 5.1.6 (cli) (built: Nov 29 2010 16:47:46)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
[root@web01 ~]#
</pre></p>
<p>Let&#8217;s check if curl is installed:</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 ~]# php -m | grep curl
curl
[root@web01 ~]#
</pre></p>
<p>Now let&#8217;s check mbstring</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 ~]# php -m | grep mbstring
[root@web01 ~]#
</pre></p>
<p>It looks like we don&#8217;t have mbstring installed, so let&#8217;s install it as well.</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 ~]# yum install php-mbstring
</pre></p>
<p>Similarly for FileInfo</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 ~]# php -m | grep file
[root@web01 ~]#
[root@web01 ~]# yum install php-pecl-Fileinfo
[root@web01 ~]# php -m | grep fileinfo
fileinfo
[root@web01 ~]#
[root@web01 ~]# cd rackspace-php-cloudfiles-b5e5481/
[root@web01 rackspace-php-cloudfiles-b5e5481]#
</pre></p>
<p>Remember you might have to change the folder name to reflect your own copy of the API</p>
<p>Now that we are in the source directory of php-cloudfiles, let&#8217;s move the required files to the right place.  Run the following commands, and move them to /usr/share/php.  This directory is part of the php include PATH.</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 rackspace-php-cloudfiles-b5e5481]# mkdir /usr/share/php
[root@web01 rackspace-php-cloudfiles-b5e5481]# cp cloudfiles* /usr/share/php/
</pre></p>
<p>After moving the php-cloudfiles API binding files into the php include PATH, now lets check it to make sure we have everything is setup ok.  We will create a simple php file and include the php-cloudfiles binding file into it.</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 rackspace-php-cloudfiles-b5e5481]# cd /var/www/html/
[root@web01 html]# touch cfcheck.php
</pre></p>
<p>Open your favorite text editor, e.g. vi editor, and type the following into cfcheck.php file:</p>
<p><pre class="brush: php; toolbar: false;">
&lt;?php
    require('cloudfiles.php'); 
?&gt;
</pre></p>
<p>Save the file cfcheck.php and run this command from the prompt:</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 html]# php cfcheck.php
[root@web01 html]#
</pre></p>
<p>Check the error state of the last command. It should be 0.</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 html]# echo $?
0
[root@web01 html]#
</pre></p>
<p>If you are returned to the prompt with no errors the PHP API is installed</p>
<p>If you get an error like this:</p>
<p><pre class="brush: bash; toolbar: false;">
PHP Fatal error:  require(): Failed opening required 'cloudfiles.php'
(include_path='.;C:\php5\pear') in cfcheck.php on line 1
</pre></p>
<p>Then you do not have the files located in the right place. This error should print out the include_path so make sure you have the files located there. Or you can change the include path in the php.ini but that is beyond the scope of this tutorial.</p>
<p><strong>PHP Cloud Files binding coding examples</strong></p>
<p>Okay.. I hope by now you have API installed. If yes, then let&#8217;s move onto actually trying some php cloud files code. If you are having problem with installing the API, then probably you should troubleshoot the above first before moving on.</p>
<p>For an easy access to php-cloudfiles documentation, run the following commands:</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 html]# cd rackspace-php-cloudfiles-b5e5481/
[root@web01 rackspace-php-cloudfiles-b5e5481]# cp -R docs/ /var/www/html/
[root@web01 rackspace-php-cloudfiles-b5e5481]# service httpd start
</pre></p>
<p>After this you can access the documentation at http:///docs url.</p>
<p>If you are a developer, then you can easily check the documentation and work from there, but let me put some examples here for non-developer or newbies.</p>
<p>Basically, whenever you put<br />
<pre class="brush: php; toolbar: false;">
require('cloudfiles.php');
</pre><br />
line in any of your php file, the following classes become available into your php code.</p>
<p>Classes:</p>
<ul>
<li>CF_Authentication: Class for handling Cloud Files Authentication, call it&#8217;s authenticate() method to obtain authorized service urls and an authentication token.</li>
<li>CF_Connection: Class for establishing connections to the Cloud Files storage system.</li>
<li>CF_Container: Container operations</li>
<li>CF_Object: Object operations</li>
</ul>
<p>Each class comes with it&#8217;s own methods and properties. Methods can be called on the objects of those classes and their properties can be set and queried.  For e.g. CF_Authentication class provides methods for authentication against the cloud files using the username and API key of your cloud files accounts. CF_Connection class provides a connection object. Connection object has methods like create_container, delete_container. Let&#8217;s look at the following code example.</p>
<p>Continuing on our previous example of cfcheck.php file, let&#8217;s add some more code into it.</p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 html]# vi cfcheck.php
</pre></p>
<p><pre class="brush: php; toolbar: false;">
&lt;?php         
       require('cloudfiles.php');
       $username='your cloud user name';
       $api_key=&quot;your cloud api key&quot;;
       $auth = new CF_Authentication($username, $api_key);
       $auth-&gt;authenticate();

        if ( $auth-&gt;authenticated() )
                echo &quot;CF Authentication successful \n&quot;;
        else
                echo &quot;Authentication faile \n&quot;;
?&gt;
</pre></p>
<p><pre class="brush: bash; toolbar: false;">
[root@web01 html]# php cfcheck.php
CF Authentication successful
[root@web01 html]#
</pre></p>
<p>if the above command runs without producing any error, then it means you have successfully authenticated against CF using the above php code. In the above code, first we created an object of CF_Authentication named auth by passing it username and API key as variables. Then we run authenticate() method of the CF_Authentication class which actually authenticates against the cloud files. Similarly, authenticated() method returns a boolean value (true or false) depending on the state of the auth object. I cannot be more explicit than this. if you are having problem understanding this, then you should probably not be doing this by yourself and get a developer, but if you still following so far and it&#8217;s working fine, let&#8217;s move forward&#8230; and add some more lines to our code.</p>
<p><pre class="brush: php; toolbar: false;">
&lt;?php         
       require('cloudfiles.php');
       $username='your cloud user name';
       $api_key=&quot;your cloud API key&quot;;
       $auth = new CF_Authentication($username, $api_key);
       $auth-&gt;authenticate();

       if ( $auth-&gt;authenticated() )
                echo &quot;CF Authentication successful \n&quot;;
       else
                echo &quot;Authentication faile \n&quot;;
       $conn = new CF_Connection($auth);
       $container_list = $conn-&gt;list_containers();
       print_r($container_list);

?&gt;
</pre><br />
<pre class="brush: bash; toolbar: false;">
[root@web01 html]# php cfcheck.php
CF Authentication successful
Array
(
    [0] =&gt; .CDN_ACCESS_LOGS
    [1] =&gt; cloudservers
    [2] =&gt; images
    [3] =&gt; sand
)
[root@web01 html]#
</pre></p>
<p>The output would be different depending on the containers you have in your cloud files and their names. Above are the name of the containers in my account. It might not list any containers if you don&#8217;t have one in your cloud files, but that&#8217;s okay. We will create container in the next lines. But as you can see in the code we added the following lines:</p>
<p><pre class="brush: php; toolbar: false;">
        $conn = new CF_Connection($auth);
        $container_list = $conn-&gt;list_containers();
        print_r($container_list);
</pre></p>
<p>we created a new CF_Connection object named conn and using this object, we got a list of all the containers with list_containers() method. list_containers() method gives us an array object in return containing the names of all the containers in your cloud files storage, in this examples I have used the print_r function to print the array in human readable format.</p>
<p>Well, I can add more code lines for creating container, deleting container, getting details of container like public URI, snet, etc., but that would be going too far and seems redundant as similar stuff is self explanatory in the API documentation.</p>
<p>But I do hope this article will give you a head start and helps you in finding the correct documentation and resources for your cloud files API and php coding. Do let me know how did you like it, and if there were any errors or typos, I would like to help back and improve it.</p>
<p>Good luck!!<br />
-Sandeep</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/275/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=275&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/10/06/rackspace-cloud-files-and-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>
	</item>
		<item>
		<title>Recovering deleted files from Linux ext3 filesystem on Cloud Servers</title>
		<link>http://sandeepsidhu.wordpress.com/2011/09/30/recovering-deleted-files-from-linux-ext3-filesystem-on-cloud-servers/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/09/30/recovering-deleted-files-from-linux-ext3-filesystem-on-cloud-servers/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 22:39:39 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[cloud servers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=252</guid>
		<description><![CDATA[Every now and then you hit enter on your keyboard and next second you realize your mistake, you just deleted some files by mistake. Immediately your mind starts thinking about your backups, changes you have made since last available backup, and all that.. Well, today I faced the challenge of recovering some accidently deleted from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=252&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Every now and then you hit enter on your keyboard and next second you realize your mistake, you just deleted some files by mistake.  Immediately your mind starts thinking about your backups, changes you have made since last available backup, and all that..</p>
<p>Well, today I faced the challenge of recovering some accidently deleted from from one of my cloud servers.  As we all know data never actually gets deleted from the hard disk, it gets unlinked from the file system table and then those blocks get overwritten by other data.  So, as soon as I realized that I have accidentally deleted the files, I booted the Cloud Server into rescue mode.  I did this because then my original HDD of the cloud server is not mounted RW and is not in use.  Then I downloaded my good old friend TestDisk, downloaded it and compiled, but bummer, it doesn&#8217;t recognize the HDD in cloud servers, don&#8217;t ask me why but it doesn&#8217;t may be it doesn&#8217;t have drivers for handling virtual hdds.  So, what next??</p>
<p>With some googling I found this link http://carlo17.home.xs4all.nl/howto/undelete_ext3.html. I really recommend that you give it a good read, very well explained by the developer how the program actually works.  The Developer of the ext3grep program wrote it to recover his own deleted files, as per his words &#8220;don&#8217;t expect it to work out-of-box&#8221;, and </p>
<p>Anyway, back to topic, I downloaded the code from http://code.google.com/p/ext3grep/ There were few other obstacles in the normal compiling and using it and finally recovering the deleted files.  So, I&#8217;ll explain the steps and additional packages you will need to compile the ext3 and running it successfully.</p>
<p>Download the latest ext3grep code:<br />
<pre class="brush: bash; toolbar: false;">
# wget http://ext3grep.googlecode.com/files/ext3grep-0.10.2.tar.gz
</pre></p>
<p>Extract the contents of the tar.gz file<br />
<pre class="brush: bash; toolbar: false;">
# tar -xzf ext3grep-0.10.2.tar.gz
</pre></p>
<p>Install the following dependency packages, these are needed for compiling the ext3grep code.<br />
<pre class="brush: bash; toolbar: false;">
# yum install gcc cpp
# yum install gcc-c++ libstdc++
# yum install e2fsprogs-devel
</pre></p>
<p>Now go into the extracted ext3grep directory and run the following commands:<br />
<pre class="brush: bash; toolbar: false;">
# cd ext3grep-0.10.2
# ./configure
</pre></p>
<p>./configure command should finish without any errors with the following lines in the bottom of the output.</p>
<p><pre class="brush: bash; toolbar: false;">
[...]
configure: creating ./config.status
config.status: creating src/timestamp-sys.h
config.status: sys.h is unchanged
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
</pre></p>
<p>If the ./configure command runs without any errors, that means all the required dependencies are met.  But even if it shows some problem, then just look at the error and improvise yourself.  Just check what it&#8217;s looking for and install those dependencies.</p>
<p>Next, please run the following commands<br />
<pre class="brush: bash; toolbar: false;">
# make
# make install
</pre></p>
<p>This will compile the ext3grep program, which you can use to recover the files.</p>
<p>Now, let&#8217;s talk about few things you need to know before starting to use the program.  I have read through the long article and will try to spit out few main points about the program.</p>
<p>The program assumes a spike of recently deleted files (shortly before the last unmount). It does NOT deal with a corrupted file system, only with accidently deleted files.</p>
<p>Also, the program is beta: the development of the program was done as a hack, solely aimed at recovering developer&#8217;s own data. He fixed few of the bugs that didn&#8217;t show in his case, but over all the program isn&#8217;t as robust as it could be. Therefore, it is likely that things might not work entirely out-of-the-box for you. The program is stashed with asserts, which makes it likely that if something doesn&#8217;t work for you then the program will abort instead of trying to gracefully recover. In that case you will have to dig deeper, and finish the program yourself, so to say.</p>
<p>The program only needs read access to the file system with the deleted files: it does not attempt to recover the files. Instead, it allows you to make a copy of deleted files and writes those to a newly created directory tree in the current directory (which obviously should be a different file system). All paths are relative to the root of the partion, thus— if you are analysing a partition /dev/md5 which was mounted under /home, then /home is unknown to the partition and to the program and therefore not part of the path(s). Instead, a path will be something like for example &#8220;carlo/c++/foo.cc&#8221;, without leading slash. The parition root (/home in the example) is the empty string, not &#8216;/&#8217;.</p>
<p>Just one more thing before you attempt to recover your files, the ext3grep program expects to find lost+found directory in the file system, and since our /dev/sda1 is not mounted in the resuce mode, there is no lost+found directory, the workaround is to mount the /dev/sda1 and just create a new directory inside it named lost+found, and unmount it.</p>
<p>Now for recovering files, ext3grep provides many command line options, it allows you to look for the superblock and read the superblock information.  It can show you which inode resides in which block group.  It can even prints the whole contents of a single inode, like all blocks linked to that inode and other data about the inode.  You can read more in the original article of ext3grep as mentioned in the starting of the article.</p>
<p>Enough about theory, let&#8217;s try some commands.</p>
<p>Running ext3grep:</p>
<p><pre class="brush: bash; toolbar: false;">
# $IMAGE=/dev/sda1
# ext3grep $IMAGE --superblock | grep 'size:'
Block size: 4096
Fragment size: 4096
</pre></p>
<p>Using the options &#8211;ls &#8211;inode $N, ext3grep lists the contents of each directory block of inode N. For example, to list the root directory of a partition:</p>
<p><pre class="brush: bash; toolbar: false;">
# ext3grep $IMAGE --ls --inode 2
</pre></p>
<p>It is also possible to apply filters to the output of &#8211;ls. An overview of the available filters is given in the output of the &#8211;help option:</p>
<p><pre class="brush: bash; toolbar: false;">
# ext3grep $IMAGE --help
[...]
Filters:
  --group grp            Only process group 'grp'.
  --directory            Only process directory inodes.
  --after dtime          Only entries deleted on or after 'dtime'.
  --before dtime         Only entries deleted before 'dtime'.
  --deleted              Only show/process deleted entries.
  --allocated            Only show/process allocated inodes/blocks.
  --unallocated          Only show/process unallocated inodes/blocks.
  --reallocated          Do not suppress entries with reallocated inodes.
                         Inodes are considered 'reallocated' if the entry
                         is deleted but the inode is allocated, but also when
                         the file type in the dir entry and the inode are
                         different.
  --zeroed-inodes        Do not suppress entries with zeroed inodes. Linked
                         entries are always shown, regardless of this option.
  --depth depth          Process directories recursively up till a depth
                         of 'depth'.
[...]
</pre></p>
<p><pre class="brush: bash; toolbar: false;">
$ ext3grep $IMAGE --restore-file 
</pre></p>
<p>the above command will create a RESTORED_FILES directory in your current directory and store the recovered files there.</p>
<p>Well, there are other lot of commands and options of manually recovering some small but important files, but I have to cut this article short as putting all that here would be duplicating the things.  Above instructions should be good enough for recovering one or two directories or some important files.  Do let me know if I have missed some important bits, I&#8217;ll update it.</p>
<p>Good Luck!!<br />
Sandeep</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/252/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=252&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/09/30/recovering-deleted-files-from-linux-ext3-filesystem-on-cloud-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>
	</item>
		<item>
		<title>Rackspace Cloud Servers &#8211; High Availability with heartbeat on CentOS 5.5</title>
		<link>http://sandeepsidhu.wordpress.com/2011/05/19/rackspace-cloud-servers-high-availability-with-heartbeat-on-linux-centos-5-5/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/05/19/rackspace-cloud-servers-high-availability-with-heartbeat-on-linux-centos-5-5/#comments</comments>
		<pubDate>Thu, 19 May 2011 21:47:05 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[cloud servers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[heartbeat]]></category>
		<category><![CDATA[high availability]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=157</guid>
		<description><![CDATA[This article is about setting up high-availability on CentOS using heartbeat software. We will have two web servers (named web1 and web2 in this article), both of these servers would have a shared IP (virtual IP) between them, this virtual IP would be active only at one web server at any time. So, it would [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=157&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This article is about setting up high-availability on CentOS using heartbeat software.  We will have two web servers (named web1 and web2 in this article), both of these servers would have a shared IP (virtual IP) between them, this virtual IP would be active only at one web server at any time.  So, it would be like an Active/Passive high-availability, where one web server would be active (have virtual IP) and other host would be in passive mode(waiting for first server to fail).  All your web requests would be directed to the virtual IP address through DNS configuration.  Both the server would have an heartbeat package installed and configured on them, this heartbeat service would be used by both the servers to check if the other box is active or have failed.  So, let&#8217;s get on with it.  I&#8217;m going to use rackspace cloud server to configure it.</p>
<h4>Creating the cloud servers and shared IP:</h4>
<p>Login into your Rackspace Cloud Control Panel at https://manage.rackspacecloud.com and create two CentOS 5.5 Cloud Servers.  Choose the configuration which suites your resource requirement, give them descriptive names so that you can easily identify them for e.g. web1 and web2.  Once you have your two Cloud Servers created, you will have to create a support ticket to get a shared IP for your cloud servers, as mentioned on this link cloudservers.rackspacecloud.com/index.php/Frequently_Asked_Questions#Can_I_buy_extra_IPs.3F</p>
<h4>Installing heartbeat software:</h4>
<p>Note: All the following commands are need to be run on both the cloud servers (e.g. web01 web02)</p>
<p>You will have to install heartbeat package to setup heartbeat between both the cloud servers for monitoring.<br />
<pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
[root@ha01 /]# yum update
[root@ha01 /]# yum install heartbeat-pils heartbeat-stonith  heartbeat
</pre></p>
<p>Once all the above packages get installed, you can confirm them by running following command:<br />
<pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
[root@ha01 /]# rpm -qa | grep heartbeat
heartbeat-pils-2.1.3-3.el5.centos
heartbeat-stonith-2.1.3-3.el5.centos
heartbeat-2.1.3-3.el5.centos
[root@ha01 /]# 
</pre></p>
<h4>Configuring heartbeat:</h4>
<p>First, we need to copy sample configuration files from the /usr/share/doc/heartbeat-2.1.3 directory to /etc/ha.d directory</p>
<p><pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
[root@ha01 ha.d]# cd /usr/share/doc/heartbeat-2.1.3/
[root@ha01 heartbeat-2.1.3]# cp ha.cf authkeys haresources /etc/ha.d
[root@ha01 heartbeat-2.1.3]# cd /etc/ha.d/
[root@ha01 ha.d]# ls
authkeys  ha.cf  harc  haresources  rc.d  README.config  resource.d  shellfuncs
[root@ha01 ha.d]# 
</pre></p>
<p>Next, we need to populate authkeys file with an MD5 sum key.  You can generate the key with following command.</p>
<p><pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
[root@ha01 ha.d]#  dd if=/dev/urandom bs=512 count=1 2&amp;gt;/dev/null | openssl md5
ea6cdc1133c424e432aed155dd48a49d
</pre></p>
<p>Now we need to enter the key into &#8220;authkeys&#8221; file, so it looks like following.</p>
<p><pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
[root@ha01 ha.d]# cat authkeys 
auth 1
1 md5 a77030a32d0cc2b6cac31f9cddfe4b09
</pre></p>
<p>Next, we need to configure ha.cf and add/update the following parameters in it with appropriate values:  You will need to change the hostname as per your cloud server host names for node parameters.</p>
<p>on web01<br />
<pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 10
udpport 694
bcast eth1
ucast eth1 
auto_failback on
node web01
node web02
</pre></p>
<p>On web02:<br />
<pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 10
udpport 694
bcast eth1
ucast eth1 &lt;private IP address of web01&gt;
auto_failback on
node web01
node web02
</pre></p>
<p>Next, we need to configure haresources and add resources into it.  The haresources file contains a list of resources that move from machine to machine as nodes go down and come up in the cluster.  Do not include any fixed IP addresses in this file.</p>
<p><b>Note: The haresources file MUST BE IDENTICAL on all nodes of the cluster.</b></p>
<p>The node names listed in front of the resource group information is the name of the preferred node to run the service.  It is not necessarily the name of the current machine.  Like in below example, I have chosen web01 as the preferred node to run the HTTPD service, but if web01 is not available then the httpd service will be started on web02.  Should the service move back to web01 again once it becomes available is controlled by the auto_failback ON configuration in ha.cf file</p>
<p>So, add the following line into haresrouces file on both the servers.</p>
<p><pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
web01 &lt;shared IP address&gt;/24/eth0 httpd
</pre></p>
<h4>Starting the heartbeat service:</h4>
<p>Now, let’s start the heartbeat service on both the nodes using following command</p>
<p><pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
[root@web01 /# chkconfig heartbeat on
[root@web01 /# service heartbeat start
Starting High-Availability services: 
2011/04/27_08:16:04 INFO:  Resource is stopped
                                                           [  OK  ]
</pre></p>
<p>Now if you check httpd service status, it should be running.  And your shared IP address should be up on the web01 node.</p>
<p><pre class="brush: plain; auto-links: false; gutter: false; toolbar: false;">
[root@web01 ~]# service httpd status
httpd (pid  23938) is running...
</pre></p>
<p>ifconfig -a command will show you all the available IP address.  By running ifconfig -a command on the web01 you can confirm that it has the virtual IP address up and accessible on it.<br />
Testing the failover using heartbeat service:<br />
Let’s test the high availability.  Shutdown the web01 node using halt command.  The virtual IP address and httpd service should automatically be failed over to web02.</p>
<p>Good Luck!<br />
- Sandeep Sidhu</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/157/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/157/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/157/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=157&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/05/19/rackspace-cloud-servers-high-availability-with-heartbeat-on-linux-centos-5-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>
	</item>
		<item>
		<title>Rackspace Cloud Servers &#8211; High Availability and Load Balancing on CentOS 5.5</title>
		<link>http://sandeepsidhu.wordpress.com/2011/05/19/rackspace-cloud-servers-high-availability-and-load-balancing-on-centos-5-5/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/05/19/rackspace-cloud-servers-high-availability-and-load-balancing-on-centos-5-5/#comments</comments>
		<pubDate>Thu, 19 May 2011 21:37:33 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[cloud servers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=77</guid>
		<description><![CDATA[This is starting page for high availability and load balancing articles I&#8217;m going to publish next. Now, there are many ways to achieve high availability (HA) for your website in cloud servers. Let me outline all of them to give you a clear picture so that you can choose whichever method best suits your requirements. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=77&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is starting page for high availability and load balancing articles I&#8217;m going to publish next.  Now, there are many ways to achieve high availability (HA) for your website in cloud servers. Let me outline all of them to give you a clear picture so that you can choose whichever method best suits your requirements.</p>
<p>1. <a href="http://sandeepsidhu.wordpress.com/2011/05/19/rackspace-cloud-servers-high-availability-with-heartbeat-on-linux-centos-5-5/" title="Rackspace Cloud Servers – High Availability with heartbeat on CentOS 5.5" target="_blank">High Availability</a><br />
Example:  You will have two webservers (master and slave).  High availability is setup using heartbeat in Active/Standby mode.  There is a virtual shared IP address between them, which IP address will be active on one of them at a time.<br />
In this setup, you will have to keep your database on a separate server.  Master and slave servers should be able to communicate with database server independently without any dependency on each other.</p>
<div id="attachment_119" class="wp-caption aligncenter" style="width: 310px"><a href="http://sandeepsidhu.files.wordpress.com/2011/02/ha-heartbeat.png"><img class="size-medium wp-image-119" title="ha-heartbeat" src="http://sandeepsidhu.files.wordpress.com/2011/02/ha-heartbeat.png?w=300&#038;h=181" alt="" width="300" height="181" /></a><p class="wp-caption-text">High Availability</p></div>
<p>Here is the <a href="http://sandeepsidhu.wordpress.com/2011/05/19/rackspace-cloud-servers-high-availability-with-heartbeat-on-linux-centos-5-5/" title="Rackspace Cloud Servers – High Availability with heartbeat on CentOS 5.5" target="_blank">link </a>to article explaining configuration of basic Active/Passive high availability using heartbeat.</p>
<p>2. Load balancing &#8212;&#8211; Still in writing&#8230;..<br />
Example: You will have one load balancer server.  You will have Load balancing service running on load balancer, listen for http traffic and will internally forward http traffic to a number of web servers.  So, you can have N+1 web servers behind this load balancer.  The Load balancing service will divide the load between your web servers.</p>
<p>3. Load balancing + High Availability   &#8212;&#8211; Still in writing&#8230;..<br />
Example: You will have two load balancer servers (master and slave).  There is a virtual shared IP address between them, which IP address will be active on one of them at a time.  You will have Load balancing service will listen on this shared IP on load balancers and will internally forward http traffic to a number of web servers.  So, you can have N+1 web servers.  The Load balancing service will divide the load between your web servers.</p>
<p>Good Luck!<br />
Sandeep Sidhu</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=77&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/05/19/rackspace-cloud-servers-high-availability-and-load-balancing-on-centos-5-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>

		<media:content url="http://sandeepsidhu.files.wordpress.com/2011/02/ha-heartbeat.png?w=300" medium="image">
			<media:title type="html">ha-heartbeat</media:title>
		</media:content>
	</item>
		<item>
		<title>MySQL master master replication on Debian 5 (Lenny)</title>
		<link>http://sandeepsidhu.wordpress.com/2011/05/19/mysql-master-master-replication-on-debian-5-lenny/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/05/19/mysql-master-master-replication-on-debian-5-lenny/#comments</comments>
		<pubDate>Thu, 19 May 2011 16:54:20 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[cloud servers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=141</guid>
		<description><![CDATA[MySQL master/master replication using Debian 5 (Lenny) on Rackspace cloud servers<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=141&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This article is about setting up mysql master master replication between two cloud servers. The operating system which I&#8217;m going to use is Debian 5 (Lenny) Rackspace cloud base image.</p>
<p>Setup outline:</p>
<p>We will have two cloud servers, named debian501 and debian502 during this exercise. Both servers have two IP addresses(one public, one private). We will configure the replication to be done using the private IP interface so that we don&#8217;t incur any bandwidth charges.</p>
<p>Creating the cloud servers:</p>
<p>You need to create two Linux cloud servers, using the Debian 5 image. You can create them by logging into your cloud control panel, and spinning up two cloud servers. Choose the RAM configuration depending on your requirement of the database. Name the server accordingly so that you can easily identify. For my exercise I have named them debian501 and debian502. All the below command I&#8217;m running as a root user.</p>
<h5>Instaling MySQL:</h5>
<p>We need to install mysql on both the debian cloud servers. Before installing MySQL we need to run few extra commands needed for any freshly installed Debian.</p>
<h6>Update the package database:</h6>
<p><pre class="brush: bash;">
#aptitude update
</pre></p>
<h6>Install locales:</h6>
<p><pre class="brush: bash;">
#aptitude install locales
#dpkg-reconfigure locales
</pre></p>
<p>The dpkg-reconfigure locales command will bring up a locales setting window where you can choose the locales for your system depending on your country and region. In my case I have choose &#8220;en_GB.UTF-8&#8243;.</p>
<h6>Now, you can run the following commands to get the MySQL installed:</h6>
<p><pre class="brush: bash;">
#aptitude install mysql-server mysql-client libmysqlclient15-dev
</pre></p>
<h6>Enabling the replication</h6>
<p>After this we need to make configuration changes into each of the server to enable replication.</p>
<p>First on debian501 server</p>
<p>We need to create our database which we will setup for replication, and also we need to create a replication username and password. Run the following commands to set it up. Do change all the values as per your needs.</p>
<p><pre class="brush: bash;">
#mysql -u root -p               --&gt; Login to your mysql with password you setup during mysql installation.&lt;br /&gt;
mysql&gt;
</pre></p>
<p>Open the file /etc/mysql/my.cnf and create/update following entries:</p>
<p><pre class="brush: bash;">
bind-address = 0.0.0.0
server-id = 1
log-bin = /usr/local/mysql/var/bin.log
log-slave-updates
log-bin-index = /usr/local/mysql/var/log-bin.index
log-error = /usr/local/mysql/var/error.log
relay-log = /usr/local/mysql/var/relay.log
relay-log-info-file = /usr/local/mysql/var/relay-log.info
relay-log-index = /usr/local/mysql/var/relay-log.index
auto_increment_increment = 10
auto_increment_offset = 1
master-host = [private IP address of debian502]
master-user = [replication username]
master-password = [replication password
replicate-do-db = [database name to be replicated]
</pre></p>
<p>Second on debian502 server</p>
<p>Open the file /etc/mysql/my.cnf and create/update following entries:</p>
<p><pre class="brush: bash;">
bind-address = 0.0.0.0
server-id = 2
log-bin = /usr/local/mysql/var/bin.log
log-slave-updates
log-bin-index = /usr/local/mysql/var/log-bin.index
log-error = /usr/local/mysql/var/error.log
relay-log = /usr/local/mysql/var/relay.log
relay-log-info-file = /usr/local/mysql/var/relay-log.info
relay-log-index = /usr/local/mysql/var/relay-log.index
auto_increment_increment = 10
auto_increment_offset = 2
master-host = [ private IP address of debian501 ]
master-user = [ replication username ]
master-password = [ replication password ]
replicate-do-db = [ database name to be replicated ]
</pre></p>
<p>Now, restart both databases.  If the service restart on either server fails, then please check the /var/log/mysql/error.log file for any errors, and update the configuration checking for any typos, etc.,  </p>
<h5>Testing the scenarios:</h5>
<p>For the purpose of testing our replication setup, we can create the database specified in the configuration section above (replicate-do-db), as well as a test table on one of the nodes and watch the log files in /var/log/mysql directory.  Note that any and all the database changes should be replicated to our other server immediately.  </p>
<p><pre class="brush: bash;">
mysql&gt; create database [your-db-name];
mysql&gt; use [your-db-name]
mysql&gt; create table foo (id int not null, username varchar(30) not null);
mysql&gt; insert into foo values (1, 'bar');
</pre></p>
<p>An additional test is to stop the MySQL service on debian502, making database changes on the debian501 and then starting the service on debian502 once again. The debian502 MySQL service should sync up all the new changes automatically.</p>
<p>you should also consider changing the default binary log rotation values (expire_logs_days and max_binlog_size) in the /etc/mysql/my.cnf file, as by default all the binary logs will be kept for 10 days. If you have high transaction count in you database and application then it can cause signifient hard disk space usage in logs.  So, I would recommend changing those values as per your server backup policies.  For example, if you have daily backups setup of your MySQL node then it makes no sense to keep 10 days worth of binary logs.</p>
<p>Good luck!<br />
-Sandeep </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=141&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/05/19/mysql-master-master-replication-on-debian-5-lenny/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>
	</item>
		<item>
		<title>Setup automatic MySQL Server backups to Cloud Files in Windows</title>
		<link>http://sandeepsidhu.wordpress.com/2011/04/26/setup-automatic-mysql-server-backups-to-cloud-files-in-windows-rackspace-cloud-servers/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/04/26/setup-automatic-mysql-server-backups-to-cloud-files-in-windows-rackspace-cloud-servers/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 20:33:58 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=187</guid>
		<description><![CDATA[This article is about setting up automatic MySQL server backup from your Windows Cloud Server to your Rackspace Cloud Files container. There are mainly following three steps to set it up. 1. Download and build a small piece of software, which will be used to upload a file to Cloud Files. 2. Create a .bat [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=187&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This article is about setting up automatic MySQL server backup from your Windows Cloud Server to your Rackspace Cloud Files container. There are mainly following three steps to set it up.</p>
<p><b>1. Download and build a small piece of software</b>, which will be used to upload a file to Cloud Files.<br />
<b>2. Create a .bat file </b>which will take the backup of MySQL server database and upload database backup file to Cloud Files using the software we create in step 1.<br />
<b>3. Create a scheduled task in Windows</b> to run the above .bat file we created in step 2 at scheduled date and time.</p>
<h5>1. Download and build the upload software:</h5>
<p>We need to download a small piece of C# software and compile it on Windows Cloud Server. There are following easy steps to do this.</p>
<ul>
<li> Download the software from this <a href="http://c16281.r81.cf2.rackcdn.com/chmouel-upload-to-cf-cs-0.1-0-g79abd66.zip" title="upload-to-cf source code link">link</a>.</li>
<li> After downloading extract the software into your C: drive, e.g. c:/upload-to-cf-cs-0.1/</li>
<li> Now download and install nant from <a href="http://nant.sourceforge.net/" title="http://nant.sourceforge.net/" target="_blank">http://nant.sourceforge.net/</a>.</li>
<li> Once you have successfully installed nant, then open a command prompt go to c:/upload-to-cf-cs-0.1 and run nant.exe command in it like shown in following screenshot.</li>
</ul>
<div id="attachment_194" class="wp-caption alignleft" style="width: 610px"><a href="http://sandeepsidhu.files.wordpress.com/2011/04/nant_run_building.png"><img src="http://sandeepsidhu.files.wordpress.com/2011/04/nant_run_building.png?w=600&#038;h=262" alt="" title="Running Nant to build" width="600" height="262" class="size-full wp-image-194" /></a><p class="wp-caption-text">Run Nant to build the upload-to-cf code</p></div>
<p>The above command will compile a binary file upload-to-cf.exe. We will be using this binary file to upload our backup files to Cloud Files. You can test this command using the following syntax:</p>
<p><pre class="brush: bash; toolbar: false;">
upload-to-cf.exe [cloud username] [cloud api_key] [container name] [file path]
</pre></p>
<h5>2. Create a .bat file for taking backups:</h5>
<p>Next, we need to create a .bat file to automate the MySQL database backup procedure. We want to backup the MySQL database backup file to a date-stamped file. There are several ways to do this, but the easiest way is through a batch file. The command we&#8217;ll be using is following:<br />
<pre class="brush: bash; toolbar: false;">
c:\\bin\mysqldump -u[user] -p[password] --result-file=&quot;c:\\backup.%DATE:~0,3%.sql&quot; [database name]
</pre></p>
<p>Replace the values for username, password, and database name with your MySQL information. You can try this command on a normal command prompt, and make sure that it works without any problem before actually using it in an .bat file. The above command should end up with .sql file containing a full dump of the MySQL database, the name you provided at the end of the above command.<br />
Once you are satisfied that the above command works without any problem, then you can go ahead and create a .bat backup file (e.g., mysql-backup.bat). It can look like this&#8230;<br />
Note: You need to replace the values in [] brackets with actual values for your system.<br />
<pre class="brush: bash; toolbar: false;">
@echo off
echo “Running dump... “
c:\\bin\mysqldump -u[user] -p[password] --result-file=&quot;c:\\backup.%DATE:~0,3%.sql&quot; [database name]
echo “MySQL dump done!”
echo “Uploading to cloud files”
upload-to-cf.exe [cloud username] [cloud api_key] [container name] “c:\\backup.%DATE:~0,3%.sql”
echo “backup file uploaded to cloud files!”
</pre></p>
<p>Now you should be able to run mysql-backup.bat from a command prompt. If it works, you should see a success message and a file should be generated in the directory you specified. If not, make sure you&#8217;ve got the correct username, password, and database and try it again.</p>
<h5>3. Fully automate, scheduled task:</h5>
<p>So we have got out mysql-backup.bat file working, which creates the backup of our MySQL database and uploads it to Rackspace Cloud Files using the upload-to-cf.exe. The next step is to create a Windows Scheduled Task so that all the above steps get done automatically at a scheduled date and time without any human intervention. Follow the below steps to setup a scheduled task in windows.<br />
a) Click Start, click Run, type cmd, and then click OK.<br />
b) At the command prompt, type net start, and then press ENTER to display a list of currently running services. If Task Scheduler is not displayed in the list, type net start &#8220;task scheduler&#8221;, and then press ENTER.</p>
<p><a href="http://sandeepsidhu.files.wordpress.com/2011/04/net_start_taskscheduler.png"><img src="http://sandeepsidhu.files.wordpress.com/2011/04/net_start_taskscheduler.png?w=600&#038;h=134" alt="" title="net_start_taskscheduler" width="600" height="134" class="alignleft size-full wp-image-195" /></a></p>
<p>c) At the command prompt, type schtasks /create /tn &#8220;MySQL_Backup&#8221; /tr c:\apps\mysql-backup.bat /sc Value /st HH:MM:SS /ed MM/DD/YYYY, and then press ENTER. Note that you may have to change the parameters for your situation. For example, you might type schtasks /create /tn &#8220;MySQL_backup&#8221; /tr c:\apps\mysql-backup.bat /sc daily /st 08:00:00 /ed 12/31/2014.</p>
<div id="attachment_193" class="wp-caption alignleft" style="width: 610px"><a href="http://sandeepsidhu.files.wordpress.com/2011/04/create_scheduled_task.png"><img src="http://sandeepsidhu.files.wordpress.com/2011/04/create_scheduled_task.png?w=600&#038;h=222" alt="" title="Create Scheduled Task" width="600" height="222" class="size-full wp-image-193" /></a><p class="wp-caption-text">Create Scheduled Task</p></div>
<p>This above example schedules the MySQL_Backup program to run once a day, every day, at 8:00 A.M. until December 31, 2014. Because it omits the /mo parameter, the default interval of 1 is used to run the command every day.<br />
During the task creation you will be asked your currently logged in user’s password. Once you enter the password a new task will be created for you. You can view the newly created task with schtasks command.</p>
<p>Good Luck!<br />
-Sandeep Sidhu</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=187&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/04/26/setup-automatic-mysql-server-backups-to-cloud-files-in-windows-rackspace-cloud-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>

		<media:content url="http://sandeepsidhu.files.wordpress.com/2011/04/nant_run_building.png" medium="image">
			<media:title type="html">Running Nant to build</media:title>
		</media:content>

		<media:content url="http://sandeepsidhu.files.wordpress.com/2011/04/net_start_taskscheduler.png" medium="image">
			<media:title type="html">net_start_taskscheduler</media:title>
		</media:content>

		<media:content url="http://sandeepsidhu.files.wordpress.com/2011/04/create_scheduled_task.png" medium="image">
			<media:title type="html">Create Scheduled Task</media:title>
		</media:content>
	</item>
		<item>
		<title>Devotion to duty</title>
		<link>http://sandeepsidhu.wordpress.com/2011/04/23/devotion-to-duty/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/04/23/devotion-to-duty/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 11:16:10 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[comics]]></category>
		<category><![CDATA[Fun]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=103</guid>
		<description><![CDATA[<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=103&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 648px"><a href="http://xkcd.com/705/"><img alt="" src="http://imgs.xkcd.com/comics/devotion_to_duty.png" title="Devotion to Duty " width="620" height="240" /></a><p class="wp-caption-text">Devotion to duty</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/103/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/103/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/103/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=103&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/04/23/devotion-to-duty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>

		<media:content url="http://imgs.xkcd.com/comics/devotion_to_duty.png" medium="image">
			<media:title type="html">Devotion to Duty </media:title>
		</media:content>
	</item>
		<item>
		<title>Installing XenServer using usb &#8211; mboot.c32: not a COM32R image</title>
		<link>http://sandeepsidhu.wordpress.com/2011/04/15/installing-xenserver-using-usb-mboot-c32-not-a-com32r-image/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/04/15/installing-xenserver-using-usb-mboot-c32-not-a-com32r-image/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 09:46:50 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=177</guid>
		<description><![CDATA[Today I was installing XenServer to one of my boxes using USB as installation media. As usual, I downloaded the XenServer ISO file and used latest version of unetbootin-linux-549 to create a bootable USB. But it wouldn&#8217;t boot as expected, and throw me an error saying &#8220;kernel image not found&#8221;. As it turns out, some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=177&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I was installing XenServer to one of my boxes using USB as installation media. As usual, I downloaded the XenServer ISO file and used latest version of unetbootin-linux-549 to create a bootable USB. But it wouldn&#8217;t boot as expected, and throw me an error saying &#8220;kernel image not found&#8221;.</p>
<p>As it turns out, some extra steps needs to be done for booting XenServer installation from USB. I followed this article <a href="http://community.citrix.com/display/ocb/2010/01/17/Install+XenServer+from+USB+Drive">here</a> and made the following changes in the USB.</p>
<p>I copied &#8220;client_install&#8221; and &#8220;packages.main&#8221; to USB<br />
Rename rename \syslinux.cfg file to syslinux_cfg.old<br />
Rename the \boot\isolinux directory to  \boot\syslinux<br />
Rename the \boot\syslinux\isolinux.cfg file to syslinux.cfg</p>
<p>As per the article, at this point you&#8217;re done &#8211; stick the USB stick into the Server where you&#8217;d like to install XenServer</p>
<p>But now I started the following error:<br />
mboot.c32: not a COM32R image</p>
<p>After lots of debugging and googling, I figured it out that unetboot is using a buggy version of syslinux and it&#8217;s messing it up for me.  So, I thought let&#8217;s replace mboot.c32 with an older version and see if it works.</p>
<p>I mounted by USB disk and replaced the mboot.c32 inside it, and run the syslinux command on it.</p>
<p>cp -r /usr/lib/syslinux/mboot.c32 /media/disk/boot/syslinux/<br />
syslinux /dev/sdb1</p>
<p>It worked for me afterwards!</p>
<p>-Sandeep Sidhu</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/177/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=177&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/04/15/installing-xenserver-using-usb-mboot-c32-not-a-com32r-image/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>
	</item>
		<item>
		<title>Installing Apache, MySQL, and PHP on Fedora 14 on Rackspace cloud servers.</title>
		<link>http://sandeepsidhu.wordpress.com/2011/03/10/installing-apache-mysql-and-php-on-fedora-14-on-rackspace-cloud-servers/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/03/10/installing-apache-mysql-and-php-on-fedora-14-on-rackspace-cloud-servers/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 14:30:48 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[cloud servers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=134</guid>
		<description><![CDATA[Installing Apache, MySQL, and PHP on Fedora 14 on Rackspace cloud servers.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=134&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Following are the steps to install Apache, MySql and PHP on Fedora 14 on Rackspace cloud servers:</p>
<p>Do a SSH login to your cloud server.  If you use windows, you can use PuTTY to login to your cloud server.  You can download the PuTTY from here.<br />
You can login with root using the password send to you via email when you first created your cloud server</p>
<p>After logging into your cloud server run the following commands:<br />
<pre class="brush: bash; toolbar: false;">
#yum update
</pre></p>
<p>Once it has finished updating run the following:</p>
<p><pre class="brush: bash; toolbar: false;">
#yum install httpd mysql mysql-server php php-devel php-mysql
</pre></p>
<p>Once this has finished installing run the following:</p>
<p><pre class="brush: bash; toolbar: false;">
#/etc/init.d/mysqld start
#/usr/bin/mysql_secure_installation
</pre></p>
<p>You will be asked for current password, just press enter.  Then next set a root password (make it a secure one), remove anonymous users, disallow root login remotely unless you want to manage your MySql remotely, and remove the test database. Finally reload the privilege tables. </p>
<p>To make sure MySQL always loads on restart run the following:</p>
<p><pre class="brush: bash; toolbar: false;">
#chkconfig mysqld on
</pre></p>
<p>We also want to do similar for Apache so run the following:</p>
<p><pre class="brush: bash; toolbar: false;">
/etc/init.d/httpd start
chkconfig --levels 235 httpd on
</pre></p>
<p>This will start the web server, however if you go to the IP address of the server in your browser it will say there is a problem loading the page, what is happening is that the Rackspace images have a very restrictive firewall to start, we need to allow some traffic through. To do this perform the following commands:</p>
<p><pre class="brush: bash; toolbar: false;">
#iptables -I INPUT 1 -p tcp --dport http -j ACCEPT
#iptables -I INPUT 1 -p tcp --dport mysql -j ACCEPT
#service iptables save
#service iptables restart
</pre></p>
<p>Once this has done you will be able to see the Apache welcome page on your server IP</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=134&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/03/10/installing-apache-mysql-and-php-on-fedora-14-on-rackspace-cloud-servers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>
	</item>
		<item>
		<title>Mounting Rackspace Cloud Files using cloudfuse into ubuntu 10.10 v2</title>
		<link>http://sandeepsidhu.wordpress.com/2011/03/07/mounting-cloud-files-using-cloudfuse-into-ubuntu-10-10-v2/</link>
		<comments>http://sandeepsidhu.wordpress.com/2011/03/07/mounting-cloud-files-using-cloudfuse-into-ubuntu-10-10-v2/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 17:38:39 +0000</pubDate>
		<dc:creator>sandeepsidhu</dc:creator>
				<category><![CDATA[cloud servers]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://sandeepsidhu.wordpress.com/?p=130</guid>
		<description><![CDATA[Mounting cloud files inside Linux operating system.  You can mount your cloud files into a directory in your Linux operating system and use it to take backup of your files directly into cloud files containers.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=130&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This article shows how to mount cloud files using cloudfuse software into your ubuntu 10.10 as a directory so you can access your cloud files containers data inside your linux server just like any other folder and files.  One heads up, this gives you an easy access to your cloud files data but in no way means you can use it as a place for any database/application directly running from it, will be darn slow.  So, why would one want it then? Well, there are plenty of uses of having system level access to your cloud files, for instance if you have some scripts which create your mysql backup or website backup, those scripts can create backups automatically into cloud files without you needing to copy them yourself.  So, lets get on with it..</p>
<p><em>Note:  The following commands are tried and tested on Ubuntu 10.10, but they should be easily applicable to other versions of ubuntu or debian.  As long as you install the required packages, you should be able to compile cloudfuse code and use it.</em> </p>
<p>Installing cloud fuse:<br />
First download the cloudfuse code from  <a href="http://c16281.r81.cf2.rackcdn.com/cloudfuse-0.1.tar.gz">cloudfuse-0.1.tar.gz</a>.  I downloaded this code from upsteam maintainer and shared it here so that all the below steps work fine, as the new code changes in repository can cause compile time errors.  So, download the code from above link .  Extract this file and then compile.</p>
<p><pre class="brush: bash; toolbar: false;">
ssidhu@ssidhu:~$ tar -xzvf cloudfuse-0.1.tar.gz
</pre></p>
<p>Once you have extracted the .tar.gz file, you should have following files under cloudfuse-0.1 directory.</p>
<p><pre class="brush: bash; toolbar: false;">
root@ubuntu-test:~/cloudfuse-0.1# ls -la
total 280
drwxr-xr-x 3 root root   4096 Feb 21 21:47 .
drwx------ 4 root root   4096 Feb 21 21:47 ..
drwxr-xr-x 8 root root   4096 Feb 21 21:47 .git
-rw-r--r-- 1 root root   1059 Feb 21 21:47 LICENSE
-rw-r--r-- 1 root root   1024 Feb 21 21:47 Makefile.in
-rw-r--r-- 1 root root   2332 Feb 21 21:47 README
-rw-r--r-- 1 root root  12014 Feb 21 21:47 cloudfsapi.c
-rw-r--r-- 1 root root   1043 Feb 21 21:47 cloudfsapi.h
-rw-r--r-- 1 root root  11240 Feb 21 21:47 cloudfuse.c
-rw-r--r-- 1 root root   4335 Feb 21 21:47 config.h.in
-rwxr-xr-x 1 root root 198521 Feb 21 21:47 configure
-rw-r--r-- 1 root root   1324 Feb 21 21:47 configure.in
-rwxr-xr-x 1 root root  13184 Feb 21 21:47 install-sh
root@ubuntu-test:~/cloudfuse-0.1#
</pre></p>
<p>Now its time to compile it and install it.  You&#8217;ll need <strong><em>libcurl, libfuse, and libxml2 and their dev packages installed</em></strong> to build it.</p>
<p>Cloudfuse is built and installed like any other autoconf-configured code.  Normally,</p>
<p><pre class="brush: bash; toolbar: false;">
./configure
make
sudo make install
</pre></p>
<p>But, first you need to install the required packages, otherwise the <em>./configure</em> command will fail and throw you errors.</p>
<p><pre class="brush: bash; toolbar: false;">
apt-get update
apt-get install gcc
apt-get install libcurl4-openssl-dev
apt-get install libxml2 libxml2-dev
apt-get install libfuse-dev
</pre></p>
<p>now run the following command in the <em>cloudfuse</em> directory</p>
<p><pre class="brush: bash; toolbar: false;">
root@ubuntu-test:~/cloudfuse-0.1# ./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for XML... yes
checking for CURL... yes
checking for FUSE... yes
.........
............
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
root@ubuntu-test:~/cloudfuse-0.1# make
gcc -g -O2 -I/usr/include/libxml2     -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse   -o cloudfuse cloudfsapi.c cloudfuse.c -lxml2   -lcurl   -pthread -lfuse -lrt -ldl
root@ubuntu-test:~/cloudfuse-0.1# make install
/usr/bin/install -c cloudfuse /usr/local/bin/cloudfuse
root@ubuntu-test:~/cloudfuse-0.1#
</pre></p>
<p>If everything went fine, you should have cloudfuse installed properly.  Confirm this by running the <em>which</em> command.  It should show the location of the cloudfuse binary file.<br />
<pre class="brush: bash; toolbar: false;">
root@ubuntu-test:~/cloudfuse-0.1# which cloudfuse
/usr/local/bin/cloudfuse
root@ubuntu-test:~/cloudfuse-0.1#
</pre></p>
<p>Mounting cloudfiles:<br />
Let&#8217;s now use cloudfuse and mount our cloudfiles.</p>
<p>You&#8217;ll have to create a configuration file for cloudfuse in your home directory and put your Rackspace cloudfiles username and API key in it, like below:<br />
<pre class="brush: bash; toolbar: false;">
$HOME/.cloudfuse
    username=[username]
    api_key=[api key]
    authurl=[auth URL]
</pre></p>
<p>Auth URLs:<br />
US cloudfiles account: https://auth.api.rackspacecloud.com/v1.0<br />
UK cloudfiles account: https://lon.auth.api.rackspacecloud.com/v1.0</p>
<p>The following entries are optional, you can define these values in the .cloudfuse file.<br />
<pre class="brush: bash; toolbar: false;">
     use_snet=[True to use snet for connections]
     cache_timeout=[seconds for directory caching, default 600]
</pre></p>
<p>After creating the above configuration file, you will run the cloudfuse command like following.  The syntax should be as simple as:<br />
<pre class="brush: bash; toolbar: false;">
cloudfuse [mount point]
</pre></p>
<p>So, you should be able to mount cloud like this</p>
<p><pre class="brush: bash; toolbar: false;">
root@ubuntu-test:/# mkdir cloudfiles
root@ubuntu-test:/# cloudfuse /cloudfiles
</pre></p>
<p>If you run <em># ls -la</em> command inside the <em>/cloudfiles</em> directory you should see your cloudfiles containers.</p>
<p>If you are not the root of the system, then you username will need to be part of &#8220;fuse&#8221; group.  This can probably be accomplished with:<br />
<pre class="brush: bash; toolbar: false;">
sudo usermod -a -G fuse [username]
</pre></p>
<p>If you are unable to see any containers inside the mountpoint, then probably some of the above steps didn&#8217;t work properly.  You need to check and make sure that all the above steps get completed properly.</p>
<p><strong>UPDATE:</strong> 30/9/2011</p>
<p>Here is some extra info for CentOS on how to mount cloudfuse using another use ie. Apache.</p>
<p><pre class="brush: bash; toolbar: false;">
$ yum install fuse
$ usermod -a -G fuse apache
$ mkdir /mnt/cloudfiles
$ chown apache:apache /mnt/cloudfiles
$ sudo -u apache cloudfuse /mnt/cloudfiles -o username=myuser,api_key=mykey,use_snet=true,authurl=&quot;https://lon.auth.api.rackspacecloud.com/v1.0&quot;
</pre></p>
<p>Play around with it and fix it how you like, but I think it would be useful.  Courtesy my frnd Anh. </p>
<p>Let me know if there are any errors in these instructions or you faced some difficulty understanding them, I will update them accordingly.  Any comments are highly appreciated.</p>
<p>Note:  Please don&#8217;t bug Rackspace Support for the help on this article, it&#8217;s not supported by them hence this article. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>Good luck!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sandeepsidhu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sandeepsidhu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sandeepsidhu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sandeepsidhu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sandeepsidhu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sandeepsidhu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sandeepsidhu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sandeepsidhu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sandeepsidhu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sandeepsidhu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sandeepsidhu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sandeepsidhu.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sandeepsidhu.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sandeepsidhu.wordpress.com/130/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sandeepsidhu.wordpress.com&amp;blog=12545265&amp;post=130&amp;subd=sandeepsidhu&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sandeepsidhu.wordpress.com/2011/03/07/mounting-cloud-files-using-cloudfuse-into-ubuntu-10-10-v2/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/05c02e0b6c829b575de236c7994de752?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sandeepsidhu</media:title>
		</media:content>
	</item>
	</channel>
</rss>
