<?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>MySQL Preacher &#187; sandbox</title>
	<atom:link href="http://mysqlpreacher.com/wordpress/tag/sandbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://mysqlpreacher.com/wordpress</link>
	<description>A MySQL blog, from a MySQL DBA</description>
	<lastBuildDate>Wed, 16 Jun 2010 13:13:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Circular Replication Implementation / Testing using MySQL Sandbox</title>
		<link>http://mysqlpreacher.com/wordpress/2009/01/mysql-sandbox-circular-replication-implementation-testing/</link>
		<comments>http://mysqlpreacher.com/wordpress/2009/01/mysql-sandbox-circular-replication-implementation-testing/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 16:11:15 +0000</pubDate>
		<dc:creator>Darren Cassar</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Intermediate]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[circular replication]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[sandbox]]></category>

		<guid isPermaLink="false">http://mysqlpreacher.com/wordpress/?p=66</guid>
		<description><![CDATA[This is a simple mysql circular replication implementation on a single machine (just a proof of concept) which can easily be done on a broader scale. Just be aware of the cons of circular replication which mainly gets down to: once a node freaks out or stops for one reason or the other, it&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple mysql circular replication implementation on a single machine (just a proof of concept) which can easily be done on a broader scale. Just be aware of the cons of circular replication which mainly gets down to: once a node freaks out or stops for one reason or the other, it&#8217;s a bitch and you need to take care of IMMEDIATELY.</p>
<p>Download Sandbox from https://launchpad.net/mysql-sandbox/+download<br />
Download MySQL from http://dev.mysql.com/downloads</p>
<p>Copy the downloaded software onto the your *nix box onto any folder of your preference called $BASEDIR</p>
<p>run:</p>
<p>cd /$BASEDIR</p>
<p>gunzip mysql_sandbox_X.X.XX.tar.gz<br />
tar -xf mysql_sandbox_X.X.XX.tar</p>
<p>ln -s mysql_sandbox_X.X.XX sandbox</p>
<p>time /$BASEDIR/sandbox/make_replication_sandbox &#8211;circular=4 &#8211;topology=circular /$BASEDIR/mysql-5.1.30-linux-x86_64-glibc23.tar.gz</p>
<blockquote><p><code><br />
user@hostname $ time /$BASEDIR/sandbox/make_replication_sandbox --circular=4 --topology=circular /$BASEDIR/mysql-5.1.30-linux-x86_64-glibc23.tar.gz<br />
installing node 1<br />
installing node 2<br />
installing node 3<br />
installing node 4<br />
# server: 1:<br />
# server: 2:<br />
# server: 3:<br />
# server: 4:<br />
# server: 1:<br />
# server: 2:<br />
# server: 3:<br />
# server: 4:<br />
Circular replication activated<br />
group directory installed on /$BASEDIR/sandboxes/rcsandbox_5_1_30<br />
</code><code><br />
real    1m47.913s<br />
user    0m6.364s<br />
sys     0m2.445s<br />
</code><code><br />
cd /$BASEDIR/sandboxes/rcsandbox_5_1_30<br />
</code><code><br />
user@hostname $ ./n1<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 9<br />
Server version: 5.1.30-log MySQL Community Server (GPL)<br />
</code><code><br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</code><code><br />
node1 [localhost] {msandbox} ((none)) &gt; show databases;<br />
+--------------------+<br />
| Database           |<br />
+--------------------+<br />
| information_schema |<br />
| mysql              |<br />
| test               |<br />
+--------------------+<br />
3 rows in set (0.01 sec)<br />
</code><code><br />
node1 [localhost] {msandbox} ((none)) &gt; show variables like 'port';<br />
+---------------+-------+<br />
| Variable_name | Value |<br />
+---------------+-------+<br />
| port          | 17001 |<br />
+---------------+-------+<br />
1 row in set (0.00 sec)<br />
</code><code><br />
node1 [localhost] {msandbox} ((none)) &gt; exit<br />
Bye<br />
user@hostname $ ./n2<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 9<br />
Server version: 5.1.30-log MySQL Community Server (GPL)<br />
</code><code><br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</code><code><br />
node2 [localhost] {msandbox} ((none)) &gt; show variables like 'port';<br />
+---------------+-------+<br />
| Variable_name | Value |<br />
+---------------+-------+<br />
| port          | 17002 |<br />
+---------------+-------+<br />
1 row in set (0.00 sec)<br />
</code><code><br />
node2 [localhost] {msandbox} ((none)) &gt; exit<br />
Bye<br />
user@hostname $ ./n3<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 9<br />
Server version: 5.1.30-log MySQL Community Server (GPL)<br />
</code><code><br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</code><code><br />
node3 [localhost] {msandbox} ((none)) &gt; show variables like 'port';<br />
+---------------+-------+<br />
| Variable_name | Value |<br />
+---------------+-------+<br />
| port          | 17003 |<br />
+---------------+-------+<br />
1 row in set (0.00 sec)<br />
</code><code><br />
node3 [localhost] {msandbox} ((none)) &gt; exit<br />
Bye<br />
user@hostname $ ./n4<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 8<br />
Server version: 5.1.30-log MySQL Community Server (GPL)<br />
</code><code><br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</code><code><br />
node4 [localhost] {msandbox} ((none)) &gt; show variables like 'port';<br />
+---------------+-------+<br />
| Variable_name | Value |<br />
+---------------+-------+<br />
| port          | 17004 |<br />
+---------------+-------+<br />
1 row in set (0.00 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} ((none)) &gt; exit<br />
Bye<br />
</code><code><br />
user@hostname $ cd ..<br />
user@hostname $ ./n1<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 10<br />
Server version: 5.1.30-log MySQL Community Server (GPL)<br />
</code><code><br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</code><code><br />
node1 [localhost] {msandbox} ((none)) &gt; show databases;<br />
+--------------------+<br />
| Database           |<br />
+--------------------+<br />
| information_schema |<br />
| mysql              |<br />
| test               |<br />
+--------------------+<br />
3 rows in set (0.00 sec)<br />
</code><code><br />
node1 [localhost] {msandbox} ((none)) &gt; create database dba;<br />
Query OK, 1 row affected (0.04 sec)<br />
</code><code><br />
node1 [localhost] {msandbox} ((none)) &gt; USE dba;<br />
Database changed<br />
node1 [localhost] {msandbox} (dba) &gt; CREATE TABLE `instance` (<br />
-&gt; `dbid` tinyint unsigned NOT NULL,<br />
-&gt; `hostname` varchar(255) NOT NULL,<br />
-&gt; `port` smallint unsigned NOT NULL,<br />
-&gt; PRIMARY KEY (`dbid`)<br />
-&gt; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;<br />
Query OK, 0 rows affected (0.03 sec)<br />
</code><code><br />
node1 [localhost] {msandbox} (dba) &gt; CREATE TABLE `backups` (<br />
-&gt; `instance` tinyint unsigned NOT NULL,<br />
-&gt; `dbname` varchar(255) NOT NULL,<br />
-&gt; `date_time` datetime NOT NULL,<br />
-&gt; `dumpsize` varchar(16) NOT NULL,<br />
-&gt; `checksum` varchar(20) NOT NULL,<br />
-&gt; FOREIGN KEY (instance) REFERENCES instance(dbid) ON UPDATE CASCADE ON DELETE RESTRICT<br />
-&gt; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;<br />
Query OK, 0 rows affected (0.02 sec)<br />
</code><code><br />
node1 [localhost] {msandbox} (dba) &gt; CREATE TABLE `table_size` (<br />
-&gt; `instance` tinyint unsigned NOT NULL,<br />
-&gt; `dbname` varchar(255) NOT NULL,<br />
-&gt; `tbname` varchar(255) NOT NULL,<br />
-&gt; `size_of_data` decimal(18,0) NOT NULL,<br />
-&gt; `size_of_index` decimal(18,0) NOT NULL,<br />
-&gt; `total` decimal(18,0) NOT NULL,<br />
-&gt; `date_time` datetime NOT NULL,<br />
-&gt; FOREIGN KEY (instance) REFERENCES instance(dbid) ON UPDATE CASCADE ON DELETE RESTRICT<br />
-&gt; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;<br />
Query OK, 0 rows affected (0.01 sec)<br />
</code><code><br />
node1 [localhost] {msandbox} (dba) &gt; CREATE TABLE `memory` (<br />
-&gt; `instance` tinyint unsigned NOT NULL,<br />
-&gt; `date_time` datetime NOT NULL,<br />
-&gt; `size` decimal(18,0) NOT NULL,<br />
-&gt; `rss` decimal(18,0) NOT NULL,<br />
-&gt; FOREIGN KEY (instance) REFERENCES instance(dbid) ON UPDATE CASCADE ON DELETE RESTRICT<br />
-&gt; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;<br />
Query OK, 0 rows affected (0.01 sec)<br />
</code><code><br />
node1 [localhost] {msandbox} (dba) &gt; exit<br />
Bye<br />
user@hostname $ ./n4<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 9<br />
Server version: 5.1.30-log MySQL Community Server (GPL)<br />
</code><code><br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</code><code><br />
node4 [localhost] {msandbox} ((none)) &gt; use dba;<br />
Reading table information for completion of table and column names<br />
You can turn off this feature to get a quicker startup with -A<br />
</code><code><br />
Database changed<br />
node4 [localhost] {msandbox} (dba) &gt; CREATE TABLE `connectivity` (<br />
-&gt; `instance` tinyint unsigned NOT NULL,<br />
-&gt; `date_time` datetime NOT NULL,<br />
-&gt; `established` smallint unsigned NOT NULL,<br />
-&gt; `listen` smallint unsigned NOT NULL,<br />
-&gt; `close` smallint unsigned NOT NULL,<br />
-&gt; `time_wait` smallint unsigned NOT NULL,<br />
-&gt; FOREIGN KEY (instance) REFERENCES instance(dbid) ON UPDATE CASCADE ON DELETE RESTRICT<br />
-&gt; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;<br />
Query OK, 0 rows affected (0.01 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} (dba) &gt; show tables;<br />
+---------------+<br />
| Tables_in_dba |<br />
+---------------+<br />
| backups       |<br />
| connectivity  |<br />
| instance      |<br />
| memory        |<br />
| table_size    |<br />
+---------------+<br />
5 rows in set (0.00 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} (dba) &gt; select * from memory;<br />
Empty set (0.00 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} (dba) &gt; show create table memory;<br />
+--------+---------------------------------------------------------+<br />
| Table  | Create Table                                                                                                                                                                                                                                                                                                                                    |<br />
+--------+---------------------------------------------------------+<br />
| memory | CREATE TABLE `memory` (<br />
`instance` tinyint(3) unsigned NOT NULL,<br />
`date_time` datetime NOT NULL,<br />
`size` decimal(18,0) NOT NULL,<br />
`rss` decimal(18,0) NOT NULL,<br />
KEY `instance` (`instance`),<br />
CONSTRAINT `memory_ibfk_1` FOREIGN KEY (`instance`) REFERENCES `instance` (`dbid`) ON UPDATE CASCADE<br />
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |<br />
+--------+---------------------------------------------------------+<br />
1 row in set (0.00 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} (dba) &gt; insert into instance (dbid,hostname,port) values ('1','machine1','17001');<br />
Query OK, 1 row affected (0.00 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} (dba) &gt; select * from instance;<br />
+------+----------+-------+<br />
| dbid | hostname | port  |<br />
+------+----------+-------+<br />
|    1 | machine1 | 17001 |<br />
+------+----------+-------+<br />
1 row in set (0.00 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} (dba) &gt; insert into memory (instance,date_time,size,rss) values('1',now(),'42252431','2543234');<br />
Query OK, 1 row affected (0.00 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} (dba) &gt; select * from memory;<br />
+----------+---------------------+----------+---------+<br />
| instance | date_time           | size     | rss     |<br />
+----------+---------------------+----------+---------+<br />
|        1 | 2009-01-28 16:27:00 | 42252431 | 2543234 |<br />
+----------+---------------------+----------+---------+<br />
1 row in set (0.00 sec)<br />
</code><code><br />
node4 [localhost] {msandbox} (dba) &gt; exit<br />
Bye<br />
user@hostname $ ./n2<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 10<br />
Server version: 5.1.30-log MySQL Community Server (GPL)<br />
</code><code><br />
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br />
</code><code><br />
node2 [localhost] {msandbox} ((none)) &gt; use dba;<br />
Reading table information for completion of table and column names<br />
You can turn off this feature to get a quicker startup with -A<br />
</code><code><br />
Database changed<br />
node2 [localhost] {msandbox} (dba) &gt; select * from memory;<br />
+----------+---------------------+----------+---------+<br />
| instance | date_time           | size     | rss     |<br />
+----------+---------------------+----------+---------+<br />
|        1 | 2009-01-28 16:27:00 | 42252431 | 2543234 |<br />
+----------+---------------------+----------+---------+<br />
1 row in set (0.00 sec)<br />
</code><code><br />
node2 [localhost] {msandbox} (dba) &gt; show tables;<br />
+---------------+<br />
| Tables_in_dba |<br />
+---------------+<br />
| backups       |<br />
| connectivity  |<br />
| instance      |<br />
| memory        |<br />
| table_size    |<br />
+---------------+<br />
5 rows in set (0.00 sec)<br />
</code><code><br />
node2 [localhost] {msandbox} (dba) &gt; exit<br />
Bye<br />
user@hostname $ ./check_slaves<br />
node # 1<br />
Slave_IO_Running: Yes<br />
Slave_SQL_Running: Yes<br />
node # 2<br />
Slave_IO_Running: Yes<br />
Slave_SQL_Running: Yes<br />
node # 3<br />
Slave_IO_Running: Yes<br />
Slave_SQL_Running: Yes<br />
node # 4<br />
Slave_IO_Running: Yes<br />
Slave_SQL_Running: Yes<br />
</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mysqlpreacher.com/wordpress/2009/01/mysql-sandbox-circular-replication-implementation-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
