<?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; Replication</title>
	<atom:link href="http://www.hackadmin.com/category/replication/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>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>Quick and Dirty DRBD with HA</title>
		<link>http://www.hackadmin.com/2008/05/06/quick-and-dirty-drbd-with-ha/</link>
		<comments>http://www.hackadmin.com/2008/05/06/quick-and-dirty-drbd-with-ha/#comments</comments>
		<pubDate>Tue, 06 May 2008 13:46:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Replication]]></category>
		<category><![CDATA[DRBD]]></category>
		<category><![CDATA[failover]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[ha]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[server pair]]></category>
		<category><![CDATA[slave]]></category>

		<guid isPermaLink="false">http://www.hackadmin.com/2008/05/06/quick-and-dirty-drbd-with-ha/</guid>
		<description><![CDATA[I had to dig a while on this one.  I think it was mostly because it took me a while to get what was going on.  Basically, I have 4 server pairs that I needed to setup.  Three where to be mysql instances, a master instance, a slave instance that was only [...]]]></description>
			<content:encoded><![CDATA[<p>I had to dig a while on this one.  I think it was mostly because it took me a while to get what was going on.  Basically, I have 4 server pairs that I needed to setup.  Three where to be mysql instances, a master instance, a slave instance that was only a partial replication of the master and a global slave instance.  The 4th pair was for crunching stats from another series of XML servers.</p>
<p>So I built all of these instances to give hardware based failover options in case of total failure or need for upgrade.  I honestly am not counting on any of these instances to be a seamless failover scenario, but I figure it could work in a crisis and worst case, I have a copy of important data that is ready to go live.</p>
<p><span id="more-9"></span>Needless to say, through setting up 4 pairs of servers I got handy with the routine that I knew worked.  Here was my process:</p>
<p><strong>DRBD Setup</strong></p>
<p>1.) Kickstart both boxes with the following KS disk layout:</p>
<p>part / &#8211;size 10000<br />
part /data &#8211;size 5000 &#8211;grow<br />
part /boot &#8211;size 100<br />
part swap &#8211;size 2000</p>
<p>The data slice is what I will share between the DRBD pair.</p>
<p>*NOTE &#8211; The next steps &#8211; Step 2 through 9 need to be completed on both servers in the HA, DRBD setup.</p>
<p>2.) Download the latest DRBD <a title="DRBD Source" href="http://oss.linbit.com/drbd/8.2/drbd-8.2.5.tar.gz">source.</a></p>
<p>3.) I wanted to make the install much harder than it actually is, so I spent time on many sites staring at kernel patches and such.. Oh well.  When all was said and done, I really just needed to make sure the kernel source was in my kickstart, then run the following from within the source directory:</p>
<p>make clean all<br />
make install<br />
make install-tools</p>
<p>4.) Brew up a config file for DRBD ( there should be a default in /etc/drbd.conf ) :</p>
<p># The important logicstics as best I can tell.<br />
# Protocol &#8211; there are 3 options I chose C as it appeared to be the best to use with mysql<br />
# syncer &#8211; this was a head scratcher.  When I first tried to sync my disks I had left it at default<br />
# and our 56G chunks were taking about 6 hours to complete.  I&#8217;m not only on GB interfaces here<br />
# but the servers in question are blades and they share a chassis backplane, so I cranked it up<br />
# 500M is close to the threshold, don&#8217;t remember what it was  but I hit it when I was being all<br />
# crazy with this setting to start.<br />
# Server Names &#8211; in this example, server1 and server2, make sure they are in /etc/host<br />
# Resource &#8211; this is going to be used through out the example as a way for the DRBD system to  identify t<br />
# the config params that create this disk replication scenario</p>
<p>global {<br />
usage-count yes;<br />
}<br />
common {<br />
protocol C;<br />
syncer { rate 500M; }<br />
}<br />
resource r0 {<br />
on server1 {<br />
device    /dev/drbd1;<br />
disk      /dev/sda3;<br />
address   192.168.195.124:7789;<br />
meta-disk internal;<br />
}<br />
on server2 {<br />
device    /dev/drbd1;<br />
disk      /dev/sda3;<br />
address   192.168.195.125:7789;<br />
meta-disk internal;<br />
}<br />
}</p>
<p>5.) Next, I umounted the disk in question, since it was built with kickstart, it came up as a mounted ext3 slice at /data</p>
<p>6.) Then I zeroed out /dev/sda3 ( what was our /data mount ) with the following command:</p>
<p>dd if=/dev/zero bs=1M count=1 of=/dev/sda3 ; sync</p>
<p>7.) Next, we need to create the device that we refer to in the config file /dev/drbd1 .  I found a bash line in a search that creates several so I just did it up  in case I ever wanted to expand this config:</p>
<p>for i in `seq 0 1` ; do mknod -m 0660 /dev/drbd$i b 147 $i; done</p>
<p>Just change the seq numbers if you want more or less.</p>
<p>8.) Next we use the drbdadm command to create our resource ( r0 ):</p>
<p>drbdadm create-md r0</p>
<p>9.) Start the drbd service</p>
<p>/etc/init.d/drbd start</p>
<p>10.) Pick the server that you want to be the primary in the pair and run the following command:</p>
<p>drbdadm &#8212; &#8211;overwrite-data-of-peer primary r0</p>
<p>This will create the sync between the 2 disks you can watch the progress of the sync with the following command:</p>
<p>watch cat /proc/drbd</p>
<p>11.) Once the disks are in sync, create a file system on both sides.  This where it can get kind of tricky if you&#8217;re not sure what it&#8217;s doing.  We just told server1 to be the primary server in the pair so when you look at /proc/drbd you&#8217;ll see the following that verifies this is the case:</p>
<p>1: cs:Connected st:Primary/Secondary ds:UpToDate/UpToDate C r&#8212;</p>
<p>I added the following to /etc/fstab so I could mount and make a file system:</p>
<p>/dev/drbd1            /data                   ext3    defaults        1 2</p>
<p>Then:</p>
<p>mount /data</p>
<p>Then:</p>
<p>/sbin/mkfs -t ext3 /dev/drbd1</p>
<p>12.) Now we are going to create the filesystem on the secondary server.  ( I&#8217;m not sure this is entirely necessary, but it&#8217;s a good exercise in moving the slice around ).</p>
<p>* Unmount the /data slice on the primary server:</p>
<p>umount /data</p>
<p>* Make the primary box ( server1 in our case ) the secondary in the drbd pair:</p>
<p>drbdadm secondary r0</p>
<p>* Make the secondary box ( server2 in our case ) the primary in the drbd pair:</p>
<p>drbdadm primary r0</p>
<p>* Add the /etc/fstab line</p>
<p>/dev/drbd1            /data                   ext3    defaults        1 2</p>
<p>* Mount the slice:</p>
<p>mount /data</p>
<p>* Create the filesystem:</p>
<p>/sbin/mkfs -t ext3 /dev/drbd1</p>
<p>Once this is complete, use the same series of commands to make server1 the primary, remove all of the /etc/fstab entries for /data ( Linux HA is going to take care of this for us ) and move on to the HA config below.</p>
<p><strong>Linux HA Setup</strong></p>
<p>The goal of this setup is as follows:</p>
<p>a.) Choose a VIP for your HA pair</p>
<p>b.) Build a config file that starts and stops services on startup and failover</p>
<p>HA is pretty simple when all is said and done ( at least in this config ).  It comes rolled up with scripts that take care of the following:</p>
<p>- Manage VIP<br />
- Manage DRBD resource<br />
- Mounting file systems<br />
- Starting services</p>
<p><strong>Install</strong></p>
<p>To install in my setup I just ran:</p>
<p>yum  -y install heartbeat</p>
<p><strong>Config</strong></p>
<p>Once heartbeat is installed there are 3 files to worry about:</p>
<p>- ha.cf<br />
- haresources<br />
- authkeys</p>
<p>All of these files will live in /etc/ha.d</p>
<p>All of these files must be identical on both servers in the pair.</p>
<p>1.) ha.cf</p>
<p>keepalive 100ms<br />
deadtime 2<br />
warntime 10<br />
initdead 120<br />
bcast   eth1 eth0<br />
autojoin none<br />
auto_failback on<br />
node    server1 server2</p>
<p>You can play with the values of each of these and there is further information <a href="http://www.linux-ha.org/ha.cf">here.</a></p>
<p>Again in this config ( and this should already be done ) .. make sure you have server1 and server2 in /etc/hosts</p>
<p>2.) haresources</p>
<p>This is basically the command file, it tells HA what to do and in what order.  Here is my config file:</p>
<p>Server1 IPaddr::192.168.195.212/24 drbddisk::r0 \<br />
Filesystem::/dev/drbd1::/data::ext3::defaults mysql.server</p>
<p>Breakdown:</p>
<p>Server1  &#8211; This will be the same on both primary and secondary, it tells HA who should be in charge.<br />
IPaddr &#8211;  This identifies the VIP that will be used between the two systems.  If you have multiple NICs, it is smart enough to figure out which one it should be a sub of.</p>
<p>* SIDE NOTE &#8211; In the haresources file, the syntax basically indicates that you are asking HA to run a script.  HA looks for scripts in /etc/ha.d/resource.d and /etc/init.d by default, take the following example:</p>
<p>IPaddr::192.168.195.212/24</p>
<p>This means you are asking HA to run the following:</p>
<p>/etc/ha.d/resource.d/IPaddr 192.168.195.212/24 start</p>
<p>The result will be an added ethernet interface with the VIP for the pair.</p>
<p>* END SIDE NOTE</p>
<p>drbddisk &#8211; This tells HA to use the drbddisk command in /etc/ha.d/resource.d to initialize the drbd resource ( r0 in our case ) and make it primary.</p>
<p>Filesystem &#8211; This tells HA to mount the drbd resource at /data</p>
<p>mysql.server &#8211; This tells HA to use the script in /etc/init.d to fire up mysql</p>
<p>* SIDE NOTE</p>
<p>You can imagine how important the sequence is here.  If I were to try to mount /data before I initialize drbd, it&#8217;s going to fail.  Unfortunately,  HA is not real clear on what is going wrong when it&#8217;s failing, it just fails.  There are log file lines you can use in ha.cf, but everything goes to /var/messages by default so don&#8217;t waste your time.</p>
<p>Also, if you are setting up multiple HA pairs that should not know about other pairs, you need to change the following parameters in your ha.cf:</p>
<p>- Remove this: bcast   eth1 eth0<br />
- Add this: mcast eth0 224.1.2.6 694 1 0</p>
<p>For each pair you will want to modify the broadcast address so that it is unique, so for the second pair you could use this:</p>
<p>- mcast eth0 224.1.2.7 694 1 0</p>
<p>Changing the &#8220;6&#8243; to a &#8220;7&#8243; makes sure that pairs aren&#8217;t chatting with each other and failing.  The result of not doing this is a /var/log/messages file that grows out of control ( I&#8217;m not kidding either, with 4 pairs on the same net this thing was growing at about 500M an hour ).  It also drives the server load up on the pair from all the logd action, to the tune of load 0 when only one pair to load 2 when 4 pairs on the same net.</p>
<p>* END SIDE NOTE</p>
<p>3.) authkeys</p>
<p>This can be pretty generic.  I thought initially changing this secret around would avoid the issue listed in the last side note, it doesn&#8217;t.  The only catch with this file is that it has to have perms of 600 or HA won&#8217;t start.</p>
<p>auth 2<br />
2 sha1 MySecret</p>
<p><strong>Verification</strong></p>
<p>As I have mentioned, the haresources file basically contains script to argument pairs.  It is good practice to walk through all of these with a &#8220;start&#8221;, then go back through with a &#8220;stop&#8221;.  This will ensure that what HA will run will actually work when HA attempts to run them.</p>
<p>Once you are satisfied with the results of your testing, just run /etc/init.d/heartbeat start on each box.  If all goes well, you should see the new VIP on the primary box, the mounted /data slice, and you should be able to log into mysql</p>
<p>* SIDE NOTE</p>
<p>To install mysql I did the following:</p>
<p>- Downloaded preferred tarball<br />
- Changed this in my.cf -  datadir=/data/mysql_data<br />
- Added this to my.cf &#8211; bind-address=192.168.195.212 ( This ensures that mysql binds to the VIP on startup)</p>
<p>* END SIDE NOTE</p>
<p>This may be a bit scattered, read it a couple times and it should all be clear.  This is basically a compilation of 2 days worth of poking at this process to find something that consistently worked.</p>
<p>Good Luck</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hackadmin.com/2008/05/06/quick-and-dirty-drbd-with-ha/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
