<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>ManojSamtani's Weblog</title>
	<atom:link href="http://manojsamtani.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://manojsamtani.wordpress.com</link>
	<description>JustLinux</description>
	<lastBuildDate>Wed, 09 Jul 2008 10:05:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='manojsamtani.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>ManojSamtani's Weblog</title>
		<link>http://manojsamtani.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://manojsamtani.wordpress.com/osd.xml" title="ManojSamtani&#039;s Weblog" />
	<atom:link rel='hub' href='http://manojsamtani.wordpress.com/?pushpress=hub'/>
		<item>
		<title>MySql Master-Master Replication</title>
		<link>http://manojsamtani.wordpress.com/2008/07/09/mysql-master-master-replication/</link>
		<comments>http://manojsamtani.wordpress.com/2008/07/09/mysql-master-master-replication/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 06:57:52 +0000</pubDate>
		<dc:creator>manojsamtani</dc:creator>
				<category><![CDATA[MySql]]></category>

		<guid isPermaLink="false">http://manojsamtani.wordpress.com/?p=5</guid>
		<description><![CDATA[MySQL DataBase Master-Master Replication Required Packages mysql mysql-server Master1 server ip: 192.168.0.82 Master2 server ip: 192.168.0.83 Slave username: user Slave password: user Your data directory is: /var/lib/mysql/ In Master1 Database machine edit /etc/my.cnf : # let&#8217;s make it so auto increment columns behave by having different increments on both servers auto_increment_increment=2 auto_increment_offset=1 # Replication Master [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=manojsamtani.wordpress.com&amp;blog=3789285&amp;post=5&amp;subd=manojsamtani&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;" align="center"><span style="color:#2323dc;"><span style="text-decoration:underline;"><strong><span style="background:transparent none repeat scroll 0 50%;">MySQL DataBase Master-Master Replication</span></strong></span></span></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><strong> Required Packages</strong></p>
<p>mysql</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">mysql-server</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><strong><span style="font-size:medium;"><span style="background:transparent none repeat scroll 0 50%;"><span style="color:#0000ff;">Master1</span></span> server ip: 192.168.0.82</span></strong></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><strong><span style="font-size:medium;"><span style="background:transparent none repeat scroll 0 50%;"><span style="color:#00ae00;">Master2</span></span> server ip: 192.168.0.83</span></strong></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><span style="font-size:medium;"><strong>Slave username: user</strong></span></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><span style="font-size:medium;"><strong>Slave password: user</strong></span></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><span style="font-size:medium;"><strong>Your data directory is: /var/lib/mysql/</strong></span></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><strong><span style="text-decoration:underline;">In <span style="background:#00ffff none repeat scroll 0 50%;">Master1</span> Database machine edit /etc/my.cnf :</span></strong></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"># let&#8217;s make it so auto increment columns behave by having different increments on both servers</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">auto_increment_increment=2</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">auto_increment_offset=1</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"># Replication Master Server</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"># binary logging is required for replication</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">log-bin=/var/log/master1-bin</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">binlog-ignore-db=mysql</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">binlog-ignore-db=test</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"># required unique id between 1 and 2^32 &#8211; 1</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">server-id = 1</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">#following is the slave settings so this server can connect to master2</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">master-host = 192.168.0.83</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">master-user = slaveuser</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">master-password = slavepw</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">master-port = 3306</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">Save and exit.</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><strong><span style="text-decoration:underline;">In <span style="background:#00ff00 none repeat scroll 0 50%;">Master2</span> Database machine edit /etc/my.cnf :</span></strong></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"># let&#8217;s make it so auto increment columns behave by having different increments on both servers</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">auto_increment_increment=2</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">auto_increment_offset=2</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"># Replication Master Server</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"># binary logging is required for replication</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">log-bin=/var/log/master2-bin</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">#Ignore database to replicate</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">binlog-ignore-db=mysql</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">binlog-ignore-db=test</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"># required unique id between 1 and 2^32 &#8211; 1</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">server-id = 2</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">#following is the slave settings so this server can connect to master1</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">master-host = 192.168.0.82</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">master-user = user</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">master-password = user</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">master-port = 3306</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">Save and exit.</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#ccffff none repeat scroll 0 50%;"><strong><span style="font-size:small;"><span style="font-family:Baekmuk Batang;"><span style="color:#000000;">Enter the following command on </span></span></span></strong><strong><span style="font-size:small;"><span><span style="color:#000000;">Master1</span></span></span></strong> </span></code><span style="background:#ccffff none repeat scroll 0 50%;"><strong><span style="font-size:small;"><span style="font-family:Baekmuk Batang;"><span style="color:#000000;">to create/grant user level access on the database to Master2.</span></span></span></strong></span></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span>mysql&gt; grant replication slave on *.* to slaveuser@'192.168.0.83' identified by 'slavepw';</span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span>mysql&gt;FLUSH PRIVILEGES;</span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#ccffff none repeat scroll 0 50%;"><strong><span style="font-size:small;"><span style="color:#000000;">Now, enter the following command on Master2 for create/grant user level access on the database to Master1.</span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span>mysql&gt; grant replication slave on *.* to user@'192.168.0.82' identified by 'user';</span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span>mysql&gt;FLUSH PRIVILEGES;</span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#999999 none repeat scroll 0 50%;"><strong><span style="color:#00ffff;">Now make slave both machines to each other.</span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#e6e6e6 none repeat scroll 0 50%;"><strong><span style="text-decoration:underline;">On <span style="color:#0000ff;">Master1</span> enter the following:</span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span>mysql&gt; show master status;</span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">+----------------------+----------+--------------+-----------------------+</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">| File                 | Position | Binlog_Do_DB | Binlog_Ignore_DB      |</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">+----------------------+----------+--------------+-----------------------+</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">| <span style="color:#0000ff;">mysql-bin-log.000017</span> |      <span style="color:#ff3366;">289</span> |              | mysql,test,mysql,test | </span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">+----------------------+----------+--------------+-----------------------+</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">1 row in set (0.00 sec)</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#e6e6ff none repeat scroll 0 50%;"><strong><span style="font-size:x-small;"><span style="font-family:URW Bookman L;">NOTE:This <span style="color:#0000ff;">mysql-bin-log</span> file used to read data by the slave servers to replicate Database. Copy file name and position i.e; (<span style="color:#ff3366;">289</span>).</span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#e6e6e6 none repeat scroll 0 50%;"><strong><span style="text-decoration:underline;"><span style="font-size:small;">Now make <span style="color:#33cc66;">Master2</span> the slave of <span style="color:#0000ff;">Master1.</span></span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#e6e6e6 none repeat scroll 0 50%;"><strong><span style="text-decoration:underline;"><span style="font-size:small;">Enter the following command on <span style="color:#00ae00;">Master2</span>:</span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin:0.02in 0.12in 0.04in 0.09in;">mysql&gt; stop slave;</p>
<p class="western" style="margin:0.02in 0.12in 0.04in 0.09in;"><code><span><span style="font-size:x-small;">mysql&gt; CHANGE MASTER TO MASTER_HOST='192.168.0.82', MASTER_USER='user', MASTER_PASSWORD='user', MASTER_LOG_FILE='mysql-bin-log.0000017', MASTER_LOG_POS=98;</span></span></code></p>
<p class="western" style="margin:0.02in 0.12in 0.04in 0.09in;"><code><span><span style="font-size:x-small;">mysql&gt;start slave;</span></span></code></p>
<p class="western" style="margin:0.02in 0.12in 0.04in 0.09in;"><code><span><span style="font-size:x-small;">mysql&gt;show slave status\G;</span></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code><span style="background:#00ae00 none repeat scroll 0 50%;"><strong><span style="font-size:x-small;"><span style="color:#ffffcc;">It will show you something inside the output:</span></span></strong></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code><span><span style="font-size:x-small;"> Master_Log_File: mysql-bin-log.000017</span></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;">
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code> <span><span style="font-size:x-small;">Read_Master_Log_Pos: 289</span></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;">
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code> <span><span style="font-size:x-small;">Relay_Log_File: localhost-relay-bin.000026</span></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;">
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code> <span><span style="font-size:x-small;">Relay_Log_Pos: 239</span></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;">
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code> <span><span style="font-size:x-small;">Relay_Master_Log_File: mysql-bin-log.000017</span></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;">
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code><span><span style="font-size:x-small;"> |</span></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code><span><span style="font-size:x-small;"> |</span></span></code></p>
<p class="western" style="margin:0.04in 0.12in 0.04in 0.09in;"><code><span><span style="font-size:x-small;"> Seconds_Behind_Master: 0</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#00ae00 none repeat scroll 0 50%;"><strong><span style="font-size:x-small;"><span style="color:#ffff99;">If it is showing Seconds_Behind_Master not “NULL” then this slave is working fine.</span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><strong><span style="background:#2300dc none repeat scroll 0 50%;">Then for making Master1 slave to Master2, we need Master2 machine&#8217;s mysql-bin-log and position, for that run the following command for required information:</span></strong></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">mysql&gt; show master status;</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">+----------------------+----------+--------------+-----------------------+</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">| File                 | Position | Binlog_Do_DB | Binlog_Ignore_DB      |</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">+----------------------+----------+--------------+-----------------------+</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">| <span style="color:#0000ff;">mysql-bin-log.000002</span> |      <span style="color:#ff3366;">574</span> |              | mysql,test,mysql,test | </span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">+----------------------+----------+--------------+-----------------------+</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;">1 row in set (0.00 sec)</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#e6e6ff none repeat scroll 0 50%;"><strong><span style="font-size:x-small;"><span style="font-family:URW Bookman L;">NOTE:This <span style="color:#0000ff;">mysql-bin-log</span> file used to read data by the slave servers to replicate database. Copy file name and position i.e; (<span style="color:#ff3366;">574</span>).</span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#e6e6e6 none repeat scroll 0 50%;"><strong><span style="text-decoration:underline;"><span style="font-size:small;"><span style="color:#000000;">Now make </span><span style="color:#0000ff;">Master1</span><span style="color:#000000;"> the slave of </span><span style="color:#33cc66;">Master2</span></span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#e6e6e6 none repeat scroll 0 50%;"><strong><span style="text-decoration:underline;"><span style="font-size:small;"><span style="color:#000000;">Enter the following command on </span><span style="color:#0000ff;">Master1</span><span style="color:#000000;">:</span></span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0.06in;">mysql&gt; stop slave;</p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0.06in;"><code><span><span style="font-size:x-small;">mysql&gt; CHANGE MASTER TO MASTER_HOST='192.168.0.83', MASTER_USER='user', MASTER_PASSWORD='user', MASTER_LOG_FILE='mysql-bin-log.000002', MASTER_LOG_POS=98;</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0.06in;"><code><span><span style="font-size:x-small;">mysql&gt; start slave;</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0.06in;"><code><span><span style="font-size:x-small;">mysql&gt;show slave status\G;</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#33cc66 none repeat scroll 0 50%;"><strong><span style="font-size:x-small;"><span style="color:#ffffcc;">It will show you something inside the output:</span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#33cc66 none repeat scroll 0 50%;"><strong><span style="font-size:x-small;"><span style="color:#ffffcc;"><br />
</span></span></strong></span></code></p>
<p class="western" style="margin:0.06in 0.12in 0 0.09in;"><code><span><span style="font-size:x-small;"> Master_Log_File: mysql-bin-log.000002</span></span></code></p>
<p class="western" style="margin:0.02in 0.12in 0.04in 0.09in;"><code> <span><span style="font-size:x-small;">Read_Master_Log_Pos: 574</span></span></code></p>
<p class="western" style="margin:0.02in 0.12in 0.04in 0.09in;"><code> <span><span style="font-size:x-small;">Relay_Log_File: mysqld-relay-bin.000003</span></span></code></p>
<p class="western" style="margin:0.02in 0.12in 0.04in 0.09in;"><code> <span><span style="font-size:x-small;">Relay_Log_Pos: 239</span></span></code></p>
<p class="western" style="margin:0.02in 0.12in 0.04in 0.09in;"><code> <span><span style="font-size:x-small;">Relay_Master_Log_File: mysql-bin-log.000002</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;"> |</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;"> |</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span><span style="font-size:x-small;"> Seconds_Behind_Master: 0</span></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#00ae00 none repeat scroll 0 50%;"><strong><span style="font-size:x-small;"><span style="color:#ffff00;">If it is showing Seconds_Behind_Master not “NULL” then this slave is working fine.</span></span></strong></span></code></p>
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;">
<p class="western" style="margin-left:0.09in;margin-right:0.12in;margin-bottom:0;"><code><span style="background:#00ae00 none repeat scroll 0 50%;"><strong><span style="font-size:x-small;"><span style="color:#ffff00;"><span style="background-color:#ffffff;font-size:small;color:#000000;">And now do some testing like create/delete database and tables on one machine and check on other, is it showing the changes???? if both are showing same data then that means your replication is working fine.</span><br />
</span></span></strong></span></code></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/manojsamtani.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/manojsamtani.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/manojsamtani.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/manojsamtani.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/manojsamtani.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/manojsamtani.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/manojsamtani.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/manojsamtani.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/manojsamtani.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/manojsamtani.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/manojsamtani.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/manojsamtani.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/manojsamtani.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/manojsamtani.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/manojsamtani.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/manojsamtani.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=manojsamtani.wordpress.com&amp;blog=3789285&amp;post=5&amp;subd=manojsamtani&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://manojsamtani.wordpress.com/2008/07/09/mysql-master-master-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3110ebc6609fb2d50a4ac89fef586762?s=96&#38;d=identicon" medium="image">
			<media:title type="html">mannu</media:title>
		</media:content>
	</item>
		<item>
		<title>DomainKeys with Sendmail</title>
		<link>http://manojsamtani.wordpress.com/2008/07/09/domainkeys-with-sendmail/</link>
		<comments>http://manojsamtani.wordpress.com/2008/07/09/domainkeys-with-sendmail/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 06:55:51 +0000</pubDate>
		<dc:creator>manojsamtani</dc:creator>
				<category><![CDATA[mail server]]></category>

		<guid isPermaLink="false">http://manojsamtani.wordpress.com/?p=3</guid>
		<description><![CDATA[Required Packages Sendmail full package like sendmail, sendmail-devel etc.. (should be 8.13 or above version) OpenSSL SASL Packages Download the Package of dk-milter (dk-milter-1.0.0.tar.gz) tar zxvf dk-milter-1.0.0.tar.gz cd dk-milter-1.0.0 cd devtools/Site and add/modify the following lines to site.config.m4 APPENDDEF(`conf_sendmail_ENVDEF&#8217;, `-DMILTER&#8217;) APPENDDEF(`confENVDEF&#8217;,`-DSASL -DSTARTTLS&#8217;) APPENDDEF(`confLIBS&#8217;, `-lsasl -lssl -lcrypto&#8217;) APPENDDEF(`confINCDIRS&#8217;, `-I/usr/local/ssl/include &#8216;) APPENDDEF(`confLIBDIRS&#8217;, `-L/usr/local/ssl/lib &#8216;) APPENDDEF(`confENVDEF&#8217;, `-D_FFR_ANTICIPATE_SENDMAIL_MUNGE &#8216;) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=manojsamtani.wordpress.com&amp;blog=3789285&amp;post=3&amp;subd=manojsamtani&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:small;">Required Packages<br />
Sendmail full package like sendmail, sendmail-devel etc..<br />
(should be 8.13 or above version)<br />
OpenSSL<br />
SASL Packages</span></p>
<p>Download the Package of dk-milter (dk-milter-1.0.0.tar.gz)</p>
<p>tar zxvf dk-milter-1.0.0.tar.gz<br />
cd dk-milter-1.0.0<br />
cd devtools/Site<br />
and add/modify the following lines to site.config.m4<br />
APPENDDEF(`conf_sendmail_ENVDEF&#8217;, `-DMILTER&#8217;)<br />
APPENDDEF(`confENVDEF&#8217;,`-DSASL -DSTARTTLS&#8217;)<br />
APPENDDEF(`confLIBS&#8217;, `-lsasl -lssl -lcrypto&#8217;)<br />
APPENDDEF(`confINCDIRS&#8217;, `-I/usr/local/ssl/include &#8216;)<br />
APPENDDEF(`confLIBDIRS&#8217;, `-L/usr/local/ssl/lib &#8216;)<br />
APPENDDEF(`confENVDEF&#8217;, `-D_FFR_ANTICIPATE_SENDMAIL_MUNGE &#8216;)</p>
<p>Add the following lines to dk-milter-1.0.0/dk-filter/Makefile.m4</p>
<p>APPENDDEF(`confLIBS&#8217;, `-lssl -lcrypto&#8217;)</p>
<p>dnl Enable and edit these paths as per your configuration:</p>
<p>APPENDDEF(`confINCDIRS&#8217;, `-I/usr/local/ssl/include &#8216;)<br />
APPENDDEF(`confLIBDIRS&#8217;, `-L/usr/local/ssl/lib &#8216;)<br />
bldPUSH_SMLIB(`dk&#8217;)<br />
APPENDDEF(`confINCDIRS&#8217;, `-I../libdk/ &#8216;)<br />
bldPUSH_SMLIB(`sm&#8217;)<br />
APPENDDEF(`confINCDIRS&#8217;, `-I/usr/local/sendmail/include&#8217;)<br />
APPENDDEF(`confLIBDIRS&#8217;, `-L/usr/local/sendmail/libmilter&#8217;)<br />
APPENDDEF(`confLIBDIRS&#8217;, `-L/usr/local/sendmail/libsm&#8217;)<br />
APPENDDEF(`confLIBDIRS&#8217;, `-L/usr/local/sendmail/libsmdb&#8217;)<br />
APPENDDEF(`confLIBDIRS&#8217;, `-L/usr/local/sendmail/libsmutil&#8217;)<br />
And add the following line(s) to sendmail.mc<br />
INPUT_MAIL_FILTER(`dk-filter&#8217;, `S=inet:5000@localhost&#8217;)<br />
dk-filter is domain key filter and 5000 is port on which dk-filter daemon will listen&#8230;</p>
<p>Then goto the dk-milter-1.0.0 directory and run the following commands<br />
1) ./Build<br />
2) ./Build install</p>
<p>Now create servers public/private key pair for the domain using the following command:<br />
1) openssl genrsa -out rsa.private 1024<br />
2) openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM<br />
Now change private key name to like test.com_key.pem</p>
<p>Now time to DNS TXT record entry with public key</p>
<p>mail._domainkey.test.com. 1D IN TXT &#8220;k=rsa; t=y;<br />
p=MHwwDQYJKoZIhvcNAQEBBQADawAwaA<br />
JhAJUf/A69N7tYPcoursysqYFzBl3+yzCCUsNQA<br />
Y6TIcD02OEix1xETOOubJ1Z5i7UrR3E36aEeeH<br />
A9tdDu1P+xvQ6PoQEXeevGWfs61j4lVRQErx4K<br />
m+KKcqja6nSgZbflQIDAQAB&#8221;</p>
<p>Replace test.com with your domain, and *mail* in the DNS record *mail*._domainkey.test.com. is selector to select the key.</p>
<p>Create a user for dk-milter like dkuser and run the following command to start dk-milter for your server.<br />
dk-filter -l -p inet:5000@localhost -c nofws -d test.com -D -H -s<br />
/usr/share/ssl/private/test.com_key.pem -S mail -u dkuser -m MTA</p>
<p>restart sendmail service.</p>
<p>Send mail to any Yahoo!/GMail ID and check to see whether the<br />
authentication-results header shows result as pass or fail.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/manojsamtani.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/manojsamtani.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/manojsamtani.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/manojsamtani.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/manojsamtani.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/manojsamtani.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/manojsamtani.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/manojsamtani.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/manojsamtani.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/manojsamtani.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/manojsamtani.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/manojsamtani.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/manojsamtani.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/manojsamtani.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/manojsamtani.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/manojsamtani.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=manojsamtani.wordpress.com&amp;blog=3789285&amp;post=3&amp;subd=manojsamtani&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://manojsamtani.wordpress.com/2008/07/09/domainkeys-with-sendmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3110ebc6609fb2d50a4ac89fef586762?s=96&#38;d=identicon" medium="image">
			<media:title type="html">mannu</media:title>
		</media:content>
	</item>
	</channel>
</rss>
