<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hack Admin &#187; Linux</title>
	<atom:link href="http://www.hackadmin.com/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hackadmin.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 21:31:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Implement htaccess with MySQL</title>
		<link>http://www.hackadmin.com/2010/03/16/how-to-implement-htaccess-with-mysql/</link>
		<comments>http://www.hackadmin.com/2010/03/16/how-to-implement-htaccess-with-mysql/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 21:31:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=275</guid>
		<description><![CDATA[Article by Aashish
# yum install httpd* mysql* -y
*** Install Module Needed for Authentication from MySQL databases. ***
# yum install mod_auth_mysql -y
*** Create a database which contains a table holding the username and passwd ***
#mysql -u root -p
password:
mysql> create database httpd;
mysql> use httpd;
mysql> create user &#8216;apache&#8217;@'localhost&#8217; identified by &#8216;apache&#8217;;
mysql> create table users( user_name char(30) NOT NULL, [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p># yum install httpd* mysql* -y</p>
<p>*** Install Module Needed for Authentication from MySQL databases. ***</p>
<p># yum install mod_auth_mysql -y</p>
<p>*** Create a database which contains a table holding the username and passwd ***</p>
<p>#mysql -u root -p<br />
password:</p>
<p>mysql> create database httpd;<br />
mysql> use httpd;<br />
mysql> create user &#8216;apache&#8217;@'localhost&#8217; identified by &#8216;apache&#8217;;<br />
mysql> create table users( user_name char(30) NOT NULL, user_passwd char(30), user_group char(30)<br />
NOT NULL, PRIMARY KEY(user_name));<br />
mysql> grant all privileges on *.* to &#8216;apache&#8217;@'localhost&#8217; with GRANT option;<br />
mysql> INSERT INTO users VALUES (&#8217;testuser&#8217;, ENCRYPT(&#8217;testpass&#8217;), &#8216;user&#8217;);<br />
mysql> INSERT INTO users VALUES (&#8217;admin&#8217;, ENCRYPT(&#8217;testpass&#8217;), &#8216;group&#8217;);<br />
mysql> quit</p>
<p># service mysqld restart</p>
<p># vim /etc/httpd/conf/httpd.conf</p>
<p><Directory /var/www/html><br />
AuthName &#8220;MySQL group authenticated zone&#8221;<br />
AuthType Basic<br />
AuthMYSQLEnable on<br />
AuthMySQLUser apache<br />
AuthMySQLPassword apache<br />
AuthMySQLDB httpd<br />
AuthMySQLUserTable users<br />
AuthMySQLNameField user_name<br />
AuthMySQLPasswordField user_passwd<br />
AuthMySQLGroupField user_group<br />
require group admin /or/ require valid-user<br />
</Directory></p>
<p># service httpd restart</p>
<p>enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/03/16/how-to-implement-htaccess-with-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL Server Replication with ssl</title>
		<link>http://www.hackadmin.com/2010/03/04/mysql-server-replication-with-ssl/</link>
		<comments>http://www.hackadmin.com/2010/03/04/mysql-server-replication-with-ssl/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 19:14:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Bushan]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Replication]]></category>
		<category><![CDATA[slave]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=262</guid>
		<description><![CDATA[TYPES OF MYSQL REPLICATION

    *

      Statement-based Replication
    *

      Row-based Replication
    *

      Mixed

      To change the type of Replication modify my.cnf configuration file and change]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		A:link { so-language: zxx } --><span>via </span><a href="http://www.hackadmin.com/bashan/"><span>Bhushan</span></a></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">TYPES OF MYSQL REPLICATION</span></span></span></span></p>
<ul>
<li>
<p style="margin-bottom: 0in;">Statement-based Replication</p>
</li>
<li>
<p style="margin-bottom: 0in;">Row-based Replication</p>
</li>
<li>
<p style="margin-bottom: 0in;">Mixed</p>
<p style="margin-bottom: 0in;">To change the type of Replication 	modify my.cnf configuration file and change</p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">binlog_format=<span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">mixed</span> | row | statement</span></span></span></p>
</li>
</ul>
<p><span id="more-262"></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW VARIABLES LIKE &#8216;binlog_format&#8217;; </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| Variable_name | Value | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| binlog_format | MIXED </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ </strong></span></span></span></p>
<ul>
<p style="margin-bottom: 0in;">
</ul>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">Processes/Threads inside MySQL that are responsible for replication</span></span></span></span></p>
<ul>
<li>
<p style="margin-bottom: 0in;">MASTER	-	Binlog Dump Thread</p>
</li>
<li>
<p style="margin-bottom: 0in;">SLAVE	-	I/O Thread</p>
<ul>
<li>
<ul>
<li>
<ul>
<li>
<ul>
<li>
<ul>
<p style="margin-bottom: 0in;">SQL Thread</p>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;"> Statements useful to check the status of these threads as replication goes:</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW PROCESSLIST\G</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW MASTER STATUS\G</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW SLAVE STATUS\G</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">Directories and File Locations</span></span></span></span></p>
<ul>
<li>
<p style="margin-bottom: 0in;">Datadir &#8211; /var/lib/mysql</p>
</li>
<li>
<p style="margin-bottom: 0in;">General Log dir. 	-	/var/log</p>
</li>
<li>
<p style="margin-bottom: 0in;">Bin Log dir.		-	/var/log/mysql</p>
</li>
<li>
<p style="margin-bottom: 0in;">Configuration 	file	-	/etc/mysql/my.cnf</p>
</li>
<li>
<p style="margin-bottom: 0in;">SSL Certificates		-	/etc/mysql/ssl</p>
</li>
<li>
<p style="margin-bottom: 0in;">Relay Log 	file		-	/var/lib/mysql/slavehost-relay-bin.NNNNNN</p>
</li>
<li>
<p style="margin-bottom: 0in;">Status Files			-	master.info, 	relay-log.info</p>
</li>
</ul>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">Note:</span></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">-	All <span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">modification/updates to data should be done on Master only, and not on any Slave. Slave should be used for queries</span>.</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;" align="center"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: medium;">setup replication</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">MySQL MASTER = 192.168.1.100:3306</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">MySQL SLAVE  = 192.168.1.111:3306</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">MASTER host</span></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> mkdir /etc/mysql/ssl</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> cd /etc/mysql/ssl/</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> rm -rf *</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Create CA certificate</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl genrsa 2048 &gt; ca-key.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl req -new -x509 -nodes -days 1000 -key ca-key.pem &gt; ca-cert.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Create server certificate</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl req -newkey rsa:2048 -days 1000 -nodes -keyout server-key.pem &gt; server-req.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl x509 -req -in server-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 &gt; server-cert.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Copy ca-cert file to MySQL clients &amp; slaves</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> scp ca-cert.pem <a href="mailto:root@192.168.1.111">root@</a>slave-host-IP:/etc/mysql/ssl/</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Modify configuration file</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> vi /etc/mysql/my.cnf</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Enable Binary logging in Mixed  format. And specify a Unique Server ID of Master</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">[mysqld]</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">log-bin			=	/var/log/mysql/mysql-bin </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">binlog_format	=	mixed </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">server-id      	= 	1</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">ssl-key			=	/etc/mysql/ssl/server-key.pem</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">ssl-cert		=	/etc/mysql/ssl/server-cert.pem</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">ssl-ca			=	/etc/mysql/ssl/ca-cert.pem</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Test SSL connectivity using MySQL-Client</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"> /etc/init.d/mysql restart</span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"> mysql --ssl-ca=/etc/mysql/ssl/ca-cert.pem -u root -p</span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW VARIABLES LIKE &#8216;%ssl%&#8217;; </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| Variable_name | Value                          | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| have_openssl  | <span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">YES</span> | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| have_ssl      | <span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">YES </span> | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_ca        | /etc/mysql/ssl/ca-cert.pem     | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_capath    |                                | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_cert      | /etc/mysql/ssl/server-cert.pem | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_cipher    |                                | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| ssl_key       | /etc/mysql/ssl/server-key.pem  | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW STATUS LIKE &#8216;Ssl_cipher&#8217;; </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| Variable_name | Value              | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| Ssl_cipher    | DHE-RSA-AES256-SHA | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+ </strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;">confirms that SSL is supported &amp; enabled on MASTER</span></span></code></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Create mysql user on master that has the privileges to do replication.</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql -u root -p</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO replssl@&#8217;<span style="font-family: Courier New,monospace;"><span style="font-size: small;">%&#8217; IDENTIFIED BY &#8216;replipass&#8217;</span></span><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"> </span></span></code><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">REQUIRE SSL</span></span></span></code><span style="font-family: Courier New,monospace;"><span style="font-size: small;">;</span></span></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;">If user already exists</span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">mysql&gt; </span></span></span><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">GRANT USAGE ON *.* </span></span></span></code><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;">TO 'repl'@'%' REQUIRE SSL;</span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; FLUSH PRIVILEGES;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; SHOW GRANTS FOR repl;</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Find the location where Master is writing now</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; show master status; </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;+ </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>| File         | Position |Binlog_Do_DB |Binlog_Ignore_DB </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>|mysql-bin.000004|   7705 |             | </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>+&#8212;&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">They are:   mysql-bin.000004,    7705</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Take snapshot of Mysql data on Master and then scp it to slave.</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; FLUSH TABLES WITH <span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">READ LOCK</span>;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> tar czvf ~/mysql-snapshot.tar.gz /var/lib/mysql</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt; UNLOCK TABLES;</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Copy snapshot to the slave</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> scp mysql-snapshot.tar/gz user@slave-IP:~</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.08in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: small;"><span style="text-decoration: underline;">SLAVE side</span></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">To configure this host as a replication slave, you can choose between </span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">two methods : </span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">-	Use the CHANGE MASTER TO command </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"> <span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>CHANGE MASTER TO MASTER_HOST=&lt;host&gt;, MASTER_PORT=&lt;port&gt;, </strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"> <span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>MASTER_USER=&lt;user&gt;, MASTER_PASSWORD=&lt;password&gt; &#8230;&#8230;</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">OR </span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">-	Set the variables in /etc/mysql/my.cnf.</span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Create client certificate</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl req -newkey rsa:2048 -days 1000</span></span></span></code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> </span></span></span><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">-nodes -keyout client-key.pem &gt; client-req.pem</span></span></span></code></strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">root@sage:~#</span></span></span></span></span></span></code><strong><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> openssl x509 -req -in client-req.pem -days 1000</span></span></span></code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> </span></span></span><code><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">-CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 &gt; client-cert.pem</span></span></span></code></strong></span></span></span></p>
<ol>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> vi /etc/mysql/my.cnf</strong></span></span></span></p>
</ol>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">[mysqld]</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">server-id       = 	2 </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">master-host     =   192.168.1.100</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">master-user     =   repl</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">master-password =   replipass</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">master-port     =  	3306</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">log-bin			=	/var/log/mysql/mysql-bin </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">binlog_format	=	mixed </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">tmpdir         	= 	/tmp/</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">[client]</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">ssl-ca=/etc/mysql/ssl/ca-cert.pem</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;">#ssl-key=/etc/mysql/ssl/client-key.pem </span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; font-weight: normal; page-break-before: auto;"><span style="color: #c90016;"><span style="font-family: Liberation Mono,monospace;"><span style="font-size: small;"><span style="background: transparent none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">#ssl-cert=/etc/mysql/ssl/client-cert.pem </span> </span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p><span style="color: #6b4794;">“<span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>If the account has no special SSL requirements or was created using a </em></span></span></span><code><a href="http://dev.mysql.com/doc/refman/5.0/en/grant.html"><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>GRANT</em></span></span></span></a></code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> statement that includes the </em></span></span></span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">REQUIRE SSL</span></em></span></span></span></code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> option, a client can connect securely by using just the </em></span></span></span><code><a href="http://dev.mysql.com/doc/refman/5.0/en/ssl-options.html#option_general_ssl-ca"><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>--ssl-ca</em></span></span></span></a></code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> option: </em></span></span></span></p>
<pre style="margin-bottom: 0.2in;"><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>shell&gt; </em></span></span></span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>mysql --ssl-ca=</em></span></span></span></code><em><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>cacert.pem</em></span></span></span></em></pre>
<p><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>To require that a client certificate also be specified, create the account using the </em></span></span></span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">REQUIRE X509</span></em></span></span></span></code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> option. Then the client must also specify the proper client key and certificate files or the server will reject the connection: </em></span></span></span></p>
<pre><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>shell&gt; </em></span></span></span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>mysql --ssl-ca=</em></span></span></span></code><em><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>cacert.pem</em></span></span></span></em><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> \</em></span></span></span></code>
<span style="color: #6b4794;">       </span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>--ssl-cert=</em></span></span></span></code><em><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>client-cert.pem</em></span></span></span></em><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em> \</em></span></span></span></code>
<span style="color: #6b4794;">       </span><code><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><em>--ssl-key=client-key.pem</em></span></span></span></code></pre>
<p><span style="font-family: Century Schoolbook L,serif;"><em><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;">In other words, the options are similar to those used for the server. </span></span></span><span style="color: #6b4794;"><span style="font-family: URW Palladio L;"><span style="font-size: small;"><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">Note that the Certificate Authority certificate has to be the same. “ </span></span></span></span><span style="background: #ffffcc none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"> </span></em></span></p>
<p>Ref:     <a href="http://dev.mysql.com/doc/refman/5.0/en/secure-using-ssl.html">http://dev.mysql.com/doc/refman/5.0/en/secure-using-ssl.html</a></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> /etc/init.d/mysql 	restart</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Test connectivity to Master from Slave</span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> mysql &#8211;ssl-ca=/etc/mysql/ssl/ca-cert.pem -u root -p -h 192.168.1.100</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><span style="font-style: normal;"><span style="text-decoration: underline;"><span style="font-weight: normal;">root@sage:~#</span></span></span><strong> mysql -u root -p</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	SLAVE STOP;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	mysql&gt; CHANGE MASTER TO MASTER_HOST=&#8217;192.168.1.100&#8242;, MASTER_PORT=3306, MASTER_USER=&#8217;replssl&#8217;, MASTER_PASSWORD=&#8217;1&#8242;,MASTER_LOG_FILE=&#8217;mysql-bin.000004&#8242;, MASTER_LOG_POS=7705, MASTER_SSL=1, MASTER_SSL_CA=&#8217;/etc/mysql/ssl/ca-cert.pem&#8217;;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	START SLAVE;</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	SHOW SLAVE STATUS\G</strong></span></span></span></p>
<p style="background: #e6e6e6 none repeat scroll 0% 0%; margin-left: 0.39in; margin-right: 0.39in; margin-bottom: 0in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004a4a;"><span style="font-family: Courier New,monospace;"><span style="font-size: small;"><strong>mysql&gt;	SHOW PROCESSLIST\G</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;"><span style="color: #004586;"><span style="font-family: URW Gothic L,sans-serif;"><span style="font-size: x-small;">Note : If we have given only GRANT &#8230; REQUIRE SSL to replication user then  <strong>MASTER_SSL=1, MASTER_SSL_CA are to be specidfied. ITo require that a client certificate also be specified, create the account using the </strong><code><strong>REQUIRE X509</strong></code><strong> option.</strong></span></span></span></p>
<p style="background: #ffffff none repeat scroll 0% 0%; margin-top: 0.04in; margin-bottom: 0.04in; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; page-break-before: auto;">
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/03/04/mysql-server-replication-with-ssl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Recover a Lost MySQL Password</title>
		<link>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/</link>
		<comments>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 18:23:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=256</guid>
		<description><![CDATA[This article explains the process that will allow you to recover a lost MySQL password:

Stop the MySQL server process]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>This article explains the process that will allow you to recover a lost MySQL password:</p>
<p>Stop the MySQL server process</p>
<p>Start the MySQL (mysqld) server/daemon process with the<br />
&#8211;skip-grant-tables option so that it will not prompt for password.</p>
<p><span id="more-256"></span></p>
<p>Connect to mysql server as the root user.</p>
<p>Setup new mysql root account password.</p>
<p>Exit and restart the MySQL server.</p>
<p><strong>Example:</strong></p>
<p># service mysqld stop</p>
<p><strong>Output:</strong></p>
<p>Stopping MySQL database server: mysqld.</p>
<p>Then start MySql in safe mode</p>
<p># mysqld_safe &#8211;skip-grant-tables</p>
<p><strong>Output</strong></p>
<p>[1] 5988<br />
Starting mysqld daemon with databases from /var/lib/mysql</p>
<p>Then connect the mysql without any password</p>
<p># mysql -u root</p>
<p>( Then setup password )</p>
<p>mysql&gt; use mysql;</p>
<p>mysql&gt; update user set password=PASSWORD(&#8221;NEW-ROOT-PASSWORD&#8221;) where User=&#8217;root&#8217;;</p>
<div id=":1it">
<p>mysql&gt; flush privileges;</p>
<p>mysql&gt; quit</p>
<p>Then stop mysql</p>
<p># service mysql stop</p>
<p># service mysql start</p>
<p>Then Try your new password :</p>
<p># mysql -u root -p</p>
<p>Good Luck!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/20/how-to-recover-a-lost-mysql-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Port Redirection through the iptables</title>
		<link>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/</link>
		<comments>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 03:44:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=254</guid>
		<description><![CDATA[How do I redirect 80 port to 8123 using iptables?

You can easily redirect incoming traffic by inserting rules into PREROUTING chain of the nat table. You can set destination port using the REDIRECT target.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong> </strong>How do I redirect 80 port to 8123 using iptables?</p>
<p>You can easily redirect incoming traffic by inserting rules into PREROUTING chain of the nat table. You can set destination port using the REDIRECT target.</p>
<p><span id="more-254"></span><br />
<strong>Syntax<br />
</strong><br />
The syntax is as follows to redirect tcp $srcPortNumber port to $dstPortNumber:</p>
<p>iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport $srcPortNumber -j REDIRECT &#8211;to-port $dstPortNumbe</p>
<p>The syntax is as follows to redirect udp $srcPortNumber port to $dstPortNumber:</p>
<p>iptables -t nat -A PREROUTING -i eth0 -p udp &#8211;dport $srcPortNumber -j REDIRECT &#8211;to-port $dstPortNumber</p>
<p>Replace eth0 with your actual interface name. The following syntax match for source and destination ips:</p>
<p>iptables -t nat -I PREROUTING &#8211;src $SRC_IP_MASK &#8211;dst $DST_IP -p tcp &#8211;dport $portNumber -j REDIRECT &#8211;to-ports $rediectPort</p>
<p><strong>Examples:</strong></p>
<p>In The following example redirects TCP port 25 to port 2525:</p>
<p># iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport 25 -j REDIRECT &#8211;to-port 2525</p>
<p>this example all incoming traffic on port 80 redirect to port 8123</p>
<p># iptables -t nat -I PREROUTING &#8211;src 0/0 &#8211;dst 192.168.1.5 -p tcp &#8211;dport 80 -j REDIRECT &#8211;to-ports 8123</p>
<p><strong>How Do I View NAT Rules?</strong></p>
<p>Type the following command:</p>
<p># iptables -t nat -L -n -v</p>
<p><strong>How Do I Save NAT Redirect Rules?</strong></p>
<p>Type the following command:</p>
<p># iptables-save</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/19/port-redirection-through-the-iptables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apache Modules and Their Functions</title>
		<link>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/</link>
		<comments>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 18:04:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=249</guid>
		<description><![CDATA[Apache is a powerful and widely-used World-Wide Web (Web) server. One of its strengths is that the modules that it is made of are customizable according to the user's requirements. Ashish Kumar discusses the benefits and the process of customization, along with a brief introduction to some useful modules.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong style="color: #333333;"><span style="font-size: medium;">Apache Performance Modules</span></strong><br style="color: #333333;" /><br style="color: #333333;" /><span style="color: #333333;">Apache is a powerful and widely-used World-Wide Web (Web) server. One of its strengths is that the modules that it is made of are customizable according to the user&#8217;s requirements. Ashish Kumar discusses the benefits and the process of customization, along with a brief introduction to some useful modules.</span><br style="color: #333333;" /><br style="color: #333333;" /></p>
<p><span id="more-249"></span><br />
<span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<h2 style="color: #333333;">List of Standard Modules</h2>
<p style="color: #333333;">This appendix (alphabetically) lists of all of the standard modules that are part of the current (version 1.3.x) Apache distribution. Table 1 the modules that are compiled-in by default and Table 2 lists the ones which are not.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_access</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Host based access control</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_actions</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Filetype/method-based script execution</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_alias</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Aliases and redirects</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_asis</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">The .asis file handler</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using text files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_autoindex</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Automatic directory listings</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cgi</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Invoking CGI scripts</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_dir</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic directory handling</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_env</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Passing of environments to CGI scripts</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_imap</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">The imagemap file handler</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_include</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server-parsed documents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_isapi</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Windows ISAPI extension support</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_config</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User-configurable logging</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mime</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Determining document types using file extension</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_negotiation</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Content negotiation</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_setenvif</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Set environment variables based on client information</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_status</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server status display</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_userdir</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User home directories</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_unique_id</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Generate unique request identifier for every request</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_usertrack</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User tracking using Cookies</td>
</tr>
</tbody>
</table>
<p><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<p style="color: #333333;">Table 1. Apache Standard Modules Compiled-In by Default.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_anon</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Anonymous user authentication, FTP-style</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_db</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using Berkeley DB files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_dbm</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">User authentication using DBM files</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cern_meta</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Support for HTTP header metafiles</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_digest</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">MD5 authentication</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_example</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Demonstrates Apache API</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_expires</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Apply Expires: headers to resources</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_headers</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Add arbitrary HTTP headers to resources</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_info</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server configuration information</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_agent</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Logging of user agents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_log_referer</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Logging of document references</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mime_magic</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Determining document types using &#8220;magic numbers&#8221;</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_mmap_static</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Mapping files into memory for faster serving</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_proxy</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Caching proxy abilities</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_rewrite</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Powerful URI-to-filename mapping using regular expressions</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_so</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Experimental support for loading modules (DLLs on Windows) at runtime (not compiled-in the UNIX distribution)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_speling</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Automatically correct minor typos in URLs</td>
</tr>
</tbody>
</table>
<p style="color: #333333;">Table 2. Apache Standard Modules Not Compiled-In by Default.</p>
<h2 style="color: #333333;"><a style="color: #005488;" name="126daf85273bb1e9_126dacf4e92051a1_app2"></a>Appendix II : List of Nonstandard Modules</h2>
<p style="color: #333333;">This appendix is a list of some nonstandard Apache modules. The selection is biased towards modules for programming language support and Web site administration. See Table 3.</p>
<table style="color: #333333;" border="1">
<tbody>
<tr>
<th>MODULE</th>
<th>FUNCTION</th>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">apache_ssl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">SSL extensions for Apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_bandwidth</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Limit bandwidth based on number of connections</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cint</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embedded C/C++ interpreter module for apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Chili!ASP</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Active Server Pages module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">ColdFusion Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Interface to the ColdFusion application server (Windows NT only)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Cookie Authentication</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Fake Basic authentication using Cookies</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">dir_log_module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Implements per-directory logging</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Distributed Permanence Control Apache Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Module designed to work with RCS and CVS to encourage the permanence of document version/editions on the Web</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">FastCGI</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Keeps CGI processes alive to avoid per-hit forks</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">GIF Counter</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic GIF counter</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Hotwired Mod_include</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Hotwired extensions to mod_include</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Indexer</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Configurable directory listing module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Java Wrapper Module</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Enables execution of Java applications as CGI directly</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_allowdev</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Restricts access to filespace more efficiently</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_ldap</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Apache LDAP authentication module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_mysql</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mySQL authentication module</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_udp</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">External authentication using UDP</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_cgisock</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Socket implementation of the CGI</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_format</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Formats C, C++, and Java source code using HTML</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_gunzip</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">On-the-fly decompression of HTML documents</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_hosts_access</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Allows you to use the hosts.allow and hosts.deny files to configure access to Apache</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_javascript</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">JavaScript module (ECMA-262)</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_jserv</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Java servlet interface</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_neoinclude</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">NeoWebScript &#8211; Tcl scripting extension</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_perl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embeds Perl language interpreter and provides a Perl interface to the server API</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_ssl</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Free Apache interface to SSLeay</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_weborb</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Directly invokes CORBA-objects to handle CGI requests</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_auth_msql</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Basic authentication with the mSQL database</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">parselog</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Perl script to parse and store logs by server and date</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">PHP</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Server-side scripting language with extensive database support</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">mod_pyapache</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Embedded Python language interpreter</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">TalentSoft WebPlus (Web+)</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Web+ (WebPlus) application development tool/database middleware. Supports Linux, Apache API, mySQL, miniSQL, PostgreSQL, etc.</td>
</tr>
<tr>
<td style="margin: 0px; font-family: arial,sans-serif; color: #000000;" valign="top">WebCounter</td>
<td style="margin: 0px; font-family: arial,sans-serif;" valign="top">Page counter</td>
</tr>
</tbody>
</table>
<p><br style="color: #333333;" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/18/apache-modules-and-their-functions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Create Connection Limits with Iptables</title>
		<link>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/</link>
		<comments>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:21:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[TCP/IP]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=243</guid>
		<description><![CDATA[How do I restrict the number of connections used by a single IP address to my server for port 80 and 25 using iptables?

You need to use the connection limit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). This is useful to protect your server or vps box against flooding, spamming or content scraping.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a><br />
<span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"><span style="font-size: medium;"><strong></strong></span></span></p>
<p>How do I restrict the number of connections used by a single IP address to my server for port 80 and 25 using iptables?</p>
<p>You need to use the connection limit modules which allows you to restrict the number of parallel TCP connections to a server per client IP address (or address block). This is useful to protect your server or vps box against flooding, spamming or content scraping.</p>
<p><span id="more-243"></span><br />
<strong>Syntax</strong><br />
The syntax is as follows:</p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport $port -m connlimit &#8211;connlimit-above N -j REJECT &#8211;reject-with tcp-reset</p>
<p>save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Example</strong>: Limit SSH Connections Per IP / Host</p>
<p>Only allow 3 ssh connections per client host:</p>
<p># /sbin/iptables  -A INPUT -p tcp &#8211;syn &#8211;dport 22 -m connlimit &#8211;connlimit-above 3 -j REJECT</p>
<p>save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Example</strong>: Limit HTTP Connections Per IP / Host</p>
<p>Only allow 20 http connections per IP (MaxClients is set to 60 in httpd.conf):</p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport 80 -m connlimit &#8211;connlimit-above 20 -j REJECT &#8211;reject-with tcp-reset<br />
save the changes see iptables-save man page, the following is redhat and friends specific command service iptables save</p>
<p><strong>Skip proxy server IP 1.2.3.4 from this kind of limitations:</strong></p>
<p># /sbin/iptables -A INPUT -p tcp &#8211;syn &#8211;dport 80 -d ! 1.2.3.4 -m connlimit-above 20 -j REJECT &#8211;reject-with tcp-reset</p>
<p>Enjoy it&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/18/how-to-create-connection-limits-with-iptables/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ISCSI Target ( Server )</title>
		<link>http://www.hackadmin.com/2010/02/16/iscsi-target-server/</link>
		<comments>http://www.hackadmin.com/2010/02/16/iscsi-target-server/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 16:12:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[iscsi]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=231</guid>
		<description><![CDATA[Article by Aashish
 


Storage resource located on an iSCSI server known as a &#8220;target&#8221;. An iSCSI target usually represents nothing but hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.

iSCSI initiator (client)

An initiator functions as an iSCSI client. An initiator typically serves the same purpose [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><span style="border-collapse: collapse; font-family: arial,sans-serif; font-size: 13px;"> </span></p>
<div style="text-align: center;"><strong><span style="font-size: medium;"><br />
</span></strong></div>
<p>Storage resource located on an iSCSI server known as a &#8220;target&#8221;. An iSCSI target usually represents nothing but hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.</p>
<p><span id="more-231"></span><br />
<strong>iSCSI initiator (client)<br />
</strong><br />
An initiator functions as an iSCSI client. An initiator typically serves the same purpose to a computer as a SCSI bus adapter would, except that instead of physically cabling SCSI devices (like hard drives and tape changers), an iSCSI initiator sends SCSI commands over an IP network.</p>
<p><strong>Debian / Ubuntu Linux Install tgt<br />
</strong><br />
Type the following command to install Linux target framework user-space tools:</p>
<p>$ sudo apt-get install tgt</p>
<p>CentOS / RHEL / Red Hat Linux Install tgt</p>
<p>RHEL 5.2 and older version do not have tgt tools. However, RHEL 5.3 (preview version) comes with tgt tools.</p>
<p>tgtadm &#8211; Linux SCSI Target Administration Utility</p>
<p>tgtadm is used to monitor and modify everything about Linux SCSI target software: targets, volumes, etc. This tool allows a system to serve block-level SCSI storage to other systems that have a SCSI initiator. This capability is being initially deployed as a Linux iSCSI target, serving storage over a network to any iSCSI initiator.</p>
<p>Start tgtd</p>
<p>To start the tgtd, enter:</p>
<p># /usr/sbin/tgtd</p>
<p>Under RHEL 5.3 to start the tgtd service, enter:</p>
<p># /etc/init.d/tgtd start</p>
<p><strong>Define an iscsi target name<br />
</strong><br />
The following example creates a target with id 1 (the iqn is 19 iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz) and adds a 20 logical unit (backed by /dev/hdc1)with lun 1.</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode target &#8211;tid 1 -T iqn.2001-04.com.example:storage.disk2.amiens.sys1.xyz<br />
To view the current configuration, enter:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op show &#8211;mode target<br />
<strong><br />
Sample output:</strong></p>
<p>Target 1: iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz</p>
<p>System information:</p>
<p>Driver: iscsi</p>
<p>Status: running</p>
<p>I_T nexus information:</p>
<p>LUN information:</p>
<p>LUN: 0</p>
<p>Type: controller</p>
<p>SCSI ID: deadbeaf1:0</p>
<p>SCSI SN: beaf10</p>
<p>Size: 0</p>
<p>Online: No</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: No backing store</p>
<p>Account information:</p>
<p>ACL information:</p>
<p>Add a logical unit to the target (/dev/sdb1):</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode logicalunit &#8211;tid 1 &#8211;lun 1 -b /dev/sdb1</p>
<p><strong>Note:-</strong><span> </span>about home computer / test system</p>
<p>Most production boxes will only use iSCSI root with real iSCSI devices, but for testing purposes it can be quite useful to set up an iSCSI target on your image server. This is useful for testing and learning iSCSI target and iSCSI initiator at home, simply use filesystem for testing purpose. Use dd command to create diskbased filesystem:</p>
<p># dd if=/dev/zero of=/fs.iscsi.disk bs=1M count=512</p>
<p>Add /fs.iscsi.disk as a logical unit to the target:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op new &#8211;mode logicalunit &#8211;tid 1 &#8211;lun 1 -b /fs.iscsi.disk</p>
<p>Now, you should able to view details:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op show &#8211;mode target</p>
<p><strong>Sample output:<br />
</strong><br />
Target 1: iqn.2001-04.com.example:storage.disk1.amiens.sys1.xyz</p>
<p>System information:</p>
<p>Driver: iscsi</p>
<p>Status: running</p>
<p>I_T nexus information:</p>
<p>LUN information:</p>
<p>LUN: 0</p>
<p>Type: controller</p>
<p>SCSI ID: deadbeaf1:0</p>
<p>SCSI SN: beaf10</p>
<p>Size: 0</p>
<p>Online: No</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: No backing store</p>
<p>LUN: 1</p>
<p>Type: disk</p>
<p>SCSI ID: deadbeaf1:1</p>
<p>SCSI SN: beaf11</p>
<p>Size: 512M</p>
<p>Online: Yes</p>
<p>Poweron/Reset: Yes</p>
<p>Removable media: No</p>
<p>Backing store: /fs.iscsi.disk</p>
<p>Account information:</p>
<p>ACL information:</p>
<p>Accept iSCSI Target</p>
<p>To enable the target to accept any initiators, enter:</p>
<p># tgtadm &#8211;lld iscsi &#8211;op bind &#8211;mode target &#8211;tid 1 -I ALL</p>
<p>This should open network port # 3260:</p>
<p># netstat -tulpn | grep 3260</p>
<p><strong>Sample output:<br />
</strong><br />
tcp 0 0<span> </span><a style="color: #005488;" href="http://0.0.0.0:3260/" target="_blank">0.0.0.0:3260</a><span> </span>0.0.0.0:* LISTEN 27328/tgtd<br />
tcp6 0 0 :::3260 :::* LISTEN 27328/tgtd</p>
<p>And you are done. Your system is configured as iSCSI Target. Remote client computer can access this computers hard disk over network. Your can use cluster aware filesystem to setup real shared storage for small business. Open TCP port 3260 in your firewall, if required.</p>
<p><strong>For Client<br />
</strong>Install Required Package</p>
<p>iscsi-initiator-utils RPM package &#8211; The iscsi package provides the server daemon for the iSCSI protocol, as well as the utility programs used to manage it. iSCSI is a protocol for distributed disk access using SCSI commands sent over Internet Protocol networks. This package is available under Redhat Enterprise Linux / CentOS / Fedora Linux and can be installed using yum command:</p>
<p># yum install iscsi-initiator-utils</p>
<p>A note about Debian / Ubuntu Linux</p>
<p>If you are using Debian / Ubuntu Linux install open-iscsi package, enter:</p>
<p>$ sudo apt-get install open-iscsi</p>
<p>iSCSI Configuration</p>
<p>There are three steps needed to set up a system to use iSCSI storage:</p>
<p>1. iSCSI startup using the init script or manual startup. You need to edit and configure iSCSI</p>
<p>via /etc/iscsi/iscsid.conf file</p>
<p>2. Discover targets.</p>
<p>3. Automate target logins for future system reboots.</p>
<p>4. You also need to obtain iSCSI username, password and storage server IP address (target host)</p>
<p><strong>Step # 1: Configure iSCSI</strong></p>
<p>Open /etc/iscsi/iscsid.conf with vi text editor:</p>
<p># vi /etc/iscsi/iscsid.conf</p>
<p>Setup username and password:</p>
<p>node.session.auth.username = My_ISCSI_USR_NAME</p>
<p>node.session.auth.password = MyPassword</p>
<p>discovery.sendtargets.auth.username = My_ISCSI_USR_NAME</p>
<p>discovery.sendtargets.auth.password = MyPassword</p>
<p>Where,</p>
<p>* node.session.* is used to set a CHAP username and password for initiator authentication by the target(s).<br />
* discovery.sendtargets.* is used to set a discovery session CHAP username and password for the initiator authentication by the target(s)</p>
<p>You may also need to tweak and set other options. Refer to man page for more information. Now start the iscsi service:</p>
<p># /etc/init.d/iscsi start</p>
<p><strong>Step # 2: Discover targets</strong><br />
Now use iscsiadm command, which is a command-line tool allowing discovery and login to iSCSI targets, as well as access and management of the open-iscsi database. If your storage server IP address is 192.168.1.5, enter:</p>
<p># iscsiadm -m discovery -t sendtargets -p 192.168.1.5</p>
<p># /etc/init.d/iscsi restart</p>
<p>Now there should be a block device under /dev directory. To obtain new device name, type:</p>
<p># fdisk -l</p>
<p>or</p>
<p># tail -f /var/log/messages</p>
<p><strong>Output:<br />
</strong>Oct 10 12:42:20 ora9is2 kernel: Vendor: EQLOGIC Model: 100E-00 Rev: 3.2<br />
Oct 10 12:42:20 ora9is2 kernel: Type: Direct-Access ANSI SCSI revision: 05<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: 41963520 512-byte hdwr sectors (21485 MB)<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: Write Protect is off<br />
Oct 10 12:42:20 ora9is2 kernel: SCSI device sdd: drive cache: write through<br />
Oct 10 12:42:20 ora9is2 kernel: sdd: unknown partition table<br />
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi disk sdd<br />
Oct 10 12:42:20 ora9is2 kernel: sd 3:0:0:0: Attached scsi generic sg3 type 0<br />
Oct 10 12:42:20 ora9is2 kernel: rtc: lost some interrupts at 2048Hz.<br />
Oct 10 12:42:20 ora9is2 iscsid: connection0:0 is operational now<br />
/dev/sdd is my new block device.</p>
<p><strong>Step # 3: Format and Mount iSCSI Volume<br />
</strong><br />
You can now partition and create a filesystem on the target using usual fdisk and mkfs.ext3 commands:</p>
<p># fdisk /dev/sdd</p>
<p># mke2fs -j -m 0 -O dir_index /dev/sdd1</p>
<p><strong>OR<br />
</strong><br />
# mkfs.ext3 /dev/sdd1</p>
<p>Tip: If your volume is large size like 1TB, run mkfs.ext3 in background using nohup:</p>
<p># nohup mkfs.ext3 /dev/sdd1 &amp;</p>
<p>Mount new partition:</p>
<p># mkdir /mnt/iscsi</p>
<p># mount /dev/sdd1 /mnt/iscsi</p>
<p><strong>Step #4: Mount iSCSI drive automatically at boot time<br />
</strong><br />
First make sure iscsi service turned on at boot time:</p>
<p># chkconfig iscsi on</p>
<p>Open /etc/fstab file and append config directive:</p>
<p>/dev/sdd1 /mnt/iscsi ext3 _netdev 0 0</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/16/iscsi-target-server/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server</title>
		<link>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/</link>
		<comments>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 18:29:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[rsnapshot]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=224</guid>
		<description><![CDATA[Article by Aashish
How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server

Q. I am using an HP RAID 6 server running RHEL 5.x. I&#8217;d like this box to act as a backup server for my other Red Hat DNS and Web server. The server must keep backup in hourly, daily and monthly [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p><strong>How To Set Red hat / CentOS Linux Remote Backup / Snapshot Server<br />
</strong><br />
<strong>Q.</strong> I am using an HP RAID 6 server running RHEL 5.x. I&#8217;d like this box to act as a backup server for my other Red Hat DNS and Web server. The server must keep backup in hourly, daily and monthly format. How do I configure my Red Hat / CentOS Linux server as remote backup or snapshot server? </p>
<p><span id="more-224"></span><br />
<strong>A.</strong> rsnapshot is easy, reliable and a good disaster recovery backup solution. It is a remote backup program that uses rsync to take backup snapshots of your filesystems. It uses hard links to save space on disk and offers following features:</p>
<p><strong>• Filesystem snapshot</strong> &#8211; for local or remote systems.</p>
<p><strong>• Database backup</strong> &#8211; MySQL backup</p>
<p><strong>• Secure</strong> &#8211; Traffic between remote backup server is always encrypted using openssh</p>
<p><strong>• Full backup</strong> &#8211; plus incremental</p>
<p><strong>• Easy to restore</strong> &#8211; Files can restored by the users who own them, without the root user getting involved.</p>
<p><strong>• Automated backup</strong> &#8211; Runs in background via cron.</p>
<p><strong>• Bandwidth friendly</strong> &#8211; rsync used to save bandwidth </p>
<p><strong>Sample setup</strong></p>
<p>• snapshot.example.com &#8211; HP box with RAID 6 configured with Red Hat / CentOS Linux ac as backup server for other clients.</p>
<p>• DNS ns1.example.com &#8211; Red Hat server act as primary name server.</p>
<p>• DNS ns2.example.com &#8211; Red Hat server act as secondary name server.</p>
<p>• www.example.com &#8211; Red Hat running Apache web server.</p>
<p>• mysql.example.com &#8211; Red Hat mysql server.</p>
<p><strong>Install rsnapshot</strong></p>
<p>Login to snapshot.example.com. Download rsnapshot rpm file, enter: WARNING! These examples only works on Red hat / CentOS / Suse / RHEL / Fedora Linux. See Debian / Ubuntu Linux backup server instructions here.</p>
<p># cd /tmp</p>
<p># wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.0-1.noarch.rpm</p>
<p># wget http://www.rsnapshot.org/downloads/rsnapshot-1.3.0-1.noarch.rpm.md5</p>
<p>Verify rpm file for integrity, enter</p>
<p># md5sum -c rsnapshot-1.3.0-1.noarch.rpm.md5</p>
<p><strong>Sample output:</strong><br />
rsnapshot-1.3.0-1.noarch.rpm: OK<br />
Install rsnapshot, enter:</p>
<p># rpm -ivh rsnapshot-1.3.0-1.noarch.rpm<br />
Sample output:<br />
Preparing&#8230; ########################################### [100%]<br />
1:rsnapshot ########################################### [100%]</p>
<p><strong>Configure rsnapshot</strong></p>
<p>You need to perform following steps</p>
<p>Step # 1: Configure passwordless login</p>
<p>To perform remote backup you need to setup passwordless login using openssh. Create ssh rsa key and upload them to all servers using scp (note you are overwriting ~/ssh/authorized_keys2 files).You need to type following commands on snapshot.example.com server:</p>
<p># ssh-keygen -t rsa</p>
<p># scp .ssh/id_rsa.pub root@ns1.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@ns2.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@www.example.com:.ssh/authorized_keys2</p>
<p># scp .ssh/id_rsa.pub root@mysql.example.com:.ssh/authorized_keys2</p>
<p>Step # 2: Configure rsnapshot</p>
<p>The default configuration file is located at /etc/rsnapshot.conf. Open configuration file using a text editor, enter:</p>
<p># vi /etc/rsnapshot.conf</p>
<p><strong>Configuration rules</strong></p>
<p>You must follow two configuration rules:</p>
<p>• rsnapshot config file requires tabs between elements.</p>
<p>• All directories require a trailing slash. For example, /home/ is correct way to specify directory, but /home is wrong.</p>
<p>First, specify root directory to store all snapshots such as /snapshots/ or /dynvol/snapshot/ as per your RAID setup, enter:</p>
<p>snapshot_root /raiddisk/snapshots/</p>
<p>You must separate snapshot_root and /raiddisk/snapshots/ by a [tab] key i.e. type snapshot_root hit [tab] key once and type /raiddisk/snapshots/.</p>
<p><strong>Define snapshot intervals</strong></p>
<p>You need to specify backup intervals i.e. specify hourly, daily, weekly and monthly intervals:</p>
<p>interval hourly 6</p>
<p>interval daily 7</p>
<p>interval weekly 4</p>
<p>interval monthly 3</p>
<p>The line &#8220;interval hourly 6&#8243; means 6 hourly backups a day. Feel free to adapt configuration as per your backup requirements and snapshot frequency.</p>
<p><strong>Remote backup directories</strong></p>
<p>To backup /var/named/ and /etc/ directory from ns1.example.com and ns2.example.com, enter:</p>
<p>backup root@ns1.example.com:/etc/ ns1.example.com/</p>
<p>backup root@ns1.example.com:/var/named/ ns1.example.com/</p>
<p>backup root@ns2.example.com:/etc/ ns2.example.com/</p>
<p>backup root@ns2.example.com:/var/named/ ns2.example.com/</p>
<p>To backup /var/www/, /var/log/httpd/ and /etc/ directory from www.example.com, enter</p>
<p>backup root@www.example.com:/var/www/ www.example.com/</p>
<p>backup root@www.example.com:/etc/ www.example.com/</p>
<p>backup root@www.example.com:/var/log/httpd/ www.example.com/</p>
<p>To backup mysql database files stored at /var/lib/mysql/, enter:</p>
<p>backup root@mysql.example.com:/var/lib/mysql/ mysql.example.com/dbdump/Save and close the file. To test your configuration, enter:</p>
<p># rsnapshot configtest</p>
<p>Sample output:</p>
<p>Syntax OK</p>
<p><strong>Schedule cron job</strong></p>
<p>Create /etc/cron.d/rsnapshot cron file. Following values used correspond to the examples in<br />
#vim /etc/rsnapshot.conf.</p>
<p>0 */4 * * * /usr/bin/rsnapshot hourly</p>
<p>50 23 * * * /usr/bin/rsnapshot daily</p>
<p>40 23 * * 6 /usr/bin/rsnapshot weekly</p>
<p>30 23 1 * * /usr/bin/rsnapshot monthly</p>
<p>Save and close the file. Now rsnapshot will work as follows to backup files from remote boxes:</p>
<p>1. 6 hourly backups a day (once every 4 hours, at 0,4,8,12,16,20)</p>
<p>2. 1 daily backup every day, at 11:50PM</p>
<p>3. 1 weekly backup every week, at 11:40PM, on Saturdays (6th day of week)</p>
<p>4. 1 monthly backup every month, at 11:30PM on the 1st day of the month<br />
<strong><br />
How do I see backups?</strong></p>
<p>To see backup change directory to</p>
<p># cd /raiddisk/snapshots/</p>
<p># ls -l</p>
<p>Sample output:<br />
drwxr-xr-x 4 root root 4096 2008-07-04 06:04 daily.0<br />
drwxr-xr-x 4 root root 4096 2008-07-03 06:04 daily.1<br />
drwxr-xr-x 4 root root 4096 2008-07-02 06:03 daily.2<br />
drwxr-xr-x 4 root root 4096 2008-07-01 06:02 daily.3<br />
drwxr-xr-x 4 root root 4096 2008-06-30 06:02 daily.4<br />
drwxr-xr-x 4 root root 4096 2008-06-29 06:05 daily.5<br />
drwxr-xr-x 4 root root 4096 2008-06-28 06:04 daily.6<br />
drwxr-xr-x 4 root root 4096 2008-07-05 18:05 hourly.0<br />
drwxr-xr-x 4 root root 4096 2008-07-05 15:06 hourly.1<br />
drwxr-xr-x 4 root root 4096 2008-07-05 12:06 hourly.2<br />
drwxr-xr-x 4 root root 4096 2008-07-05 09:05 hourly.3<br />
drwxr-xr-x 4 root root 4096 2008-07-05 06:04 hourly.4<br />
drwxr-xr-x 4 root root 4096 2008-07-05 03:04 hourly.5<br />
drwxr-xr-x 4 root root 4096 2008-07-05 00:05 hourly.6<br />
drwxr-xr-x 4 root root 4096 2008-07-04 21:05 hourly.7<br />
drwxr-xr-x 4 root root 4096 2008-06-22 06:04 weekly.0<br />
drwxr-xr-x 4 root root 4096 2008-06-15 09:05 weekly.1<br />
drwxr-xr-x 4 root root 4096 2008-06-08 06:04 weekly.2</p>
<p><strong>How do I restore backup?</strong></p>
<p>Let us say you would like to restore a backup for www.example.com. Type the command as follows (select day and date from ls -l output):</p>
<p># cd /raiddisk/snapshots/<br />
# ls -l</p>
<p># cd hourly.0/www.example.com/</p>
<p># scp -r var/www/ root@www.example.com:/var/www/</p>
<p># scp -r etc/httpd/ root@www.example.com:/etc/httpd/</p>
<p><strong>How do I exclude files from backup?</strong></p>
<p>To exclude files from backup, open rsnapshot.conf file and add following line:</p>
<p>exclude_file /etc/rsnapshot.exclude.www.example.com</p>
<p>Create /etc/rsnapshot.exclude.www.example.com as follows:</p>
<p>/var/www/tmp/</p>
<p>/var/www/*.cache</p>
<p>That&#8217;s It!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/15/how-to-set-red-hat-centos-linux-remote-backup-snapshot-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL Permissions</title>
		<link>http://www.hackadmin.com/2010/02/14/mysql-permissions/</link>
		<comments>http://www.hackadmin.com/2010/02/14/mysql-permissions/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 17:52:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[permissions]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=220</guid>
		<description><![CDATA[Article by Aashish
MySQL Change Password
 How do I  MySQL root password under Linux, FreeBSD, OpenBSD and UNIX like operating system over ssl / telnet session ?
 Setting up mysql password is one of the essential tasks.

 By default root user is MySQL admin account. Please note that the Linux / UNIX login root account [...]]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>MySQL Change Password<br />
 How do I  MySQL root password under Linux, FreeBSD, OpenBSD and UNIX like operating system over ssl / telnet session ?<br />
 Setting up mysql password is one of the essential tasks.</p>
<p><span id="more-220"></span><br />
 By default root user is MySQL admin account. Please note that the Linux / UNIX login root account for your operating system and MySQL root are different. They are separate and have nothing to do with each other (indeed some admins remove the root account and setup admin as mysql super user).</p>
<p>mysqladmin command to change root password:</p>
<p> If you have never set a root password for MySQL, the sever doesn&#8217;t require a password at all for connecting as root to setup root password for first time, use the mysqladmin command at shell prompt as follows:</p>
<p> $ mysqladmin -u root password NEWPASSWORD</p>
<p>However, if you want to change (or update) a root passwod, then you need to use following command</p>
<p> $ mysqladmin -u root -p&#8217;oldpassword&#8217; password newpass</p>
<p>For example, if old password abc, and set new password 123456, enter:</p>
<p> $ mysqladmin -u root -p&#8217;abc&#8217; password &#8216;123456&#8242;</p>
<p>Change MySQL password for other user:</p>
<p>To change a normal user password you need to type (let us assume to would like to change password for ashish):</p>
<p> $ mysqladmin -u ashish -p oldpassword password newpass</p>
<p>Changing MySQL root user password using MySQL sql command:</p>
<p>This is the another method. MySQL stores username and passwords in user table inside MySQL database. You can directly update password using<br />
the following method to update or change password for user ashish:</p>
<p> 1)       Loging to mysql server, type following command at shell prompt:<br />
             $ mysql -u root -p<br />
 2)       Use mysql database (type command at mysql>prompt):<br />
             mysql> use mysql;<br />
 3)       Change password for user ashish<br />
             mysql> update user set password=PASSWORD(“NEWPASSWORD”) where User=&#8217;ashish&#8217;;<br />
 4)       Reload privileges:<br />
             mysql> flush privileges;<br />
            mysql> quit<br />
             $ mysql -u root -p</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/14/mysql-permissions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Identifying Slow MySQL queries</title>
		<link>http://www.hackadmin.com/2010/02/13/identifying-slow-mysql-queries/</link>
		<comments>http://www.hackadmin.com/2010/02/13/identifying-slow-mysql-queries/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 17:34:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Aashish]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[querry]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/?p=213</guid>
		<description><![CDATA[MySQL can sometimes create big problems on a server when you have users abusing it.
This article will teach you how to correctly identify the queries that are creating a problem for your server.]]></description>
			<content:encoded><![CDATA[<p>Article by <a href="http://www.hackadmin.com/aashish/">Aashish</a></p>
<p>MySQL can sometimes create big problems on a server when you have users abusing it.<br />
This article will teach you how to correctly identify the queries that are creating a problem for your server.</p>
<p><span id="more-213"></span><br />
MySQL can log those queries that are taking longer then X seconds but this future is not turned on by default.<br />
Here’s how you turn it on:<br />
Login to your server as root<br />
Open my.cnf with your favorite editor. Example:<br />
vim /etc/my.cnf</p>
<p>Into the [mysqld] section add the fallowing lines<br />
log-slow-queries = /var/log/mysql-slow.log<br />
long_query_time = 3</p>
<p>This is just an example. You can use any file name that you want and you can modify the long_query_time to any value. In this example I will be logging to /var/log/mysql-slow.log any queries that are taking longer then 3 seconds.</p>
<p>Go ahead and save the configuration.<br />
For vim: CTRL+X and YES</p>
<p>Now we have to actually create the log file.<br />
touch /var/log/mysql-slow.log</p>
<p>Now we are changing the owner of the file so that mysql and actually write to it.<br />
chown mysql.root /var/log/mysql-slow.log</p>
<p>Now we restart mysql<br />
service mysql restart</p>
<p>It should restart successfully. If it doesn’t check that you didn’t brake my.cnf by examining the error file in your data directory.</p>
<p>Wait a few minutes and then examine the slow queries log<br />
A few examples on how to do it:</p>
<p>cat /var/log/mysql-slow.log<br />
tail /var/log/mysql-slow.log<br />
tail -50 /var/log/mysql-slow.log</p>
<p>After you have identified the offending query go ahead and optimize or remove it.<br />
Again test the results by looking at your server load and the mysql slow queries log.</p>
<p>After you fixed all the problems go ahead and comment the slow queries logging as it will slow your server a bit if you leave it on. my.cnf should now look similar to this:</p>
<p>#log-slow-queries = /var/log/mysql-slow.log<br />
#long_query_time = 3</p>
<p>And don’t forget to restart MySQL after this.</p>
<p>service mysql restart</p>
<p>Hope this helps ! </p>
<p>Install MySQL Performance Tuning Primer Script</p>
<p>Tuning the performance of MySQL can be a really hard job to do.<br />
There are many things to consider and no two servers are identical so there is no universal solution.<br />
Tuning Primer is a script that will help you tune your mysql installation by providing very healthy recommendations based on past mysql records.<br />
For the script to be efficient you must run the mysql server for at least 48 hours.<br />
Installation is extremely simple:</p>
<p>Download the script<br />
wget http://day32.com/MySQL/tuning-primer.sh</p>
<p>Change the permissions for the file<br />
chmod 755 tuning-primer.sh</p>
<p>Run it<br />
./tuning-primer.sh</p>
<p>Apply the sugesttions</p>
<p>                    Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2010/02/13/identifying-slow-mysql-queries/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
