<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' 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'><id>tag:blogger.com,1999:blog-8033252853889217827</id><updated>2024-11-01T14:03:30.083+05:30</updated><category term="Linux"/><category term="Security"/><category term="MongoDB"/><category term="MySQL"/><category term="Amazon"/><category term="Nginx"/><title type='text'>Akhil&#39;s Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-3318642448310713118</id><published>2015-02-25T22:39:00.000+05:30</published><updated>2015-03-11T19:40:19.531+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Security"/><title type='text'>3 Amazing facts about SElinux.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
What is SELinux?&lt;/h3&gt;
&lt;b&gt;SELinux&lt;/b&gt;, Security-Enhanced linux , is an additional method to
protect your system.Presuming we want to allow remote
anonymous access to a web server,we must open the ports
through firewall. However,that means that malicious people
can try to crack into the system through a security exploit and,
if they compromise the web server process, gain its
permissions: the permissions to the apache user and the apache
group. That user/group has read access to things like the
document root (/var/www/html),as well as write access to
/tmp,/var/tmp and any other files/directories that are world
writable.&lt;div&gt;
&lt;i&gt;SELinux&lt;/i&gt; is a a set of security rules that determine which process
can access which files, directories, ports, etc. Every file,
process, directory and ports has a special security label called
&lt;b&gt;Selinux&lt;/b&gt; contexts.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
A context is simply a name that is used by the
SELinux policy to determine whether or not a process can access a file, directory or post.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SELinux&lt;/b&gt; labels have several contexts, but we will discuss only one context with web server: The type context. Type context
names usually end with_t.The type context for the web server
is httpd_t. The type context for files and directories normally
found in /var/www/html is httpd_sys_content_t. The type
contexts for files and directories normally found in /tmp and
/var/tmp is tmp_t.The t type context for web server ports is
http_port_t.&lt;/div&gt;
&lt;div&gt;
There is a rule in the policy that permits Apache (the web
server process running as httpd_t) to access files and
directories with a context normally found in /var/www/html
and other web server directories (httpd_sys_content_t). There
is no allow rule in the policy for files normally found in /tmp
and /var/tmp, so access is not permitted. With SELinux enabled a
malicious user could not access the /tmp directory, let alone
write files to it. &lt;i&gt;SELinux&lt;/i&gt; even has rules for remote filesystems
such as NFS and CIFS, although all files on these filesystems
are labeled with the same context.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
SELinux MODES&lt;/h3&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Enforcing Mode&lt;/li&gt;
&lt;li&gt;Premissive Mode&lt;/li&gt;
&lt;li&gt;Disabled&lt;/li&gt;
&lt;/ul&gt;
&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Enforcing Mode&lt;/b&gt;:In enforcing mode, SELinux actively access to
the web server attempting to read files with tmp_t type context. In enforcing
mode , SELinux both logs and protects.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Permissive Mode&lt;/b&gt;:Permissive mode is often used to
troubleshoot issues. In permissive mode, SELinux allows all interactions, even if
there is an explicit rule mentioned and it logs all of the denied interactions. This mode can
be used to determine if you are having an SELinux issue. NO reboot is required to
go from enforcing to permissive or back again.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Disabled:&lt;/b&gt;A third mode,disabled, completely disables SELinux. You must reboot to disable SELinux entirely, or to get from disabled mode to enforcing or permissive.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
Enable And Disable SELinux Mode&lt;/h3&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
There are two ways of &lt;i&gt;Enable and Disable SElinux&lt;/i&gt; on linux:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
1. Make the changes in /etc/sysconfig/selinux file.&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
# This file controls the state for selinux on the system.&lt;/div&gt;
&lt;div&gt;
# selinux= can take one of these three values:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
# enforcing – SELinux security policy is enforced.&lt;/div&gt;
&lt;div&gt;
# permissive – SELinux prints warnings instead of enforcing.&lt;/div&gt;
&lt;div&gt;
# disabled – No SELinux policy is loaded.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SELINUX=enforcing&lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
# SELINUXTYPE= can take one of these two values:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
# targeted – Targeted processes are protected,&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
# mls – Multi Level Security protection.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SELINUXTYPE=targeted&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
use /etc/sysconfig/selinux to change the default SELinux mode at boot time. In the
example above, it is set to enforcing mode.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
2. Changed the Mode at command line.&lt;/h4&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To make the SELinux mode change without restart you can use the two commands:-&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;getenforce&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;b&gt;setenforce&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To check the current status of SELinux on the system use getenforce&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
[root@serverx ~]# getenforce&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Enforcing&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It show&#39;s the current SELinux Status is Enforcing.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To change the current Status of SELinux on the system use Setenforce&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
[root@serverx ~]# setenforce&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;b&gt;usage: setenforce [enforcing | permissive | 1 | 0 ]&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
You can choose either enforcing or permissive mode but you can&#39;t disable it with setenforce.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;[root@serverx ~]# setenforce 0&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;[root@serverx ~]# getenforce&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;b&gt;Permissive&lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
SElinux Status changed to Premissive&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;[root@serverx ~]# setenforce 1&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;[root@serverx ~]# getenforce&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&lt;b&gt;Enforcing&lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
SElinux Status changed to Enforcing&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
[root@serverx ~]# setenforce permissive&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
[root@serverx ~]# getenforce&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;permissive&lt;/b&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
SElinux Status changed to Premissive&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
[root@serverx ~]# setenforce enforcing&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;[root@serverx ~]# getenforce&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
Enforcing&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
SElinux Status changed to Enforcing&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Above Example shows you the different usage of setenforce command to change the modes of SELinux.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/3318642448310713118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/3318642448310713118?isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/3318642448310713118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/3318642448310713118'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2015/02/3-amazing-facts-about-selinux.html' title='3 Amazing facts about SElinux.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-4915118535156663015</id><published>2015-01-20T19:36:00.001+05:30</published><updated>2015-03-11T19:40:28.966+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to Install Mongodb on Ubuntu</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h3 style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;
Install Mongodb On Ubuntu&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;In this Article we will learn how to install mongodb on &lt;i&gt;Ubuntu&lt;/i&gt;.If you want to install mongodb on other systems i.e &lt;a href=&quot;http://akhilmudgal.blogspot.com/2014/12/install-mongodb-on-fedora-red-hat.html&quot;&gt;fedora,redhat &amp;amp; centos&lt;/a&gt; please refer my &lt;a href=&quot;http://akhilmudgal.blogspot.com/2014/12/install-mongodb-on-fedora-red-hat.html&quot;&gt;last article&lt;/a&gt;.So lets start with &lt;i&gt;install&lt;/i&gt; mongodb &lt;b&gt;&amp;nbsp;Ubuntu&lt;/b&gt; systems.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h3 style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;
What is Mongodb?&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;div style=&quot;font-size: 14px; line-height: 20px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;&lt;b&gt;MongoDB&lt;/b&gt;&amp;nbsp;is the leading NoSQL database, designed for how we build and run applications today.&lt;i&gt;MongoDB&lt;/i&gt;&amp;nbsp;empowers organizations to be agile and scalable. It helps them enable new types of applications, improve customer experience, accelerate time to market and reduce total cost of ownership (TCO).&amp;nbsp;&lt;i&gt;MongoDB&lt;/i&gt;&amp;nbsp;is named from &quot;huMONGOus&quot; meaning &quot;extremely large&quot;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px; line-height: 20px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;MongoDB is a general purpose, open-source database. MongoDB features:&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;font-size: 14px; line-height: 20px; margin: 0px 20px 20px 0px; padding-left: 40px; text-align: justify;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Document data model with dynamic schemas&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Full, flexible index support and rich queries&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Auto-Sharding for horizontal scalability&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Built-in replication for high availability&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Text&amp;nbsp;&lt;span class=&quot;IL_AD&quot; id=&quot;IL_AD2&quot; style=&quot;background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat !important; background-size: initial !important; border-bottom-color: rgb(103, 176, 69) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(103, 176, 69) !important; cursor: pointer !important; display: inline !important; float: none !important; padding: 0px 0px 1px !important; position: static; text-decoration: underline !important;&quot;&gt;search&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Advanced security&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Aggregation Framework and MapReduce&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;Large media storage with GridFS&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;After looking what is mongodb.let&#39;s gets started with installation of &lt;b&gt;mongodb&lt;/b&gt; on Ubuntu..&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;
Install Mongodb Ubuntu System&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Ubuntu&lt;/b&gt; has its own Mongodb Packages but we will be using the offical Mongodb package available on the mongodb website as they are more up-to-date.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;First Import the public key used by the package management system&amp;nbsp;&lt;span style=&quot;background-color: white; color: #494747; font-size: 16px; line-height: 24px;&quot;&gt;i.e.&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;background-color: white; box-sizing: border-box; font-size: 16px; line-height: 24px;&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;box-sizing: border-box;&quot;&gt;dpkg&lt;/span&gt;&lt;/tt&gt;&lt;span style=&quot;background-color: white; color: #494747; font-size: 16px; line-height: 24px;&quot;&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;tt class=&quot;docutils literal&quot; style=&quot;background-color: white; box-sizing: border-box; font-size: 16px; line-height: 24px;&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;box-sizing: border-box;&quot;&gt;apt &lt;span style=&quot;font-family: inherit;&quot;&gt;which can be done with the following command.&lt;/span&gt;&lt;/span&gt;&lt;/tt&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit; line-height: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit; line-height: 24px;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: inherit; line-height: 24px;&quot;&gt;Create the repo file or list file for the mongodb using the following command&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit; line-height: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;echo &#39;deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen&#39; | sudo tee &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /etc/apt/sources.list.d/mongodb.list&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Now it&#39;s time to reload the database of package management which can be done with following command&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt; &lt;i&gt;sudo apt-get update&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Now it&#39;s Time to Install the Mongodb package which can be done&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;i&gt;&amp;nbsp;&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;sudo apt-get install -y mongodb-org&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp; &amp;nbsp;This will install the latest stable release of mongodb on ubuntu &amp;nbsp; &amp;nbsp;if you want to install a specific release of mongodb on ubuntu,Please use the following command.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #f3f3f3; line-height: 24px;&quot;&gt;&lt;i&gt;sudo apt-get install -y mongodb-org=2.6.1 mongodb-org-server=2.6.1 mongodb-org-shell=2.6.1 mongodb-org-mongos=2.6.1 mongodb-org-tools=2.6.1&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;The above command will install the mongodb version 2.6.1,you can replace the version number with your requirement.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;If you have successfully executed all the above steps.You will be able to install mongodb on ubuntu.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/4915118535156663015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/4915118535156663015?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/4915118535156663015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/4915118535156663015'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2015/01/how-to-install-mongodb-on-ubuntu.html' title='How to Install Mongodb on Ubuntu'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-7742274301472835582</id><published>2015-01-15T20:18:00.000+05:30</published><updated>2015-03-11T19:40:42.482+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>MysqlDump - A program to take Mysql  Backup</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In This article we will learn What is &lt;b&gt;Mysqldump&lt;/b&gt;? how it can be used with multiple options like &lt;b&gt;add-drop-tables,d,e,w,x,f,no-tablespaces&lt;/b&gt;.Lets start with what is &lt;i&gt;Mysqldump.&lt;/i&gt;&lt;br /&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;command&quot; style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;What is Mysqldump?&lt;/strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;span class=&quot;command&quot; style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Mysqldump&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&amp;nbsp;client is a utility that performs &lt;b&gt;backup&lt;/b&gt; .It can be used to &lt;i&gt;backup&lt;/i&gt; a database or a collection of databases for backup or transfer to another &lt;b&gt;MySQL&lt;/b&gt; server. The dump typically contains SQL statements to create the table, populate it, or both. However,&amp;nbsp;&lt;b&gt;M&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;command&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ysqldump&lt;span style=&quot;color: #015a84;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;can also be used to generate files in CSV, other delimited text, or XML format.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&lt;i&gt;Mysqldump&lt;/i&gt; requires at least the &lt;b&gt;SELECT&lt;/b&gt; privilege for dumped tables, SHOW VIEW for dumped views, TRIGGER for dumped triggers, and LOCK&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&amp;nbsp;TABLES if the --single-transaction option is not used.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;You can use &lt;b&gt;Mysqldump&lt;/b&gt; in three ways:-&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;db_name [tbl_name ...]&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;--databases db_name ...&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;--all-databases&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
let&#39;s see how to use all the three ways of &lt;i&gt;Mysqldump&lt;/i&gt;:-&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;db_name [tbl_name ...] : This option should be used,if you are taking backup of a single database with multiple tables.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;shell&amp;gt; mysqldump [options] db_name [tbl_name ...]&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;--databases db_name ... : &amp;nbsp;This option should be used,If we have multiple databases to backup.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;shell&amp;gt; mysqldump [options] --databases db_name ...&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;--all-databases: As the name suggest,This options should be used if you need to take backup of complete database.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;shell&amp;gt; mysqldump [options] --all-databases&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now we will se what lies in the [ options ],Mysqldump supports multiples options which can be used but we will be discussing only few of those options here.The options which are going to discuss are given below:-&lt;/div&gt;
&lt;div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #ffffee; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 13px; white-space: nowrap;&quot;&gt;--add-drop-table&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #ffffee; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 13px; white-space: nowrap;&quot;&gt;-d&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #ffffee; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 13px; white-space: nowrap;&quot;&gt;-e&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #ffffee; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 13px; white-space: nowrap;&quot;&gt;-w&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #ffffee; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 13px; white-space: nowrap;&quot;&gt;-x&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #ffffee; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 13px; white-space: nowrap;&quot;&gt;-f&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: #ffffee; color: #222222; font-family: arial, helvetica, sans-serif; font-size: 13px; white-space: nowrap;&quot;&gt;--no-tablespaces&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/h4&gt;
&lt;div&gt;
&lt;span style=&quot;color: #222222; font-family: arial, helvetica, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;white-space: nowrap;&quot;&gt;&lt;b&gt;--add-drop-table:&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;Add a DROP TABLE statement before each CREATE TABLE statement.So when every you take a backup of database or a table,It will always drop the existing table before creating the new table.It will help you in case having the same schema design.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;b&gt;-d or --no-data:&lt;/b&gt; if this option is used,No content from the table will be dumped.This option will only dump the structure of the table or tables&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;b&gt;-e or --extended-insert:&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;Use multiple-row&amp;nbsp;&lt;/span&gt;&lt;code class=&quot;literal&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 0px; font-family: &#39;Courier New&#39;, Courier, fixed, monospace; font-size: 13px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&amp;nbsp;syntax that include several&amp;nbsp;&lt;/span&gt;&lt;code class=&quot;literal&quot; style=&quot;background: white; border: 0px; font-family: &#39;Courier New&#39;, Courier, fixed, monospace; font-size: 13px; line-height: 25.2000007629395px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;VALUES&lt;/code&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;&amp;nbsp;lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;b&gt;-w or --where:&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 23.3999996185303px;&quot;&gt;Dump only selected records. Quotes are mandatory.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;b&gt;-x or --xml:&lt;/b&gt; Dump the database/databases in the well formed XML.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;b&gt;-f or --force:&lt;/b&gt; it will continue to take the dump of the table even if there is any error.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;b&gt;--no-tablespaces:&lt;/b&gt; If the option no-tablespaces is used, it will take not take the dump of table structure,only the content will be backup from the tables.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 13px; line-height: 23.3999996185303px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;
&lt;div id=&quot;disqus_thread&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/7742274301472835582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/7742274301472835582?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/7742274301472835582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/7742274301472835582'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2015/01/mysqldump-program-to-take-mysql.html' title='MysqlDump - A program to take Mysql  Backup'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-2627017609641049209</id><published>2015-01-02T23:00:00.004+05:30</published><updated>2015-03-11T19:40:52.960+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Amazon"/><title type='text'>Amazon S3 - Simple Storage Service</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;&lt;b&gt;What is Amazon S3?&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Amazon S3&lt;/b&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt; is a repository for Internet data. &lt;/span&gt;&lt;i style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Amazon S3&lt;/i&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt; provides access to reliable, fast, and inexpensive data storage. It is designed to make web-scale computing easy by enabling you to store and retrieve any amount of data, at any time, from within &lt;/span&gt;&lt;b style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Amazon EC2&lt;/b&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt; or anywhere on the web.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Amazon S3&lt;/i&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt; stores data objects redundantly on multiple devices across multiple facilities and allows concurrent read or write access to these data objects by many separate clients or application threads. You can use the redundant data stored in Amazon S3 to recover quickly and reliably from instance or application failures.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;How to Start With&amp;nbsp;&lt;/span&gt;Amazon&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;&amp;nbsp;S3 - Simple Storage Service&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Follow the simple six steps to successfully Use a Amazon S3 :-&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Sign-up&amp;nbsp;for &lt;b&gt;Amazon S3&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Create Bucket&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Add An Object to the Bucket&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;View Object&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Move &amp;nbsp;Object&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Delete &amp;nbsp;Object and Bucket&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Sign-up for Amazon S3&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;ol class=&quot;orderedlist&quot; style=&quot;font-family: verdana, arial, sans-serif;&quot; type=&quot;1&quot;&gt;
&lt;li class=&quot;listitem&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
Go to&amp;nbsp;&lt;a class=&quot;ulink&quot; href=&quot;http://aws.amazon.com/s3&quot; style=&quot;color: #996633;&quot; target=&quot;_blank&quot;&gt;http://aws.amazon.com/s3&lt;/a&gt;&amp;nbsp;and click&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Sign Up&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;listitem&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
Follow the on-screen instructions.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Create Bucket for Amazon S3&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ol class=&quot;procedure&quot; style=&quot;font-family: verdana, arial, sans-serif;&quot; type=&quot;1&quot;&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div class=&quot;simpara&quot; style=&quot;margin-bottom: 1em; margin-top: -0.4em;&quot;&gt;
Sign into the AWS Management Console at&amp;nbsp;&lt;a class=&quot;ulink&quot; href=&quot;https://console.aws.amazon.com/s3&quot; style=&quot;color: #996633;&quot; target=&quot;_blank&quot;&gt;https://console.aws.amazon.com/s3&lt;/a&gt;.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div class=&quot;simpara&quot; style=&quot;margin-bottom: 1em; margin-top: -0.4em;&quot;&gt;
Click&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Create Bucket &lt;/span&gt;&lt;span class=&quot;guilabel&quot;&gt;and dialog box will pop up&lt;/span&gt;.&lt;/div&gt;
&lt;div class=&quot;simpara&quot; style=&quot;margin-bottom: 1em; margin-top: -0.4em;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div class=&quot;simpara&quot; style=&quot;margin-bottom: 1em; margin-top: -0.4em;&quot;&gt;
In the&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Create a Bucket&lt;/span&gt;&amp;nbsp;dialog box,&amp;nbsp;enter a bucket name in the bucket Name box .After you create a bucket, you cannot change its name. The bucket name is also visible in the URL that points to the objects stored in the bucket. Ensure that the bucket name you choose is appropriate.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div class=&quot;simpara&quot; style=&quot;margin-bottom: 1em; margin-top: -0.4em;&quot;&gt;
In the&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Region&lt;/span&gt;&amp;nbsp;box, select a region.You can choose a region to optimize latency, minimize costs, or address regulatory requirements.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div class=&quot;simpara&quot; style=&quot;margin-bottom: 1em; margin-top: -0.4em;&quot;&gt;
Click&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Create&lt;/span&gt;.&lt;/div&gt;
&lt;div class=&quot;simpara&quot; style=&quot;margin-bottom: 1em; margin-top: -0.4em;&quot;&gt;
When Amazon S3 successfully creates your bucket, the console displays your empty bucket in the&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Buckets&lt;/span&gt;&amp;nbsp;panel.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;Add An Object To The Bucket for Amazon S3&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;ol class=&quot;procedure&quot; style=&quot;font-family: verdana, arial, sans-serif;&quot; type=&quot;1&quot;&gt;
&lt;li class=&quot;step&quot;&gt;click the name of bucket that you want to upload an object to and then click&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Upload&lt;/span&gt;.&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
In the&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;Upload - Select Files&lt;/span&gt;&amp;nbsp;wizard, if you want to upload an entire folder, you must click&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;Enable Enhanced Uploader&lt;/span&gt;&amp;nbsp;to install the necessary Java applet. You only need to do this once per console session.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
Click&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Add Files&lt;/span&gt;.&lt;/div&gt;
&lt;div class=&quot;itemizedlist&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;
&lt;ul class=&quot;itemizedlist&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;listitem&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
If you enabled the advanced uploader in step 2, you see a Java dialog box titled&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;Select files and folders to upload&lt;/span&gt;, as shown.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;listitem&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
If not, you see the&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;File Upload&lt;/span&gt;&amp;nbsp;dialog box associated with your operating system.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
Now Select the file that you want to upload and then click&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;Open&lt;/span&gt;.&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
Click&amp;nbsp;&lt;span class=&quot;guilabel&quot;&gt;Start Upload&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;View Object from Amazon S3&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;div class=&quot;procedure&quot; style=&quot;font-family: verdana, arial, sans-serif; margin: 0px; padding: 0px;&quot;&gt;
&lt;ol class=&quot;procedure&quot; type=&quot;1&quot;&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
In&amp;nbsp;the&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Objects and Folders&lt;/span&gt;&amp;nbsp;list, right-click the object or objects that you want to open or download, then click&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Open&lt;/span&gt;&amp;nbsp;or&amp;nbsp;&lt;span class=&quot;guilabel&quot; style=&quot;font-weight: bold;&quot;&gt;Download&lt;/span&gt;&amp;nbsp;as appropriate.&lt;/div&gt;
&lt;div class=&quot;simpara&quot; style=&quot;margin-bottom: 1em; margin-top: -0.4em;&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;step&quot;&gt;&lt;div style=&quot;margin-bottom: 1em;&quot;&gt;
If you are downloading the object, specify where you want to save it. The procedure for saving the object depends on the browser and operating system that you are using.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
So far we have seen how to create an &lt;b&gt;Amazon S3&lt;/b&gt; bucket,Add an object in the bucket and how to view the same object from the bucket.In the next article we will see how to move object in bucket and how to delete an object and bucket from &lt;b&gt;Amazon S3&lt;/b&gt;.Thanks!!&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: verdana, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/2627017609641049209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/2627017609641049209?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/2627017609641049209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/2627017609641049209'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2015/01/amazon-s3-simple-storage-service.html' title='Amazon S3 - Simple Storage Service'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-4315405096858074320</id><published>2014-12-24T16:09:00.004+05:30</published><updated>2015-03-11T19:41:28.255+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>Setup Mysql Replication in Master Slave Mode</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
In this tutorial we will learn what is M&lt;b&gt;ysql Replication&lt;/b&gt;,How to &lt;i&gt;setup mysql replication&lt;/i&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;
Let&#39;s start with what is MySQL replication is.&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;
MySQL replication&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i&gt;MySQL replication&lt;/i&gt; is a process that allows you to easily maintain multiple copies of a MySQL data by having them copied automatically from a master to a slave database. This can helpful for many reasons :&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;Scale-out solutions&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;Data Security&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;Analytics&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;data distribution&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 25.2000007629395px;&quot;&gt;Backup&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&amp;nbsp;we will &lt;b&gt;Setup&lt;/b&gt; a very simple &lt;b&gt;Mysql Replication&lt;/b&gt; with One Master and One slave.let&#39;s take two machines for achieving the same. lets take two machines for setting up the Mysql R&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;eplication&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;Machine One:&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px;&quot;&gt;10.33.76.78- Master Database&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;Machine Two:10.22.43.46- Slave Database&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: large; line-height: 28px;&quot;&gt;Setup&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;In this article i am using ubuntu to setup the replication,So first thing which needs to be done for &amp;nbsp;replication is installation of mysql on the system&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;apt-get install mysql-server mysql-client&lt;/i&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;Once you are done with the installation part,lets start the real fun of replication.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3 style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;
Step One—Setup the Master Database&lt;/span&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
On Master database we need to make couple changes in the configuration file on Mysql.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;The first step is to find the section that looks like this, binding the server to the local host:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;bind-address &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 127.0.0.1&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px;&quot;&gt;Replace the standard IP address with the IP address of server.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;bind-address &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 0.0.0.0&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;Next we need to un-comment the line which has server-id:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;server-id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = 1&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;Now,Search for the line that refers to log_bin and uncomment the same,I will make the bin logs on default location but you can change the location of bin logs as well.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;log_bin &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = /var/log/mysql/mysql-bin.log&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;Next option is used if you want to have Mysql Replication on the basis of databases i.e if you have multiple databases and you want Replication for only selective database&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;binlog_do_db &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= newdatabase&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; line-height: 28px;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;We are done with all the configuration changes on Master and now it&#39;s time to restart the mysql.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;service mysql restart&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; line-height: 28px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;We need to grant privileges to the slave.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;The command should be in this format:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;GRANT REPLICATION SLAVE ON *.* TO &#39;slave_user&#39;@&#39;%&#39; IDENTIFIED BY &#39;password&#39;;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#39;slave_user&#39; : Denotes the name of user used for replication,It can be anything.&lt;br /&gt;
&lt;br /&gt;
&#39;%&#39; : Denotes that with above user and password,Any host can become slave of this master,I would recommend that instead of % you should use the ip-address of the slave host.&lt;br /&gt;
&lt;br /&gt;
&#39;password&#39;: it should be combination of character numeric.&lt;br /&gt;
&lt;br /&gt;
Last thing to do :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;FLUSH PRIVILEGES;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now,We need to note down the position of master and take the backup of databases for which we want to setup the Mysql Replication,Which can be done with following sequence of commands:-&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;USE newdatabase;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;FLUSH TABLES WITH READ LOCK;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;mysql&amp;gt; SHOW MASTER STATUS;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;+------------------+----------+--------------+------------------+&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;| File &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | Position | Binlog_Do_DB | Binlog_Ignore_DB |&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;+------------------+----------+--------------+------------------+&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;| mysql-bin.000001 | &amp;nbsp; &amp;nbsp; &amp;nbsp;107 | &amp;nbsp; | &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;+------------------+----------+--------------+------------------+&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f3f3f3;&quot;&gt;1 row in set (0.00 sec)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The position noted above will be helpful while setting up the Slave.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;export your database using mysqldump in the new window (make sure you are typing this command in the bash shell, not in MySQL).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; line-height: 28px; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;mysqldump -u root -p --opt newdatabase &amp;gt; newdatabase.sql&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; line-height: 28px; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;Now, returning to your your original window, unlock the databases (making them writeable again). Finish up by exiting the shell.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;UNLOCK TABLES;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 28px; text-align: start;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/i&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;QUIT;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: start;&quot;&gt;
&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;
Step Two—Configure the Slave Database&lt;/span&gt;&lt;/h3&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; text-align: start;&quot;&gt;On Slave Machine,open up the MySQL shell and create the new database that you will be replicating from the master (then exit):&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;CREATE DATABASE newdatabase;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;
&lt;/i&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;EXIT;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; text-align: start;&quot;&gt;After creating the database, Now Import that you previously exported from the master database.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 28px; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 28px; text-align: start;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;mysql -u root -p newdatabase &amp;lt; /path/to/newdatabase.sql&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 28px; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 28px; text-align: start;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 28px; text-align: start;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;Now we need to configure the slave configuration :&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; font-family: proxima-nova, sans-serif; font-size: 16px; line-height: 28px; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;make sure that your have the following Four criteria appropriately filled out:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;div style=&quot;background-color: white;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;server-id &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = 2&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;relay-log &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = /var/log/mysql/mysql-relay-bin.log&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;log_bin &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; = /var/log/mysql/mysql-bin.log&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;binlog_do_db &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= newdatabases&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;Server-id needs to be unique as and we have already used server-id = 1 on master,lets setup server-id=2 here on slave.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;You might not find the rest of three values in my.cnf by default,So if the values are missing please add it and restart the mysql.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;service mysql restart&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;Let&#39;s enable the replication from within the MySQL shell.&lt;/span&gt;Open up the the MySQL shell &amp;nbsp;and type in the details :&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;CHANGE MASTER TO MASTER_HOST=&#39;ip-address of master&#39;,MASTER_USER=&#39;slave_user&#39;, MASTER_PASSWORD=&#39;slave_password&#39;, MASTER_LOG_FILE=&#39;&#39;, MASTER_LOG_POS= ;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
This command accomplishes several things at the same time:&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;It designates the current server as the slave of our master server.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;It provides the server the correct login credentials&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;Last of all, it lets the slave server know where to start replicating from; the master log file and log position come from the numbers we wrote down previously.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;With that—you have configured a master and slave server.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;br /&gt;
Activate the slave server:&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;START SLAVE;&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
You be able to see the details of the slave replication by typing in this command. The \G rearranges the text to make it more readable.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;&lt;i style=&quot;background-color: #f3f3f3;&quot;&gt;SHOW SLAVE STATUS\G&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
Show slave status will give you complete details which you have entered while setting up the slave.like master server,user name and etc.You can test t&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;he replication by simplying createing a table in the database for which you have enabled the replication and see if the same table exists on slave.If&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; margin-bottom: 22px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;you table is present on the slave machine as well then your Mysql Replication is working fine,Else investagte further to check what has went worng.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;background-color: white; text-align: start;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f6f6f6; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; box-sizing: border-box; font-family: monospace, serif; font-size: 14px; margin-bottom: 28px; overflow: auto !important; padding: 13px 17px; word-wrap: normal !important;&quot;&gt;&lt;/pre&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: proxima-nova, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 28px;&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/4315405096858074320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/4315405096858074320?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/4315405096858074320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/4315405096858074320'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2014/12/set-up-mysql-replication-in-master.html' title='Setup Mysql Replication in Master Slave Mode'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-1334828812478931988</id><published>2014-12-13T11:16:00.000+05:30</published><updated>2015-03-11T19:41:46.987+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>Install MongoDB on Fedora, Red Hat Enterprise and CentOS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #444444;&quot;&gt;In this Tutorial we will learn how to &lt;b&gt;Install MongoDB&lt;/b&gt;&amp;nbsp;on different Flavors on&amp;nbsp;&lt;a href=&quot;http://www.ap2v.com/blog/what-is-linux&quot; target=&quot;_blank&quot;&gt;Linux&lt;/a&gt;&amp;nbsp;i.e &lt;i&gt;&lt;b&gt;fedora, Redhat Enterprise and CentOS.&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; box-sizing: border-box; color: #313030; cursor: pointer; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-weight: normal; line-height: 24px; margin: 24px 0px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;
Considerations&lt;/span&gt;&lt;/h3&gt;
&lt;h3 style=&quot;background-color: white; box-sizing: border-box; color: #313030; cursor: pointer; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-weight: normal; line-height: 24px; margin: 24px 0px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747;&quot;&gt;For production deployments, always run &lt;i&gt;MongoDB&lt;/i&gt; on 64-bit systems.&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;background-color: white; box-sizing: border-box; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; line-height: 24px; margin-bottom: 24px; margin-top: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The default&amp;nbsp;&lt;tt class=&quot;docutils literal&quot; style=&quot;box-sizing: border-box; color: black; font-family: &#39;Source Code Pro&#39;, monospace;&quot;&gt;/etc/mongodb.conf&lt;/tt&gt;&amp;nbsp;configuration file supplied by the 2.6 series packages has&amp;nbsp;&lt;tt class=&quot;xref mongodb mongodb-setting docutils literal&quot; style=&quot;background-color: transparent; box-sizing: border-box; color: black; font-family: &#39;Source Code Pro&#39;, monospace;&quot;&gt;bind_ip`&lt;/tt&gt;set to&amp;nbsp;&lt;tt class=&quot;docutils literal&quot; style=&quot;box-sizing: border-box; color: black; font-family: &#39;Source Code Pro&#39;, monospace;&quot;&gt;127.0.0.1&lt;/tt&gt;&amp;nbsp;by default. Modify this setting as needed for your environment before initializing a&amp;nbsp;replica set.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;versionchanged&quot; style=&quot;background-color: white; box-sizing: border-box;&quot;&gt;
&lt;div style=&quot;box-sizing: border-box; color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; line-height: 24px; margin-bottom: 24px; margin-top: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;versionmodified&quot; style=&quot;box-sizing: border-box; font-style: italic;&quot;&gt;Changed in version 2.6:&amp;nbsp;&lt;/span&gt;The package structure and names have changed as of version 2.6. For instructions on installation of an older release, please refer to the documentation for the appropriate version.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;box-sizing: border-box; margin-bottom: 24px; margin-top: 24px;&quot;&gt;
&lt;h2 style=&quot;color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; line-height: 24px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;h3 style=&quot;color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; line-height: 24px; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Install Mongodb&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/h3&gt;
&lt;div style=&quot;color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;Lets begin with the installation of &lt;/span&gt;&lt;b&gt;Mongodb&lt;/b&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt; with YUM.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;b&gt;Step 1&lt;/b&gt;:&lt;span style=&quot;font-weight: normal;&quot;&gt; Add the Mongodb repo in package management system (YUM) in &lt;i&gt;fedora&lt;/i&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-weight: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;Create a&amp;nbsp;&lt;tt class=&quot;docutils literal&quot; style=&quot;box-sizing: border-box; color: black; font-family: &#39;Source Code Pro&#39;, monospace;&quot;&gt;&lt;span class=&quot;pre&quot; style=&quot;box-sizing: border-box;&quot;&gt;/etc/yum.repos.d/mongodb.repo&lt;/span&gt;&lt;/tt&gt;&amp;nbsp;file which should have the following &amp;nbsp;configuration information for the &lt;i&gt;MongoDB repository&lt;/i&gt;:&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #494747; font-family: &#39;PT Sans&#39;, &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp;[mongodb]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&amp;nbsp;name=MongoDB Repository&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&amp;nbsp;baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&amp;nbsp;gpgcheck=0&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&amp;nbsp;enabled=1&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;The Above configuration will work with 64-bit system,if You are running a 32-bit configuration please use the given below Confiugration:&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;line-height: 24px;&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;[mongodb]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;name=MongoDB Repository&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;gpgcheck=0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;enabled=1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;b&gt;Step 2&lt;/b&gt;: &lt;span style=&quot;font-weight: normal;&quot;&gt;Once you have successfully done the changes in the package management system (YUM),It&#39;s time to install the &lt;/span&gt;&lt;b&gt;Mongodb&lt;/b&gt; on the system i.e &amp;nbsp;&lt;i&gt;&lt;b&gt;fedora&lt;/b&gt;&lt;/i&gt;, Red Hat Enterprise and CentOS&amp;nbsp;:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 16px; line-height: 24px;&quot;&gt;To install the latest stable version of &lt;i&gt;MongoDB&lt;/i&gt;, simply issue the following command:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;
&lt;div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp;&amp;nbsp;sudo yum install -y mongodb-org&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: #f5f6f7; color: #222222; font-family: &#39;Source Code Pro&#39;, monospace; font-size: 14px; line-height: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;if you want to use a specific version of &lt;i&gt;mongodb&lt;/i&gt;,You have&amp;nbsp;&lt;span style=&quot;font-size: 16px; line-height: 24px;&quot;&gt;&amp;nbsp;to&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: 16px; line-height: 24px;&quot;&gt;specify each component package individually and append the version number to the package name,An example is shown below:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;line-height: 24px;&quot;&gt;&amp;nbsp; &amp;nbsp;sudo yum install -y mongodb-org-2.6.1 mongodb-org-server-2.6.1 mongodb-org-shell-2.6.1 mongodb-org-mongos-2.6.1 mongodb-org-tools-2.6.1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;If you have completed the above two steps successfully,You have installed &amp;nbsp;mongodb in &lt;i&gt;fedora or Redhat Enterprise&lt;/i&gt; .Thanks!!&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;span style=&quot;color: #494747; font-family: PT Sans, Helvetica Neue, Helvetica, Arial, sans-serif;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/1334828812478931988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/1334828812478931988?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/1334828812478931988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/1334828812478931988'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2014/12/install-mongodb-on-fedora-red-hat.html' title='Install MongoDB on Fedora, Red Hat Enterprise and CentOS'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-7772630277237531206</id><published>2014-12-09T14:23:00.000+05:30</published><updated>2015-03-11T19:41:59.317+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>DRBD and Heartbeat</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;&lt;u&gt;DRBD And HeartBeat&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
About three months ago, I was planning a new server setup that would 
run our new portal as well as e-mail, databases, &lt;b&gt;DNS&lt;/b&gt; and so forth.  One 
of the most important goals was to create a redundant solution, so that 
if one of the servers failed, it wouldn&#39;t affect company operation. &lt;br /&gt;
I
 looked through a lot of the redundant solutions available for Linux at 
the time, and with most of them, I had trouble getting all the services 
we needed to run redundantly.  After all, there is a very big difference
 in functionality between a Sendmail dæmon and a PostgreSQL dæmon. &lt;br /&gt;
In
 the end, though, I did find one solution that worked very well for our 
needs.  It involves setting up a disk mirror between machines using the 
software &lt;b&gt;DRBD&lt;/b&gt; and a high-availability monitor on those machines using 
&lt;b&gt;Heartbeat&lt;/b&gt;. &lt;br /&gt;
&lt;i&gt;DRBD&lt;/i&gt; mirrors a partition between two machines allowing
 only one of them to mount it at a time.  &lt;i&gt;Heartbeat&lt;/i&gt; then monitors the 
machines, and if it detects that one of the machines has died, it takes 
control by mounting the mirrored disk and starting all the services the 
other machine is running. &lt;br /&gt;
In this tutorial, I show you how to set
 up a redundant Sendmail system, because once you do that, you will be 
able to set up almost any service you need.  We assume that your master 
server is called server1 and has an IP address of 192.168.1.1, and your 
slave server is called server2 and has an IP address of 192.168.1.2. &lt;br /&gt;
And,
 because you don&#39;t want to have to access your mail server on any of 
these addresses in case they are down, we will give it a virtual address
 of 192.168.1.5.  You can, of course, change this to whatever address 
you want in the Heartbeat configuration. &lt;br /&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;titlepage&amp;quot;&quot;&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
How It Works&lt;/h4&gt;
------------------------- &lt;/div&gt;
This
 high-availability solution works by replicating a disk partition in a 
master/slave mode.  The server that is running as a master has full 
read/write access to that partition; whereas the server running as slave
 has absolutely no access to the partition but silently replicates all 
changes made by the master server. &lt;br /&gt;
Because of this, all the 
processes that need to access the replicated partition must be running 
on the master server.  If the master server fails, the Heartbeat dæmon 
running on the slave server will tell DRBD that it is now the master, 
mount the replicated partition, and then start all the processes that 
have data stored on the replicated partition.&lt;/div&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;titlepage&amp;quot;&quot;&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
How to Get It Running&lt;/h4&gt;
&lt;/div&gt;
------------------------------------- &lt;br /&gt;
The
 first step for running a redundant system is having two machines ready 
to try it out.  They don&#39;t need to have identical specs, but they should
 meet the following requirements: &lt;br /&gt;
&lt;div class=&quot;&amp;quot;itemizedlist&amp;quot;&quot;&gt;
&lt;ul type=&quot;&amp;quot;disc&amp;quot;&quot;&gt;
&lt;li&gt; Enough free space on both machines to create an equal-sized partition on each of them. &lt;/li&gt;
&lt;li&gt; The same versions of the dæmons you want to run across both machines. &lt;/li&gt;
&lt;li&gt; A network card with crossover cable or a hub/switch. &lt;/li&gt;
&lt;li&gt; An optional serial port and serial port crossover cable for additional monitoring. &lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
You also should think carefully about which services you 
want running on both machines, as this will affect the amount of hard 
disk you will need to dedicate to replication across them and how you 
will store the configuration and data files of these services. &lt;br /&gt;
It&#39;s
 very important that you have enough space on this shared partition, 
because it will be the main data storage location for all of these 
services.  So, if you are going to be storing a large Sendmail spool or a
 database, you should make sure it has more than enough space to run for
 a long time before having to repartition and reconfigure &lt;b&gt;DRBD&lt;/b&gt; for a 
larger disk size.&lt;/div&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;titlepage&amp;quot;&quot;&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Setting Up the Basics on Your Servers&lt;/h4&gt;
&lt;/div&gt;
---------------------------------------------------------------- &lt;br /&gt;
Once
 you&#39;ve made sure your machines are ready, you can go ahead and create 
an equal-sized partition on both machines.  At this stage, you do not 
need to create a filesystem on that partition, because you will do that 
only once it is running mirrored over DRBD. &lt;br /&gt;
For my servers, I have one DRBD replicated drive that looks like this on my partition tables:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;/dev/sda5      7916    8853   7534453+  83  Linux&lt;/pre&gt;
Note: type &lt;tt&gt;fdisk -l&lt;/tt&gt;
 at your command prompt to view a listing of your partitions in a format
 similar to that shown here.  Also, in my case, the partition table is 
identical on both redundant machines. &lt;br /&gt;
The next step after 
partitioning is getting the packages for Heartbeat version 1.2+ and DRBD
 version 0.8+ installed and the DRBD kernel module compiled.  If you can
 get these prepackaged for your distribution, it will probably be 
easier, but if not, you can download them from &lt;a href=&quot;https://www.blogger.com/%22http://www.linux-ha.org/DownloadSoftware%22&quot;&gt;www.linux-ha.org/DownloadSoftware&lt;/a&gt; and &lt;a href=&quot;https://www.blogger.com/%22http://www.drbd.org/download.html%22&quot;&gt;www.drbd.org/download.html&lt;/a&gt;. &lt;br /&gt;
Now,
 go to your /etc/hosts file and add a couple lines, one for your primary
 and another for your secondary redundant server.  Call one server1, the
 other server2, and finally, call one mail, and set the IP addresses 
appropriately.  It should look something like this:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;192.168.1.1    server1
192.168.1.2    server2
192.168.1.5    mail&lt;/pre&gt;
Finally, on both your master and slave 
server, make a folder called /replicated, and add the following line to 
the /etc/fstab file:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;/dev/drbd0    /replicated   ext3   noauto    0   0&lt;/pre&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;titlepage&amp;quot;&quot;&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Configuring DRBD&lt;/h4&gt;
-------------------------------- &lt;/div&gt;
After
 you&#39;ve done that, you have to set up DRBD before moving forward with 
Heartbeat.  In my setup, the configuration file is /etc/drbd.conf, but 
that can change depending on distribution and compile time options, so 
try to find the file and open it now so you can follow along.  If you 
can&#39;t find it, simply create one called /etc/drbd.conf. &lt;br /&gt;
Listing 1
 is my configuration file.  I go over it line by line and add 
explanations as comments that begin with the # character. &lt;/div&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;titlepage&amp;quot;&quot;&gt;
&lt;a href=&quot;https://www.blogger.com/%22http://www.blogger.com/post-edit.g?blogID=8033252853889217827&amp;amp;postID=7772630277237531206%22&quot; name=&quot;&amp;quot;N0x1d7f6890.0x1d8ebae8&amp;quot;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;&amp;quot;sidebar&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;title&amp;quot;&quot;&gt;
&lt;b&gt; Listing 1. /etc/drbd.conf&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;# Each resource is a configuration section for a
# mirrored disk.
# The drbd0 is the name we will use to refer
# to this disk when starting or stopping it.

resource drbd0 {
  protocol C;
  handlers {
    pri-on-incon-degr &quot;echo &#39;DRBD: primary requested but inconsistent!&#39;
    ↪| wall; /etc/init.d/heartbeat stop&quot;; #&quot;halt -f&quot;;
    pri-lost-after-sb &quot;echo &#39;DRBD: primary requested but lost!&#39;
    ↪| wall; /etc/init.d/heartbeat stop&quot;; #&quot;halt -f&quot;;
  }

  startup {
    degr-wfc-timeout 120;    # 2 minutes.
  }

  disk {
    on-io-error   detach;
  }
# These are the network settings that worked best for me.
# If you want to play around with them, go
# ahead, but take a look in the man pages of drbd.conf
# and drbdadm to see what each does.

  net {
    timeout 120;
    connect-int 20;
    ping-int 20;
    max-buffers     2048;
    max-epoch-size  2048;
    ko-count 30;

# Remember to change this shared-secret on both the master
# and slave machines.

    cram-hmac-alg &quot;sha1&quot;;
    shared-secret &quot;FooFunFactory&quot;;
  }

  syncer {
    rate 10M;
    al-extents 257;
  }

# This next block defines the settings for the server
# labeled as server1.  This label should be in your
# /etc/hosts file and point to a valid host.

  on server1 {

# The following device will be created automatically by
# the drbd kernel module when the DRBD
# partition is in master mode and ready to write.
# If you have more than one DRBD resource, name
# this device drbd1, drbd2 and so forth.

    device     /dev/drbd0

# Put the partition device name you&#39;ve prepared here.

    disk      /dev/sda5;

# Now put the IP address of the primary server here.
# Note: you will need to use a unique port number for
# each resource.

    address   192.168.1.3:7788;
    meta-disk  internal;
  }

# This next block is identical to that of server1 but with
# the appropriate settings of the server called
# server2 in our /etc/hosts file.

  on server2 {
    device    /dev/drbd0;
    disk      /dev/sda5;
    address   192.168.1.2:7788;
    meta-disk internal;
  }
}&lt;/pre&gt;
&lt;/div&gt;
Now, let&#39;s test it by starting the DRBD driver to see if
 everything works as it should.  On your command line on both servers 
type:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;drbdadm create-md drbd0; /etc/init.d/drbd restart; cat /proc/drbd&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
If all goes well, the output of the last command should look something like this:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;0: cs:Connected st:Secondary/Secondary ds:Inconsistent/Inconsistent r---
   ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0
       resync: used:0/7 hits:0 misses:0 starving:0 dirty:0 changed:0
       act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:0&lt;/pre&gt;
&lt;br /&gt;
Note: you always can find information about the DRBD status by typing:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;cat /proc/drbd&lt;/pre&gt;
&lt;br /&gt;
Now, type the following command on the master system:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;drbdadm -- --overwrite-data-of-peer primary drbd0; cat /proc/drbd&lt;/pre&gt;
&lt;br /&gt;
The output should look something like this:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;0: cs:SyncSource st:Primary/Secondary ds:UpToDate/Inconsistent r---
   ns:65216 nr:0 dw:0 dr:65408 al:0 bm:3 lo:0 pe:7 ua:6 ap:0
       [&amp;gt;...................] sync&#39;ed:  2.3% (3083548/3148572)K
       finish: 0:04:43 speed: 10,836 (10,836) K/sec
       resync: used:1/7 hits:4072 misses:4 starving:0 dirty:0 changed:4
       act_log: used:0/257 hits:0 misses:0 starving:0 dirty:0 changed:0&lt;/pre&gt;
&lt;br /&gt;
This
 means it is syncing your disks from the master computer that is set as 
the primary one to the slave computer that is set as secondary. &lt;br /&gt;
Next, create the filesystem by typing the following on the master system:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;mkfs.ext3 /dev/drbd0&lt;/pre&gt;
&lt;br /&gt;
Once
 that is done, on the master computer, go ahead and mount the drive 
/dev/drbd0 on the /replicated directory we created for it.  We&#39;ll have 
to mount it manually for now until we set up Heartbeat. &lt;/div&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;titlepage&amp;quot;&quot;&gt;
&lt;br /&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Preparing Your Services&lt;/h4&gt;
&lt;/div&gt;
------------------------------------------ &lt;br /&gt;
An
 important part of any redundant solution is properly preparing your 
services so that when the master machine fails, the slave machine can 
take over and run those services seamlessly.  To do that, you have to 
move not only the data to the replicated DRBD disk, but also move the 
configuration files. &lt;br /&gt;
Let me show you how I&#39;ve got Sendmail set up
 to handle the mail and store it on the replicated drives.  I use 
Sendmail for this example as it is one step more complicated than the 
other services, because even if the machine is running in slave mode, it
 may need to send e-mail notifications from internal applications, and 
if Sendmail can&#39;t access the configuration files, it won&#39;t be able to do
 this. &lt;br /&gt;
On the master machine, first make sure Sendmail is 
installed but stopped. Then create an etc directory on your /replicated 
drive.  After that, copy your /etc/mail directory into the 
/replicated/etc and create a symlink from /replicated/etc/mail to 
/etc/mail. &lt;br /&gt;
Next, make a var directory on the /replicated drive, 
and copy /var/mail, /var/spool/mqueue and any other mail data folders 
into that directory. Then, of course, create the appropriate symlinks so
 that the new folders are accessible from their previous locations. &lt;br /&gt;
Your /replicated directory structure should now look something like:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;/replicated/etc/mail
/replicated/var/mail
/replicated/var/spool/mqueue
/replicated/var/spool/mqueue-client
/replicated/var/spool/mail&lt;/pre&gt;
And, on your main drive, those folders should be symlinks and look something like:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;/etc/mail -&amp;gt; /replicated/etc/mail
/var/mail -&amp;gt; /replicated/var/mail
/var/spool/mqueue -&amp;gt; /replicated/var/spool/mqueue
/var/spool/mqueue-client -&amp;gt; /replicated/var/spool/mqueue-client
/var/spool/mail -&amp;gt; /replicated/var/spool/mail&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
Now, start Sendmail again and give it a try.  If all is working well, you&#39;ve successfully finished the first part of the setup. &lt;br /&gt;
The
 next part is to make sure it runs, even on the slave.  The trick we use
 is copying the Sendmail binary onto the mounted /replicated drive and 
putting a symlink to the binary ssmtp on the unmounted /replicated 
folder. &lt;br /&gt;
First, make sure you have ssmtp installed and configured 
on your system. Next, make a directory /replicated/usr/sbin, and copy 
/usr/sbin/sendmail to that directory.  Then, symlink from 
/usr/sbin/sendmail back to /replicated/usr/sbin/sendmail. &lt;br /&gt;
Once 
that&#39;s done, shut down Sendmail and unmount the /replicated drive. Then,
 on both the master and slave computers, create a folder 
/replicated/usr/sbin and a symlink from /usr/sbin/ssmtp to 
/replicated/usr/sbin/sendmail. &lt;br /&gt;
After setting up Sendmail, setting
 up other services like Apache and PostgreSQL will seem like a breeze.  
Just remember to put all their data and configuration files on the 
/replicated drive and to create the appropriate symlinks. &lt;/div&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
Heartbeat
 is designed to monitor your servers, and if your master server fails, 
it will start up all the services on the slave server, turning it into 
the master.  To configure it, we need to specify which servers it should
 monitor and which services it should start when one fails. &lt;br /&gt;
Let&#39;s
 configure the services first.  We&#39;ll take a look at the Sendmail we 
configured previously, because the other services are configured the 
same way.  First, go to the directory /etc/heartbeat/resource.d.  This 
directory holds all the startup scripts for the services Heartbeat will 
start up. &lt;br /&gt;
Now add a symlink from /etc/init.d/sendmail to /etc/heartbeat/resource.d. &lt;br /&gt;
Note: keep in mind that these paths may vary depending on your Linux distribution. &lt;br /&gt;
With
 that done, set up Heartbeat to start up services automatically on the 
master computer, and turn the slave to the master if it fails. Listing 2
 shows the file that does that, and in it, you can see we have only one 
line, which has different resources to be started on the given server, 
separated by spaces. &lt;/div&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;titlepage&amp;quot;&quot;&gt;
&lt;a href=&quot;https://www.blogger.com/%22http://www.blogger.com/post-edit.g?blogID=8033252853889217827&amp;amp;postID=7772630277237531206%22&quot; name=&quot;&amp;quot;N0x1d7f6890.0x1dba2958&amp;quot;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;&amp;quot;sidebar&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;title&amp;quot;&quot;&gt;
&lt;br /&gt;
&lt;b&gt;Listing 2. /etc/heartbeat/haresources&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;server1 IPaddr::192.168.1.5/24 datadisk::drbd0 sendmail&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The first command, &lt;tt&gt;server1&lt;/tt&gt;, defines which server should be the default master of these services; the second one, &lt;tt&gt;IPaddr::192.168.1.5/24&lt;/tt&gt;, tells Heartbeat to configure this as an additional IP address on the master server with the given netmask.  Next, with &lt;tt&gt;datadisk::drbd0&lt;/tt&gt;
 we tell Heartbeat to mount this drive automatically on the master, and 
after this, we can enter the names of all the services we want to start 
up—in this case, we put &lt;tt&gt;sendmail&lt;/tt&gt;. &lt;br /&gt;
Note: these names should be the same as the filename for their startup script in /etc/heartbeat/resource.d. &lt;br /&gt;
Next,
 let&#39;s configure the /etc/heartbeat/ha.cf file (Listing 3).  The main 
things you would want to change in it are the hostnames of the 
master/slave machine at the bottom, and the deadtime and initdead.  
These specify how many seconds of silence should be allowed from the 
other machine before assuming it&#39;s dead and taking over. &lt;br /&gt;
If you 
set this too low, you might have false positives, and unless you&#39;ve got a
 system called STONITH in place, which will kill the other machine if it
 thinks it&#39;s already dead, you can have all kinds of problems.  I set 
mine at two minutes; it&#39;s what has worked best for me, but feel free to 
experiment. &lt;br /&gt;
Also keep in mind the following two points: for the 
serial connection to work, you need to plug in a crossover serial cable 
between the machines, and if you don&#39;t use a crossover network cable 
between the machines but instead go through a hub where you have other 
Heartbeat nodes, you have to change the udpport for each master/slave 
node set, or your log file will get filled with warning messages. &lt;/div&gt;
&lt;div class=&quot;&amp;quot;simplesect&amp;quot;&quot; lang=&quot;&amp;quot;en&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;titlepage&amp;quot;&quot;&gt;
&lt;a href=&quot;https://www.blogger.com/%22http://www.blogger.com/post-edit.g?blogID=8033252853889217827&amp;amp;postID=7772630277237531206%22&quot; name=&quot;&amp;quot;N0x1d7f6890.0x1dba2e80&amp;quot;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;&amp;quot;sidebar&amp;quot;&quot;&gt;
&lt;div class=&quot;&amp;quot;title&amp;quot;&quot;&gt;
&lt;br /&gt;
&lt;b&gt;Listing 3. /etc/heartbeat/ha.cf&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility     local0
keepalive 2
deadtime 120
initdead 120
serial  /dev/ttyS1
baud 9600
udpport 694
udp     eth0
nice_failback on
node server1
node server2&lt;/pre&gt;
&lt;/div&gt;
Now, all that&#39;s left to do is start your Heartbeat on both the master and slave server by typing:  &lt;br /&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;&amp;quot;programlisting&amp;quot;&quot;&gt;/etc/init.d/heartbeat start&lt;/pre&gt;
&lt;br /&gt;
Once
 you&#39;ve got that up and running, it&#39;s time to test it.  You can do that 
by stopping Heartbeat on the master server and watching to see whether 
the slave server becomes the master.  Then, of course, you might want to
 try it by completely powering down the master server or any other 
disconnection tests. &lt;br /&gt;
&lt;br /&gt;
Congratulations on setting up 
your redundant server system! And, remember, &lt;b&gt;&lt;i&gt;Heartbeat and DRBD &lt;/i&gt;&lt;/b&gt;are 
fairly flexible, and you can put together some complex solutions, 
including having one server being a master of one DRBD partition and a 
slave of another.  Take some time, play around with them and see what 
you can discover. &lt;/div&gt;
&lt;/div&gt;
--&amp;gt;
&lt;br /&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/7772630277237531206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/7772630277237531206?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/7772630277237531206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/7772630277237531206'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2011/10/how-to-build-redundant-high.html' title='DRBD and Heartbeat'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-4377522839373880788</id><published>2014-12-09T14:21:00.000+05:30</published><updated>2015-03-11T19:42:50.430+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>Centralized Syslog Server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
A&lt;b&gt; centralized syslog&lt;/b&gt; server was one of the first true SysAdmin tasks that I was given as a Linux Administrator way back.  My boss at the time wanted to pull in log files from various appliances and have me use regexp to search them for certain key words.  At the time Linux was still in its infancy, and I had just been dabbling with it in my free time. So, I jumped at the chance to introduce Linux to the company that I had worked for.  Did it work? You bet it did!  What this post is going to cover is not only how to setup a &lt;i&gt;centralized syslog-ng&lt;/i&gt; server, but why you would go about setting one up in the first place. &lt;br /&gt;
So what is &lt;b&gt;syslog&lt;/b&gt;?  Syslog is used in Linux to log system messages (huh, another easy to guess name).  Syslog-ng is just a rewrite of the original syslog, that was developed in 1998.  &lt;b&gt;Syslog-ng&lt;/b&gt; is still being actively developed (as of 2010) by BalaBit IT Security and comes with many more features, including better TCP handling, TLS encryption of messages, and sending messages to a database among other things.  Some distributions allow you to install either syslog,&lt;i&gt; rsyslog or syslog-ng&lt;/i&gt;.  For this article, I&#39;ll be focusing on syslog-ng as this is more up to date, and if the reader wishes, can be &#39;supported&#39; via the company that owns the syslog-ng software by going with their enterprise edition version at a later date. &lt;br /&gt;
Now that you&#39;ve got an overview of syslog-ng, let&#39;s talk about just why you would use a &lt;b&gt;centralized syslog-ng&lt;/b&gt; server.  I am sure there are more than the two reasons that I will bring up, but I can think of at least 2 of them off the top of my head.  The first is for security purposes.  If you have your routers, firewalls, switches, Linux servers and/or other hardware pointing to a SECURED centralized syslog-ng server, when someone does attempt to attack one of the above devices log files can be safely off-site in a secure location.  If syslog files are kept on the device this gives an attacker the ability to clean up their tracks.  Granted, they can disable the ability to send log files to an external &lt;i&gt;syslog-ng server&lt;/i&gt;, but any and all connections prior to that will be located on the centralized syslog server.  The other reason is for convenience. For instance, if you have a server that crashed and is unresponsive, you can check the kernel error logs on your centralized syslog server.  If you want to check syslog patterns between various dates over an extended time, regex the log files from the centralized syslog server.   &lt;br /&gt;
So what do I do?  I actually use both approaches at home.  Not only do my devices and servers forward all their syslog files to a centralized location, but that location is locked down.  The machine in question is a virtual machine with only 1 port open (syslog) and accessible only from the local machine, the syslog files are kept on an external drive.  Is it paranoia? Probably a wee bit.  But I do know that in my home environment, if my external drive fills up from too many syslog files it won&#39;t crash my virtual machine.  If somehow something happens to my virtual machine, my host OS won&#39;t be affected, if someone does gain access to one of my devices then they can&#39;t gain access to my syslog server. Granted if something happened to my host OS then I would have issues with my guest VM&#39;s, but we can&#39;t always prepare for everything.  Okay, I admit it&#39;s paranoia in the highest of levels, and for most people this is probably too far.  &lt;br /&gt;
Before we get started, here&#39;s a quick disclaimer.  First off, as with all of my previous posts, I do all of my blogpost testing in Debian.  In this case I had a virtual machine setup for Debian 6.0.1, thus your mileage may vary.  Also I won&#39;t be getting into how to properly secure your server, best practices on where to place syslog files, or how to setup anything other than syslog-ng.  I leave that up to the reader.  This blog post just covers the basics of a centralized syslog-ng server. &lt;br /&gt;
&lt;h3&gt;
Installing and Configuring - Server Side&lt;/h3&gt;
&lt;b&gt;Installing syslog-ng&lt;/b&gt; isn&#39;t as hard as it looks especially if you&#39;re installing from packages.  For Debian: apt-get install syslog-ng, for Redhat: yum install syslog-ng.  For those of you that enjoy a good source install: http://www.balabit.com/downloads/files?path=/syslog-ng/sources/3.2.4/source/syslog-ng_3.2.4.tar.gz Download, unpackage, configure, make &amp;amp; make install.  Once you have syslog-ng installed, we can get to configuring the server side. &lt;br /&gt;
&lt;h4&gt;
Global Options&lt;/h4&gt;
First thing you need to do is locate your syslog-ng configuration file.  The default install (for Debian variants) is &#39;/etc/syslog-ng/syslog-ng.conf&#39;. Before editing any configuration files it is best practice to make a copy of the original configuration file prior to any changes. This is just in case something happens and you need to go back to the original configuration file. I tend to label my original configuration files with .orig (in this case: syslog-ng.conf.orig).  Now that you have made a copy of your configuration file, let&#39;s open it up with your editor of choice and get started. &lt;br /&gt;
long_hostnames(default: off ) - For this post I&#39;m using syslong-ng OSE version 3.1, and I actually can&#39;t find long_hostnames in the global configuration guide online.  I&#39;ll go with long hostnames as a default of off, being fully qualified domain names. &lt;br /&gt;
flush_lines(default: 0 ) - Sets the number of lines flushed to a destination at a time.  Setting to 0 sends messages as they are received, but keep in mind setting this number higher may increase message latency. This is useful on the client side of syslog-ng.  You would keep xx messages on the client before flushing to the destination so that you are not flooding the main syslog-ng server if you have alot of traffic coming from a server. &lt;br /&gt;
use_dns(default: no ) - Options: yes, no, persist_only.  This one is up to you and your environment.  If your syslog-ng is behind a firewall and not accessible to the outside of the world then &#39;yes&#39; would be appropriate.  If accessible to the outside of the world, set to &#39;no&#39; in order to stop possible DoS attacks.  I set mine to &#39;persist_only&#39; which checks my /etc/hosts file on my syslog-ng server to resolve hostnames, without relying on dns servers. &lt;br /&gt;
use_fqdn(default: no ) - Set the Fully Qualified Domain Name, your choice.  As a home network I only have one internal domain name.  So mine defaults to &#39;no&#39;. Setting to &#39;yes&#39; would have your clients hostname show up as: &#39;hostA.domain.com&#39; instead of &#39;hostA&#39; &lt;br /&gt;
owner(default: root ) - Owner of output files &lt;br /&gt;
group(default: adm ) - Group of output files &lt;br /&gt;
perm(default: 0640 ) - Permission of output files.  Defaults to 640 - Owner Read-Write, Group Read, Other none. &lt;br /&gt;
stats_freq(default: 0 ) - Time (in seconds) between two STATS (statistics messages about dropped log messages) Messages.  0 disables STATS messaging. &lt;br /&gt;
bad_hostname(default: ^gconfd$ ) - Regex containing hostnames that should not be handled as hostnames..in this case gconfd.  If you have more than a  handful of servers than I woudl recommend hostnames, unless of course you remember every ip address in your domain..if you, I applaud you. &lt;br /&gt;
Now that&#39;s it for the &#39;Default&#39; Global configuration options, but there are many more that you can use.  I also use the following: &lt;br /&gt;
normalize_hostnames(yes) - This converts all hostnames to lowercase.  Some of my devices have uppercase hostnames, and sometimes I get carried away with a new host and Uppercase the first letter of the hostname.  This will just lowercase all characters for easier readability. &lt;br /&gt;
keep_hostname(yes) - This keeps the hostname if running through a relay or an external server, so that when the host finally reaches the central server the hostname comes with it instead of relying on DNS (or /etc/hosts).  If you&#39;re using $HOST macro, this should be enabled. &lt;br /&gt;
In a bigger and more important environment (read: not soho) I would be setting stats_freq(600) and stats_level(2) in order to retrieve statistics messages from the server.  In most soho environments you might be gathering syslog data from 3-5 devices, at which point the odds of actually losing data are pretty slim.  In a larger enterprise environment of several hundred devices reporting to centeral syslog servers, enabling statistics allows the sys admin the ability to check on stats and possibly lost messages. &lt;br /&gt;
Your global configuration options (if you want it to mirror mine) would look like the following:  &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
options {(off); 
flush_lines(0); 
use_dns(persist_only);
use_fqdn(no); 
owner(&quot;root&quot;); 
group(&quot;adm&quot;); 
perm(0640); 
stats_freq(0);
bad_hostname(&quot;^gconfd$&quot;); 
normalize_hostnames(yes);
keep_hostname(yes); 
};&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;
Setting up Listener&lt;/h3&gt;
Setting up the listener for syslog-ng is actually only a few lines in the configuration file. A typical listener line looks like this: &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;source s_net { tcp((ip(127.0.0.1) port(1000) max-connections 5000)); udp (); };&lt;/code&gt;&lt;/pre&gt;
source s_net = Network listener &lt;br /&gt;
tcp(ip(127.0.0.1) = Listen on localhost.  If you have multiple NIC&#39;s, or want to specify an ip to bind this to, change 127.0.0.1 to the ip address of that specific network card &lt;br /&gt;
port (1000) = Listen to TCP port 1000 &lt;br /&gt;
max connections = Allow 5000 simultaneous connections (stops the dreaded &#39;run away server&#39; syndrome) &lt;br /&gt;
udp () = Some devices send their syslog messages via udp, so enable udp if you can&#39;t specify tcp and port number. &lt;br /&gt;
encrypt(allow) = This could be an entire blog post in itself.  Syslog-ng allows for encrypted (TLS, certificate based) syslog messages &lt;br /&gt;
Mine for example looks like this: &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
# Listen on TCP Port 1000 and UDP Port 514, Max 500 Connections source s_net {
tcp(port(1000) max-connections(500)); udp(););&lt;/code&gt;&lt;/pre&gt;
&lt;i&gt;Destination&lt;/i&gt; - What goes up must come down.  In this case what gets sent out must get put somewhere. Once a message is received from the syslog-ng server it&#39;s got to go somewhere.  Thus the destination section of the syslog-ng.conf file.  As you can see, the default covers your *nix destination for server messages on the local machine.  But what about incoming messages? Where do they go? Good question, by default they will send their syslog messages to the subsystem specified in syslog-ng.  For instance if it&#39;s a message that would be classified as an authentication message (/var/log/auth) then it will dump the message into the syslog-ng&#39;s /var/log/auth.log file with the appended information (hostname, date/time, etc). &lt;br /&gt;
If that&#39;s actually what you want to accomplish, a bunch of servers dumping to the same file as your main server, then I guess the task is complete.  But syslog-ng can do so much more than that.  If I do much more on server side configuration though I fear this will end up being a chapter in a book. Destinations can be flat files, pipes into other applications, SQL Databases (mysql, MS SQL, Oracle, etc), Remote Log servers, and Terminal Windows.  I&#39;ll be focusing on flat files and assume you are doing the same for now. &lt;br /&gt;
Now the way I setup my centralized syslog server might be different then the way you setup yours.  In my case I have a folder that has each hostname and the syslogs from the hostname are located in the folder.  For Example: /mount/syslog/macha, /mount/syslog/beag, and so on and so forth.  Logrotate takes care of zipping, removing (old files are backed up to a remote server just in case) and cleaning up log files. &lt;br /&gt;
My Destination directive looks like this:  &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
destination d_net_auth {
file(&quot;/var/log/syslog/remote/$HOSTNAME/auth.log&quot;); }; destination d_net_cron {
file(&quot;/var/log/syslog/remote/$HOSTNAME/cron.log&quot;); }; destination d_net_daemon
{ file(&quot;/var/log/syslog/remote/$HOSTNAME/daemon.log&quot;); }; destination
d_net_kern { file(&quot;/var/log/syslog/remote/$HOSTNAME/kern.log&quot;); }; destination
d_net_lpr { file(&quot;/var/log/syslog/remote/$HOSTNAME/lpr.log&quot;); }; destination
d_net_mail { file(&quot;/var/log/syslog/remote/$HOSTNAME/mail.log&quot;); }; destination
d_net_syslog { file(&quot;/var/log/syslog/remote/$HOSTNAME/syslog.log&quot;); };
destination d_net_user { file(&quot;/var/log/syslog/remote/$HOSTNAME/user.log&quot;); };
destination d_net_user { file(&quot;/var/log/syslog/remote/$HOSTNAME/uucp.log&quot;); };
destination d_net_debug { file(&quot;/var/log/syslog/remote/$HOSTNAME/debug&quot;); };
destination d_net_error { file(&quot;/var/log/syslog/remote/$HOSTNAME/error&quot;); };
destination d_net_messages { file(&quot;/var/log/syslog/remote/$HOSTNAME/messages&quot;);
}; destination d_net_mailinfo {
file(&quot;/var/log/syslog/remote/$HOSTNAME/mail/mail.info&quot;); }; destination
d_net_mailwarn { file(&quot;/var/log/syslog/remote/$HOSTNAME/mail/mail.warn&quot;); };
destination d_net_mailerr {
file(&quot;/var/log/syslog/remote/$HOSTNAME/mail/mail.err&quot;); }; &lt;/code&gt;&lt;/pre&gt;
Now in theory, the syslog-ng server is supposed to create the directories necessary for the files to drop into (as specified in the global policies) but sometimes I run into problems where the directories were not created properly and the errors in syslog-ng are reported in /var/log/errors.  To alleviate future pain and suffering I tend to create the host and log files as I go, anything I&#39;m missing will end up in /var/log/errors and I can create them later. &lt;br /&gt;
For those of you that are veteran syslog-ng users, you might wonder why I split my localhost destination and my remote(off-site clients) destinations when in theory I could have created a d_auth and had my regular localhost filter into a folder as well.  The reason behind that was that I wanted to separate my localhost syslog traffic from remote traffic - more configuration lines, but easier on me.  Also, I&#39;m not messing with the Linux subsystem when it&#39;s out looking for where to put regular log files. &lt;br /&gt;
&lt;i&gt;Filtering&lt;/i&gt; - The ability for Syslog-NG to filter its messages is what really seperates the &#39;men from the boys&#39; in the syslog battle.  The filtering is what really sets syslog-ng apart.  Granted I separate my hosts in folders defined in $HOST variable, but filtering is the real meat and potatoes. With filtering I can (and do) the following:  Filter Firewall logs looking for certain key words such as port scans, that get dumped into 1 folder, DDOS attacks that get filtered into another folder.  My voip adaptor sends syslog events and I filter based on those messages into individual files instead of a single file.  Filtering also allows you to specify multiple hosts to filter based on, and into multiple destinations.  Not only that, but you can use regular expressions in filtering. &lt;br /&gt;
Filtering expressions are created like: filter &lt;identifier&gt; { expression; }; &lt;/identifier&gt;&lt;br /&gt;
&lt;identifier&gt; is the name you give your filter.  &lt;expression&gt; contains the function, and boolean operators (and,or,not). &lt;/expression&gt;&lt;/identifier&gt;&lt;br /&gt;
An example for my firewall would be: &lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
filter firewall_ddos_filter { host(&quot;10.1.1.1&quot;) and match(&quot;Denial of Service&quot;
value(&quot;MESSAGE&quot;)); };&lt;/code&gt;&lt;/pre&gt;
This filter is called &#39;firewall_ddos_filter, it listens for incoming syslog messages from 10.1.1.1 with a message of &#39;Denial of Service&#39;.  To complete the filter you need a log statement: &lt;br /&gt;
&lt;code&gt; log firewall_ddos_filter { source(s_net); filter(firewall_ddos_filter); destination(d_net_firewall_ddos); }; &lt;/code&gt; &lt;br /&gt;
In my above destination I would add a destination for firewall DDOS Attacks, port scanning, etc.  This makes it easier to separate log files from servers/devices that do not use the standard *nix logging facilities, or easier for a system admin to filter logs coming out of a firewall (or many firewalls filtered into one log). &lt;br /&gt;
If you want to use multiple &#39;firewall&#39; hosts (as an example) do NOT use just add them in and create a log/filter rule using a boolean operator of &#39;and&#39;.  It will not work, and you beat your head on the desk for many hours to come. Instead, use the &#39;or&#39; boolean operator as such: &lt;br /&gt;
&lt;code&gt;filter firewall_ddos_filter { host(&quot;10.1.1.1&quot;) or host (&quot;10.1.1.2&quot;) and match(&quot;Denial of Service&quot; value(&quot;MESSAGE&quot;)((; };&lt;/code&gt; &lt;br /&gt;
My &#39;Default&#39; Filtering directive looks like this (Beautified for this post but they call fit in &#39;paragraph&#39; form as long as there is a semi-colon seperating each case): &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
filter f_dbg { level(debug); }; 
filter f_info { level(info); }; 
filter f_notice{ level(notice); }; 
filter f_warn { level(warn); }; 
filter f_err { level(err);  }; 
filter f_crit { level(crit .. emerg); };

filter f_debug { level(debug) and not facility(auth, authpriv, news, mail); };
filter f_error { level(err .. emerg) ; }; 
filter f_messages { level(info,notice,warn) and not facility(auth,authpriv,cron,daemon,mail,news);
};

filter f_auth { facility(auth, authpriv) and not filter(f_debug); }; 
filter f_cron { facility(cron) and not filter(f_debug); }; 
filter f_daemon { facility(daemon) and not filter(f_debug); }; 
filter f_kern { facility(kern) and not filter(f_debug); }; 
filter f_lpr { facility(lpr) and not filter(f_debug);}; 
filter f_local { facility(local0, local1, local3, local4, local5, local6, local7) and not filter(f_debug); }; 
filter f_mail { facility(mail) and not filter(f_debug); }; 
filter f_news { facility(news) and not filter(f_debug); };
filter f_syslog3 { not facility(auth, authpriv, mail) and not filter(f_debug); }; 
filter f_user { facility(user) and not filter(f_debug); }; filter f_uucp { facility(uucp) and not filter(f_debug); };

filter f_cnews { level(notice, err, crit) and facility(news); }; 
filter f_cother { level(debug, info, notice, warn) or facility(daemon, mail); };

filter f_ppp { facility(local2) and not filter(f_debug); }; 
filter f_console { level(warn .. emerg); };&lt;/code&gt;&lt;/pre&gt;
&lt;h4&gt;
Statistics&lt;/h4&gt;
There&#39;s nothing more I enjoy better than some good statistics.  When I run any server or service, be it at the house or at work I want to see what my server has processed over time.  Beginning with version 3.1, syslog-ng now has a syslog-ng-ctl stats utility which has greatly simplified grabbing log files. Prior to 3.1 to fetch statistic files you would run: echo STATS | nc -U /var/run/syslog-ng.ctl. &lt;br /&gt;
Because I&#39;m a regex geek I&#39;m not thrilled with the semi-colons in the output of syslog-ng-ctl stats thus I run: syslog-ng-ctl stats | sed &#39;s|;|\t|g&#39; to clean up the output. &lt;br /&gt;
What you have when you type the above command is 6 columns: SourceName, SourceID, SourceInstance, State, Type and Number. &lt;br /&gt;
SourceName - The name of the Source, for instance: destination, source, global, center &lt;br /&gt;
SourceID - The ID you gave the source (a previous example was firewall_ddos_filter, other examples would be: d_mail, d_net_user, etc) &lt;br /&gt;
SourceInstance - The destination of the Source Instance such as a filename, or the name of an application for a program source (sql) or destination &lt;br /&gt;
State: - Status of the object: a (Active - Currently active and receiving data), d (Dynamic - Not continuously available) o (Once active but stopped receiving messages such as an orphaned object) &lt;br /&gt;
Type - Type of Statistic such as: Processed: Number of Messages that reached their destination Dropped: Number of dropped messages Stored: Number of messaged stored in message Queue waiting to be sent to destination Suppressed (not sent): Number of Suppressed Messaged Stamp: Timestamp of Last message sent. These statistics are reset when the syslog-ng service is reset. &lt;br /&gt;
Number: Number of Messages &lt;br /&gt;
&lt;h4&gt;
Log Rotate, Log Rotate, LOG ROTATE&lt;/h4&gt;
Was that a clear enough message for you?  Rotating your message logs will save your butt in the log run.  Without rotating your logs your log disk space will just continue to grow and grow eventually filling up your hard drive.  Not only will log rotate save space, but it will make searching for log files on specific dates easier than pulling up a 50MB log file that you didn&#39;t set into log rotate and searching for a specific date.  Depending on your distro, logrotate is located in /etc/logrotate.conf.  As this isn&#39;t a blogpost on logrotate, I&#39;ll leave your configuration up to your imagination and give you an example on how I rotate my log files: &lt;br /&gt;
&lt;code&gt;/var/log/remote/*/ { rotate 5 weekly missingok create }&lt;/code&gt; &lt;br /&gt;
This goes through /var/log/remote/*/ every week and rotates my logs.  Logs are rotated for 1 month at which point I have a cronjob that tar-zips my old logs and they are moved off to a backup location where they are kept for another month before being rotated off.  In a business environment of course logs would be kept for however long management and legal dictates, but for a home environment I feel 2 months of logs is good enough to troubleshoot any problems that might have come up in that time. &lt;br /&gt;
&lt;h3&gt;
Syslog Client&lt;/h3&gt;
As each server and device is different in their setup, I won&#39;t get too in-depth into this.  Syslog communicates on UDP port 514, but as I stated earlier above, I also set the main syslog server to communicate on TCP port 1000 for other devices.  This allows the syslog-ng server to listen on two ports, 514 UDP for devices that can&#39;t change their ports, and TCP 1000 for servers that you can specify port numbers.  Why did I put TCP 1000 and not TCP 514?  Because Linux uses tcp 514 for rsh (remote shell) which would have caused some problems with my (and other&#39;s) host system.  If you plan on running syslog-ng on the outside of the world (and I would assume your setting authentication, and using TLS encryption) then setting a TCP port that&#39;s not typical would be your best bet. &lt;br /&gt;
1. For devices all you should need to do is tell the device to point to the hostname and make sure either UDP 514 or TCP 1000 is the destination &lt;br /&gt;
2. For rsyslog clients add the following line:  &lt;br /&gt;
&lt;pre&gt;For TCP:  *.* @@ipaddress:1000
For UDP:  *.* @ipaddress:514&lt;/pre&gt;
3. For syslog-ng clients add the following line: &lt;br /&gt;
&lt;pre&gt;*New syslog Protocol* syslog(host tranport [options];

*old syslog protocol* destination d_tcp { syslog(ip(&quot;remoteip&quot;)
transport(&quot;tcp&quot;) port(1000) localport(999)}; };

destination d_udp { syslog(ip(&quot;remoteip&quot;) transport(&quot;udp&quot;) port(514)
localport(999)}; };&lt;/pre&gt;
&lt;h3&gt;
Conclusion&lt;/h3&gt;
Well there you have it, a birds eye view of syslog-ng.  There is plenty more that you can learn about syslog-ng, as I just went into the basics of getting started.  From here you can get into macros, increased filtering, and TLS/Certificate based encryption of syslog messages (which I might cover in a later blog post).  By sending your syslog messages to a centralized syslog server, and backing up said syslog server, you can rest assured that your system messages are secure and easy to get to when you need them.   &lt;/div&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/4377522839373880788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/4377522839373880788?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/4377522839373880788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/4377522839373880788'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2011/11/centralized-syslog-server.html' title='Centralized Syslog Server'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-7222152049043820088</id><published>2014-12-09T14:19:00.000+05:30</published><updated>2015-03-11T19:43:06.887+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>Upgrade MongoDB Replica Set to 2.4</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;MongoDB&lt;/b&gt; is the leading NoSQL database,
 designed for how we build and run applications today. &lt;i&gt;MongoDB&lt;/i&gt; empowers 
organizations to be agile and scalable. It helps them enable new types 
of applications, improve customer experience, accelerate time to market 
and reduce total cost of ownership (TCO). &lt;i&gt;MongoDB&lt;/i&gt; is named from 
&quot;huMONGOus&quot; meaning &quot;extremely large&quot;.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
MongoDB is a general purpose, open-source database. MongoDB features:&lt;/div&gt;
&lt;ul style=&quot;text-align: justify;&quot;&gt;
&lt;li&gt;Document data model with dynamic schemas&lt;/li&gt;
&lt;li&gt;Full, flexible index support and rich queries&lt;/li&gt;
&lt;li&gt;Auto-Sharding for horizontal scalability&lt;/li&gt;
&lt;li&gt;Built-in replication for high availability&lt;/li&gt;
&lt;li&gt;Text search&lt;/li&gt;
&lt;li&gt;Advanced security&lt;/li&gt;
&lt;li&gt;Aggregation Framework and MapReduce&lt;/li&gt;
&lt;li&gt;Large media storage with GridFS&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;After having a overview of 
what &lt;b&gt;Mongodb&lt;/b&gt; is,Lets have look on how to &lt;b&gt;upgrade Mongodb&lt;/b&gt; to its latest 
version on Ubuntu.In the general case, the &lt;i&gt;upgrade&lt;/i&gt; from MongoDB 2.2 to 
2.4 is a
binary-compatible “drop-in” upgrade: shut down the &lt;tt class=&quot;xref mongodb mongodb-program docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mongod&lt;/span&gt;&lt;/tt&gt;
instances and replace them with &lt;tt class=&quot;xref mongodb mongodb-program docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mongod&lt;/span&gt;&lt;/tt&gt; instances running
2.4. &lt;b&gt;However&lt;/b&gt;, before you attempt any upgrade please familiarize
yourself with the Recommendations and Checklist &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
When upgrading, consider the following:&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;first&quot;&gt;
For all deployments using authentication, upgrade the
drivers (i.e. client libraries), before upgrading the
&lt;tt class=&quot;xref mongodb mongodb-program docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mongod&lt;/span&gt;&lt;/tt&gt; instance or instances.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;first&quot;&gt;
To upgrade to 2.4 sharded clusters &lt;i&gt;must&lt;/i&gt; upgrade following the
&lt;i&gt;meta-data upgrade procedure&lt;/i&gt;.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;If you’re using 2.2.0 and running with &lt;tt class=&quot;xref mongodb mongodb-setting docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;auth&lt;/span&gt;&lt;/tt&gt; enabled, you
will need to upgrade first to 2.2.1 and then upgrade to 2.4. See
&lt;i&gt;Rolling &lt;b&gt;Upgrade&lt;/b&gt; Limitation for 2.2.0 Deployments Running with auth Enabled&lt;/i&gt;.&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;first&quot; style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;If you have &lt;tt class=&quot;xref mongodb mongodb-data docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;system.users&lt;/span&gt;&lt;/tt&gt; documents
(i.e. for &lt;tt class=&quot;xref mongodb mongodb-setting docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;auth&lt;/span&gt;&lt;/tt&gt;) that you created before 2.4 you &lt;i&gt;must&lt;/i&gt;
ensure that there are no duplicate values for the &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;user&lt;/span&gt;&lt;/tt&gt; field in
the &lt;tt class=&quot;xref mongodb mongodb-data docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;system.users&lt;/span&gt;&lt;/tt&gt; collection in
&lt;i&gt;any&lt;/i&gt; database.  If you &lt;i&gt;do&lt;/i&gt; have documents with duplicate user
fields, you must remove them before upgrading.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;You can upgrade to 2.4 by performing a “rolling”
&lt;b&gt;upgrade&lt;/b&gt; of the set by upgrading the members individually while the
other members are available to minimize downtime. Use the following
procedure:&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&amp;nbsp;Upgrade the &lt;i class=&quot;xref std std-term&quot;&gt;secondary&lt;/i&gt; members of the set one at a time by
shutting down the &lt;tt class=&quot;xref mongodb mongodb-program docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mongod&lt;/span&gt;&lt;/tt&gt; and replacing the 2.2 binary
with the 2.4 binary.  After upgrading a &lt;tt class=&quot;xref mongodb mongodb-program docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mongod&lt;/span&gt;&lt;/tt&gt; instance,
wait for the member to recover to &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;SECONDARY&lt;/span&gt;&lt;/tt&gt; state
before upgrading the next instance.
To check the member’s state, issue &lt;tt class=&quot;xref mongodb mongodb-method docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;rs.status()&lt;/span&gt;&lt;/tt&gt; in the
&lt;tt class=&quot;xref mongodb mongodb-program docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mongo&lt;/span&gt;&lt;/tt&gt; shell.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;
&lt;li&gt;Login to one of the secondary in replica set and shutdown the instances.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&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; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;Akhil@akhil-3450:~# mongo&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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; MongoDB shell version: 2.2.3&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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; connecting to: test&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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; &amp;gt; use admin;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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;gt; db.shutdownServer()&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;
&lt;li&gt;&amp;nbsp;Now Install the Lastest package of Mongod &lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;&amp;nbsp;Issue the following command
to import the 10gen public GPG Key:&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&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; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;Create a &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;/etc/apt/sources.list.d/10gen.list&lt;/span&gt;&lt;/tt&gt; file and include the
following line for the 10gen repository.&lt;span class=&quot;k&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;span class=&quot;k&quot;&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;deb&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt; &lt;span class=&quot;s&quot;&gt;http://downloads-distro.mongodb.org/repo/ubuntu-upstart&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;dist&lt;/span&gt;&lt;/i&gt;&lt;/span&gt; &lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;kp&quot;&gt;10gen&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;&lt;i&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span class=&quot;kp&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;Now issue the following command to reload your repository:&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;sudo apt-get update&lt;/i&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;To install a specific release, append the version number
to the package name:&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;sudo apt-get install mongodb-10gen&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;2.X.X&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;ul&gt;&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;To install the latest stable version of
&lt;b&gt;MongoDB&lt;/b&gt;:&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;sudo apt-get install mongodb-10gen&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Once
 you are done with all the above steps successfully,restart the mongodb 
and wait for this instances to became secondary and in-sync with the 
master.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Now
 continue upgrading the remaining secondary members by repeating the 
above steps.After you are done with upgrading secondaries to the latest 
version It&#39;s time to upgrade the master to latest version as well.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;To upgrade master first we need to 
switch the master,So that one of the Secondary becomes master and the 
existing master becomes secondary.&lt;/span&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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; Akhil@akhil-3450:~# mongo&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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; MongoDB shell version: 2.2.3&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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; connecting to: test&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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;gt; use admin;&lt;/i&gt;&lt;/span&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&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;&amp;nbsp; &amp;gt; rs.StepDown()&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;Once the primary has stepped down and another member has assumed
&lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;PRIMARY&lt;/span&gt;&lt;/tt&gt; state, as observed in the output of
&lt;tt class=&quot;xref mongodb mongodb-method docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;rs.status()&lt;/span&gt;&lt;/tt&gt;,Follow the above mentioned steps for upgrading Secondaries in the replica set.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
After
 all the members of replica set are upgraded to required version,you can
 switch back the primary and you are done with upgrade of mongodb.&lt;/div&gt;
&lt;div&gt;
&lt;input name=&quot;IL_IN_TAG&quot; type=&quot;hidden&quot; value=&quot;2&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/7222152049043820088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/7222152049043820088?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/7222152049043820088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/7222152049043820088'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2013/04/upgrade-mongodb-replica-set-to-24.html' title='Upgrade MongoDB Replica Set to 2.4'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-7675850054699427481</id><published>2014-12-09T14:18:00.000+05:30</published><updated>2015-03-11T19:43:21.548+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Nginx"/><title type='text'>Page Caching with Nginx </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: white; color: #555555; line-height: 20px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;Nginx&lt;/b&gt; can also be used as a &lt;i&gt;cache&lt;/i&gt; server for serving cache static content.In this tutorial we will learn how to do &lt;b&gt;page&lt;/b&gt; &lt;b&gt;caching&lt;/b&gt; with &lt;i&gt;Nginx.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #555555; line-height: 20px;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #424037; line-height: 24px;&quot;&gt;To start, install the latest stable &lt;i&gt;Nginx&lt;/i&gt; avaliable at&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://wiki.nginx.org/NginxInstall&quot; style=&quot;color: #bc7134; line-height: 24px; text-decoration: none;&quot;&gt;http://wiki.nginx.org/NginxInstall&lt;/a&gt;&lt;span style=&quot;color: #424037; line-height: 24px;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 30px; margin-top: 30px;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;color: #424037;&quot;&gt;&lt;span style=&quot;line-height: 2em;&quot;&gt;Next edit your nginx.conf and add the &lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;color: #424037; line-height: 2em;&quot;&gt;proxy_cache_path directive&lt;/b&gt;&lt;span style=&quot;color: #424037;&quot;&gt;&lt;span style=&quot;line-height: 2em;&quot;&gt; to define a named cache storage. These are&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 32px;&quot;&gt;independent&lt;/span&gt;&lt;span style=&quot;line-height: 2em;&quot;&gt;&amp;nbsp;of servers and locations, and can be reused inside each later on.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #424037;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;...&lt;br /&gt;http {&lt;br /&gt;    ...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;    proxy_cache_path&lt;/b&gt; /var/cache/nginx keys_zone=anonymous:10m;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #424037; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;crayon-i&quot; style=&quot;border: 0px; color: black; height: inherit; line-height: 15px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre;&quot;&gt;&lt;b&gt;proxy_temp_path&lt;/b&gt;&lt;/span&gt;&lt;span class=&quot;crayon-h&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; height: inherit; line-height: 15px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;crayon-o&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; height: inherit; line-height: 15px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;crayon-i&quot; style=&quot;border: 0px; color: black; height: inherit; line-height: 15px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre;&quot;&gt;tmp&lt;/span&gt;&lt;span class=&quot;crayon-o&quot; style=&quot;border: 0px; color: rgb(0, 111, 224) !important; height: inherit; line-height: 15px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;crayon-i&quot; style=&quot;border: 0px; color: black; height: inherit; line-height: 15px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre;&quot;&gt;nginx&lt;/span&gt;&lt;span class=&quot;crayon-sy&quot; style=&quot;border: 0px; color: rgb(51, 51, 51) !important; height: inherit; line-height: 15px; margin: 0px; padding: 0px; vertical-align: baseline; white-space: pre;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; line-height: 20px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; vertical-align: baseline; white-space: normal;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;proxy_cache_path&lt;/i&gt; and&amp;nbsp;&amp;nbsp;&lt;i&gt;proxy_temp_path&lt;/i&gt; — are used to set default cache folder settings and temporary folder&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #424037; line-height: 2em; margin-bottom: 30px; margin-top: 30px; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Next create the directory for the cache:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;color: #424037; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;mkdir -p /var/cache/nginx&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #424037; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;color: #424037;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Once your are done with above mentioned steps,It time to make the changes in the nginx.conf.Add the following directives in the nginx conf for caching only get and head requests.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #424037;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;location / {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;if ($request_method !~ ^(GET|HEAD)$) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set $nocache 1;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_pass &amp;nbsp; &amp;nbsp;http://127.0.0.1:8080;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_cache browse;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_cache_key $request_uri;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_cache_valid &amp;nbsp;1440m;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_cache_use_stale updating;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_ignore_headers &quot;Set-Cookie&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_cache_bypass &amp;nbsp;$nocache;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_no_cache &amp;nbsp; &amp;nbsp; &amp;nbsp;$nocache;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_set_header Host $host;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_set_header X-Real-IP $remote_addr;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;add_header X-Cached $upstream_cache_status;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;log_format custom &#39;$remote_addr - $remote_user [$time_local] &amp;nbsp;&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&#39;&quot;$request&quot; $status $body_bytes_sent &#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;&#39;&quot;$http_referer&quot; &quot;$http_user_agent&quot; nocache:$upstream_cache_status&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;access_log &amp;nbsp;/var/log/nginx/microcache.log custom;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #424037;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; line-height: 20px; margin-bottom: 20px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;I only included what you need to add to your virtualhost configuration that you are already using, some more configuration can exist there&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: white; color: #424037; line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;proxy_pass&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 17.279998779296875px;&quot;&gt;sets the address of the proxied server and the URI to which location will be mapped&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; line-height: 20px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #424037; line-height: normal;&quot;&gt;proxy_cache&lt;/span&gt;&lt;span style=&quot;color: #424037; font-weight: normal; line-height: normal;&quot;&gt; &amp;nbsp;&lt;/span&gt;&lt;/b&gt;you pass here the name of your cache server&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; line-height: 20px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #424037; line-height: normal;&quot;&gt;proxy_cache_key&lt;/span&gt;&lt;span style=&quot;color: #424037; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;this is important, do not forget to set this variable else content may be passed to other vhosts and that’s not good.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; line-height: 20px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #424037; line-height: normal;&quot;&gt;proxy_cache_valid&lt;/span&gt;&lt;span style=&quot;color: #424037; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;set some validation on the cached files&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;ul style=&quot;border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #424037; line-height: normal;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;b&gt;proxy_cache_use_stale updating &amp;nbsp;&lt;/b&gt;t&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;ells Nginx when to serve a stale item from the proxy cache.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;background-color: white; border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #424037; line-height: normal;&quot;&gt;proxy_ignore_headers &amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;Prohibits the processing of the header lines from the proxy server&#39;s response.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; line-height: 20px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #424037; line-height: normal;&quot;&gt;proxy_cache_bypass&lt;/span&gt;&lt;span style=&quot;color: #424037; font-weight: normal; line-height: normal;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;set the bypass headers that will invalidate the cache and refresh it&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;background-color: white; border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif; line-height: 20px;&quot;&gt;&lt;span style=&quot;color: #424037; line-height: normal;&quot;&gt;&lt;b&gt;proxy_no_cache&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;Specifies in what cases a response will not be cached&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;ul style=&quot;background-color: white; border: 0px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 20px 20px; padding: 0px 0px 0px 25px; text-align: left; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif; line-height: 20px;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #424037; line-height: normal;&quot;&gt;proxy_set_header&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #424037; font-family: Arial, Helvetica, sans-serif;&quot;&gt;This directive allows to redefine and to add some request header lines which will be transferred to the proxied server.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;Make sure though you have created the &lt;i&gt;cache&lt;/i&gt; folders before you reload the configuration.Once you are done with all the above steps,You &lt;b&gt;caching&lt;/b&gt; has been setup successfully.To Test the &lt;i&gt;Caching&lt;/i&gt; you can simple check the headers with curl.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;A simple example with curl is given below:-&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;akhil@akhil-Dell-System-Vostro-3360:~# curl -I http://www.example.com/search/simple/CD&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;HTTP/1.1 200 OK&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Server: nginx&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Date: Tue, 18 Mar 2014 07:40:07 GMT&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Content-Type: text/html; charset=utf-8&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Content-Length: 0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Connection: keep-alive&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Location:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;http://www.example.com/search/simple/CD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Vary: Accept-Encoding&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;X-Cached: MISS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The X-cached filed shows whether the page is served from cache or not.if it&#39;s a MISS then the page is not served from the cache and if it&#39;s a HIT then the page has been served from the Cache.Requesting the same page again will change the status of X-Cached.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;akhil@akhil-Dell-System-Vostro-3360:~# curl -I http://www.example.com/search/simple/CD&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;HTTP/1.1 200 OK&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Server: nginx&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Date: Tue, 18 Mar 2014 07:40:07 GMT&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Content-Type: text/html; charset=utf-8&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Content-Length: 0&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Connection: keep-alive&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Location:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;http://www.example.com/search/simple/CD&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;Vary: Accept-Encoding&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 15px; line-height: 20px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #555555; font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 15px; line-height: 20px;&quot;&gt;X-Cached: HIT&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;And that’s all for today, hope it helps someone and will see you again.&lt;/span&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 20px;&quot;&gt;Don’t forget to comment below and subscribe!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #424037;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;color: #424037; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #424037; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #424037; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;color: #424037; text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;color: #424037; font-size: 12px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #424037; font-size: 12px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #424037; font-size: 12px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #424037; font-size: 12px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #424037; font-size: 12px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;color: #424037; font-size: 12px;&quot;&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/7675850054699427481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/7675850054699427481?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/7675850054699427481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/7675850054699427481'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2014/03/page-caching-with-nginx.html' title='Page Caching with Nginx '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-5521519331551711210</id><published>2014-12-09T14:17:00.000+05:30</published><updated>2015-02-23T19:23:31.185+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Security"/><title type='text'>Snort : Network Intrusion Detection System</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;snort&lt;/b&gt; really isn&#39;t hard to use,this article aims to make using &lt;i&gt;snort &lt;/i&gt;easier for new users&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;i&gt;snort &lt;/i&gt;can be configured to run in three modes:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;sniffer mode: which simply reads packets off the network&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;packet logger mode: which logs the packets to disk&amp;nbsp; &lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Network Intrusion Dectection system mode: The most complex and most configurable.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;This article will focus more on 
the installation and configuration of &lt;b&gt;snort&lt;/b&gt;,if you are looking for 
detail description of snort,I would request you to please go thru the 
documentation.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;u&gt;Prerequisites&amp;nbsp;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span class=&quot;system&quot;&gt;&amp;nbsp;Libpcap-1.2.1-dev&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;system&quot;&gt;&amp;nbsp;daq-0.6.2&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;system&quot;&gt;&amp;nbsp;libdnet-1.12&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;system&quot;&gt;&amp;nbsp;libpcap-1.2.1&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;system&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;system&quot;&gt;bison&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;system&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;system&quot;&gt;flex&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;system&quot;&gt;&amp;nbsp;PCRE&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;system&quot;&gt;&amp;nbsp;&lt;/span&gt;libc6-dev&lt;/li&gt;
&lt;li&gt;&amp;nbsp;g++&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;gcc&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span class=&quot;system&quot;&gt;&amp;nbsp;&lt;/span&gt;The 
first thing I like to do is grab all the dependant packages once your 
are done with the installation of all the dependencies we are ready for 
the next step.It&#39;s time to download tar package of snort and untar the 
packages.I would like to have all the tar packages at a single place,So 
I&#39;m going to use edge&#39;s structure here:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp; # cd /opt&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp; # mkdir snortpackage&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp; # cd /opt/snortpackage&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Let&#39;s get &lt;i&gt;snort&lt;/i&gt;. The latest version of snort at the time of writing is 2.9.2.1&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Open a web browser and navigate to &lt;a href=&quot;http://www.snort.org/dl/&quot; target=&quot;_blank&quot;&gt;http://www.snort.org/&lt;/a&gt;; download the most recent release in /opt/snortpackages.It&#39;s time to untar the Snort package&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;#tar -xzvf /opt/snortpackage/snort-2.9.2.1.tar.gz&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;It&#39;s time to get snort rules.Change directories into the new snort-2.9.2.1 folder&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
# cd /opt/snortpackages/snort-2.9.2.1&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Open a web browser and navigate to &lt;a href=&quot;http://www.snort.org/snort-rules/#registered&quot;&gt;http://www.snort.org/snort-rules/#registered&lt;/a&gt; &lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Scroll
 down to the &quot;Sourcefire VRT Certified Rules - The Official Snort Rule 
set (registered user release)&quot; section and download the snort rules.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;Untar the &lt;b&gt;Snort&lt;/b&gt; Rules&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;# tar -xzvf /opt/snortpackages/snortrules-snapshot-2911.tar.gz&lt;br /&gt;
&lt;br /&gt;
Now it&#39;s time start the installation of snort&lt;br /&gt;
&lt;br /&gt;
# cd&amp;nbsp; /opt/snortpackages/snort-2.9.2.1&lt;br /&gt;
&lt;br /&gt;
Here we will do the make/install&lt;br /&gt;
&lt;br /&gt;
# ./configure -enable-dynamicplugin --with-mysql&lt;br /&gt;
# make&lt;br /&gt;
# make install&lt;br /&gt;
&lt;br /&gt;
after the above commands are executed successfully.We need to create some folders in &lt;span class=&quot;system&quot;&gt;/etc&lt;/span&gt; for snort to function correctly and copy some files over to them&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;# mkdir /etc/snort /etc/snort/rules /var/log/snort&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Let&#39;s move some files.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;command&quot;&gt;
# cd /opt/snortpackages/snort-2.9.2.1/rules&lt;br /&gt;
# cp * /etc/snort/rules/&lt;/div&gt;
&lt;div class=&quot;command&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Let&#39;s get the &lt;span class=&quot;system&quot;&gt;/etc&lt;/span&gt; snort files also.&lt;br /&gt;
&lt;div class=&quot;command&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;command&quot;&gt;
# cd /opt/snortpackages/snort-2.9.2.1/etc&lt;br /&gt;
# cp * /etc/snort/&lt;/div&gt;
&lt;div class=&quot;command&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;command&quot;&gt;
We
 are done with the installation of snort and now we need to tweak some 
options to configure snort according to your requirement.&lt;/div&gt;
&lt;div class=&quot;command&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;command&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&amp;nbsp;We need to modify the snort.conf file to suite our needs.&lt;br /&gt;
Open &lt;span class=&quot;system&quot;&gt;/etc/snort/snort.conf&lt;/span&gt; with your favorite text editor. &lt;br /&gt;
&lt;div class=&quot;command&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;command&quot;&gt;
# vim /etc/snort/snort.conf&lt;/div&gt;
&lt;br /&gt;
Change &quot;&lt;b&gt;var HOME_NET any&lt;/b&gt;&quot; to &quot;&lt;b&gt;var HOME_NET 192.168.1.0/24&lt;/b&gt;&quot; (your home network may differ from 192.168.1.0)&lt;br /&gt;
&lt;br /&gt;
Change &quot;&lt;b&gt;var EXTERNAL_NET any&lt;/b&gt;&quot; to &quot;v&lt;b&gt;ar EXTERNAL_NET !$HOME_NET&lt;/b&gt;&quot; (this is stating everything except HOME_NET is external)&lt;br /&gt;
&lt;br /&gt;
Change &quot;&lt;b&gt;var RULE_PATE ../rules&lt;/b&gt;&quot; to &quot;&lt;b&gt;var RULE_PATH /etc/snort/rules&lt;/b&gt;&quot;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Once you are done with changes in the config,you can test those changes with following command:&lt;br /&gt;
# snort -c /etc/snort/snort.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;
We are done. Congrats!!!&lt;/h3&gt;
To start Snort in the terminal type:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;command&quot;&gt;
&amp;nbsp;# snort -c /etc/snort/snort.conf -A fast -D&lt;/div&gt;
&lt;br /&gt;
This starts snort&amp;nbsp; in a daemon mode.&lt;br /&gt;
&lt;br /&gt;
To make sure it is running you can check with the following command:&lt;br /&gt;
&lt;div class=&quot;command&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;command&quot;&gt;
# ps aux | grep snort&lt;/div&gt;
&lt;br /&gt;
If it&#39;s running you will see an entry similar to &lt;span class=&quot;system&quot;&gt;snort -c /etc/snort/snort.conf -A fast -D &lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/5521519331551711210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/5521519331551711210?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/5521519331551711210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/5521519331551711210'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2012/02/snort-network-intrusion-detection.html' title='Snort : Network Intrusion Detection System'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-1976166931716796595</id><published>2011-10-18T15:31:00.000+05:30</published><updated>2015-02-23T19:23:41.310+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>Creating Jailkit With Chroot Sftp </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
A few  months back I was given an assignment to create some &lt;b&gt;chroot jails&lt;/b&gt; for a  group of customers so that they could securely upload files with &lt;b&gt;sftp&lt;/b&gt;.  The requirement was that the customers needed to be able to upload file,  but in a secure and private way. Customer One should not be able to see  Customer Two&#39;s files, for example. And neither customer should be able  to browse the filesystem of the server. I was also asked to define a  process whereby our support staff could add new jails as needed.&lt;br /&gt;
I&#39;ve used the &lt;i&gt;chroot&lt;/i&gt; command many times, it&#39;s a very handy way of  fixing servers that can&#39;t otherwise be fixed --- like when no one can  remember the root password on some box that no one has touched for  years. Simply boot the server with a live CD (Knoppix is a personal  favorite, I have it loaded on a usb key that I carry with me  everywhere), mount the main drive and then issue a command along the  lines of:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
chroot /mnt/hda1&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;&lt;/code&gt;
Suddenly it&#39;s like you are root on the local filesystem and not on  the live CD. I can then change passwords, run programs, and generally  get myself into trouble. :-)&lt;br /&gt;
&lt;br /&gt;
You can do a lot more with chroot than simply use it as part of your  system recovery toolkit though. &lt;b&gt;Chroot&lt;/b&gt; is _very_ useful on a day-to-day  basis for jailing applications and users that should (or need) to be  isolated from the rest of the system (and from each other).&lt;br /&gt;
&lt;br /&gt;
To create a &lt;b&gt;jail&lt;/b&gt; you create a folder that has a replication of the  directory structure of a normal Linux box. The difference is that you  only copy in the bare minimum of what you need into the directory  structure. The way you find out what libraries and files an application  needs is by using ldd or strace. If I can get away with it, I prefer  using ldd since its output is much more readable, but there are times  when both are needed to track down elusive libraries.&lt;br /&gt;
As an example, lets say I want to have a &lt;i&gt;jail&lt;/i&gt; that contains the bash  shell, just that and nothing more. It&#39;s a stupid example, but very easy.&lt;br /&gt;
I first need to create the directory that will house the jail:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ mkdir /opt/jail&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
It&#39;s just an empty directory now, so we now need to add some apps to  it. Bash lives in the /bin directory so I first recreate the /bin  directory and then copy the bash binary into it like so:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ mkdir /opt/jail/bin&lt;br /&gt;
Akhil@groundzero:~$ cp /bin/bash /opt/jail/bin/&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
Then I run ldd on bash to find out what libraries it uses like so:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ ldd /bin/bash&lt;br /&gt;
linux-gate.so.1 =&amp;gt; (0xffffe000)&lt;br /&gt;
libncurses.so.5 =&amp;gt; /lib/libncurses.so.5 (0xb7ec2000)&lt;br /&gt;
libdl.so.2 =&amp;gt; /lib/tls/i686/cmov/libdl.so.2 (0xb7ebe000)&lt;br /&gt;
libc.so.6 =&amp;gt; /lib/tls/i686/cmov/libc.so.6 (0xb7d7d000)&lt;br /&gt;
/lib/ld-linux.so.2 (0xb7f1f000)&lt;br /&gt;
Akhil@groundzero:~$&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
I can ignore the linux-gate.so.1 file, it&#39;s a virtual object created  by the Linux Kernel, but I need the others so I create the directories  and then copy them over:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ mkdir -p /opt/jail/lib/tls/i686/cmov&lt;br /&gt;
Akhil@groundzero:~$ cp /lib/libncurses.so.5 /opt/jail/lib/&lt;br /&gt;
Akhil@groundzero:~$ cp /lib/tls/i686/cmov/libdl.so.2 /opt/jail/lib/tls/i686/cmov/&lt;br /&gt;
Akhil@groundzero:~$ cp /lib/tls/i686/cmov/libc.so.6 /opt/jail/lib/tls/i686/cmov/&lt;br /&gt;
Akhil@groundzero:~$ cp /lib/ld-linux.so.2 /opt/jail/lib/&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
Now I can test the jail like so:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ sudo chroot /opt/jail /bin/bash&lt;br /&gt;
bash-3.2#&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
The presence of the bash-3.2# prompt tells me I was successful.&lt;br /&gt;
This is a pretty useless &lt;b&gt;jail&lt;/b&gt; right now, with only bash. I can &#39;cd&#39;  and &#39;pwd&#39; and &#39;exit&#39; and do other bash built-in commands, but I can&#39;t  &#39;ls&#39; or &#39;less&#39; or &#39;cp&#39; or &#39;mv&#39; or anything else that is external to  bash. Adding more binaries is the same as adding bash: copy the binary  in and then ldd it to find its libraries and then copy them in. A lot of  programs use the exact same libraries, so often you&#39;ll find that  copying the binary in to an existing jail is all you need to do since  the libraries will already be there.&lt;br /&gt;
Once I copy in a few binaries this could turn into a very nice  sandbox. However, I had some specific needs when I started out building  custom jails, and there are a few gotchas that the above jail doesn&#39;t  come close to meeting:&lt;br /&gt;
1. Users assigned to a jail need to be automatically chrooted into their jail when they login&lt;br /&gt;
&lt;br /&gt;
2. There should be no shell access --- we don&#39;t want them to be able to ssh in, they should only be able to use &lt;i&gt;sftp&lt;/i&gt; and &lt;i&gt;scp&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
3. This needs to be done yesterday, and it needs to be repeatable.&lt;br /&gt;
&lt;br /&gt;
Number one is easy enough in theory, just create a false shell whose  sole purpose is to &lt;b&gt;chroot &lt;/b&gt;you into your jail. Yeah. Easy. Oh, and do it  securely with no shortcuts that might open up security holes. Yup,  definitely easy.&lt;br /&gt;
Number two actually is easy in theory and practice, just copy in the  &lt;b&gt;sftp &lt;/b&gt;and scp binaries and leave out the ssh binary and any shell  binaries.&lt;br /&gt;
Number three is the real kicker. I needed a quick, repeatable  process. Especially since once things are up and running the plan was to  turn everything over to the support group so that they could create new  jails as needed.&lt;br /&gt;
So what did I do? I went looking for something someone had already built and I found Jailkit.&lt;br /&gt;
There are other tools out there for automatically creating jails, so  please do some searching and explore all options when choosing your own  solution. Some of the things I like about jailkit are:&lt;br /&gt;
1. It has many pre-configured collections that you can mix and match to build the perfect jail. I call them jail-sets.&lt;br /&gt;
2. If none of the existing jail-sets meets your needs you can customize them or create new ones.&lt;br /&gt;
3. Creating multiple jails is easy and each jail can have multiple users  assigned to it --- users can&#39;t belong to more than one jail though, but  that&#39;s a good thing IMO.&lt;br /&gt;
4. Adding users to jails is very easy, almost to the point of &quot;that&#39;s all there is to it?&quot;&lt;br /&gt;
5. The fake shell that Jailkit uses to &lt;b&gt;chroot &lt;/b&gt;users when they log in  checks for potential security risks every time it is run and will  disconnect the user if it notices anything bad (like the jail directory  being setuid root, for example).&lt;br /&gt;
6. The Jailkit website has clear, easy to follow directions that walk  you through several potential jail setups and it has a good  troubleshooting section to help you when things don&#39;t work for some  reason or other.&lt;br /&gt;
Here&#39;s what I did to create the jails on my server:&lt;br /&gt;
As far as the actual server is concerned, I didn&#39;t do much to it  apart from installing a base ubuntu-server OS with the ssh-server  option. Oh, and I also installed the build-essential meta-package so  that I could compile and install Jailkit.&lt;br /&gt;
After downloading the tarball from the Jailkit website, Jailkit is installed from source like so:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ wget &lt;a href=&quot;http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz&quot; title=&quot;http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz&quot;&gt;http://olivier.sessink.nl/jailkit/jailkit-2.5.tar.gz&lt;/a&gt;&lt;br /&gt;
Akhil@groundzero:~$ tar -zxvf jailkit-2.5.tar.gz&lt;br /&gt;
Akhil@groundzero:~$ cd jailkit-2.5&lt;br /&gt;
Akhil@groundzero:~/jailkit-2.5$ ./configure&lt;br /&gt;
Akhil@groundzero:~/jailkit-2.5$ make&lt;br /&gt;
Akhil@groundzero:~/jailkit-2.5$ sudo make install&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
The whole unpack-compile-install process is really quick. By default,  Jailkit installs its binaries into /usr/sbin/ and the configuration and  template files into /etc/jailkit/.&lt;br /&gt;
Once installed, creating jails is easy. As I said above, Jailkit  comes with several default jail-sets. These are defined in  /etc/jailkit/jk_init.ini and they include things like scp, &lt;b&gt;sftp&lt;/b&gt;, apache,  basicshell, and so on. As far as learning about what jail-sets are  available and what each jail-set includes, the best thing I can say is  to look through the /etc/jailkit/jk_init.ini file and familiarize  yourself with them. This file is also where you can define your own  custom sets.&lt;br /&gt;
You create a jail using the jk_init script and specifying where you  want the jail to be located and what jail-sets you want included in the  jail. The example below is what I use to create a jail that has sftp and  scp functionality:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ sudo jk_init -v /path/to/jail sftp scp jk_lsh&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
The jk_lsh jail-set provides a special shell that limits the binaries  it will execute via a config file. That way, even if a user uploads  their own binary file, they won&#39;t be able to execute it.&lt;br /&gt;
The jail at this point (assuming nothing went wrong) is technically a  valid jail, but there aren&#39;t any users in it yet and because this jail  has no &#39;shell&#39;, it is pretty useless to try and &lt;b&gt;chroot&lt;/b&gt; into it manually  to test it. The next order of business therefore is to create some users  and add them to the jail. Once a user has been created and added to a  jail using the method below, they will always be put in that shell  whenever they log in. So you absolutely need to create special jail-only  users. Do not put regular users into jails!&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ sudo groupadd companyname&lt;br /&gt;
Akhil@groundzero:~$ sudo useradd -g companyname -m username&lt;br /&gt;
Akhil@groundzero:~$ sudo passwd username&lt;br /&gt;
Akhil@groundzero:~$ sudo jk_jailuser -m -j /path/to/jail username&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
The reason I create a group is because I am creating jails per client  company on this server and it made sense to group (no pun intended) all  the users that way. I also threw in the passwd command into the example  above since the useradd command (on Ubuntu at least) doesn&#39;t set a  password by default. Things may be different on your Linux distro of  choice.&lt;br /&gt;
The jk_jailuser utility, when run as in the example above, changes  the shell of an existing user to jk_chrootsh in the /etc/passwd file and  it changes the home directory to /path/to/jail/./home/username. It also  adds the user to a stripped down passwd file located at  /path/to/jail/etc/passwd and adds the user&#39;s groups to a stripped down  group file located at /path/to/jail/etc/group.&lt;br /&gt;
If you want to edit the two passwd files yourself you can do so. Just  change the user&#39;s line in /etc/passwd to something resembling this:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
username:x:1010:1010::/path/to/jail/./home/username:/usr/sbin/jk_chrootsh&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
and change the user&#39;s line in /path/to/jail/etc/passwd to something resembling this:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
username:x:1010:1010::/home/username:/usr/sbin/jk_lsh&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
(I&#39;m afraid of messing things up if I do it manually, so I use the jk_jailuser utility whenever possible.)&lt;br /&gt;
Now we need to allow the user to execute the scp and sftp programs.  Edit the /path/to/jail/etc/jailkit/jk_lsh.ini file and add in some lines  like so:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
[group companyname]&lt;br /&gt;
paths= /usr/bin, /usr/lib/&lt;br /&gt;
executables= /usr/bin/scp, /usr/lib/sftp-server, /usr/lib/openssh/sftp-server, /usr/libexec/sftp-server&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
That&#39;s all there is to it. I now have a fully functioning jail and I  can test it by connecting to the server using &lt;b&gt;sftp &lt;/b&gt;or scp. When I &lt;i&gt;sftp&lt;/i&gt;  in and look around, I only see the directories below the jail directory,  exactly the behavior I wanted.&lt;br /&gt;
Should you find later on that the jail needs to have some other  binary in it, Jailkit also includes a handy copy command that you can  use to copy additional files into jails like so:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
Akhil@groundzero:~$ sudo jk_cp /path/to/jail /path/to/command&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
Very simple, and it handles all of the locating of dependencies,  libraries, and whatnot. The only gripe I have about the jk_cp command is  that you have to specify jk_cp &lt;destination&gt; &lt;/destination&gt;&lt;br /&gt;
&lt;source&gt;&lt;/source&gt; instead of doing it the way the cp command works, which is cp &lt;source&gt;&lt;/source&gt; &lt;destination&gt;.&lt;/destination&gt; On occasion I have run into issues where Jailkit doesn&#39;t copy over  everything properly, or it simply misses some libraries. In those cases I  had to experiment with copying over additional libraries. Rather than  reinvent the wheel, I&#39;ll just point you to the Jailkit website, which  has a very nice page on troubleshooting jails. (it&#39;s in the links)&lt;br /&gt;
Once I had jailkit working on my jail server and I had a repeatable  process for adding users, my next step was to create two _very_ simple  shell scripts for creating jails and creating jailed users. These  scripts are used by our support staff, who have limited sudo access to  run only these scripts as root along with the passwd command (so that  they can change jailed users&#39; passwords, if need be).&lt;br /&gt;
The two scripts are called &lt;a href=&quot;http://www.linuxjournal.com/files/linuxjournal.com/code/mkjail&quot;&gt;mkjail&lt;/a&gt; and &lt;a href=&quot;http://www.linuxjournal.com/files/linuxjournal.com/code/jailuser&quot;&gt;jailuser&lt;/a&gt;.  They&#39;re not all that pretty, and they could be considered dangerous if  used by the wrong people. But for internal use by a select group of  specifically authorized and trained people, they work fine.&lt;br /&gt;
With the server set up and the scripts in place and the staff trained  my job was done. The server is under constant use and new jails are  created whenever they are needed with no intervention needed on my part.  Of course, the minute the project was completed I was immediately  assigned three more . . . but that&#39;s what&#39;s great about working in  technology, right? It&#39;s never boring, that&#39;s for sure. :-)&lt;br /&gt;
Admittedly, creating an &lt;b&gt;sftp&lt;/b&gt; jail is probably not something that  everyone will need to do, but jailkit has found its way into my sysadmin  bag of tricks. Whenever I need to isolate a user or a process into a  sandbox, and a Xen virtual machine is way too much overkill, the first  thing I reach for is jailkit.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/1976166931716796595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/1976166931716796595?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/1976166931716796595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/1976166931716796595'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2011/10/creating-chroot-sftp-jails-jailkit.html' title='Creating Jailkit With Chroot Sftp '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-8386746794398193865</id><published>2010-11-13T05:54:00.000+05:30</published><updated>2015-02-23T19:23:58.745+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Security"/><title type='text'>Enhance Security with Port Knocking</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In the field of IT systems security, concept of” &lt;b&gt;port knocking&lt;/b&gt;” is  relatively new. However with the passage of time, it is getting popular  day by day among system and security administrators.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Port knocking&lt;/i&gt; is a method of externally opening ports on a firewall  by generating a connection attempt on a set of pre-specified closed  ports. Once a correct sequence of connection attempts is received, the  firewall rules are dynamically modified to allow the host which sent the  connection attempts to connect over specified port (s).&lt;br /&gt;
The primary purpose of &lt;b&gt;port knocking&lt;/b&gt; is to prevent an attacker from  scanning a system for potentially exploitable services by doing a port  scan. Until the correct knock sequence is used, the protected ports will  appear closed– so attackers won’t be able to conduct an attack on those  ports.&lt;br /&gt;
&lt;br /&gt;
More specifically,&lt;i&gt; Port knocking&lt;/i&gt; works on the concept that users  wishing to attach to a network service must initiate a predetermined  sequence of port connections or send a unique string of bytes before the  remote client can connect to the eventual service.&lt;br /&gt;
For example, suppose that a remote client wants to connect to an FTP  server. The administrator configures the port-knocking requirements  ahead of time, requiring that connecting remote clients first connect to  ports 2000, 4000, and 7107 before connecting to the final destination  port, 21 on FTP server.&lt;br /&gt;
The administrator tells all legitimate clients about the correct”  combination” of knocks to port knocking daemon running on FTP server and  hence when they want to connect to FTP service, they simply send these  knocks to the server and then start using FTP service.&lt;br /&gt;
The question arises, what is the basic advantage of the additional  step of sending knocks and then connecting to FTP service? The answer is  simple: The FTP service is not always running on the server, it will be  started only when the correct port knocks are sent to server, and it  will shut down once it receives another predefined sequence of port  knocks.&lt;br /&gt;
The potential backdoor to business-critical services is only to be  opened for a short time, when it’s required. Once the service is no  longer needed, it is closed again, mitigating the vulnerability to  attack.&lt;br /&gt;
One of the primary advantages to using &lt;b&gt;port knocking&lt;/b&gt; is that it is  platform, service, and application agnostic. Any operating system with  the correct client and server software can take advantage of port  knocking. If you need help finding a tool, you can find a list of port  knocking implementations &lt;a class=&quot;story_link&quot; href=&quot;http://www.portknocking.org/view/implementations&quot;&gt;here&lt;/a&gt;. The site lists clients and daemons for pretty much any platform you’d care to use.&lt;br /&gt;
I selected &lt;code&gt;knockd&lt;/code&gt;, which is considered to be one of the  most famous and robust implementation of port knocking mechanism for  &lt;b&gt;Linux &lt;/b&gt;and UNIX. In this article, I will cover setting up port knocking  on a Red Hat Enterprise Linux (RHEL) server, using &lt;code&gt;knockd&lt;/code&gt;, a  popular open source port knocking tool. Most importantly, I will try to  extend the idea of port knocking beyond simple firewall modifications  to more complex system administration tasks.&lt;br /&gt;
Note that &lt;code&gt;knockd&lt;/code&gt; is available for other systems as well,  so if you’re using Debian, Ubuntu, Mac OS X, or even Windows, you  should be able to follow along with most of the advice herein to secure  your system with &lt;code&gt;knockd&lt;/code&gt;.&lt;br /&gt;
&lt;div style=&quot;background-color: #ccccff; border: 1px solid rgb(102, 102, 102); padding: 15px;&quot;&gt;
&lt;div class=&quot;subhead&quot;&gt;
Flaws with Port Knocking&lt;/div&gt;
Before we begin, I should note that port knocking has some  detractors. Some IT security professionals say that a predefined and  fixed sequence of knocks is, in and of itself, a security flaw. To  overcome this, some port knocker daemons have been modified to generate a  random sequence of knocks, which can be used by clients to issue  requests.&lt;br /&gt;
It’s also important to remember that port knocking is just one  component of a successful security strategy. You’ll need to deploy other  security mechanisms so that if an attacker is successful in providing  the correct sequence, they are still faced with authentication and other  barricades before connecting to a service.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;subhead&quot;&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;
Port Knocking: A Basic Overview&lt;/h4&gt;
&lt;/div&gt;
To start, let’s take a look at the basic functionality of a port knock server. &lt;code&gt;knockd&lt;/code&gt; is a daemon that runs on a server, passively listening to network traffic. You configure &lt;code&gt;knockd&lt;/code&gt;  with a sequence of ports, the length of time between connection  attempts, the type of packet that will be sent, and the command to be  run when the correct sequence is given.&lt;br /&gt;
Once &lt;code&gt;knockd&lt;/code&gt;” sees” a port sequence it has been  configured to recognize, it will run the command it’s been configured to  run. Note that you can use TCP, UDP, or a combination of both. Usually  the action will be an &lt;code&gt;iptables&lt;/code&gt; command, but not always.&lt;br /&gt;
So, to implement port knocking, we start with the installation of &lt;code&gt;knockd&lt;/code&gt; and run it in the background. (Or foreground, if you wish, but we will usually want to run it in the background.)&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;
Securing A MySQL Database Remote Connections with Port Knocks&lt;/div&gt;
Now that we know what port knocking is, let’s put it to use. In this  scenario, I have a business-critical MySQL-based application running on  RHEL. On occasion, I need to allow remote connections from a DBA who is  performing basic database maintenance activities.&lt;br /&gt;
However, for security reasons, we don’t want to allow remote database  connections at all times or from every IP address. Because we wanted  tighter control over remote connections, we decided to explore port  knocking so that remote connections would be open for a limited time  only and from a specific IP address.&lt;br /&gt;
Let’s start with the firewall rule, just in case you’re not already a  firewall wizard. To append a rule to one of the” chains,” you’ll use  the &lt;code&gt;-A&lt;/code&gt; option. The &lt;code&gt;-I&lt;/code&gt; parameter tells &lt;code&gt;iptables&lt;/code&gt;  to insert the rule into a specific position in the chain. This is  important because you may want specific rules to be processed first.  Make sure you give it a rule number.&lt;br /&gt;
Now, to secure MySQL connections to my database server  (172.16.2.183), I blocked network traffic on server’s MySQL port  (default 3306) coming from all addresses. For this purpose, I executed  following command:&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;iptables -A INPUT -p tcp -s 0/0 -d 172.16.2.183 --dport 3306 -j REJECT&lt;/pre&gt;
You don’t want to be reissuing the command every time you restart the  machine, so you’ll want to save the rule permanently, using &lt;code&gt;iptables-save&lt;/code&gt;.&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;
Getting and configuring &lt;code&gt;knockd&lt;/code&gt;&lt;/div&gt;
The next step is to install the &lt;code&gt;knockd&lt;/code&gt; server on the system you want to use it on. You can get the RPM from the RHEL network.&lt;br /&gt;
After installing &lt;code&gt;knockd&lt;/code&gt; it’s time to customize your configuration. The &lt;code&gt;knockd&lt;/code&gt; config file is found at &lt;em&gt;/etc/knockd.conf&lt;/em&gt;&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;[options]
  logfile=/var/log/knockd.log
[DB2clientopen]
        sequence    = 7050,8050,9050
        seq_timeout = 10
        tcpflags    = syn
        command     = /sbin/iptables -I INPUT 1 -p tcp -s 192.168.2.201 
       --sport 1024:65535 -d 172.16.2.183 --dport 3306 -m state 
 --state NEW,ESTABLISHED -j ACCEPT
[DB2clientclose]
        sequence    = 9050,8050,7000
        seq_timeout = 10
        tcpflags    = syn
        command     = /sbin/iptables -D INPUT 1&lt;/pre&gt;
Let’s take a look at the format. The syntax is very simple, you give &lt;code&gt;knockd&lt;/code&gt; option / value pairs, separated by &lt;code&gt;=&lt;/code&gt;,  and port numbers are separated by commas in the order you want the”  knocks” to be received. Don’t forget to specify a logfile, you may need  to review it later!&lt;br /&gt;
It should be obvious from the &lt;em&gt;knockd.conf&lt;/em&gt; example that it has two types of actions that can be executed by the daemon, depending on the sequence it receives.&lt;br /&gt;
First, if it receives syn packets to port 7050, 8050, and 9050, &lt;code&gt;knockd&lt;/code&gt; will insert the first iptables rule as rule number 1 in the &lt;code&gt;INPUT&lt;/code&gt; chain. This will open the MySQL database port, so a remote connection can be made from &lt;em&gt;192.168.2.201&lt;/em&gt;–  and only that IP address. It’s a good idea to specify the IP address  whenever possible, so that if an attacker tries to connect while the  port is open, they will still be denied.&lt;br /&gt;
On the other hand, if the server receives a knock sequence of 9050,  8050, and 7000, it will delete the rule so that all remote database  connections will be closed down again.&lt;br /&gt;
I made sure that MySQL would know what address my DBA would be coming from, so I added my PC’s IP address to the server’s &lt;em&gt;/etc/hosts&lt;/em&gt; file and created a test database called &lt;em&gt;test1&lt;/em&gt;, and created a user called test1 as well with the appropriate grant privileges.&lt;br /&gt;
First, fire up the MySQL client with &lt;code&gt;mysql-u root-p test1&lt;/code&gt; and enter the following commands:&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;mysql&amp;gt; create user test;
mysql&amp;gt; grant all privileges on *.* to &#39;test@dbawin&#39; 
identified by &#39;polanipass&#39; with grant option;&lt;/pre&gt;
Next, restart &lt;code&gt;knockd&lt;/code&gt; as a daemon.&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;/usr/sbin/knockd -d&lt;/pre&gt;
It should be noted that, by default, &lt;code&gt;knockd&lt;/code&gt; will start listening on &lt;em&gt;eth0&lt;/em&gt;. If you need it to run on a different interface, you can configure it to do so using the &lt;code&gt;-i&lt;/code&gt; option. For instance, to start &lt;code&gt;knockd&lt;/code&gt; as a daemon on &lt;em&gt;wlan0&lt;/em&gt; you’d use &lt;code&gt;/usr/sbin/knockd-i wlan0&lt;/code&gt;. If you’re always going to run &lt;code&gt;knockd&lt;/code&gt; on a different interface, you can add this to your &lt;em&gt;knockd.conf&lt;/em&gt;:&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;[options]
 interface = wlan0&lt;/pre&gt;
&lt;div class=&quot;subhead&quot;&gt;
Knock, Knock, It’s Me!&lt;/div&gt;
Now, &lt;code&gt;knockd&lt;/code&gt; isn’t very useful without a client, so let’s get a client to talk to &lt;code&gt;knockd&lt;/code&gt;.  I chose a Windows-based Cygwin client, but you can find a client for  just about any client OS at the implementations page mentioned earlier.&lt;br /&gt;
To use the Windows client, you open a DOS prompt and run something similar to this command:&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;C:KNOCKKNOCKWINDOWS&amp;gt;knock.exe 172.16.2.183 9050 8050 7000&lt;/pre&gt;
Of course, the IP address and ports will vary. Once the” knock” is  issued, the knock daemon will execute the iptables command listed under  the &lt;code&gt;[DB2clientopen]&lt;/code&gt; section of knockd.conf and add the rule in INPUT chain to allow DB2 PC to connect to database running on server.&lt;br /&gt;
Now you can connect to your MySQL database with your favorite client  and do whatever you need to do. Once you’re finished, it’s time to close  the door.&lt;br /&gt;
If you send the close knock sequence, in this case a &lt;code&gt;syn&lt;/code&gt;  packet sent to ports 9050, 8050, and then 7000, the MySQL port will be  closed and all connections will be terminated. If you try to reconnect  to the server, your MySQL client will time out and you’ll eventually see  an access error. This will be the case until you send the proper  sequence to re-open the port.&lt;br /&gt;
So, now you see how you can use port knocking to increase security  for remote MySQL connections. Of course, this is really database (and  application) independent, so you can use port knocking to secure any  database or application you want to connect to remotely.&lt;br /&gt;
If it’s too much hassle to open and close the connection each time  you need to connect to the database, it might make more sense to set it  up so that the port is open during specific hours. For example, if your  database guru works 10 a.m. to 7 p.m., you could set up a script to open  the port a bit before 10 a.m., and close the port a bit after 7 p.m.&lt;br /&gt;
This is not quite as secure, but it does mean that the port won’t be  open 24/7, so it may block some automated and casual (i.e., not  targeted) attacks. Also, if the port knocking is coupled with only  allowing connections from specific IP addresses or IP address ranges,  then you have an additional layer of security.&lt;br /&gt;
Performing Other System Administration Tasks with Knocks&lt;br /&gt;
But wait, that’s not all! Port knocking can be used to do more than set iptables rules. After configuring &lt;code&gt;knockd&lt;/code&gt; to play doorkeeper, I decided to explore the feature and see if I could use it to make my life easier in other ways.&lt;br /&gt;
I decided I wanted to be able to restart my system remotely, just by” knocking” in the right sequence. I also configured &lt;code&gt;knockd&lt;/code&gt;  to kick off my backups to tape, so I don’t even need to log in to start  the backup– just send a quick series of packets, and my data is safe  another day.&lt;br /&gt;
Here’s my &lt;em&gt;/etc/knockd.conf&lt;/em&gt;:&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;[options]
  logfile=/var/log/knockd.log
[systemreboot]
        sequence    = 7050,8050,9050
        seq_timeout = 10
        tcpflags    = syn
        command     = /usr/bin/reboot
[systembackup]
        sequence    = 9050,8050,7000
        seq_timeout = 10
        tcpflags    = syn
        command     =  /usr/bin/tar -cf  /dev/rmt0 /home/root/&lt;/pre&gt;
You can take this a lot farther, and set it up so that other admins  (say, the junior admin who’s reliable but still a bit green) can perform  complex actions just by using a knock client, or even just by running a  shell script that sends the packets.&lt;br /&gt;
&lt;div class=&quot;subhead&quot;&gt;
Summary&lt;/div&gt;
Port knocking is a very useful tool for systems security. It is  because of its usefulness and robustness that the number of  implementations, and users, are growing rapidly. If you can open a door  into a closed black box for to perform some system administration tasks,  even without requiring a login to the system, it can be very ideal for  many environments.&lt;br /&gt;
Finally, it is always a good idea to further secure your systems by  changing the knock sequences frequently, or by using random seed  generators to create random port knocks.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/8386746794398193865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/8386746794398193865?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/8386746794398193865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/8386746794398193865'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2010/11/enhance-security-with-port-knocking.html' title='Enhance Security with Port Knocking'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-3236732633634840306</id><published>2010-04-12T14:54:00.000+05:30</published><updated>2015-02-23T19:24:06.846+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>Svn backup</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;Whatever your reason for migrating repository history, using the svnadmin dump and svnadmin load subcommands is straightforward.svnadmin dump will output a range of repository revisions that are formatted using Subversion&#39;s custom filesystem dump format. The dump format is printed to the standard output stream, while informative messages are printed to the standard error stream. This allows you to redirect the output stream to a file while watching the status output in your terminal window. For example:&lt;br /&gt;&lt;strong&gt;$ svnlook youngest myrepos&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;26&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;$ svnadmin dump myrepos &amp;gt; dumpfile&lt;br /&gt;* Dumped revision 0.&lt;br /&gt;* Dumped revision 1.&lt;br /&gt;* Dumped revision 2.&lt;br /&gt;…*&lt;br /&gt;Dumped revision 25.&lt;br /&gt;* Dumped revision 26.&lt;/strong&gt;At the end of the process, you will have a single file (dumpfile in the previous example) that contains all the data stored in your repository in the requested range of revisions. Note that svnadmin dump is reading revision trees from the repository just like any other “reader” process would (e.g., svn checkout), so it&#39;s safe to run this command at any time.The other subcommand in the pair, svnadmin load, parses the standard input stream as a Subversion repository dump file and effectively&lt;br /&gt;replays those dumped revisions into the target repository for that operation. It also gives informative feedback, this time&lt;br /&gt;using the standard output stream:&lt;br /&gt;&lt;strong&gt;$ svnadmin load newrepos &amp;lt;&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&lt;/strong&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;strong&gt;------- Committed new rev 25 (loaded from original rev 25) &amp;gt;&amp;gt;&amp;gt;&lt;br /&gt;&amp;lt;&amp;lt;&amp;lt;&amp;gt;&lt;/strong&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;strong&gt;------- Committed new rev 26 (loaded from original rev 26) &amp;gt;&amp;gt;&amp;gt;&lt;/strong&gt;The result of a load is new revisions added to a repository—the same thing you get by making commits against that repository from a regular Subversion client. Just as in a commit, you can use hook programs to perform actions before and after each of the commits made during a load process. By passing the --use-pre-commit-hook and --use-post-commit-hook options to svnadmin load, you can instruct Subversion to execute the pre-commit and post-commit hook programs, respectively, for each&lt;br /&gt;loaded revision. You might use these, for example, to ensure that loaded revisions pass through the same validation steps that regular commits pass through. Of course, you should use these options with care—if your post-commit hook sends emails to a mailing list for each new commit, you might not want to spew hundreds or thousands of commit emails in rapid succession at that list! You can read more about the use of hook scripts in the section called “Implementing Repository Hooks”.&lt;br /&gt;Note that because svnadmin uses standard input and output streams for the repository dump and load processes, people who are feeling especially saucy can try things such as this (perhaps even using different versions of svnadmin on each side of the pipe):&lt;br /&gt;&lt;strong&gt;$ svnadmin create newrepos&lt;br /&gt;$ svnadmin dump oldrepos svnadmin load newrepos&lt;/strong&gt;By default, the dump file will be quite large—much larger than the repository itself. That&#39;s because by default every version of every file is expressed as a full text in the dump file. This is the fastest and simplest behavior, and it&#39;s nice if you&#39;re piping the dump data directly into some other process (such as a compression program, filtering program, or loading process). But if you&#39;re creating a dump file for longer-term storage, you&#39;ll likely want to save disk space by using the --deltas option. With this option, successive revisions of files will be output as compressed, binary differences—just as file revisions are stored in a repository.&lt;br /&gt;This option is slower, but it results in a dump file much closer in size to the original repository.&lt;br /&gt;We mentioned previously that svnadmin dump outputs a range of revisions. Use the --revision (-r) option to specify a single revision, or a range of revisions, to dump. If you omit this option, all the existing repository revisions will be dumped.&lt;br /&gt;&lt;strong&gt;$ svnadmin dump myrepos -r 23 &amp;gt; rev-23.dumpfile&lt;br /&gt;$ svnadmin dump myrepos -r 100:200 &amp;gt; revs-100-200.dumpfile&lt;/strong&gt;&lt;br /&gt;As Subversion dumps each new revision, it outputs only enough information to allow a future loader to re-create that revision based on the previous one. In other words, for any given revision in the dump file, only the items that were changed in that revision will appear in the dump. The only exception to this rule is the first revision that is dumped with the current svnadmin dump command.&lt;br /&gt;By default, Subversion will not express the first dumped revision as merely differences to be applied to the previous revision. For one thing, there is no previous revision in the dump file! And second, Subversion cannot know the state of the repository into which the dump data will be loaded (if it ever is). To ensure that the output of each execution of svnadmin dump is self-sufficient,&lt;br /&gt;the first dumped revision is, by default, a full representation of every directory, file, and property in that revision of the repository. However, you can change this default behavior. If you add the &lt;strong&gt;--incrementa&lt;/strong&gt;l option when you dump your repository, svnadmin will compare the first dumped revision against the previous revision in the repository—the same way it treats every other revision that gets dumped. It will then output the first revision exactly as it does the rest of the revisions in the dump range—mentioning only the changes that occurred in that revision. The benefit of this is that you can create several small dump files that can be loaded in succession, instead of one large one, like so:$ svnadmin dump myrepos -r 0:1000 &amp;gt; dumpfile1&lt;br /&gt;&lt;strong&gt;$ svnadmin dump myrepos -r 1001:2000 --incremental &amp;gt; dumpfile2&lt;br /&gt;$ svnadmin dump myrepos -r 2001:3000 --incremental &amp;gt; dumpfile3&lt;/strong&gt;&lt;br /&gt;These dump files could be loaded into a new repository with the following command sequence:&lt;br /&gt;&lt;strong&gt;$ svnadmin load newrepos &amp;lt;&amp;gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;strong&gt;$ svnadmin load newrepos &amp;lt;&amp;gt;&lt;/strong&gt;Another neat trick you can perform with this --incremental option involves appending to an existing dump file a new range of dumped revisions. For example, you might have a post-commit hook that simply appends the repository dump of the single revision that triggered the hook. Or you might have a script that runs nightly to append dump file data for all the revisions that were added to the repository since the last time the script ran. Used like this, svnadmin dump can be one way to back up changes to your repository over time in case of a system crash or some other catastrophic event.&lt;br /&gt;The dump format can also be used to merge the contents of several different repositories into a single repository. By using the --parent-dir option of svnadmin load, you can specify a new virtual root directory for the load process. That means if you have dump files for three repositories—say calc-dumpfile, cal-dumpfile, and ss-dumpfile—you can first create a new repository to hold them all:&lt;strong&gt;&lt;br /&gt;$ svnadmin create /var/svn/projects&lt;br /&gt;$&lt;/strong&gt;Then, make new directories in the repository that will encapsulate the contents of each of the three previous repositories:&lt;br /&gt;&lt;strong&gt;$ svn mkdir -m &quot;Initial project roots&quot; \&lt;br /&gt;file:///var/svn/projects/calc \&lt;br /&gt;file:///var/svn/projects/calendar \&lt;br /&gt;file:///var/svn/projects/spreadsheet&lt;br /&gt;Committed revision 1.&lt;br /&gt;$&lt;/strong&gt;Lastly, load the individual dump files into their respective locations in the new repository:&lt;br /&gt;&lt;strong&gt;$ svnadmin load /var/svn/projects --parent-dir calc &amp;lt;&amp;gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;strong&gt; …$ svnadmin load /var/svn/projects --parent-dir calendar &amp;lt;&amp;gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&lt;strong&gt;…$ svnadmin load /var/svn/projects --parent-dir spreadsheet &amp;lt;&amp;gt; We&#39;ll mention one final way to use the Subversion repository dump format—conversion from a different storage mechanism or version control system altogether. Because the dump file format is, for the most part, human-readable, it should be relatively easy to describe generic sets of changes—each of which should be treated as a new revision—using this file format. In fact, the cvs2svn utility (see the section called “Converting a Repository from CVS to Subversion”) uses the dump format to represent the contents of a CVS repository so that those contents can be copied into a Subversion repository.&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;justify&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/3236732633634840306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/3236732633634840306?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/3236732633634840306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/3236732633634840306'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2010/04/svn-backup.html' title='Svn backup'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8033252853889217827.post-6391885054554562423</id><published>2010-03-27T10:16:00.000+05:30</published><updated>2015-03-11T19:43:34.382+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Security"/><title type='text'>Five Steps to Secure Your Linux System</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
There’s no excuse to run insecure systems on your network. Your data’s integrity (and your job) depend on your ability to keep those systems running correctly and securely for your co-workers and customers. Shown here are five simple ways to make your systems less vulnerable to compromise.&lt;br /&gt;
&lt;ul style=&quot;font-weight: bold;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;Account Locking&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
Account locking for multiple failed tries puts extra burden on the system administrators but it also puts some responsibility on the user to remember his passwords. Additionally, locking allows the administrator to track the accounts that have potential hack attempts against them and to notify those users to use very strong passwords.&lt;br /&gt;
Typically, a system will drop your connection after three unsuccessful attempts to login but you may reconnect and try again. By allowing an infinite number of failed attempts, you’re compromising your system’s security. Smart system administrators can take the following measure to stop this threat: Account lockout after a set number of attempts. My preference is to set that limit to three.&lt;br /&gt;
Add the following lines to your system’s &lt;i&gt;/etc/pam.d/system-auth&lt;/i&gt; file.&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;auth    required   /lib/security/$ISA/pam_tally.so onerr=fail no_magic_root&lt;/span&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;account required   /lib/security/$ISA/pam_tally.so per_user deny=3 no_magic_root reset&lt;/span&gt;&lt;/pre&gt;
Your distribution might not include the system-auth file but instead uses the &lt;i&gt;/etc/pam.d/login&lt;/i&gt; file for these entries.&lt;br /&gt;
&lt;ul style=&quot;font-weight: bold;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;Cron Restriction&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
On multiuser systems, you should restrict &lt;i&gt;cron&lt;/i&gt; and &lt;i&gt;at&lt;/i&gt; to root only. If other users must have access to scheduling, add them individually to the &lt;i&gt;/etc/cron.allow&lt;/i&gt; and &lt;i&gt;/etc/at.allow&lt;/i&gt; files. If you choose to create these files and add user accounts into them, you also need to create &lt;i&gt;/etc/cron.deny&lt;/i&gt; and &lt;i&gt;/etc/at.deny&lt;/i&gt; files. You can leave them empty but they need to exist. Don’t create an empty &lt;i&gt;/etc/cron.deny&lt;/i&gt; unless you add entries to the /etc/cron.allow because doing so allows global access to cron. Same goes for &lt;i&gt;at&lt;/i&gt;.&lt;br /&gt;
To use the &lt;i&gt;allow&lt;/i&gt; files, create them in the &lt;i&gt;/etc&lt;/i&gt; directory and add one user per line to the file. The root user should have an entry in both &lt;i&gt;allow&lt;/i&gt; files. Doing this restricts &lt;i&gt;cron&lt;/i&gt; to the root user only.&lt;br /&gt;
As the system administrator, you can allow or deny &lt;i&gt;cron&lt;/i&gt; and &lt;i&gt;at&lt;/i&gt; usage based upon the user’s knowledge and responsibility levels.&lt;br /&gt;
&lt;ul style=&quot;font-weight: bold;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;Deny, Deny, Deny&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
“Deny everything” sounds eerily Presidential doesn’t it? But for system security and certain political indiscretions, it’s the right answer. System security experts recommend denying all services for all hosts using an all encompassing deny rule in the &lt;i&gt;/etc/hosts.deny&lt;/i&gt; file. The following simple entry (ALL: ALL) gives you the security blanket you need.&lt;br /&gt;
&lt;pre class=&quot;WonB&quot;&gt;#
# hosts.deny    This file describes the names of the hosts which are
#               *not* allowed to use the local INET services, as decided
#               by the &#39;/usr/sbin/tcpd&#39; server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!

ALL: ALL&lt;/pre&gt;
Edit the &lt;i&gt;/etc/hosts.allow&lt;/i&gt; file and insert your network addresses (192.168.1., for example) where you and your users connect from before you logout or you’ll have to login via the console to correct the problem. Insert entries similar to the following to allow access for an entire network, single host or domain. You can add as many exceptions as you need. The &lt;i&gt;/etc/hosts.allow&lt;/i&gt; file takes precedence over the &lt;i&gt;/etc/hosts.deny&lt;/i&gt; to process your exceptions.&lt;br /&gt;
&lt;ul style=&quot;font-weight: bold;&quot;&gt;
&lt;li&gt;Deny SSH by Root&lt;/li&gt;
&lt;/ul&gt;
Removing the root user’s ability to SSH provides indirect system security. Logging in as root to a system removes your ability to see who ran privileged commands on your systems. All users should SSH to a system using their standard user accounts and then issue &lt;i&gt;su&lt;/i&gt; or &lt;i&gt;sudo&lt;/i&gt; commands for proper tracking via system logs.&lt;br /&gt;
Open the &lt;i&gt;/etc/ssh/sshd_config&lt;/i&gt; file with your favorite editor and change &lt;i&gt;PermitRootLogin yes&lt;/i&gt; to &lt;i&gt;PermitRootLogin no&lt;/i&gt; and restart the ssh service to accept the change.&lt;br /&gt;
&lt;ul style=&quot;font-weight: bold;&quot;&gt;
&lt;li&gt;Change the Default Port&lt;/li&gt;
&lt;/ul&gt;
While changing the default SSH port (22) will have limited effectiveness in a full port sweep, it will thwart those who focus on specific or traditional service ports. Some sources suggest changing the default port to a number greater than 1024, for example: 2022, 9922 or something more random, such as 2345. If you’re going to use this method as one of your strategies, I suggest that you use a port that doesn’t include the number 22.&lt;br /&gt;
Edit your &lt;i&gt;/etc/ssh/sshd_config&lt;/i&gt; and change the “Port” parameter to your preferred port number. Uncomment the Port line too. Restart the sshd service when you’re finished and inform your users of the change. Update any applicable firewall rules to reflect the change too.&lt;br /&gt;
System security is important and is a constant battle. You have to maintain patch levels, updates and constantly plug newly discovered security holes in system services. As long as there are black hat wearing malcontents lurking the Net looking for victims, you’ll have a job keeping those wannabe perpetrators at bay.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://akhilmudgal.blogspot.com/feeds/6391885054554562423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/8033252853889217827/6391885054554562423?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/6391885054554562423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8033252853889217827/posts/default/6391885054554562423'/><link rel='alternate' type='text/html' href='http://akhilmudgal.blogspot.com/2010/03/first-blog.html' title='Five Steps to Secure Your Linux System'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/02701991801407742931</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>