<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8911354555622031874</atom:id><lastBuildDate>Fri, 17 May 2013 23:48:44 +0000</lastBuildDate><category>indexes</category><category>Fedora</category><category>gpg</category><category>numsigninfo</category><category>http_load</category><category>news</category><category>smtp_athu</category><category>apt-get</category><category>freenx</category><category>mencoder</category><category>lvm</category><category>Windows</category><category>privvmpages</category><category>upgrade</category><category>kloxo</category><category>redhat</category><category>ppp</category><category>Domain-0</category><category>tftp</category><category>configuration</category><category>dhcpd</category><category>NIS</category><category>nginx</category><category>spam</category><category>RKHunter</category><category>.htaccess</category><category>Apache</category><category>Howto</category><category>RDS</category><category>hypervm</category><category>Videos Streaming</category><category>sysctl</category><category>Subversion</category><category>Boot Process</category><category>What is</category><category>putty</category><category>ffmpeg</category><category>Perl</category><category>Photon</category><category>memory</category><category>numproc</category><category>FreeNAS</category><category>mysqlslap</category><category>squid</category><category>Tomcat</category><category>puttygen</category><category>dns</category><category>Squirrelmail</category><category>fix</category><category>dhcp</category><category>Bash</category><category>User Administration</category><category>error</category><category>tmp</category><category>Trouble Shooting</category><category>json</category><category>xl2tpd</category><category>virtualization</category><category>ELB</category><category>Nessus</category><category>libogg</category><category>NTP</category><category>ec2</category><category>Samba</category><category>Anti Virus</category><category>Replication</category><category>Solutions</category><category>LMD</category><category>iso</category><category>rhel5</category><category>Oracle</category><category>pptpd</category><category>Openvpn</category><category>pgp</category><category>Remote installation</category><category>aptitude</category><category>nfs</category><category>firewall</category><category>mod_jk</category><category>Cluster</category><category>bruteforce</category><category>Cloud</category><category>named</category><category>rhel6</category><category>Network</category><category>screen</category><category>login</category><category>Load balancing</category><category>useful sites</category><category>phpmyadmin</category><category>ssh</category><category>Find Command</category><category>Semaphore</category><category>ddos</category><category>vnc</category><category>Dovecot</category><category>Boot</category><category>Dansguardian</category><category>lxadmin</category><category>exim</category><category>disk quota</category><category>hardening</category><category>AMI Copy</category><category>Database</category><category>xen vps</category><category>Proxy</category><category>kernel</category><category>Authentication</category><category>vpn</category><category>Ubuntu</category><category>mod_security</category><category>ftp</category><category>kickstart</category><category>proxmox</category><category>Release notes</category><category>Mail servers</category><category>High Availability</category><category>How To</category><category>mod_wsgi</category><category>installation</category><category>automounter</category><category>chattr</category><category>RAID</category><category>storage</category><category>unrar</category><category>date</category><category>suphp</category><category>whiltelist</category><category>Scripting</category><category>csf</category><category>yum</category><category>PXE</category><category>solusvm</category><category>cpanel</category><category>GNUPanel</category><category>phpmail</category><category>Benchmark</category><category>cyrus</category><category>qmail</category><category>Sudo</category><category>aws</category><category>cron</category><category>Sendmail</category><category>bind</category><category>xen</category><category>cpu</category><category>backup</category><category>lame</category><category>SMS</category><category>centos</category><category>fastcgi</category><category>mysql</category><category>Realm</category><category>httpd</category><category>security</category><category>package manager</category><category>pptp</category><category>ffmpg</category><category>openssl</category><category>AMI</category><category>FreeBSD</category><category>ufw</category><category>nrpe</category><category>Ebs</category><category>l2tpd</category><category>iscsi</category><category>jail environment</category><category>ssl</category><category>easyapache</category><category>Process</category><category>Monitoring tools</category><category>architecture</category><category>Small Tips</category><category>lfd</category><category>libvorbis</category><category>/proc</category><category>Dongle</category><category>arp</category><category>cache</category><category>postfix</category><category>load</category><category>directadmin</category><category>rpm</category><category>Log servers</category><category>virtual memory</category><category>vsftpd</category><category>SWAT</category><category>Openvz</category><category>commands</category><category>amazon</category><category>telnet</category><category>Linux-HA</category><category>debian</category><category>autoscaling</category><category>chkrootkit</category><category>csv</category><category>Servers</category><category>Android</category><category>rar</category><category>maldet</category><category>vps</category><category>linux</category><category>Tata</category><category>php</category><category>openfiler</category><category>control panel</category><category>Iptables</category><category>Migration</category><category>amazon s3</category><category>route</category><category>Nagios</category><category>Java</category><category>Webserver</category><category>nat</category><category>tcp</category><category>remote graphical access</category><category>Programing languages</category><category>nxserver</category><category>Timezone</category><category>s3cmd</category><category>Red5</category><title>Linux Help</title><description /><link>http://www.linuxhelp.in/</link><managingEditor>noreply@blogger.com (Randeep)</managingEditor><generator>Blogger</generator><openSearch:totalResults>223</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Linux-helps" /><feedburner:info uri="linux-helps" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>Linux-helps</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-1699512478612838249</guid><pubDate>Mon, 01 Apr 2013 18:54:00 +0000</pubDate><atom:updated>2013-04-02T00:26:03.173+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">tcp</category><category domain="http://www.blogger.com/atom/ns#">Windows</category><category domain="http://www.blogger.com/atom/ns#">Monitoring tools</category><title>TCP trace route in windows using tracetcp</title><description>Trace route is a nice tool to find where in network&amp;nbsp;resides&amp;nbsp;the actual problem.&amp;nbsp;Windows tracert uses ICMP. ICMP traces can often be inaccurate. To get a more realistic picture of what is going on we will use TCP based trace route. For this in windows based systems we can use tracetcp tool. In this post we will see how to install tracetcp in windows 7 and use it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can download a TCP trace route utility for Windows from the following location:&lt;br /&gt;
&lt;a href="http://tracetcp.sourceforge.net/"&gt;http://tracetcp.sourceforge.net/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You will need to download and install WinPcap first to be able to use tracetcp from the command line. You can download WinPcap from here:&lt;br /&gt;
&lt;a href="http://www.winpcap.org/install/default.htm"&gt;http://www.winpcap.org/install/default.htm&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Installing Wincap:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Click next:&lt;/li&gt;
&lt;/ul&gt;&lt;!-- adsense --&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-uzjehAobO4g/UVnSCUQ5VgI/AAAAAAAAF6A/jAVzoEY-pgg/s1600/11.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="260" src="http://2.bp.blogspot.com/-uzjehAobO4g/UVnSCUQ5VgI/AAAAAAAAF6A/jAVzoEY-pgg/s320/11.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Click agree and complete the installation.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-WigLjGH9p5w/UVnSNEWcptI/AAAAAAAAF6E/mI7s9LEfPvI/s1600/12.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="248" src="http://2.bp.blogspot.com/-WigLjGH9p5w/UVnSNEWcptI/AAAAAAAAF6E/mI7s9LEfPvI/s320/12.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Now download tracetcp, unzip it and copy it to your executable's location.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-Tgn-gv5KCeg/UVnTLVxPuVI/AAAAAAAAF6M/ZUBdgA9N90E/s1600/13.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="246" src="http://4.bp.blogspot.com/-Tgn-gv5KCeg/UVnTLVxPuVI/AAAAAAAAF6M/ZUBdgA9N90E/s320/13.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Now open the command prompt and run tracetcp command.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
Syntax:&lt;br /&gt;
#tracetcp &amp;nbsp;host&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-2iWfvs_c8BM/UVnTjw55eHI/AAAAAAAAF6U/3f8410amHPM/s1600/14.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="187" src="http://3.bp.blogspot.com/-2iWfvs_c8BM/UVnTjw55eHI/AAAAAAAAF6U/3f8410amHPM/s320/14.PNG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats it :)&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/VcSUgsNjQBI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/VcSUgsNjQBI/tcp-trace-route-in-windows-using.html</link><author>noreply@blogger.com (Randeep)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-uzjehAobO4g/UVnSCUQ5VgI/AAAAAAAAF6A/jAVzoEY-pgg/s72-c/11.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2013/04/tcp-trace-route-in-windows-using.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-411892775328979196</guid><pubDate>Mon, 25 Mar 2013 07:42:00 +0000</pubDate><atom:updated>2013-03-25T14:33:21.425+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Replication</category><category domain="http://www.blogger.com/atom/ns#">Cloud</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">Windows</category><category domain="http://www.blogger.com/atom/ns#">AMI</category><category domain="http://www.blogger.com/atom/ns#">amazon</category><category domain="http://www.blogger.com/atom/ns#">AMI Copy</category><category domain="http://www.blogger.com/atom/ns#">aws</category><title>Amazon AMI Copy example with snapshots</title><description>Amazon recently announced a new feature to copy the AMIs over regions. It makes replication very easy process. You have to &lt;a href="http://www.linuxhelp.in/2012/04/create-full-backup-image-of-amazon-ec2.html" target="_blank"&gt;create Linux AMI&lt;/a&gt; or &lt;a href="http://www.linuxhelp.in/2012/04/creating-amazon-windows-ami.html"&gt;Windows AMI&lt;/a&gt; of your instances. Then copy it to other regions in case if the current region goes down you can run your site/application from other regions. I have explained how to create AMIs of&amp;nbsp;Linux&amp;nbsp;and&amp;nbsp;windows&amp;nbsp;in previous posts. Also the &lt;a href="http://www.linuxhelp.in/2012/04/replicating-amazon-instance-to.html" target="_blank"&gt;replication of AMI&lt;/a&gt;. But this feature makes it very easy. &lt;br /&gt;
&lt;br /&gt;
In this example we will show how to copy an AMI from North Virginia(US-East) to Oregon(US-West):&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
Here We have an AMI in North Virginia&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/-_itPcH-5tiY/UU_-cfF8MyI/AAAAAAAAF4M/JuDr3ANvabY/s1600/1.png" imageanchor="1"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-_itPcH-5tiY/UU_-cfF8MyI/AAAAAAAAF4M/JuDr3ANvabY/s320/1.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Right click on it and click copy&lt;br /&gt;
&lt;a href="http://3.bp.blogspot.com/-tienAe1-4J4/UU_7fxWItZI/AAAAAAAAF3k/fLAP0sgzSVE/s1600/2.png" imageanchor="1"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-tienAe1-4J4/UU_7fxWItZI/AAAAAAAAF3k/fLAP0sgzSVE/s320/2.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
Choose the Destination Region and give a name for new AMI. And click yes copy. Copying is initiated. It will take20-30 minutes for copying the AMI.&lt;br /&gt;
&lt;a href="http://1.bp.blogspot.com/-7BMX44iKqco/UU_7kXfekYI/AAAAAAAAF3s/dmlImkGVI8I/s1600/3.png" imageanchor="1"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-7BMX44iKqco/UU_7kXfekYI/AAAAAAAAF3s/dmlImkGVI8I/s320/3.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Copying is initiated. It will take20-30 minutes for copying the AMI.&lt;br /&gt;
&lt;a href="http://1.bp.blogspot.com/-aUWWYk7uMMU/UU_7pk_8-6I/AAAAAAAAF30/u-xn56Doh8E/s1600/4.png" imageanchor="1"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-aUWWYk7uMMU/UU_7pk_8-6I/AAAAAAAAF30/u-xn56Doh8E/s320/4.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You can go to Oregon dashboard and check the status. While processing it will be in Pending status. After finishing it will be Available.&lt;br /&gt;
&lt;a href="http://4.bp.blogspot.com/-J_tQQ3XuwxA/UU_7vHWdo8I/AAAAAAAAF38/nZxoGt95AAM/s1600/5.png" imageanchor="1"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-J_tQQ3XuwxA/UU_7vHWdo8I/AAAAAAAAF38/nZxoGt95AAM/s320/5.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Don't just finish and run. Always check its working by launching one instance and make sure you terminate the test instance after testing.&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/HONzl2YYHeQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/HONzl2YYHeQ/amazon-ami-copy-example-with-snapshots.html</link><author>noreply@blogger.com (Randeep)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-_itPcH-5tiY/UU_-cfF8MyI/AAAAAAAAF4M/JuDr3ANvabY/s72-c/1.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2013/03/amazon-ami-copy-example-with-snapshots.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-323559468252621772</guid><pubDate>Tue, 18 Dec 2012 07:12:00 +0000</pubDate><atom:updated>2013-01-04T11:36:15.915+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">tftp</category><category domain="http://www.blogger.com/atom/ns#">Ubuntu</category><title>configuring tftp server in Ubuntu</title><description>We use tftp server for network boots. Loading images etc. In this post we will see how to set up a tftp server in Ubuntu.&lt;br /&gt;
&lt;br /&gt;
Install xinetd:&lt;br /&gt;
tftp&amp;nbsp;doesn't&amp;nbsp;have a&amp;nbsp;daemon&amp;nbsp;of its own. So it uses xinetd for service control. It is not installed in Ubuntu by default.&lt;br /&gt;
apt-get install xinetd&lt;br /&gt;
&lt;br /&gt;
Now install tftpd:&lt;br /&gt;
apt-get install tftpd&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
Create tftp content repository directory&lt;br /&gt;
We have to create a directory or use an existing directory to keep the images available through tftp.&lt;br /&gt;
mkdir /tftpboot&lt;br /&gt;
&lt;br /&gt;
Create tftp xinetd configuration file:&lt;br /&gt;
#vi /etc/xinet.d/tftp&lt;br /&gt;
service tftp&lt;br /&gt;
{&lt;br /&gt;
disable = no&lt;br /&gt;
socket_type = dgram&lt;br /&gt;
protocol = udp&lt;br /&gt;
wait = yes&lt;br /&gt;
user = root&lt;br /&gt;
server = /usr/sbin/in.tftpd&lt;br /&gt;
server_args = -s /tftpboot&lt;br /&gt;
per_source = 11&lt;br /&gt;
csp = 100 2&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Now the configuration is done. We can restart the xinetd to enabling tftp server.&lt;br /&gt;
#service xinetd restart&lt;br /&gt;
or&lt;br /&gt;
#sudo service xinetd restart&lt;br /&gt;
&lt;br /&gt;
Thats it. Enjoy. Don't forget to set enough env variables on client while accessing tftp service.&lt;br /&gt;
&lt;hr/&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/0672336243/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0672336243"&gt;Ubuntu Unleashed 2013 Edition: Covering 12.10 and 13.04 (8th Edition)&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/B0047B0U1C/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B0047B0U1C"&gt;Ubuntu 12.10, 4-discs DVD Installation and Reference Set, Ed.2012&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/159327047X/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=159327047X"&gt;The TCP/IP Guide: A Comprehensive, Illustrated Internet Protocols Reference&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/24Q7yT_2sUw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/24Q7yT_2sUw/configuring-tftp-server-in-ubuntu.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/12/configuring-tftp-server-in-ubuntu.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-3474999238232516869</guid><pubDate>Sat, 03 Nov 2012 17:59:00 +0000</pubDate><atom:updated>2013-01-04T11:32:24.712+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">Benchmark</category><category domain="http://www.blogger.com/atom/ns#">http_load</category><category domain="http://www.blogger.com/atom/ns#">How To</category><category domain="http://www.blogger.com/atom/ns#">Webserver</category><title>benchmarking with http_load</title><description>&lt;br /&gt;
There are a lot tools are there to benchmark a webserver. One of the useful tool is http_load. It is very simple to use. First you have to download and install http_load. Then test the webserver with urls and different options. With http_load you can run multiple http fetches in parallel to test the performance. It gives you a rough idea of how many bytes a server can serve in a time period.&lt;br /&gt;
Install the http_load tool:&lt;br /&gt;
wget http://www.acme.com/software/http_load/http_load-12mar2006.tar.gz&lt;br /&gt;
tar xvzf http_load-12mar2006.tar.gz&lt;br /&gt;
cd http_load-12mar2006&lt;br /&gt;
make&lt;br /&gt;
make install #if required&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
Now create a file of urls you want to test.&lt;br /&gt;
vi urls.txt&lt;br /&gt;
# cat urls.txt&lt;br /&gt;
http://www.linuxhelp.in/&lt;br /&gt;
http://www.linuxhelp.in/index.html&lt;br /&gt;
&lt;br /&gt;
Now start the test.&lt;br /&gt;
./http_load -rate 5 -seconds 5 urls.txt&lt;br /&gt;
./http_load -rate 500 -seconds 10 urls.txt&lt;br /&gt;
Some points to remember:&lt;br /&gt;
parallel – number of requests to open at a time&lt;br /&gt;
rate – number of requests to open per second&lt;br /&gt;
&lt;br /&gt;
jitter – vary the rate by about 10%&lt;br /&gt;
&lt;br /&gt;
fetches – quit after this many fetches&lt;br /&gt;
seconds – seconds to run the program&lt;br /&gt;
Example:&lt;br /&gt;
[root@work http_load-12mar2006]# ./http_load -rate 500 -seconds 10 urls.txt&lt;br /&gt;
4629 fetches, 435 max parallel, 1.56025e+08 bytes, in 10.0193 seconds&lt;br /&gt;
33706 mean bytes/connection&lt;br /&gt;
462.007 fetches/sec, 1.55724e+07 bytes/sec&lt;br /&gt;
msecs/connect: 271.956 mean, 4062.13 max, 1.98 min&lt;br /&gt;
msecs/first-response: 159.822 mean, 5099.23 max, 2.672 min&lt;br /&gt;
HTTP response codes:&lt;br /&gt;
&amp;nbsp; code 200 -- 4629&lt;br /&gt;
[root@work]#&lt;br /&gt;
&lt;hr/&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/0596529945/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596529945"&gt;Apache Cookbook: Solutions and Examples for Apache Administrators&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/1565925092/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1565925092"&gt;HTTP: The Definitive Guide&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/nJjQPn37xao" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/nJjQPn37xao/benchmarking-with-http-load.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/11/benchmarking-with-http-load.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-393246600251739882</guid><pubDate>Mon, 15 Oct 2012 11:01:00 +0000</pubDate><atom:updated>2012-10-29T23:40:08.632+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">centos</category><category domain="http://www.blogger.com/atom/ns#">Webserver</category><category domain="http://www.blogger.com/atom/ns#">Apache</category><category domain="http://www.blogger.com/atom/ns#">Semaphore</category><title>No space left on device: mod_jk: could not create jk_log_lock</title><description>I got this error while working on Apache.&lt;br /&gt;
[crit] (28)No space left on device: mod_jk: could not create jk_log_lock&lt;br /&gt;
Configuration Failed&lt;br /&gt;
&lt;br /&gt;
It was due to the semaphore limitation.&lt;br /&gt;
[root@host ~]# ipcs -su&lt;br /&gt;
------ Semaphore Status --------&lt;br /&gt;
used arrays = 127&lt;br /&gt;
allocated semaphores = 127&lt;br /&gt;
[root@host~]#&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
[root@host~]# ipcs -s&lt;br /&gt;
------ Semaphore Arrays --------&lt;br /&gt;
key        semid      owner      perms      nsems&lt;br /&gt;
0x00000000 4292608    nobody    600        1&lt;br /&gt;
0x00000000 4325377    nobody    600        1&lt;br /&gt;
0x00000000 4358146    nobody    600        1&lt;br /&gt;
0x00000000 4390915    nobody    600        1&lt;br /&gt;
0x00000000 4423684    nobody    600        1&lt;br /&gt;
0x00000000 4456453    nobody    600        1&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
Apache was running as nobody. In your case it may be as Apache itself.&lt;br /&gt;
I had to kill all the semaphores and restart Apache.&lt;br /&gt;
You can either kill one by one or use some script if a lot of semaphores are there.&lt;br /&gt;
&lt;br /&gt;
To kill one by one:&lt;br /&gt;
[root@host~]# ipcrm -s &lt;semaphore_id&gt;&lt;br /&gt;
&lt;br /&gt;
By script:&lt;br /&gt;
[root@host~]# for i in `ipcs -s | grep nobody | cut -d " " -f2`;do ipcrm -s $i; done&lt;br /&gt;
Now restart Apache. It should work.&lt;/semaphore_id&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;semaphore_id&gt;&lt;/semaphore_id&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/047051860X/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=047051860X&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Web Application Architecture: Principles, Protocols and Practices&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/1453689923/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1453689923&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;The Accidental Administrator: Linux Server Step-by-Step Configuration Guide&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/1430237236/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1430237236&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Apache Tomcat 7&lt;/a&gt;&lt;br /&gt;
4. &lt;a href="http://www.amazon.com/gp/product/0975240226/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0975240226&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Run Your Own Web Server Using Linux &amp; Apache&lt;/a&gt;&lt;br /&gt;
5. &lt;a href="http://www.amazon.com/gp/product/0471753610/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0471753610&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Professional Apache Tomcat 6 (WROX Professional Guides)&lt;/a&gt;&lt;br /&gt;
6. &lt;a href="http://www.amazon.com/gp/product/1423903234/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1423903234&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Web Server Administration (Web Warrior)&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/-eeeTCOWNI0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/-eeeTCOWNI0/No-space-left-on-device-modjk-could-not-create-jk-log-lock.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/10/No-space-left-on-device-modjk-could-not-create-jk-log-lock.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-7140773904356361538</guid><pubDate>Thu, 11 Oct 2012 07:41:00 +0000</pubDate><atom:updated>2012-10-29T23:51:10.833+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">centos</category><category domain="http://www.blogger.com/atom/ns#">ssl</category><category domain="http://www.blogger.com/atom/ns#">openssl</category><category domain="http://www.blogger.com/atom/ns#">Webserver</category><category domain="http://www.blogger.com/atom/ns#">Tomcat</category><category domain="http://www.blogger.com/atom/ns#">Apache</category><title>Installing SSL certificate on Apache with Tomcat</title><description>I have an Apache tomcat stack on which Apache is front proxy and tomcat is serving contents. How to install SSL on this scenario? Whether to install ssl on Apache or Install ssl on Tomcat? In my case Apache and tomcat is connected using mode_jk. I installed ssl on apache. Here is the steps how I did. Comment if you know some better methods. Operating system used is Centos 5.4, Apache version is httpd-2.2.3-65.el5.centos and Tomcat tested on 5 and 6.&lt;br /&gt;
&lt;br /&gt;
Check here for &lt;a href="http://www.linuxhelp.in/2012/03/integrating-apache-tomact-with-modjk.html" target="_blank"&gt;Installing and configuring Apache with tomcat using mod_jk&lt;/a&gt;&lt;br /&gt;
Generating key and csr:&lt;br /&gt;
yum install mod_ssl openssl&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
Key:&lt;br /&gt;
openssl genrsa -out www.yourdomain.com.key 2048 &lt;br /&gt;
&lt;br /&gt;
csr:&lt;br /&gt;
openssl req -new -key www.yourdomain.com.key -out www.yourdomain.com.csr &lt;br /&gt;
You have to give&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
Country Name (2 letter code) [GB]:IN&lt;br /&gt;
State or Province Name (full name) [Berkshire]:Karnataka&lt;br /&gt;
Locality Name (eg, city) [Newbury]:Bangalore&lt;br /&gt;
Organization Name (eg, company) [My Company Ltd]:Some Company Private Limited&lt;br /&gt;
Organizational Unit Name (eg, section) []:IT&lt;br /&gt;
Common Name (eg, your name or your server's hostname) []:www.yourdomain.com&lt;br /&gt;
Email Address []:someone@yourdomain.com&lt;br /&gt;
Please enter the following 'extra' attributes&lt;br /&gt;
to be sent with your certificate request&lt;br /&gt;
A challenge password []: [You can skip by pressing enter]&lt;br /&gt;
An optional company name []: [You can skip by pressing enter]&lt;br /&gt;
&lt;br /&gt;
Now you have generated csr.&lt;br /&gt;
Now buy ssl for this csr from Godaddy,bigrock,geotrust or whomever you trust. Don't forget to keep the key safe.&lt;br /&gt;
&lt;br /&gt;
Now when the crt is issued do the following.&lt;br /&gt;
Save the ssl and ca certificates &lt;br /&gt;
Add ssl.conf to /etc/httpd/conf.d/ (It will be there if you install mod_ssl)&lt;br /&gt;
Include ssl.conf in your httpd.conf&lt;br /&gt;
&lt;br /&gt;
And give the following in ssl.conf&lt;br /&gt;
&lt;br /&gt;
SSLCertificateFile /etc/pki/tls/certs/www.yourdomain.com.crt&lt;br /&gt;
SSLCertificateKeyFile  /etc/pki/tls/private/www.yourdomain.com.key&lt;br /&gt;
SSLCACertificateFile /etc/pki/tls/private/www.yourdomain.com.ca.crt&lt;br /&gt;
&lt;br /&gt;
Restart apache. You are done.&lt;br /&gt;
To redirect all the http to https you can use the following rewrite rules.&lt;br /&gt;
&lt;br /&gt;
RewriteEngine On&lt;br /&gt;
RewriteCond %{HTTPS} off&lt;br /&gt;
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}&lt;br /&gt;
&lt;br /&gt;
&lt;hr/&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/059600270X/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=059600270X&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Network Security with OpenSSL&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0470920416/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0470920416&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Implementing SSL / TLS Using Cryptography and PKI&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/B0028N4W3I/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B0028N4W3I&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Network Security with OpenSSL: Cryptography for Secure Communications&lt;/a&gt;&lt;br /&gt;
4. &lt;a href="http://www.amazon.com/gp/product/0201615983/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0201615983&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;SSL and TLS: Designing and Building Secure Systems&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/WEfDUvqmxDw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/WEfDUvqmxDw/installing-ssl-certificate-on-apache-with-tomcat.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/10/installing-ssl-certificate-on-apache-with-tomcat.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-8555649502649520043</guid><pubDate>Sun, 07 Oct 2012 17:55:00 +0000</pubDate><atom:updated>2012-10-30T00:08:31.049+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">Webserver</category><category domain="http://www.blogger.com/atom/ns#">Tomcat</category><category domain="http://www.blogger.com/atom/ns#">Apache</category><title>url redirection in apache using proxypass</title><description>Url redirection in&amp;nbsp;Apache webserver.&lt;br /&gt;
Here is a small example of url redirection in&amp;nbsp;Apache&amp;nbsp;using proxypass. I used this when I was using&amp;nbsp;Apache&amp;nbsp;as proxy to&amp;nbsp;Apache&amp;nbsp;tomcat using mod_jk.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
you want to forward &lt;br /&gt;
www.yourdomain.come/abc to www.yourdomain.com/linux/commands/abc&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
Here is how you can do it. Open httpd.conf in your&amp;nbsp;favorite&amp;nbsp;editor. Add the following lines.&lt;br /&gt;
ProxyPass /abc http://localhost/linux/commands/abc&lt;br /&gt;
ProxyPassReverse /abc http://localhost/linux/commands/abc&lt;br /&gt;
&lt;br /&gt;
But while using above solution you may have to give trailing "/" to correct it use the following rewrite rule.&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
RewriteRule ^/abc$ /abc/ [R]&lt;br /&gt;
&lt;br /&gt;
But for using the above solution you have to load modules mod_proxy and mod_rewrite.&lt;br /&gt;
Load the modules, add the rules, restart&amp;nbsp;Apache&amp;nbsp; You are done. Please suggest if you know any better ways to do it. Remember that all my webapps is in tomcat and&amp;nbsp;Apache&amp;nbsp;is just front end.&lt;br /&gt;
&lt;br /&gt;
&lt;hr/&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/1590595610/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1590595610&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;The Definitive Guide to Apache mod_rewrite (Definitive Guides)&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0596529945/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596529945&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Apache Cookbook: Solutions and Examples for Apache Administrators&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/B006OQDBE6/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B006OQDBE6&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;.htaccess Handbook&lt;/a&gt;&lt;br /&gt;
4. &lt;a href="http://www.amazon.com/gp/product/5510773278/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=5510773278&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;.htaccess&lt;/a&gt;&lt;br /&gt;
5. &lt;a href="http://www.amazon.com/gp/product/1118073428/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1118073428&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;WordPress For Dummies&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/J98dyi6ntag" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/J98dyi6ntag/url-redirection-in-apache-using.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>1</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/10/url-redirection-in-apache-using.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-178435630363037282</guid><pubDate>Wed, 05 Sep 2012 18:09:00 +0000</pubDate><atom:updated>2012-10-30T00:09:33.167+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">Webserver</category><category domain="http://www.blogger.com/atom/ns#">Tomcat</category><category domain="http://www.blogger.com/atom/ns#">Apache</category><title>Configuring multiple domains or sub-domains in tomcat</title><description>&lt;br /&gt;
We all know how to create multiple domains in&amp;nbsp;Apache. By adding virtual host etries. But how to configure multiple domains in tomcat? We can do this by adding multiple Host tags in server.xml. Its very simple. See the example below. Edit server.xml under conf directory. Suppose you want to setup three domains domain1.com, domain2.com and domain3.com. Every domain points to same ip address in the server.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;&amp;lt;Engine defaultHost="arnid" name="Catalina"&amp;gt;&lt;br /&gt;
&amp;lt;Host name="domain1.com" appBase="/usr/tomcat/apache-tomcat-6.0.26/webapps/domain_root1"&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; unpackWARs="true" autoDeploy="true"&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Alias&amp;gt;www.domain1.com&amp;lt;/Alias&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Context path="" docBase="."/&amp;gt;&lt;br /&gt;
&amp;lt;/Host&amp;gt;&lt;br /&gt;
&amp;lt;Host name="domain2.com" appBase="/usr/tomcat/apache-tomcat-6.0.26/webapps/domain_root2"&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; unpackWARs="true" autoDeploy="true"&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Alias&amp;gt;www.domain2.com&amp;lt;/Alias&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Context path="" docBase="."/&amp;gt;&lt;br /&gt;
&amp;lt;/Host&amp;gt;&lt;br /&gt;
&amp;lt;Host name="domain3.com" appBase="/usr/tomcat/apache-tomcat-6.0.26/webapps/domain_root3"&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; unpackWARs="true" autoDeploy="true"&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Alias&amp;gt;www.domain3.com&amp;lt;/Alias&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Context path="" docBase="."/&amp;gt;&lt;br /&gt;
&amp;lt;/Host&amp;gt;&lt;br /&gt;
&amp;lt;Engine&lt;/blockquote&gt;Now restart tomcat and&amp;nbsp;everything&amp;nbsp;should be working fine.&lt;br /&gt;
&lt;br /&gt;
&lt;hr/&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/047051860X/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=047051860X&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Web Application Architecture: Principles, Protocols and Practices&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/1453689923/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1453689923&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;The Accidental Administrator: Linux Server Step-by-Step Configuration Guide&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/1430237236/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1430237236&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Apache Tomcat 7&lt;/a&gt;&lt;br /&gt;
4. &lt;a href="http://www.amazon.com/gp/product/0975240226/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0975240226&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Run Your Own Web Server Using Linux &amp; Apache&lt;/a&gt;&lt;br /&gt;
5. &lt;a href="http://www.amazon.com/gp/product/0471753610/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0471753610&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Professional Apache Tomcat 6 (WROX Professional Guides)&lt;/a&gt;&lt;br /&gt;
6. &lt;a href="http://www.amazon.com/gp/product/1423903234/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1423903234&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Web Server Administration (Web Warrior)&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/TfV1QcIpyt4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/TfV1QcIpyt4/Configuring-multiple-domains-or-sub-domains-in-tomcat.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/09/Configuring-multiple-domains-or-sub-domains-in-tomcat.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-5750210658440441256</guid><pubDate>Sat, 11 Aug 2012 07:40:00 +0000</pubDate><atom:updated>2012-10-30T00:22:05.295+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">puttygen</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">centos</category><category domain="http://www.blogger.com/atom/ns#">ssh</category><category domain="http://www.blogger.com/atom/ns#">amazon</category><category domain="http://www.blogger.com/atom/ns#">security</category><category domain="http://www.blogger.com/atom/ns#">ec2</category><category domain="http://www.blogger.com/atom/ns#">putty</category><title>Creating multiple user login in Amazon ec2</title><description>&lt;br /&gt;
We know we can login in Amazon ec2 linux instances with our .ppk/.pem keys. But it is restricted to a single root user. How to create more normal users and let them also login to the instance? of course they cant use root users key. so we have to create new login keys for them. This post is also applicable for normal systems. We will see how to create key based authentication for normal users.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
We will add a normal user randeep and set password for him.&lt;br /&gt;
[root@server ~]# adduser randeep&lt;br /&gt;
[root@server ~]# passwd randeep&lt;br /&gt;
Changing password for user randeep.&lt;br /&gt;
New UNIX password:&lt;br /&gt;
BAD PASSWORD: it is based on a dictionary word&lt;br /&gt;
Retype new UNIX password:&lt;br /&gt;
passwd: all authentication tokens updated successfully.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Now we will create a ssh key for him and set the permissions.&lt;/b&gt;&lt;br /&gt;
[root@server ~]# cd /home/randeep/&lt;br /&gt;
[root@server randeep]# mkdir .ssh&lt;br /&gt;
[root@server randeep]# ls -a&lt;br /&gt;
. &amp;nbsp;.. &amp;nbsp;.bash_logout &amp;nbsp;.bash_profile &amp;nbsp;.bashrc &amp;nbsp;.mozilla &amp;nbsp;.ssh&lt;br /&gt;
[root@server randeep]# chmod 700 .ssh&lt;br /&gt;
[root@server randeep]# ssh-keygen -b 1024 -f randeep -t dsa&lt;br /&gt;
Generating public/private dsa key pair.&lt;br /&gt;
Enter passphrase (empty for no passphrase):&lt;br /&gt;
Enter same passphrase again:&lt;br /&gt;
Your identification has been saved in randeep.&lt;br /&gt;
Your public key has been saved in randeep.pub.&lt;br /&gt;
The key fingerprint is:&lt;br /&gt;
82:ed:75:a3:6e:03:f4:bf:49:e3:39:2f:bb:8f:66:f6 root@server.lap.work&lt;br /&gt;
[root@server randeep]# ls -a&lt;br /&gt;
. &amp;nbsp;.. &amp;nbsp;.bash_logout &amp;nbsp;.bash_profile &amp;nbsp;.bashrc &amp;nbsp;.mozilla &amp;nbsp;randeep &amp;nbsp;randeep.pub &amp;nbsp;.ssh&lt;br /&gt;
[root@server randeep]# cat randeep.pub &amp;gt; .ssh/authorized_keys&lt;br /&gt;
[root@server randeep]# chmod 600 .ssh/authorized_keys&lt;br /&gt;
[root@server randeep]# chown -R &amp;nbsp;randeep:randeep .ssh&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Now checking the login from the command line itself&lt;/b&gt;&lt;br /&gt;
[root@server randeep]# ssh -i randeep randeep@localhost&lt;br /&gt;
The authenticity of host 'localhost (127.0.0.1)' can't be established.&lt;br /&gt;
RSA key fingerprint is 63:6d:4a:08:b4:b4:19:3c:d0:58:f3:60:8a:ec:7a:a0.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)? yes&lt;br /&gt;
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.&lt;br /&gt;
[randeep@server ~]$&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Now you can transfer this key to any windows machine and convert the key to .ppk using puttygen for login through putty of scp.&lt;/b&gt;&lt;br /&gt;
Install puttygen and load the key.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-xzh-MsifBQQ/UCYLQ-gcd7I/AAAAAAAAFpQ/CYKj2-12jZ8/s1600/puttygen1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="296" src="http://2.bp.blogspot.com/-xzh-MsifBQQ/UCYLQ-gcd7I/AAAAAAAAFpQ/CYKj2-12jZ8/s400/puttygen1.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Loading key for creating .ppk key&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;create a private key of the loaded key.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-WfZ_5hoHisU/UCYLSNJFUtI/AAAAAAAAFpY/L5w97V3PnSI/s1600/puttygen2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="335" src="http://3.bp.blogspot.com/-WfZ_5hoHisU/UCYLSNJFUtI/AAAAAAAAFpY/L5w97V3PnSI/s400/puttygen2.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Click yes and proceed to create .ppk key&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;thats it. now you can use the key for login.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;if you want to disable password authentication and restrict only to key authentication,&lt;/b&gt;&lt;br /&gt;
open ssh configuration file /etc/ssh/sshd_config&lt;br /&gt;
edit as&lt;br /&gt;
PasswordAuthentication no&lt;br /&gt;
save it and restart ssh&lt;br /&gt;
[root@server randeep]# /etc/init.d/sshd restart&lt;br /&gt;
Stopping sshd: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [ &amp;nbsp;OK &amp;nbsp;]&lt;br /&gt;
Starting sshd: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;[ &amp;nbsp;OK &amp;nbsp;]&lt;br /&gt;
[root@server randeep]#&lt;br /&gt;
&lt;br /&gt;
&lt;hr/&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/B007Q4H9JI/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B007Q4H9JI&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Amazon Elastic Compute Cloud (EC2) User Guide&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/B007Q4LMMI/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B007Q4LMMI&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Getting Started Guide: Analyzing Big Data with AWS&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/B007Q4JESC/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B007Q4JESC&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Getting Started Guide: AWS Free Usage Tier&lt;/a&gt;&lt;br /&gt;
4. &lt;a href="http://www.amazon.com/gp/product/B007X6SMD6/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B007X6SMD6&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Getting Started with AWS&lt;/a&gt;&lt;br /&gt;
5. &lt;a href="http://www.amazon.com/gp/product/B007Q4LMJ6/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B007Q4LMJ6&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;AWS Computing Basics for Linux&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/GstQQutyjpE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/GstQQutyjpE/creating-multiple-user-login-in-amazon-ec2-linux.html</link><author>noreply@blogger.com (Randeep)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-xzh-MsifBQQ/UCYLQ-gcd7I/AAAAAAAAFpQ/CYKj2-12jZ8/s72-c/puttygen1.png" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/08/creating-multiple-user-login-in-amazon-ec2-linux.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-3591903800609481628</guid><pubDate>Sat, 11 Aug 2012 06:37:00 +0000</pubDate><atom:updated>2012-10-30T00:22:55.784+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Realm</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">centos</category><category domain="http://www.blogger.com/atom/ns#">Webserver</category><category domain="http://www.blogger.com/atom/ns#">security</category><category domain="http://www.blogger.com/atom/ns#">Tomcat</category><category domain="http://www.blogger.com/atom/ns#">Apache</category><title>password protected directory in tomcat</title><description>&lt;br /&gt;
How to protect a web directory with a password? if we are using&amp;nbsp;Apache, we can do it easily with .htaccess. It will prompt user for credentials while entering the&amp;nbsp;directory. But how to protect a directory with password in tomcat&amp;nbsp;web server? In this post we will discuss how to do it with tomcat Realms. This example was tested in tomcat 7 and tomcat 6.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
&lt;b&gt;Steps :&lt;/b&gt;&lt;br /&gt;
1) Add user, password and role in conf/tomcat-users.xml&lt;br /&gt;
2) In the webapps/examples/WEB-INF/web.xml specify role, method and urls.&lt;br /&gt;
3) Restart Tomcat and check.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt;&lt;br /&gt;
in vi conf/tomcat-users.xml&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;&amp;lt;tomcat-users&amp;gt;&lt;br /&gt;
&amp;lt;role rolename="webadmin"/&amp;gt; &amp;nbsp;//webadmin is the rolename of the users who can access the application&lt;br /&gt;
&amp;lt;user username="randeep" password="randeep" roles="webadmin"/&amp;gt;&lt;br /&gt;
&amp;lt;/tomcat-users&amp;gt;&lt;/blockquote&gt;&lt;b&gt;Step 2:&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;&amp;lt;security-constraint&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;display-name&amp;gt;Example Security Constraint&amp;lt;/display-name&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;web-resource-collection&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;web-resource-name&amp;gt;application&amp;lt;/web-resource-name&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;url-pattern&amp;gt;/*&amp;lt;/url-pattern&amp;gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;//applicable toall urls in the application&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;http-method&amp;gt;DELETE&amp;lt;/http-method&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;http-method&amp;gt;GET&amp;lt;/http-method&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;http-method&amp;gt;POST&amp;lt;/http-method&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;http-method&amp;gt;PUT&amp;lt;/http-method&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/web-resource-collection&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;auth-constraint&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&amp;lt;role-name&amp;gt;webadmin&amp;lt;/role-name&amp;gt;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&amp;lt;/auth-constraint&amp;gt;&lt;br /&gt;
&amp;lt;/security-constraint&amp;gt;&lt;/blockquote&gt;&lt;blockquote class="tr_bq"&gt;&amp;lt;login-config&amp;gt;&lt;br /&gt;
&amp;lt;auth-method&amp;gt;BASIC&amp;lt;/auth-method&amp;gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;//Authentication type&lt;br /&gt;
&amp;lt;realm-name&amp;gt;application&amp;lt;/realm-name&amp;gt;&lt;br /&gt;
&amp;lt;/login-config&amp;gt;&lt;/blockquote&gt;&lt;b&gt;Step 3:&lt;/b&gt;&lt;br /&gt;
Restart tomcat&lt;br /&gt;
/etc/init.d/tomcat restart&lt;br /&gt;
or&lt;br /&gt;
bin/shutdown.sh&lt;br /&gt;
bin/startup.sh&lt;br /&gt;
&lt;br /&gt;
Now goto browser and check. You can see it prompt for credentials as this.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-qcd3otnz2-0/UCX8tB4c3hI/AAAAAAAAFpA/vOFrqPIVFUo/s1600/password_protected_directory_tomcat.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="221" src="http://3.bp.blogspot.com/-qcd3otnz2-0/UCX8tB4c3hI/AAAAAAAAFpA/vOFrqPIVFUo/s400/password_protected_directory_tomcat.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;password protected directory in tomcat&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/047051860X/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=047051860X&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Web Application Architecture: Principles, Protocols and Practices&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/1453689923/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1453689923&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;The Accidental Administrator: Linux Server Step-by-Step Configuration Guide&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/1430237236/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1430237236&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Apache Tomcat 7&lt;/a&gt;&lt;br /&gt;
4. &lt;a href="http://www.amazon.com/gp/product/0975240226/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0975240226&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Run Your Own Web Server Using Linux &amp; Apache&lt;/a&gt;&lt;br /&gt;
5. &lt;a href="http://www.amazon.com/gp/product/0471753610/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0471753610&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Professional Apache Tomcat 6 (WROX Professional Guides)&lt;/a&gt;&lt;br /&gt;
6. &lt;a href="http://www.amazon.com/gp/product/1423903234/ref=as_li_ss_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1423903234&amp;linkCode=as2&amp;tag=technicalhelp-20"&gt;Web Server Administration (Web Warrior)&lt;/a&gt;&lt;br /&gt;
&lt;hr/&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/QIHEV878Ty8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/QIHEV878Ty8/password-protected-directory-in-tomcat.html</link><author>noreply@blogger.com (Randeep)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-qcd3otnz2-0/UCX8tB4c3hI/AAAAAAAAFpA/vOFrqPIVFUo/s72-c/password_protected_directory_tomcat.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/08/password-protected-directory-in-tomcat.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-2435261091895662786</guid><pubDate>Wed, 04 Jul 2012 17:38:00 +0000</pubDate><atom:updated>2012-10-06T02:33:24.759+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">dns</category><category domain="http://www.blogger.com/atom/ns#">dhcpd</category><category domain="http://www.blogger.com/atom/ns#">Android</category><category domain="http://www.blogger.com/atom/ns#">Howto</category><title>setting nameserver ip addresses on android</title><description>Almost all the android devices will be using dhcp service to get ip address and nameservers. But how to set custom nameservers on android devices? In this article we will see how. Is resolv.conf is there in android? if not? how?&lt;br /&gt;
&lt;br /&gt;
From the command prompt :&lt;br /&gt;
run the following command to set the nameservers. We will use google's public nameserver ips 8.8.8.8 and 8.8.4.4 in this example.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;#setprop net.dns1 &amp;nbsp;8.8.8.8&lt;/span&gt;&lt;br /&gt;
#setprop net.dns2 &amp;nbsp;8.8.4.4&lt;br /&gt;
&lt;br /&gt;
NOTE:&lt;br /&gt;
in some post you can see like "setprop net.eth0.dns1" which is deprecated now.&lt;br /&gt;
&lt;br /&gt;
You can also make this variable permanent by adding to default.prop file&lt;br /&gt;
vi default.prop&lt;br /&gt;
net.dns1 8.8.8.8&lt;br /&gt;
net.dns2 8.8.4.4&lt;br /&gt;
&lt;br /&gt;
In mobile devices you can set the ips as follows:&lt;br /&gt;
&lt;span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; text-align: justify;"&gt;Settings &amp;gt; Wireless &amp;amp; network settings &amp;gt; Wi-Fi settings &amp;gt; Advanced &amp;gt; Use static IP&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; text-align: justify;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; text-align: justify;"&gt;The dhcp uses the following scipt in android devices. you can modify the script to use google's public dns also.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; text-align: justify;"&gt;“/system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf”&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; text-align: justify;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: Arial, sans-serif; font-size: 13px; line-height: 20px; text-align: justify;"&gt;You can modify the script as&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; white-space: pre-wrap;"&gt;-----------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; white-space: pre-wrap;"&gt;# Set net.&amp;lt;iface&amp;gt;.dnsN properties that contain the&lt;/span&gt;&lt;br /&gt;
&lt;pre style="white-space: pre-wrap; word-wrap: break-word;"&gt;# DNS server addresses given by the DHCP server.
set_dns_props()
{
    case "${new_domain_name_servers}" in
    "")   return 0;;
    esac
    count=1
    for i in 1 2 3 4; do
        setprop dhcp.${interface}.dns${i} ""
    done    
    count=1
    for dnsaddr in ${new_domain_name_servers}; do
        setprop dhcp.${interface}.dns${count} ${dnsaddr}
        count=$(($count + 1))
    done 
 setprop dhcp.eth0.dns1 8.8.8.8
 setprop dhcp.eth0.dns2 8.8.8.4
}
unset_dns_props()
{
    for i in 1 2 3 4; do
        setprop dhcp.${interface}.dns${i} ""
    done
}
case "${reason}" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT)       set_dns_props;;
EXPIRE|FAIL|IPV4LL|RELEASE|STOP)                unset_dns_props;;
esac&lt;/pre&gt;&lt;pre style="white-space: pre-wrap; word-wrap: break-word;"&gt;-----------------------------------------------------------------&lt;/pre&gt;&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/1449389694/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1449389694"&gt;Programming Android&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0132121360/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0132121360"&gt;Android for Programmers: An App-Driven Approach (Deitel Developer Series)&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/1118102274/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1118102274"&gt;Professional Android 4 Application Development (Wrox Professional Guides)&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/-UA90O-FSLk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/-UA90O-FSLk/setting-nameserver-ip-addresses-on.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>1</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/07/setting-nameserver-ip-addresses-on.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-7462345738734515504</guid><pubDate>Sat, 30 Jun 2012 12:30:00 +0000</pubDate><atom:updated>2012-10-06T02:33:57.917+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">indexes</category><category domain="http://www.blogger.com/atom/ns#">mysql</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">Database</category><title>Creating and dropping indexes in MySQL table</title><description>Indexes increases the speed of select queries. At the same time indexes decreases the insert query performance if there are lots of indexes in a table. How to add an index to&amp;nbsp;MySQL&amp;nbsp;table &amp;nbsp;and how to drop an index from a&amp;nbsp;MySQL&amp;nbsp;table? We will discuss both in this article.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For showing indexes in a table we can use show indexes from command. In this we can see that there is only one index that is primary index in the table based on the column employee_id&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
&lt;b&gt;Show index :&lt;/b&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;mysql&amp;gt; show index from table_name;&lt;/span&gt;&lt;br /&gt;
+--------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+&lt;br /&gt;
| Table &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Non_unique | Key_name | Seq_in_index | Column_name &amp;nbsp; &amp;nbsp;| Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |&lt;br /&gt;
+--------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+&lt;br /&gt;
| Table_name | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 | PRIMARY &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 | employee_id | A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 231 | &amp;nbsp; &amp;nbsp; NULL | NULL &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp;| BTREE &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;br /&gt;
+--------------+------------+----------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+&lt;br /&gt;
1 row in set (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
Now when we search with a parent_id it will scan all the 231 rows because there is no index associated with parent_id column.&lt;br /&gt;
mysql&amp;gt; explain SELECT* &amp;nbsp;FROM table_name &amp;nbsp;WHERE parent_id = '23';&lt;br /&gt;
+----+-------------+--------------+------+---------------+------+---------+------+------+-------------+&lt;br /&gt;
| id | select_type | table &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| type | possible_keys | key &amp;nbsp;| key_len | ref &amp;nbsp;| rows | Extra &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;br /&gt;
+----+-------------+--------------+------+---------------+------+---------+------+------+-------------+&lt;br /&gt;
| &amp;nbsp;1 | SIMPLE &amp;nbsp; &amp;nbsp; &amp;nbsp;| widget_stats | ALL &amp;nbsp;| NULL &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| NULL | NULL &amp;nbsp; &amp;nbsp;| NULL | &amp;nbsp;231 | Using where |&lt;br /&gt;
+----+-------------+--------------+------+---------------+------+---------+------+------+-------------+&lt;br /&gt;
1 row in set (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creating the index :&lt;/b&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Now we will add an index&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;parent_id_index on the tables to the column prent_id&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;mysql&amp;gt; create index parent_id_index on table_name (parent_id);&lt;/span&gt;&lt;br /&gt;
Query OK, 231 rows affected (0.03 sec)&lt;br /&gt;
Records: 231 &amp;nbsp;Duplicates: 0 &amp;nbsp;Warnings: 0&lt;br /&gt;
&lt;br /&gt;
Now we can see that there are two indexes available in the table.&lt;br /&gt;
mysql&amp;gt; show indexes from table_name;&lt;br /&gt;
+--------------+------------+---------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+&lt;br /&gt;
| Table &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Non_unique | Key_name &amp;nbsp; &amp;nbsp; &amp;nbsp;| Seq_in_index | Column_name &amp;nbsp; &amp;nbsp;| Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |&lt;br /&gt;
+--------------+------------+---------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+&lt;br /&gt;
| Table_name | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 | PRIMARY &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 | employee_id | A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 231 | &amp;nbsp; &amp;nbsp; NULL | NULL &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp;| BTREE &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;br /&gt;
| Table_name&amp;nbsp;&amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 | parent_id_index | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 | parent_id &amp;nbsp; &amp;nbsp;| A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8 | &amp;nbsp; &amp;nbsp; NULL | NULL &amp;nbsp; | YES &amp;nbsp;| BTREE &amp;nbsp; &amp;nbsp; &amp;nbsp;| &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;br /&gt;
+--------------+------------+---------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+&lt;br /&gt;
2 rows in set (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
Now repeating the select with explain. We can see that it took only 5&amp;nbsp;comparisons&amp;nbsp;instead of 231( when there was no index associated with parent_id)&lt;br /&gt;
mysql&amp;gt; explain SELECT * &amp;nbsp;FROM&amp;nbsp; Table_name&amp;nbsp;&amp;nbsp;WHERE parent_id = '23';&lt;br /&gt;
+----+-------------+--------------+------+---------------+---------------+---------+-------+------+-------------+&lt;br /&gt;
| id | select_type | table &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| type | possible_keys | key &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | key_len | ref &amp;nbsp; | rows | Extra &amp;nbsp; &amp;nbsp; &amp;nbsp; |&lt;br /&gt;
+----+-------------+--------------+------+---------------+---------------+---------+-------+------+-------------+&lt;br /&gt;
| &amp;nbsp;1 | SIMPLE &amp;nbsp; &amp;nbsp; &amp;nbsp;|&amp;nbsp; Table_name&amp;nbsp;&amp;nbsp;| ref &amp;nbsp;| parent_id_index | parent_id_index | 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; | const | &amp;nbsp; &amp;nbsp;2 | Using where |&lt;br /&gt;
+----+-------------+--------------+------+---------------+---------------+---------+-------+------+-------------+&lt;br /&gt;
1 row in set (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Dropping the index :&lt;/b&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;You can drop an index by using the following command.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Syntax:&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;DROP INDEX index_name ON table_name&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Eg:&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;mysql&amp;gt; DROP INDEX parent_id_index ON &amp;nbsp;&lt;/span&gt; Table_name&lt;span style="background-color: white;"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Query OK, 231 rows affected (0.03 sec)&lt;br /&gt;
Records: 231 &amp;nbsp;Duplicates: 0 &amp;nbsp;Warnings: 0&lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/1449314287/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1449314287"&gt;High Performance MySQL: Optimization, Backups, and Replication&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0672329387/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0672329387"&gt;MySQL (4th Edition)&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/4TuM4N558xw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/4TuM4N558xw/creating-and-dropping-indexes-in-mysql.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/06/creating-and-dropping-indexes-in-mysql.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-4111080153573178751</guid><pubDate>Sat, 30 Jun 2012 11:04:00 +0000</pubDate><atom:updated>2012-10-06T02:36:13.231+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">mysql</category><category domain="http://www.blogger.com/atom/ns#">Benchmark</category><category domain="http://www.blogger.com/atom/ns#">mysqlslap</category><category domain="http://www.blogger.com/atom/ns#">Database</category><title>Benchmarking MySQL with mysqlslap</title><description>I have been checking with different tools for benchmarking a mysql server. I went through a lot of blogs and manuals and decided to use a tool named mysqlslap. In this post we will discuss how to install mysqlslap and use it. We are using Centos&amp;nbsp;Linux&amp;nbsp;5.4 to test this.&lt;br /&gt;
&lt;br /&gt;
Luckily mysqlslap comes with mysql-client rpm itself. With the versions 5.1.4 and above. So you can either install mysql with yum or rpm. rpms are&amp;nbsp;available&amp;nbsp;on &lt;a href="http://mysql.com/"&gt;mysql.com&lt;/a&gt; for download.&lt;br /&gt;
&lt;br /&gt;
I have tested it with&amp;nbsp;MySQL-client-5.5.25-1.rhel5.i386.rpm.&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Just install it as&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
#rpm -ivh&amp;nbsp;MySQL-client-5.5.25-1.rhel5.i386.rpm&lt;br /&gt;
Then you will get the command "mysqlslap"&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
&lt;b&gt;Testing :&lt;/b&gt;&lt;br /&gt;
Command :&lt;br /&gt;
[root@mysql ~]# mysqlslap -v -h &amp;nbsp;hostname -u root&amp;nbsp;&lt;span style="background-color: white;"&gt;-ppassword&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;--auto-generate-sql&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
Output :&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Benchmark&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Average number of seconds to run all queries: 0.002 seconds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Minimum number of seconds to run all queries:&amp;nbsp;&lt;span style="background-color: white;"&gt;0.002&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;seconds&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Maximum number of seconds to run all queries:&amp;nbsp; 0.002&amp;nbsp;&amp;nbsp;seconds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Number of clients running queries: 1&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Average number of queries per client: 0&lt;br /&gt;
&lt;br /&gt;
The –auto-generate-sql argument tells mysqlslap to automatically generate and execute SQL statements. The results shows that &amp;nbsp;MySQL took 0.002&amp;nbsp;&amp;nbsp;seconds to execute a single sql statement.&lt;br /&gt;
&lt;span style="background-color: white;"&gt;The –auto-generate-sql&amp;nbsp; argument&amp;nbsp;&amp;nbsp;creates a table, executes an INSERT query and saves dummy data to it, executes a SELECT query to retrieve the dummy data, and then drops the table. You can see behind-the-scenes action by adding the -v option. You can use multiple v's to get more detailed output.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Eg:&lt;/span&gt;&lt;br /&gt;
[root@mysql ~]# mysqlslap -vvv -h &amp;nbsp;hostname -u root --auto-generate-sql -ppassword &lt;br /&gt;
&lt;br /&gt;
Suppose you can to test the mysql with a 100 concurrent users each executing a single query. It can be done with the following command.&lt;br /&gt;
&lt;span style="background-color: white;"&gt;[root@mysql ~]# mysqlslap -vvv -h &amp;nbsp;hostname -u root&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;-ppassword&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;--auto-generate-sql --concurrency=100 &amp;nbsp;--number-of-queries=1&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Benchmark&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Average number of seconds to run all queries: 0.055 seconds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Minimum number of seconds to run all queries:&amp;nbsp;&lt;span style="background-color: white;"&gt;0.055&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;seconds&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Maximum number of seconds to run all queries:&amp;nbsp;&amp;nbsp;0.055 &amp;nbsp;seconds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Number of clients running queries: 100&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Average number of queries per client: 1&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Using the number of Queries&lt;/b&gt;:&lt;br /&gt;
If you want to test with 100 concurrent users and 10,000 queries,&lt;br /&gt;
&lt;span style="background-color: white;"&gt;[root@mysql ~]# mysqlslap -vvv -h &amp;nbsp;hostname -u root&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;-ppassword&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;--auto-generate-sql --concurrency=100 &amp;nbsp;--number-of-queries=10000&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Benchmark&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Average number of seconds to run all queries: 0.450 seconds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Minimum number of seconds to run all queries:&amp;nbsp; 0.450&amp;nbsp;&lt;span style="background-color: white;"&gt;&amp;nbsp;seconds&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Maximum number of seconds to run all queries: &amp;nbsp; 0.450&amp;nbsp;&amp;nbsp;&amp;nbsp;seconds&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Number of clients running queries: 100&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Average number of queries per client: 100&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Using iterations:&lt;/b&gt;&lt;br /&gt;
You can tell mysqlslap to repeat the query more than once using the iterations argument.&lt;br /&gt;
[root@mysql ~]# mysqlslap -vvv -h &amp;nbsp;hostname -u root&amp;nbsp;&lt;span style="background-color: white;"&gt;-ppassword&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;--auto-generate-sql --concurrency=100 &amp;nbsp;--number-of-queries=10000&amp;nbsp;--iterations=5&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Using custom queries.&lt;/b&gt;&lt;br /&gt;
By default mysqlslap will use its own schema and queries to test. Suppose you want to test a mysql server where exists a database and schema, you can then specify the database and custom query in the mysqlslap command as,&lt;br /&gt;
&lt;br /&gt;
[root@mysql ~]# mysqlslap -vv -h &amp;nbsp;hostname -u root -ppassword&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;--create-schema=DATABASE_NAME&amp;nbsp; --query="SELECT * from table_name;"&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span style="background-color: white;"&gt;--concurrency=100&lt;/span&gt;&amp;nbsp;&lt;span style="background-color: white;"&gt;&amp;nbsp;--number-of-queries=100&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Comparing the Engines:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
You know the performance varies when using different engines. You can compare the performance by engine using the argument --engine.&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style="background-color: white;"&gt;Using the engine&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;innodb&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
[root@mysql ~]# mysqlslap -vvv -h &amp;nbsp;hostname -u root&amp;nbsp;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;-ppassword&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;--auto-generate-sql&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;--concurrency=100 --number-of-queries=1000 --engine=innodb&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="background-color: white;"&gt;Using the engine&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;myisam&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
[root@mysql ~]# mysqlslap -vvv -h &amp;nbsp;hostname -u root&amp;nbsp;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;-ppassword&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;--auto-generate-sql&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;--concurrency=100 --number-of-queries=1000 --engine=myisam&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;Thats it. Try it and comment your experiences.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/1449314287/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1449314287"&gt;High Performance MySQL: Optimization, Backups, and Replication&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0672329387/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0672329387"&gt;MySQL (4th Edition)&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0596514336/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596514336"&gt;MYSQL in a Nutshell (In a Nutshell (O'Reilly))&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/4weyO7f0baE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/4weyO7f0baE/benchmarking-mysql-with-mysqlslap.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/06/benchmarking-mysql-with-mysqlslap.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-8634358396206074927</guid><pubDate>Thu, 28 Jun 2012 15:05:00 +0000</pubDate><atom:updated>2012-10-30T00:27:04.944+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">csv</category><category domain="http://www.blogger.com/atom/ns#">mysql</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">Database</category><title>importing csv file to MySQL database table</title><description>&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;Sometimes we need to get the MySQL tables into an Excel sheet. How this can be done? We can dump the MySQL tables into a csv format file. It is explained in our previous post &lt;a href="http://www.linuxhelp.in/2012/05/dumping-mysql-table-into-csv-file.html" target="_blank"&gt;Dumping MySQL table into CSV file&lt;/a&gt;. But how to import a csv file to a mysql database table? We will discuss it in this post.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;Login to your MySQL server.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"&gt;[root@database ~]# mysql -p&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;Enter password:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;Use the desired database&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;mysql&amp;gt; use database_name&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;For importing the csv file "viewership.csv" from the directory "/root/databases" into the table "table_name"&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;mysql&amp;gt; load data local infile '/root/databases/viewership.csv' into table &amp;nbsp;table_name fields terminated by ',' enclosed by '"' lines terminated by '\n';&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #333333; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"&gt;&lt;span style="line-height: 18px;"&gt;Thats it. Now the csv file is loaded into the table.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/1449314287/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=technicalhelp-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=1449314287"&gt;High Performance MySQL: Optimization, Backups, and Replication&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0672329387/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=technicalhelp-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0672329387"&gt;MySQL (4th Edition)&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0596514336/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=technicalhelp-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=0596514336"&gt;MYSQL in a Nutshell (In a Nutshell (O'Reilly))&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/2R1QN69JOI0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/2R1QN69JOI0/importing-csv-file-to-mysql-database.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/06/importing-csv-file-to-mysql-database.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-4303842634464217554</guid><pubDate>Thu, 07 Jun 2012 18:22:00 +0000</pubDate><atom:updated>2012-10-30T00:29:36.994+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Videos Streaming</category><title>Things to consider in video streaming</title><description>Video streaming is gaining momentum. Nowadays nobody wants to download videos and watch. Why should we download videos if we can watch them online? But nobody can enjoy a video if it's quality is bad or if it periodically pauses for buffering etc. So every system administrators must be aware of some aspects while streaming videos. In this post we will discuss main points in streaming videos. The main aspects of video streaming are resolution, encoding, frame rate, bit rate, data rate, aspect ratio and data transfer rate.&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
First of all lets see some video definitions :&lt;br /&gt;
&lt;b&gt;Standard Definition :&lt;/b&gt;&lt;br /&gt;
These are the common standard definition resolutions.&lt;br /&gt;
480p 720x480 (Normal)&lt;br /&gt;
576p 720x576 (PAL)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;High Definition :&lt;/b&gt;&lt;br /&gt;
720p 1280x720&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Full HD :&lt;/b&gt;&lt;br /&gt;
1080p 1920x1080&lt;br /&gt;
&lt;br /&gt;
Before streaming a raw video we have to encode it. Here is my suggestions for encoding a video.&lt;br /&gt;
&lt;b&gt;Video format :&lt;/b&gt;&lt;br /&gt;
MPEG-4 (.mp4)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Video encoding:&lt;/b&gt;&lt;br /&gt;
H.264&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Audio encoding:&lt;/b&gt;&lt;br /&gt;
AAC LC&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Protocol :&lt;/b&gt;&lt;br /&gt;
RTMP, or RTSP&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Resolution:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Before encoding we have to decide some parameters for encoding the video. Of course, the first one is resolution of the video, here we have a few options&lt;br /&gt;
1080p&lt;br /&gt;
720p&lt;br /&gt;
480p&lt;br /&gt;
360p&lt;br /&gt;
YouTube gives 4 different resolutions which users can select manually. 1080p, 720p, 480p and 360p (Full screen not supported).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Frame rate :&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Frame rate is one of the important parameter affecting the quality of the picture. Some commonly used are 25fps(frame per second), 29.97 and 30. I recomment 30 fps.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Bit rate / Data rate&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
At which rate the data should be encoded. We will discuss this later in this post.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Adaptive or By user selection.&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Adaptive bit rate streaming is one of the latest tecchnologies in video streaming. In this video will be encoded in many bitrates and the customer will be able to select the most suitable bitrate video depending upon his network capabilities. This can be done either automatically or manually. YouTube gives option for users to select the quality they want. Normally 1080p, 720p, 480p, 360p and 240p&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Audio&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Sample rate 96khz or 48khz&lt;br /&gt;
Channels: Stereo or Stereo + 5.1&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Bits Per Pixel:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Bits per pixel is one of the most important thing affecting the picture quality. It can be calculated using the following formulae.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: red;"&gt;bits per pixel = (bit rate)/(height x width x frame rate)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
For the low motion, talking head videos the BPP range of .1 to .15 will be fine. &amp;nbsp;But for the high motion videos like car race of football match .15 to .20 is required. But in my experience it has been see that if the source file is good, converted files with BPP with range even 0.7 - 0.15 does well.&lt;br /&gt;
&lt;br /&gt;
For example a video encoded with 5000kbps bit rate with 1280*720 resolution @30fps&lt;br /&gt;
will have a bit/pixel rate of&lt;br /&gt;
(5000*1000)/(1280*720*30) = 0.18&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Aspect ratio :&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Old telivisions were using the 4:3 aspect ration. But almost all the televisions and monitors available now is using 16:9. So the later one is preferable.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Data transfer size &lt;/u&gt;&lt;/b&gt;:&lt;br /&gt;
Data transfer size is the most important one. It is the data trasnferred between server and clients pc while watching a video. It can be calculated using the fowllowing formulae.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: red;"&gt;Storage size (in megabytes) = length (in seconds) × bit rate (in bit/s) / (8 × 1024 × 1024)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Lets see how much data will be trasferred or bandwidth usage for watching a video for one hours.&lt;br /&gt;
Playing video with bit rate 8,000 kbps&lt;br /&gt;
3433Mb = (3600*8000*1000)/(8*1024*1024) 3.4 G/Hour&lt;br /&gt;
&lt;br /&gt;
Playing video with bit rate 5,000 kbps&lt;br /&gt;
2145Mb = (3600*5000*1000)/(8*1024*1024) 2.2 G/Hour&lt;br /&gt;
&lt;br /&gt;
Playing video with bit rate 2,500 kbps&lt;br /&gt;
1072Mb = (3600*2500*1000)/(8*1024*1024) 1.0 G/Hour&lt;br /&gt;
&lt;br /&gt;
Playing video with bit rate 2,000 kbps&lt;br /&gt;
1072Mb = (3600*2000*1000)/(8*1024*1024) 860Mb/Hour&lt;br /&gt;
&lt;br /&gt;
The data transfer will be same irrespective of frame(XxY) size. For different frame sizes with same bitrate, quality will differ. (Big frames will have less quality with same bitrate).&lt;br /&gt;
&lt;br /&gt;
Thats all for now. Kindly share your experiences, opinions and views. For streaming videos using Amazon Cloudfront, you can read my guest post on &lt;a href="http://www.renjusblog.com/" target="_blank"&gt;renjusblog&lt;/a&gt; at &lt;a href="http://www.renjusblog.com/2012/06/stream-videos-using-amazon-cloudfront.html" target="_blank"&gt;streaming videos using clodfront&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;&lt;style&gt;
.adslot-overlay {position: absolute; font-family: arial, sans-serif; background-color: rgba(0,0,0,0.65); border: 2px solid rgba(0,0,0,0.65); color: white !important; margin: 0; z-index: 2147483647; text-decoration: none; box-sizing: border-box; text-align: left;}.adslot-overlay-iframed {top: 0; left: 0; right: 0; bottom: 0;}.slotname {position: absolute; top: 0; left: 0; right: 0; font-size: 13px; font-weight: bold; padding: 3px 0 3px 6px; vertical-align: middle; background-color: rgba(0,0,0,0.45); text-overflow: ellipsis; white-space: nowrap; overflow: hidden;}.slotname span {text-align: left; text-decoration: none; text-transform: capitalize;}.revenue {position: absolute; bottom: 0; left: 0; right: 0; font-size: 11px; padding: 3px 0 3px 6px; vertial-align: middle; text-align: left; background-color: rgba(0,0,0,0.45); font-weight: bold; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}.revenue .name {color: #ccc;}.revenue .horizontal .metric {display: inline-block; padding-right: 1.5em;}.revenue .horizontal .name {padding-right: 0.5em;}.revenue .vertical .metric {display: block; line-height: 1.5em; margin-bottom: 0.5em;}.revenue .vertical .name, .revenue .vertical .value {display: block;}.revenue .square .metric, .revenue .button .metric {display: table-row;}.revenue .square .metric {line-height: 1.5em;}.revenue .square .name, .revenue .square .value, .revenue .button .value {display: table-cell;}.revenue .square .name {padding-right: 1.5em;}.revenue .button .name {display: block; margin-right: 0.5em; width: 1em; overflow: hidden; text-overflow: clip;}.revenue .button .name:first-letter {margin-right: 1.5em;}a.adslot-overlay:hover {border: 2px solid rgba(58,106,173,0.9);}a.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}a.adslot-overlay:hover .revenue {border-top: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}div.adslot-overlay:hover {cursor: not-allowed; border: 2px solid rgba(64,64,64,0.9);}div.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}div.adslot-overlay:hover .revenue {border-top: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}
&lt;/style&gt;&lt;/div&gt;&lt;div&gt;&lt;style&gt;
.adslot-overlay {position: absolute; font-family: arial, sans-serif; background-color: rgba(0,0,0,0.65); border: 2px solid rgba(0,0,0,0.65); color: white !important; margin: 0; z-index: 2147483647; text-decoration: none; box-sizing: border-box; text-align: left;}.adslot-overlay-iframed {top: 0; left: 0; right: 0; bottom: 0;}.slotname {position: absolute; top: 0; left: 0; right: 0; font-size: 13px; font-weight: bold; padding: 3px 0 3px 6px; vertical-align: middle; background-color: rgba(0,0,0,0.45); text-overflow: ellipsis; white-space: nowrap; overflow: hidden;}.slotname span {text-align: left; text-decoration: none; text-transform: capitalize;}.revenue {position: absolute; bottom: 0; left: 0; right: 0; font-size: 11px; padding: 3px 0 3px 6px; vertial-align: middle; text-align: left; background-color: rgba(0,0,0,0.45); font-weight: bold; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}.revenue .name {color: #ccc;}.revenue .horizontal .metric {display: inline-block; padding-right: 1.5em;}.revenue .horizontal .name {padding-right: 0.5em;}.revenue .vertical .metric {display: block; line-height: 1.5em; margin-bottom: 0.5em;}.revenue .vertical .name, .revenue .vertical .value {display: block;}.revenue .square .metric, .revenue .button .metric {display: table-row;}.revenue .square .metric {line-height: 1.5em;}.revenue .square .name, .revenue .square .value, .revenue .button .value {display: table-cell;}.revenue .square .name {padding-right: 1.5em;}.revenue .button .name {display: block; margin-right: 0.5em; width: 1em; overflow: hidden; text-overflow: clip;}.revenue .button .name:first-letter {margin-right: 1.5em;}a.adslot-overlay:hover {border: 2px solid rgba(58,106,173,0.9);}a.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}a.adslot-overlay:hover .revenue {border-top: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}div.adslot-overlay:hover {cursor: not-allowed; border: 2px solid rgba(64,64,64,0.9);}div.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}div.adslot-overlay:hover .revenue {border-top: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}
&lt;/style&gt;&lt;/div&gt;&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/0764536508/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0764536508"&gt;Streaming Media Bible&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0240810848/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0240810848"&gt;Video Over IP, Second Edition: IPTV, Internet Video, H.264, P2P, Web TV, and Streaming: A Complete Guide to Understanding the Technology &lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0321122461/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0321122461"&gt;Mastering Internet Video: A Guide to Streaming and On-Demand Video: A Guide to Streaming and On-Demand Video&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/EhDGpSsELUg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/EhDGpSsELUg/things-to-consider-in-video-streaming.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/06/things-to-consider-in-video-streaming.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-332081402750376883</guid><pubDate>Thu, 31 May 2012 12:16:00 +0000</pubDate><atom:updated>2012-07-08T01:46:20.973+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">csv</category><category domain="http://www.blogger.com/atom/ns#">mysql</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">backup</category><category domain="http://www.blogger.com/atom/ns#">How To</category><category domain="http://www.blogger.com/atom/ns#">Database</category><category domain="http://www.blogger.com/atom/ns#">Small Tips</category><title>Dumping MySQL table into CSV file</title><description>Sometimes we need to get the&amp;nbsp;MySQL&amp;nbsp;tables into an Excel sheet. How this can be done? We can dump the&amp;nbsp;MySQL&amp;nbsp;tables into a csv format file. Lets see how to do it.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Login to your&amp;nbsp;MySQL&amp;nbsp;server.&lt;br /&gt;
&lt;br /&gt;
[root@database ~]# mysql -p&lt;br /&gt;
Enter password:&lt;br /&gt;
&lt;br /&gt;
Use the desired database&lt;br /&gt;
mysql&amp;gt; use database_name&lt;br /&gt;
&lt;br /&gt;
Now for dumping the data of the table named "table_name" execute the command, the csv file will be save in /tmp. You can specify the destination in the command.&lt;br /&gt;
&lt;br /&gt;
mysql&amp;gt; SELECT * INTO OUTFILE '/tmp/table_name.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM table_name;&lt;br /&gt;
Query OK, 5000 rows affected (0.09 sec)&lt;br /&gt;
mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you need only first 250 RAWs, you can specify the limit as follows.&lt;br /&gt;
&lt;br /&gt;
mysql&amp;gt; SELECT * INTO OUTFILE '/tmp/table_name.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM table_name &lt;b&gt;LIMIT 250&lt;/b&gt;;&lt;br /&gt;
Query OK, &lt;b&gt;250&lt;/b&gt; rows affected (0.09 sec)&lt;br /&gt;
mysql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats it. You can get the csv file to your windows system and can open with Microsoft Excel.&lt;br /&gt;
&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/0764536508/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0764536508"&gt;Streaming Media Bible&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0240810848/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0240810848"&gt;Video Over IP, Second Edition: IPTV, Internet Video, H.264, P2P, Web TV, and Streaming: A Complete Guide to Understanding the Technology &lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0321122461/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0321122461"&gt;Mastering Internet Video: A Guide to Streaming and On-Demand Video: A Guide to Streaming and On-Demand Video&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/Xy87XKTzr8g" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/Xy87XKTzr8g/dumping-mysql-table-into-csv-file.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/05/dumping-mysql-table-into-csv-file.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-7544831859647177201</guid><pubDate>Mon, 21 May 2012 14:24:00 +0000</pubDate><atom:updated>2012-10-30T00:29:53.129+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Scripting</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">centos</category><category domain="http://www.blogger.com/atom/ns#">backup</category><category domain="http://www.blogger.com/atom/ns#">amazon</category><category domain="http://www.blogger.com/atom/ns#">amazon s3</category><category domain="http://www.blogger.com/atom/ns#">aws</category><category domain="http://www.blogger.com/atom/ns#">Bash</category><title>Confiugring daily backup of amazon centos instance</title><description>Configuring&amp;nbsp;daily backup of amazon linux centos instance to amazon s3 storage&lt;br /&gt;
&lt;br /&gt;
How do you backup your amazon ec2 (Amazon elastic cloud)&amp;nbsp;Linux&amp;nbsp;&amp;nbsp;instance? Did you buy any costly backup sofwares to do the daily backup task? Here we will discuss how to backup your&amp;nbsp;amazon&amp;nbsp;ec2&amp;nbsp;Linux&amp;nbsp;&amp;nbsp;instance&amp;nbsp;to amazon s3 bucket storage using a bash script scheduled with cron on a daily basis.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
Requirements :&lt;br /&gt;
Amazon ec2 (Amazon elastic cloud)&amp;nbsp;Linux&amp;nbsp;instance.&lt;br /&gt;
Amazon s3 storage bucket for storing the backups.&lt;br /&gt;
&lt;a href="http://www.linuxhelp.in/2012/04/installing-s3cmd-in-amazon-ec2-instance.html" target="_blank"&gt;s3cmd command line tools&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Before we go to the code we will discuss what our daily backup script does.&lt;br /&gt;
Script takes the backup of &amp;nbsp;following directories and databases&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1) /usr/share/tomcat5/webapps/company&lt;br /&gt;
Databases&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;1) company&lt;br /&gt;
All the log files will be save in /scripts/logs directory&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;#!/bin/bash&lt;br /&gt;
### Creating the daily backup directory&lt;br /&gt;
mkdir /scripts/server_name-`date +%F`&lt;br /&gt;
cd /scripts/server_name-`date +%F`&lt;br /&gt;
### Taking the backup of directories&lt;br /&gt;
tar -cpvzf company.tar.gz /usr/share/tomcat5/webapps/company 2&amp;gt;&amp;gt; /scripts/logs/tar.log 1&amp;gt; /dev/null&lt;br /&gt;
if [ $? == 0 ]&lt;br /&gt;
then&lt;br /&gt;
echo -ne "company.tar.gz is created\n" &amp;gt;&amp;gt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
else&lt;br /&gt;
echo -ne "ALERT: company.tar.gz creation has FAILED\n" &amp;gt;&amp;gt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
fi&lt;br /&gt;
### Uploading the directory backups to s3 bucket "bucket_name"&lt;br /&gt;
s3cmd put company.tar.gz s3://bucket_name/`date +%F`/company.tar.gz 2&amp;gt;&amp;gt; /scripts/logs/s3cmd.log 1&amp;gt; /dev/null&lt;br /&gt;
if [ $? == 0 ]&lt;br /&gt;
then&lt;br /&gt;
echo -ne "company.tar.gz is uploaded to amazon s3\n" &amp;gt;&amp;gt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
else&lt;br /&gt;
echo -ne "ALERT: company.tar.gz uploading to amazon s3 has FAILED\n" &amp;gt;&amp;gt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
fi&lt;br /&gt;
### Taking backup of databases&lt;br /&gt;
mysqldump company &amp;gt; company.`date +%F`.sql 2&amp;gt;&amp;gt; /scripts/logs/mysql.log&lt;br /&gt;
if [ $? == 0 ]&lt;br /&gt;
then&lt;br /&gt;
echo -ne "company.`date +%F`.sql is created\n" &amp;gt;&amp;gt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
else&lt;br /&gt;
echo -ne "ALERT: company.`date +%F`.sql creation has FAILED\n" &amp;gt;&amp;gt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
fi&lt;br /&gt;
### Uploading the database backups to s3 bucket bucket_name&lt;br /&gt;
s3cmd put company.`date +%F`.sql s3://bucket_name/`date +%F`/company.`date +%F`.sql &amp;nbsp;2&amp;gt;&amp;gt; /scripts/logs/s3cmd.log 1&amp;gt; /dev/null&lt;br /&gt;
if [ $? == 0 ]&lt;br /&gt;
then&lt;br /&gt;
echo -ne "company.`date +%F`.sql is uploaded to amazon s3\n" &amp;gt;&amp;gt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
else&lt;br /&gt;
echo -ne "ALERT: company.`date +%F`.sql uploading to amazon s3 has FAILED\n" &amp;gt;&amp;gt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
fi&lt;br /&gt;
### Mailing the status&lt;br /&gt;
mail -s "Daily backup report on `date +%F` of Production server" admin@domain.com &amp;lt; /scripts/logs/production_daily`date +%F`.log&lt;br /&gt;
### Clearing the logs and temporary data&lt;br /&gt;
cd ~&lt;br /&gt;
rm -rf /scripts/server_name-production-`date +%F`&lt;/blockquote&gt;------------------------------------------------ &lt;br /&gt;
&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;Give the script executable permissions:&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;#chmod u+x&amp;nbsp;&lt;/span&gt; &lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;ec2_backup_script.sh&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;Install the crontab entry :&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;#crontab -e&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;30 15 * * * sh /scripts/ec2_backup_script.sh&lt;/span&gt; &lt;br /&gt;
&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
Thats it.&lt;br /&gt;
&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/0980576830/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980576830"&gt;Host Your Web Site In The Cloud: Amazon Web Services Made Easy: Amazon EC2 Made Easy&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0596515812/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596515812"&gt;Programming Amazon Web Services: S3, EC2, SQS, FPS, and SimpleDB&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0980798000/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980798000"&gt;Middleware and Cloud Computing: Oracle on Amazon Web Services (AWS), Rackspace Cloud and RightScale (Volume 1)&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/yWayAWSdc4I" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/yWayAWSdc4I/confiugring-daily-backup-of-amazon.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/05/confiugring-daily-backup-of-amazon.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-2109866837244303229</guid><pubDate>Mon, 21 May 2012 14:00:00 +0000</pubDate><atom:updated>2012-07-08T01:51:59.556+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Scripting</category><category domain="http://www.blogger.com/atom/ns#">RDS</category><category domain="http://www.blogger.com/atom/ns#">mysql</category><category domain="http://www.blogger.com/atom/ns#">backup</category><category domain="http://www.blogger.com/atom/ns#">amazon</category><category domain="http://www.blogger.com/atom/ns#">amazon s3</category><category domain="http://www.blogger.com/atom/ns#">aws</category><category domain="http://www.blogger.com/atom/ns#">Bash</category><title>Configuring daily backup of amazon RDS server</title><description>Configuring&amp;nbsp;daily backup of amazon RDS server to amazon s3 storage&lt;br /&gt;
&lt;br /&gt;
How do you backup your amazon RDS (Amazon Relational Database Service)&amp;nbsp;MySQL&amp;nbsp;server? Did you buy any costly backup managers to do the daily backup task? Here we will discuss how to backup your amazon rds&amp;nbsp;&amp;nbsp;MySQL&amp;nbsp;databases to amazon s3 bucket storage using a bash script scheduled with cron on a daily basis.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Requirements :&lt;br /&gt;
Amazon RDS (Amazon Relational Database Service)&amp;nbsp;MySQL&amp;nbsp;instance.&lt;br /&gt;
Amazon s3 storage bucket for storing the backups.&lt;br /&gt;
Amazon Elastic Cloud (ec2) Linux (centos) instance.&lt;br /&gt;
&lt;a href="http://www.linuxhelp.in/2012/04/installing-s3cmd-in-amazon-ec2-instance.html" target="_blank"&gt;s3cmd command line tools&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Before we go to the code we will discuss what our daily backup script does.&lt;br /&gt;
1) First it creates a file containing list of existing databases&lt;br /&gt;
2) Take the dump each and every&amp;nbsp;databases&amp;nbsp;in the file&lt;br /&gt;
3) Creates an compressed archive (tar.gz) of all the database dumps&lt;br /&gt;
4) Uploads the archive to the s3 bucket.&lt;br /&gt;
5) Deletes the 8 days old backup from the s3 bucket. (Why do we need backups older than one week. Remember we have to pay for the storage.)&lt;br /&gt;
6) Sends the admins email notification regarding the status/errors etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The script is as follows :&lt;br /&gt;
You have to save the script in a file(.sh), set proper executable permissions and install a crontab entry.&lt;br /&gt;
&lt;br /&gt;
---------------------------------------------------&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;#!/bin/bash&lt;br /&gt;
### Creating the file list_of_databases.txt which contains the list of databases.&lt;br /&gt;
mysql -u root -pPASSWORD -h RDS_Public_DNS_URL -e "show databases" | awk '{print $1}' &amp;gt; /scripts/logs/list_of_databases.txt&lt;br /&gt;
sed -i '1d' /scripts/logs/list_of_databases.txt&lt;br /&gt;
mkdir /scripts/RDS_backups-`date +%F`&lt;br /&gt;
### Taking backup ###&lt;br /&gt;
for i in `cat /scripts/logs/list_of_databases.txt`&lt;br /&gt;
do&lt;br /&gt;
mysqldump -u root -h RDS_Public_DNS_URL -pPASSWORD --lock-tables=false $i &amp;gt; /scripts/RDS_backups-`date +%F`\/$i.sql 2&amp;gt;&amp;gt; /scripts/logs/rds_backup_log.`date +%F`.txt&lt;br /&gt;
if [ $? == 0 ]&lt;br /&gt;
then&lt;br /&gt;
echo -ne "Backup of $i of RDS server has been completed\n" &amp;gt;&amp;gt; /scripts/logs/rds_backup_log.`date +%F`.txt&lt;br /&gt;
else&lt;br /&gt;
echo -ne "ALERT: Backup of $i of RDS server has FAILED\n" &amp;gt;&amp;gt; /scripts/logs/rds_backup_log.`date +%F`.txt&lt;br /&gt;
fi&lt;br /&gt;
done&lt;br /&gt;
### command to archive and upload to s3 bucket ###&lt;br /&gt;
tar cvzf /scripts/RDS_backups-`date +%F`.tar.gz /scripts/RDS_backups-`date +%F`/ &amp;amp;&amp;gt; /scripts/logs/tar.log&lt;br /&gt;
s3cmd put /scripts/RDS_backups-`date +%F`.tar.gz s3://s3_bucket_name/`date +%F`/RDS_backups-`date +%F`.tar.gz &amp;amp;&amp;gt; /scripts/logs/s3cmd.log&lt;br /&gt;
if [ $? == 0 ]&lt;br /&gt;
then&lt;br /&gt;
echo -ne "RDS_backups-`date +%F`.tar.gz has been uploaded to s3_bucket_name\n" &amp;gt;&amp;gt; /scripts/logs/rds_backup_log.`date +%F`.txt&lt;br /&gt;
else&lt;br /&gt;
echo -ne "Uploading RDS_backups-`date +%F`.tar.gz to s3_bucket_name has FAILED\n" &amp;gt;&amp;gt; /scripts/logs/rds_backup_log.`date +%F`.txt&lt;br /&gt;
fi&lt;br /&gt;
### Deleting the logs that are older than one week&lt;br /&gt;
jan=31&lt;br /&gt;
feb=28&lt;br /&gt;
march=31&lt;br /&gt;
april=30&lt;br /&gt;
may=31&lt;br /&gt;
june=30&lt;br /&gt;
july=31&lt;br /&gt;
aug=31&lt;br /&gt;
sep=30&lt;br /&gt;
oct=31&lt;br /&gt;
nov=30&lt;br /&gt;
dec=31&lt;br /&gt;
yearmonth=`date +%F | cut -f1,2 -d "-"`&lt;br /&gt;
current_date=`date +%F | cut -f3 -d "-"`&lt;br /&gt;
current_month=`date +%F | cut -f2 -d "-"`&lt;br /&gt;
old_month=`echo "$current_month - 01" | bc`&lt;br /&gt;
year=`date +%F | cut -f1 -d "-"`&lt;br /&gt;
if [ $current_date -lt 9 ]&lt;br /&gt;
then&lt;br /&gt;
diff=`echo "8 - $current_date" | bc`&lt;br /&gt;
case $old_month in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$jan - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt; &amp;nbsp; &amp;nbsp;2)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$feb - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$march - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 4)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$april - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 5)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$may - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$june - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$july - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$aug - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$sep - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-0$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$oct - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 11)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$nov - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-$old_month-$x ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x=`echo "$dec - $diff" | bc`&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; old_date=$year-$old_month-$x ;;&lt;br /&gt;
esac&lt;br /&gt;
else&lt;br /&gt;
x=`echo "$current_date - 8" | bc`&lt;br /&gt;
### suppose the date is 15, 15 -8 will become 7 but we need 07 so adding a 0 in the front&lt;br /&gt;
if [ $x -lt 10 ]&lt;br /&gt;
then&lt;br /&gt;
x=0$x&lt;br /&gt;
fi&lt;br /&gt;
old_date=$yearmonth-$x&lt;br /&gt;
fi&lt;br /&gt;
s3cmd del --recursive s3://s3_bucket_name/$old_date 2&amp;gt;&amp;gt; /scripts/logs/s3cmd.log 1&amp;gt; /dev/null&lt;br /&gt;
if [ $? == 0 ]&lt;br /&gt;
then&lt;br /&gt;
echo -ne "Backup of the day $old_date is deleted\n" &amp;gt;&amp;gt; /scripts/logs/rds_backup_log.`date +%F`.txt&lt;br /&gt;
else&lt;br /&gt;
echo -ne "ALERT: Backup of the day $old_date does not exists\n" &amp;gt;&amp;gt; /scripts/logs/rds_backup_log.`date +%F`.txt&lt;br /&gt;
fi&lt;br /&gt;
### Notifying the admin ###&lt;br /&gt;
mail -s "Daily backup report `date +%F` of RDS server" admin@domain.com &amp;lt; /scripts/logs/rds_backup_log.`date +%F`.txt&lt;br /&gt;
### Cleare temporary logs and data ###&lt;br /&gt;
&amp;gt; /scripts/logs/list_of_databases.txt&lt;br /&gt;
rm -rf /scripts/RDS_backups-`date +%F`&lt;br /&gt;
rm -rf /scripts/RDS_backups-`date +%F`.tar.gz&lt;/blockquote&gt;---------------------------------------------------&lt;br /&gt;
Give the script executable permissions:&lt;br /&gt;
#chmod u+x filename.sh&lt;br /&gt;
&lt;br /&gt;
Install the crontab entry :&lt;br /&gt;
#crontab -e&lt;br /&gt;
30 15 * * * sh /scripts/RDS_backup_script.sh&lt;br /&gt;
&lt;br /&gt;
Thats it.&lt;br /&gt;
&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/0980576830/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980576830"&gt;Host Your Web Site In The Cloud: Amazon Web Services Made Easy: Amazon EC2 Made Easy&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0596515812/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596515812"&gt;Programming Amazon Web Services: S3, EC2, SQS, FPS, and SimpleDB&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0980798000/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980798000"&gt;Middleware and Cloud Computing: Oracle on Amazon Web Services (AWS), Rackspace Cloud and RightScale (Volume 1)&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/-mX0G5mqAQQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/-mX0G5mqAQQ/configuring-daily-backup-of-amazon-rds.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/05/configuring-daily-backup-of-amazon-rds.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-2685971976186971284</guid><pubDate>Thu, 17 May 2012 18:50:00 +0000</pubDate><atom:updated>2012-10-30T00:30:04.757+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Load balancing</category><category domain="http://www.blogger.com/atom/ns#">High Availability</category><category domain="http://www.blogger.com/atom/ns#">Cloud</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">autoscaling</category><category domain="http://www.blogger.com/atom/ns#">ELB</category><category domain="http://www.blogger.com/atom/ns#">amazon</category><category domain="http://www.blogger.com/atom/ns#">aws</category><title>Amazon Elastic Load balancing with autoscaling</title><description>Suppose you have a website. &lt;a href="http://linxhelp.in/"&gt;linxhelp.in&lt;/a&gt; And suppose sometimes you get a traffic which your system cannot handle. What you will do? You will create multiple instances of your system and will configure a load balancer. But you have to keep both instances running even if there is not much traffic. We will discuss how to eliminate this resource wastage using amazon elastic load balancer and amazon autoscaling. For using this, your instances should be configured in amazon elastic cloud or ec2.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;!-- adsense --&gt;&lt;br /&gt;
In this example we will use the domain linuxhelp.in and our test instances are in centos linux. For doing this you will need amazon web services account.&lt;br /&gt;
&lt;br /&gt;
Objective :&lt;br /&gt;
Create new instance based on the AMI created beforehand when CPU load increases beyond 80% and distribute the load between the old and newly created instances.&lt;br /&gt;
Terminate the instance when the CPU load falls below 40% thus making only one instance running while the load is less.&lt;br /&gt;
&lt;br /&gt;
Requirements :&lt;br /&gt;
Amazon web services account&lt;br /&gt;
Amazon elastic cloud EC2&lt;br /&gt;
Amazon Elastic Load Balancer&lt;br /&gt;
Amazon Detailed Cloudwatch&lt;br /&gt;
Amazon AutoScaling&lt;br /&gt;
Amazon Cloudwatch command line tools&lt;br /&gt;
Amazon AutoScaling command line tools&lt;br /&gt;
Amazon ELB command line tools&lt;br /&gt;
DNS configuration access&lt;br /&gt;
&lt;br /&gt;
Steps :&lt;br /&gt;
ELB:&lt;br /&gt;
Create an Amazon Elastic Load balancer&lt;br /&gt;
Configure health Check&lt;br /&gt;
&lt;br /&gt;
AutoScaling:&lt;br /&gt;
Create a Launch configuration&lt;br /&gt;
Create a Auto Scaling Group&lt;br /&gt;
&lt;br /&gt;
Cloudwatch:&lt;br /&gt;
Create Policy to Scale up the instances.&lt;br /&gt;
Create Alarm on Average CPUUtilization with threshold &amp;gt; 80 which triggers scale up policy.&lt;br /&gt;
Create Policy to Scale down the instances.&lt;br /&gt;
Create Alarm on Average CPUUtilization with threshold &amp;lt; 40 which triggers scale down policy.&lt;br /&gt;
&lt;br /&gt;
DNS:&lt;br /&gt;
Point the domain to ELB&lt;br /&gt;
&lt;br /&gt;
Now we will see every steps in detail:&lt;br /&gt;
First we need to create an amazon Elastic load balancer. We can do this using the following command. In this we need to specify the port, protocol and the availability zones.&lt;br /&gt;
elb-create-lb MyELB --headers --listener "lb-port=80,instance-port=80,protocol=http" --availability-zones us-east-1a,us-east-1d&lt;br /&gt;
&lt;br /&gt;
Then we need to specify the health check details to determine which instance is healthy or not.&lt;br /&gt;
elb-configure-healthcheck MyELB –target “HTTP:80/” –interval 60 –timeout 5 –unhealthy-threshold 3 –healthy-threshold 5&lt;br /&gt;
&lt;br /&gt;
We can check the status of the elastic load balancer as&lt;br /&gt;
[root@Server ~]# elb-describe-lbs MyELB -C cert-id.pem &amp;nbsp;-K pk-id.pem&lt;br /&gt;
LOAD_BALANCER &amp;nbsp;MyELB &amp;nbsp;MyELB-2114043205.us-east-1.elb.amazonaws.com &amp;nbsp;2012-05-12T05:36:37.180Z&lt;br /&gt;
&lt;br /&gt;
Autoscaling:&lt;br /&gt;
Creating the launch configuration:&lt;br /&gt;
Launch configuration guides aws to which AMI to be used for spawning a new instance, instance type, Security group etc.&lt;br /&gt;
&lt;br /&gt;
[root@Server ~]# as-create-launch-config MyLaunchC --image-id ami-12345 --instance-type m1.small --group Basics --key cdnkey -C cert-id.pem -K pk-id.pem&lt;br /&gt;
OK-Created launch config&lt;br /&gt;
[root@Server ~]#&lt;br /&gt;
&lt;br /&gt;
Creating autoscaling group:&lt;br /&gt;
We have to create a AutoScaling group for the instances to run. In this we can specify minimum and maximum instances, availability zones, and ELB name to associate with.&lt;br /&gt;
&lt;br /&gt;
[root@Server ~]# as-create-auto-scaling-group MyScalingGroup --launch-configuration MyLaunchC --availability-zones us-east-1a,us-east-1d &amp;nbsp;--min-size 1 --max-size 2 --load-balancers MyELB -C cert-id.pem -K pk-id.pem&lt;br /&gt;
OK-Created AutoScalingGroup&lt;br /&gt;
[root@Server ~]#&lt;br /&gt;
&lt;br /&gt;
Describing the autoscaling group status :&lt;br /&gt;
We can check the status of the autoscaling groups with following command. To check how many instances are running, their health etc.&lt;br /&gt;
[root@Server ~]# as-describe-auto-scaling-groups --headers -C cert-id.pem -K pk-id.pem&lt;br /&gt;
AUTO-SCALING-GROUP &amp;nbsp;GROUP-NAME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LAUNCH-CONFIG &amp;nbsp;AVAILABILITY-ZONES &amp;nbsp; &amp;nbsp; LOAD-BALANCERS &amp;nbsp;MIN-SIZE &amp;nbsp;MAX-SIZE &amp;nbsp;DESIRED-CAPACITY&lt;br /&gt;
AUTO-SCALING-GROUP &amp;nbsp;MyScalingGroup &amp;nbsp;MyLaunchC &amp;nbsp; &amp;nbsp;us-east-1a,us-east-1d &amp;nbsp;MyELB &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
INSTANCE &amp;nbsp;INSTANCE-ID &amp;nbsp;AVAILABILITY-ZONE &amp;nbsp;STATE &amp;nbsp; &amp;nbsp; &amp;nbsp;STATUS &amp;nbsp; LAUNCH-CONFIG&lt;br /&gt;
INSTANCE &amp;nbsp;i-8df54deb &amp;nbsp; us-east-1d &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InService &amp;nbsp;Healthy &amp;nbsp;MyLaunchC&lt;br /&gt;
[root@Server ~]#&lt;br /&gt;
&lt;br /&gt;
Creating the scale up policy :&lt;br /&gt;
In this we set a policy / action to be executed to increase the number of instances running(Response to the alaram when cpu utilization &amp;gt; 80)&lt;br /&gt;
By executing the command we get a policy arn which is to be noted.&lt;br /&gt;
[root@Server ~]# as-put-scaling-policy MyScaleUpPolicy --auto-scaling-group MyScalingGroup &amp;nbsp;--adjustment=1 --type ChangeInCapacity &amp;nbsp;--cooldown 300 -C cert-id.pem -K pk-id.pem&lt;br /&gt;
arn:aws:autoscaling:us-east-1:MyAwsID:scalingPolicy:arnid:autoScalingGroupName/MyScalingGroup:policyName/MyScaleUpPolicy&lt;br /&gt;
[root@Server ~]#&lt;br /&gt;
&lt;br /&gt;
Creating the high CPU Utilization alarm :&lt;br /&gt;
Here we create an alarm when the average cpu utilization of the instance increase more than 80%. In the command we have to specify the policy arn (Policy to increase the number of instance by 1) to be called when the alarm occurs.&lt;br /&gt;
[root@Server ~]# mon-put-metric-alarm MyHighCPUAlarm &amp;nbsp;--comparison-operator &amp;nbsp;GreaterThanThreshold &amp;nbsp;--evaluation-periods &amp;nbsp;3 --metric-name &amp;nbsp;CPUUtilization &amp;nbsp;--namespace &amp;nbsp;"AWS/EC2" &amp;nbsp;--period &amp;nbsp;60 &amp;nbsp;--statistic Average --threshold &amp;nbsp;80 --alarm-actions arn:aws:autoscaling:us-east-1:MyAwsID:scalingPolicy:arnid:autoScalingGroupName/MyScalingGroup:policyName/MyScaleUpPolicy --dimensions "AutoScalingGroupName=MyScalingGroup" -C cert-id.pem &amp;nbsp;-K pk-id.pem&lt;br /&gt;
OK-Created Alarm&lt;br /&gt;
[root@Server ~]#&lt;br /&gt;
&lt;br /&gt;
Creating the scale down policy :&lt;br /&gt;
In this we set a policy / action to be executed to decrease the number of instances running ( Response to the alaram when cpu utilization &amp;lt; 40%).By executing the command we get a policy arn which is to be noted.&lt;br /&gt;
[root@Server ~]# as-put-scaling-policy MyScaleDownPolicy --auto-scaling-group MyScalingGroup &amp;nbsp;--adjustment=-1 --type ChangeInCapacity &amp;nbsp;--cooldown 300 -C cert-id.pem -K pk-id.pem&lt;br /&gt;
arn:aws:autoscaling:us-east-1:MyAwsID:scalingPolicy:arnid:autoScalingGroupName/MyScalingGroup:policyName/MyScaleDownPolicy&lt;br /&gt;
[root@Server ~]#&lt;br /&gt;
&lt;br /&gt;
Creating the low CPU Utilization alarm :&lt;br /&gt;
Here we create an alarm when the average cpu utilization of the instance falls below 40%. In the command we have to specify the policy arn (Policy to decrease the number of instance by 1) to be called when the alarm occurs.&lt;br /&gt;
[root@Server ~]# mon-put-metric-alarm MyLowCPUAlarm &amp;nbsp;--comparison-operator &amp;nbsp;LessThanThreshold --evaluation-periods &amp;nbsp;3 --metric-name &amp;nbsp;CPUUtilization --namespace &amp;nbsp;"AWS/EC2" &amp;nbsp;--period &amp;nbsp;60 &amp;nbsp;--statistic Average --threshold &amp;nbsp;40 &amp;nbsp;--alarm-actions arn:aws:autoscaling:us-east-1:MyAwsID:scalingPolicy:arnid:autoScalingGroupName/MyScalingGroup:policyName/MyScaleDownPolicy --dimensions "AutoScalingGroupName=MyScalingGroup" -C cert-id.pem &amp;nbsp;-K pk-id.pem&lt;br /&gt;
OK-Created Alarm&lt;br /&gt;
[root@Server ~]#&lt;br /&gt;
&lt;br /&gt;
Testing:&lt;br /&gt;
First we will increase the cpu load and check whether new instance is created or not when the cpu utilization becomes more than 80%.&lt;br /&gt;
For increasing the CPU Load:&lt;br /&gt;
Run the following command from multiple terminals:&lt;br /&gt;
#echo "9999999^999999" | bc&lt;br /&gt;
&lt;br /&gt;
Check the CPU usage using the following command:&lt;br /&gt;
#top -c&lt;br /&gt;
&lt;br /&gt;
Check whether new instances are spawned using the following command or from web intercface of aws.&lt;br /&gt;
#as-describe-auto-scaling-groups MyScalingGroup --headers -C cert-KEY.pem -K pk-KEY.pem&lt;br /&gt;
Now kill all the processes started for increasing the load and check whether one of the instance is terminated.&lt;br /&gt;
Point the domain name to the Public DNS of Elastic Load Balancer and check whether the site is loading from the browser.&lt;br /&gt;
We have to create CNAME record in Godaddy.com (Or your registrar) account for this. For example,&lt;br /&gt;
&lt;br /&gt;
CNAME:&lt;br /&gt;
create a cname record for "elb" points to "MyELB-2114043205.us-east-1.elb.amazonaws.com"&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;&lt;style&gt;
.adslot-overlay {position: absolute; font-family: arial, sans-serif; background-color: rgba(0,0,0,0.65); border: 2px solid rgba(0,0,0,0.65); color: white !important; margin: 0; z-index: 2147483647; text-decoration: none; box-sizing: border-box; text-align: left;}.adslot-overlay-iframed {top: 0; left: 0; right: 0; bottom: 0;}.slotname {position: absolute; top: 0; left: 0; right: 0; font-size: 13px; font-weight: bold; padding: 3px 0 3px 6px; vertical-align: middle; background-color: rgba(0,0,0,0.45); text-overflow: ellipsis; white-space: nowrap; overflow: hidden;}.slotname span {text-align: left; text-decoration: none; text-transform: capitalize;}.revenue {position: absolute; bottom: 0; left: 0; right: 0; font-size: 11px; padding: 3px 0 3px 6px; vertial-align: middle; text-align: left; background-color: rgba(0,0,0,0.45); font-weight: bold; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}.revenue .name {color: #ccc;}.revenue .horizontal .metric {display: inline-block; padding-right: 1.5em;}.revenue .horizontal .name {padding-right: 0.5em;}.revenue .vertical .metric {display: block; line-height: 1.5em; margin-bottom: 0.5em;}.revenue .vertical .name, .revenue .vertical .value {display: block;}.revenue .square .metric, .revenue .button .metric {display: table-row;}.revenue .square .metric {line-height: 1.5em;}.revenue .square .name, .revenue .square .value, .revenue .button .value {display: table-cell;}.revenue .square .name {padding-right: 1.5em;}.revenue .button .name {display: block; margin-right: 0.5em; width: 1em; overflow: hidden; text-overflow: clip;}.revenue .button .name:first-letter {margin-right: 1.5em;}a.adslot-overlay:hover {border: 2px solid rgba(58,106,173,0.9);}a.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}a.adslot-overlay:hover .revenue {border-top: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}div.adslot-overlay:hover {cursor: not-allowed; border: 2px solid rgba(64,64,64,0.9);}div.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}div.adslot-overlay:hover .revenue {border-top: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}
&lt;/style&gt;&lt;/div&gt;&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/0980576830/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980576830"&gt;Host Your Web Site In The Cloud: Amazon Web Services Made Easy: Amazon EC2 Made Easy&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0596515812/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596515812"&gt;Programming Amazon Web Services: S3, EC2, SQS, FPS, and SimpleDB&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0980798000/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980798000"&gt;Middleware and Cloud Computing: Oracle on Amazon Web Services (AWS), Rackspace Cloud and RightScale (Volume 1)&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/hlP1zOboFrY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/hlP1zOboFrY/amazon-elastic-load-balancing-with.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>1</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/05/amazon-elastic-load-balancing-with.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-9211020273972808762</guid><pubDate>Mon, 30 Apr 2012 12:13:00 +0000</pubDate><atom:updated>2012-06-20T02:03:39.196+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">debian</category><category domain="http://www.blogger.com/atom/ns#">amazon</category><category domain="http://www.blogger.com/atom/ns#">ec2</category><category domain="http://www.blogger.com/atom/ns#">Ubuntu</category><category domain="http://www.blogger.com/atom/ns#">aws</category><title>Please login as the ec2-user user</title><description>When login to yous amazon ec2 instance via putty or command line it is possible that you get this error.&lt;br /&gt;
&lt;br /&gt;
Authenticating with public key "imported-openssh-key"&lt;br /&gt;
Please login as the ec2-user user rather than root user.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
Then login as user "ec2-user" instead of root user and if you want to run commands as root user, use sudo command or switch the user to root&lt;br /&gt;
&lt;br /&gt;
eg:&lt;br /&gt;
#sudo vi /etc/dhcpd.conf&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
#sudo su -&lt;br /&gt;
Then you'll become root user.&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/RqwQ66wx8oY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/RqwQ66wx8oY/please-login-as-ec2-user-user.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/04/please-login-as-ec2-user-user.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-1407920282209005890</guid><pubDate>Fri, 27 Apr 2012 08:11:00 +0000</pubDate><atom:updated>2012-06-20T02:03:46.916+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">debian</category><category domain="http://www.blogger.com/atom/ns#">amazon</category><category domain="http://www.blogger.com/atom/ns#">amazon s3</category><category domain="http://www.blogger.com/atom/ns#">s3cmd</category><category domain="http://www.blogger.com/atom/ns#">storage</category><category domain="http://www.blogger.com/atom/ns#">Ubuntu</category><category domain="http://www.blogger.com/atom/ns#">aws</category><title>installing s3cmd in ubuntu</title><description>&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;s3cmd is a command line tool for uploading, downloading and managing file and directories with amazon simple storage s3. It is very useful when running scripts and scheduling scripts with cron. First you have to install s3cmd package which is available from&amp;nbsp;&lt;/span&gt;&lt;a href="http://s3tools.org/" style="background-color: white; color: #940202; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px; text-decoration: none;"&gt;s3tools.org&lt;/a&gt;&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;. In this post we discuss how to install and configure s3cmd in ubuntu or debian systems.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;span style="background-color: white; font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif; font-size: 15px; line-height: 21px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-size: 15px; line-height: 21px;"&gt;&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;Import S3tools signing key:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | sudo apt-key add -&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;Add the repo to sources.list:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;sudo wget -O /etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;Refresh package cache and install the newest s3cmd:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install s3cmd&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;Now configure it. It will ask your access key, secret key and encryption key(just hit enter if you don't want).&lt;br /&gt;s3cmd --configure
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;Now you will be able to list your buckets in your amazon s3 storage using the following command.&lt;br /&gt;s3cmd ls
&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Trebuchet MS', Trebuchet, Verdana, sans-serif;"&gt;See this post for &lt;a href="http://www.linuxhelp.in/2012/04/installing-s3cmd-in-amazon-ec2-instance.html" target="_blank"&gt;installing s3cmd in centos&lt;/a&gt; and &lt;a href="http://www.linuxhelp.in/2012/04/s3cmd-example-commands.html" target="_blank"&gt;s3cmd examples&lt;/a&gt; also.&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/1pBYJSQbRec" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/1pBYJSQbRec/installing-s3cmd-in-ubuntu.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/04/installing-s3cmd-in-ubuntu.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-6287776128989768877</guid><pubDate>Thu, 26 Apr 2012 19:17:00 +0000</pubDate><atom:updated>2012-11-03T23:50:55.327+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">centos</category><category domain="http://www.blogger.com/atom/ns#">SMS</category><category domain="http://www.blogger.com/atom/ns#">Nagios</category><category domain="http://www.blogger.com/atom/ns#">Monitoring tools</category><title>sms notification using nagios</title><description>We have discussed &lt;a href="http://www.linuxhelp.in/2010/10/how-to-install-and-configure-nagios.html" target="_blank"&gt;how to install and configure nagios monitoring system&lt;/a&gt;&amp;nbsp;and &lt;a href="http://www.linuxhelp.in/2011/08/installing-nagios-with-nrpe-to-monitor.html" target="_blank"&gt;configuring nrpe with nagios&lt;/a&gt; in previous posts. But it sends only email notifications. What if we are not able to access mail? Internet is not working? Or forgot to check the mails. So it is always better to have a better notification system. Notifications via SMS is an alternative. We can know if a service or host is down by sms even if dont check mail. But how to enable notifications via sms? What are the requirements? Which files needs to modified? How to configure sms gateway? We discuss all these things in this post.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Requirements :&lt;/span&gt;&lt;br /&gt;
To set up sms alerts notification with nagios we need a few things.&lt;br /&gt;
1. Existing Nagios implementation: -We need a working Nagios implementation with email alerts are already&lt;br /&gt;
configured.&lt;br /&gt;
2. SMS gateway account and API details:&amp;nbsp;For this testing purpose we have used sms gateway provided by&lt;br /&gt;
&lt;a href="http://clickatell.com/"&gt;clickatell.com&lt;/a&gt;. We have used their HTTP API for this. We need&amp;nbsp;following credentials to use this.&lt;br /&gt;
&lt;br /&gt;
● Username of &lt;a href="http://clickatell.com/"&gt;clickatell.com&lt;/a&gt; account&lt;br /&gt;
● Client ID&lt;br /&gt;
● API ID&lt;br /&gt;
● Password&lt;br /&gt;
● Mobile numbers&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;Configuration :&lt;/span&gt;&lt;br /&gt;
We have to edit mainly two configuration files and include the fields required for configuring alerts via sms.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Commands.cfg&lt;/b&gt;&lt;br /&gt;
We have to add the commands for&lt;br /&gt;
● Host notification via sms&lt;br /&gt;
● Service notification via sms&lt;br /&gt;
Only via mail will be defined by default.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2. Contacts.cfg&lt;/b&gt;&lt;br /&gt;
We have to add the commands defined in commands.cfg for notifications via sms in&lt;br /&gt;
● Service notification commands&lt;br /&gt;
● Host notification commands&lt;br /&gt;
● Mobile numbers&lt;br /&gt;
● Notification periods&lt;br /&gt;
● Notification options&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Commands.cfg&lt;/b&gt;&lt;br /&gt;
Add the following lines to the commands.cfg file in order to send sms notifactions via HTTP API of&lt;br /&gt;
&lt;a href="http://clickatell.com/"&gt;clickatell.com&lt;/a&gt;. The fields USERNAME,PASSWORD and API_ID needs to be replaced with&lt;br /&gt;
original ones.&lt;br /&gt;
# host-notify-by-sms&lt;br /&gt;
define command{&lt;br /&gt;
command_name host-notify-by-sms&lt;br /&gt;
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type:&lt;br /&gt;
$NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress:&lt;br /&gt;
$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | wget "http:&lt;br /&gt;
//api.clickatell.com/http/sendmsg?&lt;br /&gt;
user=USERNAME&amp;amp;password=PASSWORD&amp;amp;api_id=API_ID&amp;amp;to=$CONTACTPAGER$&amp;amp;text='**&lt;br /&gt;
$NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ @ $LONGDATETIME$ **'"&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# service-notify-by-sms&lt;br /&gt;
define command{&lt;br /&gt;
command_name service-notify-by-sms&lt;br /&gt;
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type:&lt;br /&gt;
$NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress:&lt;br /&gt;
$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | wget "http:&lt;br /&gt;
//api.clickatell.com/http/sendmsg?&lt;br /&gt;
user=USERNAME&amp;amp;password=PASSWORD&amp;amp;api_id=API_ID&amp;amp;to=$CONTACTPAGER$&amp;amp;text='**&lt;br /&gt;
$NOTIFICATIONTYPE$ Service Alert: $SERVICEDESC$ on $HOSTNAME$ State:&lt;br /&gt;
$SERVICESTATE$ @ $LONGDATETIME$ **'"&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Contacts.cfg&lt;/b&gt;&lt;br /&gt;
The following lines need to be added in contacts.cfg&lt;br /&gt;
service_notification_options &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;w,u,c,r,f,s #statuses –warning/critical/fapping/restarted&amp;nbsp;etc.&lt;br /&gt;
host_notification_options &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;d,u,r,f,s&lt;br /&gt;
service_notification_commands &amp;nbsp; &amp;nbsp; &amp;nbsp; notify-service-by-email service-notify-by-sms #mail and&amp;nbsp;sms&lt;br /&gt;
host_notification_commands &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; notify-host-by-email host-notify-by-sms&lt;br /&gt;
pager &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 91xxxxxxxxxx #mobile number&lt;br /&gt;
service_notification_period &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 24x7 &amp;nbsp; &amp;nbsp;#Notifications will be sent 24x7&lt;br /&gt;
host_notification_period &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 24x7&lt;br /&gt;
&lt;br /&gt;
IF you want to get notified to multiple numbers, define multiple contacts.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Testing :&lt;/b&gt;&lt;br /&gt;
We can test the Gateway using a simple command from the command line&lt;br /&gt;
#Wget http://api.clickatell.com/http/sendmsg?&lt;br /&gt;
user=USERNAME&amp;amp;password=PASSWORD&amp;amp;api_id=API_ID53&amp;amp;to=MOBILE_NUMBER&amp;amp;t&lt;br /&gt;
ext=Message&lt;br /&gt;
&lt;br /&gt;
We can test the alerts working by stopping a service such as mysql and checking the&lt;br /&gt;
mobile for the sms.&amp;nbsp;If the service is working properly we will get the following lines in Nagios log file.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;#tail -f &amp;nbsp; /usr/local/nagios/var/nagios.log&lt;/b&gt;&lt;br /&gt;
[1335345427] SERVICE ALERT: nagios-server;MYSQL;CRITICAL;SOFT;3;Connection&lt;br /&gt;
refused&lt;br /&gt;
[1335345487] SERVICE ALERT: nagios-server;MYSQL;CRITICAL;HARD;4;Connection&lt;br /&gt;
refused&lt;br /&gt;
[1335345487] SERVICE NOTIFICATION: nagiosadmin;nagios-server;MYSQL;CRITICAL;&lt;br /&gt;
service-notify-by-sms;Connection refused&lt;br /&gt;
[1335345488] SERVICE NOTIFICATION: nagiosadmin;nagios-server;MYSQL;CRITICAL;&lt;br /&gt;
notify-service-by-email;Connection refused&lt;br /&gt;
&lt;br /&gt;
We will get the sms’ with original content only after we buy credit. Else we will get a test&lt;br /&gt;
success notification from clickatell.com only.&lt;br /&gt;
&lt;div&gt;
&lt;style&gt;
.adslot-overlay {position: absolute; font-family: arial, sans-serif; background-color: rgba(0,0,0,0.65); border: 2px solid rgba(0,0,0,0.65); color: white !important; margin: 0; z-index: 2147483647; text-decoration: none; box-sizing: border-box; text-align: left;}.adslot-overlay-iframed {top: 0; left: 0; right: 0; bottom: 0;}.slotname {position: absolute; top: 0; left: 0; right: 0; font-size: 13px; font-weight: bold; padding: 3px 0 3px 6px; vertical-align: middle; background-color: rgba(0,0,0,0.45); text-overflow: ellipsis; white-space: nowrap; overflow: hidden;}.slotname span {text-align: left; text-decoration: none; text-transform: capitalize;}.revenue {position: absolute; bottom: 0; left: 0; right: 0; font-size: 11px; padding: 3px 0 3px 6px; vertial-align: middle; text-align: left; background-color: rgba(0,0,0,0.45); font-weight: bold; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}.revenue .name {color: #ccc;}.revenue .horizontal .metric {display: inline-block; padding-right: 1.5em;}.revenue .horizontal .name {padding-right: 0.5em;}.revenue .vertical .metric {display: block; line-height: 1.5em; margin-bottom: 0.5em;}.revenue .vertical .name, .revenue .vertical .value {display: block;}.revenue .square .metric, .revenue .button .metric {display: table-row;}.revenue .square .metric {line-height: 1.5em;}.revenue .square .name, .revenue .square .value, .revenue .button .value {display: table-cell;}.revenue .square .name {padding-right: 1.5em;}.revenue .button .name {display: block; margin-right: 0.5em; width: 1em; overflow: hidden; text-overflow: clip;}.revenue .button .name:first-letter {margin-right: 1.5em;}a.adslot-overlay:hover {border: 2px solid rgba(58,106,173,0.9);}a.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}a.adslot-overlay:hover .revenue {border-top: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}div.adslot-overlay:hover {cursor: not-allowed; border: 2px solid rgba(64,64,64,0.9);}div.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}div.adslot-overlay:hover .revenue {border-top: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}
&lt;/style&gt;&lt;/div&gt;
&lt;div&gt;
&lt;style&gt;
.adslot-overlay {position: absolute; font-family: arial, sans-serif; background-color: rgba(0,0,0,0.65); border: 2px solid rgba(0,0,0,0.65); color: white !important; margin: 0; z-index: 2147483647; text-decoration: none; box-sizing: border-box; text-align: left;}.adslot-overlay-iframed {top: 0; left: 0; right: 0; bottom: 0;}.slotname {position: absolute; top: 0; left: 0; right: 0; font-size: 13px; font-weight: bold; padding: 3px 0 3px 6px; vertical-align: middle; background-color: rgba(0,0,0,0.45); text-overflow: ellipsis; white-space: nowrap; overflow: hidden;}.slotname span {text-align: left; text-decoration: none; text-transform: capitalize;}.revenue {position: absolute; bottom: 0; left: 0; right: 0; font-size: 11px; padding: 3px 0 3px 6px; vertial-align: middle; text-align: left; background-color: rgba(0,0,0,0.45); font-weight: bold; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}.revenue .name {color: #ccc;}.revenue .horizontal .metric {display: inline-block; padding-right: 1.5em;}.revenue .horizontal .name {padding-right: 0.5em;}.revenue .vertical .metric {display: block; line-height: 1.5em; margin-bottom: 0.5em;}.revenue .vertical .name, .revenue .vertical .value {display: block;}.revenue .square .metric, .revenue .button .metric {display: table-row;}.revenue .square .metric {line-height: 1.5em;}.revenue .square .name, .revenue .square .value, .revenue .button .value {display: table-cell;}.revenue .square .name {padding-right: 1.5em;}.revenue .button .name {display: block; margin-right: 0.5em; width: 1em; overflow: hidden; text-overflow: clip;}.revenue .button .name:first-letter {margin-right: 1.5em;}a.adslot-overlay:hover {border: 2px solid rgba(58,106,173,0.9);}a.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}a.adslot-overlay:hover .revenue {border-top: 1px solid rgba(81,132,210,0.9); background-color: rgba(58,106,173,0.9);}div.adslot-overlay:hover {cursor: not-allowed; border: 2px solid rgba(64,64,64,0.9);}div.adslot-overlay:hover .slotname {border-bottom: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}div.adslot-overlay:hover .revenue {border-top: 1px solid rgba(128,128,128,0.9); background-color: rgba(64,64,64,0.9);}
&lt;/style&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/WYosuweTiyA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/WYosuweTiyA/sms-notification-using-nagios.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>1</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/04/sms-notification-using-nagios.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-6702552975990236584</guid><pubDate>Thu, 26 Apr 2012 12:50:00 +0000</pubDate><atom:updated>2012-06-20T02:04:20.822+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">redhat</category><category domain="http://www.blogger.com/atom/ns#">cpu</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">debian</category><category domain="http://www.blogger.com/atom/ns#">centos</category><category domain="http://www.blogger.com/atom/ns#">kernel</category><category domain="http://www.blogger.com/atom/ns#">architecture</category><category domain="http://www.blogger.com/atom/ns#">Ubuntu</category><title>checking cpu architecture in linux</title><description>You may have to check which is the architecture of your linux system 32 bit or 64 bit. Here there is one thing needs to keep in mind. Whether you are checking the version of installed os kernel or the architecture of underlying cpu. It is possible that Operating system is 32 but cpu has 64 bit support. This post explains how to find or check the architecture of the Linux Operating system and cpu.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
The following commands will only show version of installed Linux kernel (OS).&lt;br /&gt;
&lt;br /&gt;
#uname -a&lt;br /&gt;
#arch&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
&lt;br /&gt;
[root@test1 ~]# uname -a&lt;br /&gt;
Linux test1.lukup.internal 2.6.18-92.el5 #1 SMP Tue Jun 10 18:49:47 EDT 2008 i686 i686 i386 GNU/Linux&lt;br /&gt;
[root@test1 ~]# arch&lt;br /&gt;
i686&lt;br /&gt;
[root@test1 ~]#&lt;br /&gt;
&lt;br /&gt;
i386/i586/i686 all means its a 32 bit os.&lt;br /&gt;
x86_64 means it is a 64 bit os.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to know the architecture of the cpu. You have to check the cpu specifications. See the following commands&lt;br /&gt;
&lt;br /&gt;
The following command will give all the information about cpu&lt;br /&gt;
cat /proc/cpuinfo&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
[root@test1 ~]# cat /proc/cpuinfo&lt;br /&gt;
processor &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;br /&gt;
vendor_id &amp;nbsp; &amp;nbsp; &amp;nbsp; : GenuineIntel&lt;br /&gt;
cpu family &amp;nbsp; &amp;nbsp; &amp;nbsp; : 6&lt;br /&gt;
model &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 23&lt;br /&gt;
model name &amp;nbsp; &amp;nbsp; &amp;nbsp;: Pentium(R) Dual-Core &amp;nbsp;CPU &amp;nbsp; &amp;nbsp; &amp;nbsp;E5200 &amp;nbsp;@ 2.50GHz&lt;br /&gt;
stepping &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 10&lt;br /&gt;
cpu MHz &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2499.684&lt;br /&gt;
cache size &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 2048 KB&lt;br /&gt;
physical id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 0&lt;br /&gt;
siblings &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2&lt;br /&gt;
core id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 0&lt;br /&gt;
cpu cores &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : 2&lt;br /&gt;
fdiv_bug &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : no&lt;br /&gt;
hlt_bug &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : no&lt;br /&gt;
f00f_bug &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : no&lt;br /&gt;
coma_bug &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : no&lt;br /&gt;
fpu &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: yes&lt;br /&gt;
fpu_exception &amp;nbsp; : yes&lt;br /&gt;
cpuid level &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 13&lt;br /&gt;
wp &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: yes&lt;br /&gt;
flags &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht nx constant_tsc pni&lt;br /&gt;
bogomips &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;: 5004.21&lt;br /&gt;
&lt;div&gt;
[root@test1 ~]#&amp;nbsp;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
To check your system is 32 bit or 64 bit, check the flags field.&lt;br /&gt;
#grep flags /proc/cpuinfo&lt;br /&gt;
&lt;br /&gt;
IM or im flag means Long mode cpu - 64 bit CPU&lt;br /&gt;
Real mode 16 bit CPU&lt;br /&gt;
Protected Mode is 32-bit CPU&lt;br /&gt;
&lt;br /&gt;
In&amp;nbsp;Debian&amp;nbsp;Ubuntu&amp;nbsp;systems you can use the following&amp;nbsp;commands&lt;br /&gt;
#lscpu&lt;br /&gt;
#cat /proc/cpuinfo |grep ” lm”&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/yFSmFemcl3U" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/yFSmFemcl3U/checking-cpu-architecture-in-linux.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/04/checking-cpu-architecture-in-linux.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-2912967876891662584</guid><pubDate>Mon, 23 Apr 2012 09:13:00 +0000</pubDate><atom:updated>2012-07-09T02:06:29.773+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">mysql</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">backup</category><title>Dumping  mysql database schema only</title><description>If &amp;nbsp;you want to dump only schema of a database,&lt;br /&gt;
&lt;br /&gt;
Execute the following command.&lt;br /&gt;
#mysqldump -u root -pPASSWORD -d -h Host_name_or_Ip_Address database_name &amp;gt; database_name.sql&lt;br /&gt;
It will dump the schema to the file&amp;nbsp;database_name.sql&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
If you just want it on the console only, then&lt;br /&gt;
#mysqldump -u root -pPASSWORD -d -h Host_name_or_Ip_Address database_name&lt;br /&gt;
&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/1449314287/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1449314287"&gt;High Performance MySQL: Optimization, Backups, and Replication&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0672329387/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0672329387"&gt;MySQL (4th Edition)&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0596514336/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596514336"&gt;MYSQL in a Nutshell (In a Nutshell (O'Reilly))&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/7monIWmbZS4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/7monIWmbZS4/dumping-mysql-database-schema-only.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/04/dumping-mysql-database-schema-only.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8911354555622031874.post-2660925156407924684</guid><pubDate>Wed, 18 Apr 2012 17:33:00 +0000</pubDate><atom:updated>2012-07-09T02:07:23.126+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Load balancing</category><category domain="http://www.blogger.com/atom/ns#">Replication</category><category domain="http://www.blogger.com/atom/ns#">linux</category><category domain="http://www.blogger.com/atom/ns#">centos</category><category domain="http://www.blogger.com/atom/ns#">ELB</category><category domain="http://www.blogger.com/atom/ns#">AMI</category><category domain="http://www.blogger.com/atom/ns#">amazon</category><category domain="http://www.blogger.com/atom/ns#">amazon s3</category><category domain="http://www.blogger.com/atom/ns#">aws</category><title>replicating an amazon instance to different zones or regions</title><description>We have to replicate an amazon ec2 instance running in one zone or &amp;nbsp;region to other zones for load balancing and high availability. Or you may want to migrate your instance to other region for low latency. We can do this by ec2-migrate-bundle command. First we have to create an image. See this post for &lt;a href="http://www.linuxhelp.in/2012/04/create-full-backup-image-of-amazon-ec2.html" target="_blank"&gt;creating image of amazon linux instance&lt;/a&gt;. Then we have to we create a s3 bucket in the destination zone and migrate the image to the destination bucket. Then we can register ami based on that and create instances.&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Steps:&lt;/b&gt;&lt;br /&gt;
1) Determining the zone to create the new instance.&lt;br /&gt;
2) Creating Amazon s3 bucket in the new zone.&lt;br /&gt;
3) Migrating the bundle&lt;br /&gt;
4) Registering the AMI&lt;br /&gt;
5) Creating new instance based on the AMI&lt;br /&gt;
6) Testing the AMI&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Requirements:&lt;/b&gt;&lt;br /&gt;
We need the following files and keys for during the replication.&lt;br /&gt;
Private Key File: pk-PRIVATEKEY.pem&lt;br /&gt;
X.509 Certificate File: cert-X509CERT.pem&lt;br /&gt;
ACCESS-KEY-ID (S3)&lt;br /&gt;
SECRET-ACCESS-KEY (S3)&lt;br /&gt;
Existing instance stored AMI&lt;br /&gt;
Security Group and key pair in destination zone.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Determining the zone :&lt;/b&gt;&lt;br /&gt;
First we have to determine Amazon zone we are going to use. There are a few zones. We can get the zone details using the command ec2-describe-regions.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
[root@hostname ~]# ec2-describe-regions -K pk-PRIVATEKEY.pem -C cert-X509CERT.pem&lt;br /&gt;
REGION eu-west-1 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;ec2.eu-west-1.amazonaws.com&lt;br /&gt;
REGION sa-east-1 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;ec2.sa-east-1.amazonaws.com&lt;br /&gt;
REGION us-east-1 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;ec2.us-east-1.amazonaws.com&lt;br /&gt;
REGION ap-northeast-1 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;ec2.ap-northeast-1.amazonaws.com&lt;br /&gt;
REGION us-west-2 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;ec2.us-west-2.amazonaws.com&lt;br /&gt;
REGION us-west-1 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;ec2.us-west-1.amazonaws.com&lt;br /&gt;
REGION ap-southeast-1 &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;ec2.ap-southeast-1.amazonaws.com&lt;br /&gt;
[root@hostname ~]#&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creating Amazon s3 bucket in the required zone :&lt;/b&gt;&lt;br /&gt;
Once the zone is decided we have to get the AMI of the instance available in the zone. For that we have to,&lt;br /&gt;
1) Create an amazon s3 bucket in the region&lt;br /&gt;
2) Migrate the bundle to the newly created bucket&lt;br /&gt;
3) Register the AMI&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Migrating the bundle :&lt;/b&gt;&lt;br /&gt;
While migrating the bundle we need to understand a few things. Same kernel and ramdisk may not be available in the destination zone. You may have to either specify them explicitly or let the Amazon decide which is best.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
ec2-migrate-bundle -k pk-key.pem -c cert-cert.pem -a Access-Key-Id -s Secret-Access-Key --bucket source_bucket --destination-bucket destination_bucket --manifest NAME.ami.manifest.xml --region ZONECode&lt;br /&gt;
ZONE-Code – is important because based on this ec2-migrate tool will decide the best kernel and ramdisk in the destination zone.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Registering the AMI :&lt;/b&gt;&lt;br /&gt;
We have to register the AMI with Amazon. Then only we can create instances based on that AMI.&lt;br /&gt;
Syntax:&lt;br /&gt;
ec2-register -K pk-PRIVATEKEY.pem -C cert-X509CERT.pem -n name_of_the_AMI Full_path_of_manifest.xml_in_s3_bucket --region zone-id&lt;br /&gt;
Example:&lt;br /&gt;
[root@hostname_of_instace image]# ec2-register -K pk-ABCDEFGHIJKLMN.pem -C cert-ABCDEFGHIJKLMN.pem -n nagios bucket_name/images/nagios.ami.manifest.xml --region us-west-2&lt;br /&gt;
IMAGE ami-wwwwww&lt;br /&gt;
[root@hostname_of_instace image]#&lt;br /&gt;
&lt;br /&gt;
It will give the AMI ID as the output. In this case,&lt;br /&gt;
IMAGE ami-wwwwww&lt;br /&gt;
--region zone-id is important. Else it will create the instance in default zone (virginia)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Creating new instance based on the AMI&lt;/b&gt;&lt;br /&gt;
Syntax:&lt;br /&gt;
ec2-run-instances -K pk-ABCDEFGHIJKLMN.pem -C cert-ABCDEFGHIJKLMN.pem -g Basics -k cdnkey ami-ID --region us-west-2&lt;br /&gt;
-g is for the Security group. We have to specify which security group we are using.&lt;br /&gt;
-k is for key type. We have to specify which key type we are using.&lt;br /&gt;
We have to have the key pair and security group prior to instance launch.&lt;br /&gt;
Last field is the AMI-ID based on the instance will be created.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Testing the AMI:&lt;/b&gt;&lt;br /&gt;
After launching the new instance we must check a few things:&lt;br /&gt;
Check the following things are same for original and new instances:&lt;br /&gt;
Disk usage&lt;br /&gt;
Services running&lt;br /&gt;
Accessibility of services such as ssh, http, tomcat and mysql&lt;br /&gt;
Ensuring mysql database is up-to-date.&lt;br /&gt;
All the important data are present.&lt;br /&gt;
&lt;br /&gt;
&lt;hr /&gt;&lt;h3&gt;Recommended Reading&lt;/h3&gt;1. &lt;a href="http://www.amazon.com/gp/product/0980576830/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980576830"&gt;Host Your Web Site In The Cloud: Amazon Web Services Made Easy: Amazon EC2 Made Easy&lt;/a&gt;&lt;br /&gt;
2. &lt;a href="http://www.amazon.com/gp/product/0596515812/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0596515812"&gt;Programming Amazon Web Services: S3, EC2, SQS, FPS, and SimpleDB&lt;/a&gt;&lt;br /&gt;
3. &lt;a href="http://www.amazon.com/gp/product/0980798000/ref=as_li_ss_tl?ie=UTF8&amp;tag=technicalhelp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980798000"&gt;Middleware and Cloud Computing: Oracle on Amazon Web Services (AWS), Rackspace Cloud and RightScale (Volume 1)&lt;/a&gt;&lt;br /&gt;
&lt;hr /&gt;&lt;img src="http://feeds.feedburner.com/~r/Linux-helps/~4/A0epfqDwcZs" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Linux-helps/~3/A0epfqDwcZs/replicating-amazon-instance-to.html</link><author>noreply@blogger.com (Randeep)</author><thr:total>0</thr:total><feedburner:origLink>http://www.linuxhelp.in/2012/04/replicating-amazon-instance-to.html</feedburner:origLink></item></channel></rss>
