<?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>Linux Admin Zone &#187; AWS</title>
	<atom:link href="http://linuxadminzone.com/tag/aws/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxadminzone.com</link>
	<description>Adding more reasons to celebrate Open Source.</description>
	<lastBuildDate>Wed, 09 May 2012 10:17:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to setup Mysql Cluster in Amazon EC2</title>
		<link>http://linuxadminzone.com/how-to-setup-mysql-cluster-in-amazon-ec2/</link>
		<comments>http://linuxadminzone.com/how-to-setup-mysql-cluster-in-amazon-ec2/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 07:41:15 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[mysql cluster]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=22</guid>
		<description><![CDATA[This is a quick Howto for setting up MySQL cluster using Amazon EC2 instances. I have used 3 small instances (1 mgmt + 2 data nodes) from RightScale&#8217;s CentOS 5 public image to test things. I&#8217;ve a working cluster using these steps but there&#8217;s no guarantee that these steps works for you as well. Management [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick Howto for setting up MySQL cluster using Amazon EC2 instances. I have used 3 small instances (1 mgmt + 2 data nodes) from RightScale&#8217;s CentOS 5 public image to test things. I&#8217;ve a working cluster using these steps but there&#8217;s no guarantee that these steps works for you as well.</p>
<p><strong>Management server for cluster:</strong><br />
Although we can set up management server for cluster in one of the data node but we should have a third node as if one of the two MySQL cluster nodes fails, and the management server is not running, then the data on the two cluster nodes will become inconsistent and if the same node fails which have management server, then we will not be able to create another node or configure cluster.</p>
<p>Beginning with MySQL 5.1.6, it is possible to store the non-indexed columns of NDB tables on disk, rather than in RAM as with previous versions of MySQL Cluster. Here I&#8217;m using MySQL 5.1.26-rc as its the latest version while writing this article. </p>
<p>Let&#8217;s dive in practical:<br />
1. Fire up 3 instances and note down their public and private IPs, dedicate roles(mgmt, node) for them and login in management node. Install ncurses library for MySQL compilation requirement:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ yum <span style="color: #c20cb9; font-weight: bold;">install</span> ncurses ncurses-devel</pre></div></div>

<p>2. Download mysql source from its <a href="http://dev.mysql.com/downloads/mysql/5.1.html#source">source download page</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src
$ groupadd mysql
$ useradd <span style="color: #660033;">-g</span> mysql mysql
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>dev.mysql.com<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>Downloads<span style="color: #000000; font-weight: bold;">/</span>MySQL-<span style="color: #000000;">5.1</span><span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.26-rc.tar.gz<span style="color: #000000; font-weight: bold;">/</span>from<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>mirror.services.wisc.edu<span style="color: #000000; font-weight: bold;">/</span>mirrors<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> xzf mysql-5.1.26-rc.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> mysql-5.1.26-rc
<span style="color: #000000; font-weight: bold;">&lt;</span>pre<span style="color: #000000; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">3</span>. Compile and <span style="color: #c20cb9; font-weight: bold;">install</span>: <span style="color: #000000; font-weight: bold;">&lt;/</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>pre <span style="color: #007800;">lang</span>=<span style="color: #ff0000;">&quot;bash&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-community-features</span> <span style="color: #660033;">--with-mysqld-user</span>=mysql <span style="color: #660033;">--with-mysqlmanager</span> <span style="color: #660033;">--with-plugins</span>=ndbcluster 
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p><strong> 4. Create required directories: </strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-cluster<span style="color: #000000; font-weight: bold;">/</span>backup
$ <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> mysql:mysql <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql
$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-cluster
$ <span style="color: #c20cb9; font-weight: bold;">vim</span> config.ini
<span style="color: #7a0874; font-weight: bold;">&#91;</span>NDBD DEFAULT<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #007800;">NoOfReplicas</span>=<span style="color: #000000;">2</span>
<span style="color: #007800;">DataMemory</span>=80M    <span style="color: #666666; font-style: italic;"># How much memory to allocate for data storage</span>
<span style="color: #007800;">IndexMemory</span>=18M   <span style="color: #666666; font-style: italic;"># How much memory to allocate for index storage</span>
<span style="color: #666666; font-style: italic;"># For DataMemory and IndexMemory, we have used the</span>
<span style="color: #666666; font-style: italic;"># default values. Since the &quot;world&quot; database takes up</span>
<span style="color: #666666; font-style: italic;"># only about 500KB, this should be more than enough for</span>
<span style="color: #666666; font-style: italic;"># this example Cluster setup.</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>MYSQLD DEFAULT<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>NDB_MGMD DEFAULT<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>TCP DEFAULT<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;"># Section for the cluster management node</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>NDB_MGMD<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;"># IP address of the management node (this system)</span>
<span style="color: #007800;">HostName</span>=10.252.169.x
<span style="color: #666666; font-style: italic;"># Section for the storage nodes</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>NDBD<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;"># IP address of the first storage node</span>
<span style="color: #007800;">HostName</span>=10.254.237.x
<span style="color: #007800;">DataDir</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-cluster
<span style="color: #007800;">BackupDataDir</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-cluster<span style="color: #000000; font-weight: bold;">/</span>backup
<span style="color: #007800;">DataMemory</span>=2048M
<span style="color: #7a0874; font-weight: bold;">&#91;</span>NDBD<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;"># IP address of the second storage node</span>
<span style="color: #007800;">HostName</span>=10.251.74.x
<span style="color: #007800;">DataDir</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-cluster
<span style="color: #007800;">BackupDataDir</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-cluster<span style="color: #000000; font-weight: bold;">/</span>backup
<span style="color: #007800;">DataMemory</span>=2048M
&nbsp;
<span style="color: #666666; font-style: italic;"># one [MYSQLD] per storage node</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>MYSQLD<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>MYSQLD<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Save and close the file. </p>
<p>5. Start management server. You can also copy ndb_mgmd in system path for easy access.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.26-rc<span style="color: #000000; font-weight: bold;">/</span>storage<span style="color: #000000; font-weight: bold;">/</span>ndb<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>mgmsrv<span style="color: #000000; font-weight: bold;">/</span>ndb_mgmd <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-cluster<span style="color: #000000; font-weight: bold;">/</span>config.ini</pre></div></div>

<p>***</p>
<p><strong>Setup of Node1 and Node2:</strong></p>
<p>1. These settings are identical for Node 1 and Node 2. Let&#8217;s start by adding mysql user and group:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ groupadd mysql 
$ useradd <span style="color: #660033;">-g</span> mysql mysql</pre></div></div>

<p>2. Install required ncurses library for MySQL compilation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ yum <span style="color: #c20cb9; font-weight: bold;">install</span> ncurses ncurses-devel</pre></div></div>

<p>3. Download, compile and install MySQL:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>dev.mysql.com<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>Downloads<span style="color: #000000; font-weight: bold;">/</span>MySQL-<span style="color: #000000;">5.1</span><span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.26-rc.tar.gz<span style="color: #000000; font-weight: bold;">/</span>from<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>mirror.services.wisc.edu<span style="color: #000000; font-weight: bold;">/</span>mirrors<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> xzf mysql-5.1.26-rc.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> mysql-5.1.26-rc
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-community-features</span> <span style="color: #660033;">--with-mysqld-user</span>=mysql <span style="color: #660033;">--with-mysqlmanager</span> <span style="color: #660033;">--with-plugins</span>=ndbcluster 
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>4. Install initial mysql db:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.26-rc<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>mysql_install_db <span style="color: #660033;">--user</span>=mysql</pre></div></div>

<p>5. Create directories:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql-cluster<span style="color: #000000; font-weight: bold;">/</span>backup
$ <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> mysql:mysql <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql</pre></div></div>

<p>6. Copy init script from mysql source to preferred location:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.26-rc<span style="color: #000000; font-weight: bold;">/</span>support-files<span style="color: #000000; font-weight: bold;">/</span>mysql.server <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql.server</pre></div></div>

<p>7. Create config file for MySQL:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>my.cnf
<span style="color: #7a0874; font-weight: bold;">&#91;</span>mysqld<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #007800;">datadir</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql
<span style="color: #007800;">socket</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql.sock
<span style="color: #666666; font-style: italic;"># Default to using old password format for compatibility with mysql 3.x</span>
<span style="color: #666666; font-style: italic;"># clients (those using the mysqlclient10 compatibility package).</span>
<span style="color: #007800;">old_passwords</span>=<span style="color: #000000;">1</span>
ndbcluster
<span style="color: #666666; font-style: italic;"># IP address of the cluster management node</span>
ndb-connectstring=10.253.191.210
default-storage-engine=NDBCLUSTER
<span style="color: #666666; font-style: italic;">#Those are for future tuning</span>
<span style="color: #666666; font-style: italic;">#max_connections=341</span>
<span style="color: #666666; font-style: italic;">#query_cache_size=16M</span>
<span style="color: #666666; font-style: italic;">#thread_concurrency = 4</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>client<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #007800;">port</span>=<span style="color: #000000;">3306</span>
<span style="color: #007800;">socket</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>mysql.sock
<span style="color: #7a0874; font-weight: bold;">&#91;</span>mysql.server<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #007800;">user</span>=mysql
<span style="color: #007800;">basedir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>mysql_cluster<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;"># IP address of the cluster management node</span>
ndb-connectstring=10.253.191.x
<span style="color: #7a0874; font-weight: bold;">&#91;</span>mysqld_safe<span style="color: #7a0874; font-weight: bold;">&#93;</span>
log-error=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>mysqld.log
pid-file=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>mysqld<span style="color: #000000; font-weight: bold;">/</span>mysqld.pid</pre></div></div>

<p>Save and close the file.</p>
<p>8. You can also include MySQL directories in your path (Optional).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>libexec
$ <span style="color: #7a0874; font-weight: bold;">export</span> PATH</pre></div></div>

<p>9. Start MySQL Server now:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>mysql.server start</pre></div></div>

<p>10. Repeat these steps in node 2 and start MySQL on both nodes. MySQL should start without any complain. You should also update the password for root user. </p>
<p><strong>Test the cluster:</strong></p>
<p>1. Focus again on Management node to have a look of Cluster connectivity. Open the ndb cluster management console. You should add this directory in PATH or can copy files to your system bin. (I&#8217;m a bit lazy <img src='http://linuxadminzone.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>mysql-5.1.26-rc<span style="color: #000000; font-weight: bold;">/</span>storage<span style="color: #000000; font-weight: bold;">/</span>ndb<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>mgmclient<span style="color: #000000; font-weight: bold;">/</span>ndb_mgm
<span style="color: #660033;">--</span> NDB Cluster <span style="color: #660033;">--</span> Management Client <span style="color: #660033;">--</span></pre></div></div>

<p>2. Issue command to view status of cluster:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ndb_mgm<span style="color: #000000; font-weight: bold;">&gt;</span> show;
Connected to Management Server at: localhost:<span style="color: #000000;">1186</span>
Cluster Configuration
<span style="color: #660033;">---------------------</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span>ndbd<span style="color: #7a0874; font-weight: bold;">&#40;</span>NDB<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>     <span style="color: #000000;">2</span> node<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">id</span>=<span style="color: #000000;">2</span>    <span style="color: #000000; font-weight: bold;">@</span>10.254.237.x  <span style="color: #7a0874; font-weight: bold;">&#40;</span>Version: 5.1.26, Nodegroup: <span style="color: #000000;">0</span>, Master<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">id</span>=<span style="color: #000000;">3</span>    <span style="color: #000000; font-weight: bold;">@</span>10.251.74.x  <span style="color: #7a0874; font-weight: bold;">&#40;</span>Version: 5.1.26, Nodegroup: <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>ndb_mgmd<span style="color: #7a0874; font-weight: bold;">&#40;</span>MGM<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000;">1</span> node<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">id</span>=<span style="color: #000000;">1</span>    <span style="color: #000000; font-weight: bold;">@</span>10.252.169.x  <span style="color: #7a0874; font-weight: bold;">&#40;</span>Version: 5.1.26<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>mysqld<span style="color: #7a0874; font-weight: bold;">&#40;</span>API<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   <span style="color: #000000;">2</span> node<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">id</span>=<span style="color: #000000;">4</span>    <span style="color: #000000; font-weight: bold;">@</span>10.254.237.x  <span style="color: #7a0874; font-weight: bold;">&#40;</span>Version: 5.1.26<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">id</span>=<span style="color: #000000;">5</span>    <span style="color: #000000; font-weight: bold;">@</span>10.251.74.x  <span style="color: #7a0874; font-weight: bold;">&#40;</span>Version: 5.1.26<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">&lt;/</span>code<span style="color: #000000; font-weight: bold;">&gt;</span>
ndb_mgm<span style="color: #000000; font-weight: bold;">&gt;</span> quit</pre></div></div>

<p>Everything should run fine.</p>
<p>3. Jump on the node 1 (or 2, doesnt matter in a cluster <img src='http://linuxadminzone.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  and try to create db, table and issue commands. BE SURE to use <strong>ENGINE=NDBCLUSTER</strong> while table creation else cluster will not work, means data will not be replicated throughtout cluster. Insert some records and check that on other node.<br />
<strong><br />
Conclusion: </strong><br />
It&#8217;s a basic test cluster and I would not recommend it for any production use. In fact, as per one of MySQL expert, &#8220;I would advise you to consider if MySQL Cluster is really a right choice for your project, it&#8217;s often not, probably in 99.9% of the cases I encountered, and does not give expected results&#8221; and when asking the alternate, &#8220;usually some MySQL/InnoDB in Master/Master, Master/Slave setup can work well enough to handle very high rate of transactions.&#8221;</p>
<p>Of course, ther are several considerations you have to take care, like network connectivity between instanes, backup to S3 and automatic promotion of second master in case first one failed. I&#8217;m looking on these and as well as on to setup Master/Master replication with S3 backup. I&#8217;ll post that here, once done.</p>
<p>You may also like to read:<br />
* <a href="http://linuxadminzone.com/install-and-configure-ftp-server-in-amazon-ec2-instance/"> Install and configure FTP server in Amazon Instance </a><br />
* <a href="http://linuxadminzone.com/quick-web-based-php-script-to-check-replication-status-of-mysql/"> Quick and simple php based script to check replication status of multiple MySQL Servers </a><br />
* <a href="http://linuxadminzone.com/setting-up-mutiple-mysql-database-servers-on-a-single-linux-machine/"> Setup multiple MySQL database servers in a single Linux host </a><br />
* <a href="http://linuxadminzone.com/optimize-mysql-on-a-large-database-server/"> Optimize MySQL on a large Database Server </a><br />
* <a href="http://linuxadminzone.com/recover-or-reset-root-password-of-mysql-and-postgresql-servers/"> Recover or reset root password of MySQL and PostgreSQL Servers </a><br />
* <a href="http://linuxadminzone.com/setting-up-a-mysql-cluster-7-0-in-redhat-based-linux/"> How to setup MySQL Cluster 7.0 in Redhat based Linux </a><br />
* <a href="http://linuxadminzone.com/optimize-and-fix-mysql-server-running-slow-without-any-load/"> Optimize and fix MySQL Server running slow without any load </a><br />
* <a href="http://linuxadminzone.com/find-out-the-clients-of-your-mysql-server/"> How to find out the clients connecting to your MySQL server </a><br />
* <a href="http://linuxadminzone.com/quickly-repair-a-huge-corrupted-or-crashed-table-in-mysql/"> Quickly repair huge corrupted or crashed table in MySQL </a><br />
* <a href="http://linuxadminzone.com/install-and-configure-phpmyadmin-to-manage-multiple-mysql-servers/"> Install and configure PhpMyAdmin to manage multiple MySQL Servers </a> </p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/how-to-setup-mysql-cluster-in-amazon-ec2/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Install and Configure FTP Server in Amazon EC2 instance</title>
		<link>http://linuxadminzone.com/install-and-configure-ftp-server-in-amazon-ec2-instance/</link>
		<comments>http://linuxadminzone.com/install-and-configure-ftp-server-in-amazon-ec2-instance/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 06:16:08 +0000</pubDate>
		<dc:creator>jagbir</dc:creator>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[vsftpd]]></category>

		<guid isPermaLink="false">http://linuxadminzone.com/?p=18</guid>
		<description><![CDATA[For many users, running FTP Sever in Amazon EC2 instance is headache at the first time. You need to experiment before being able to transfer data. The main problems are Ingress firewall in Amazon environment and NAT traversal. Here I&#8217;m using vsftp (vsfptd) Server, which is one of the most popular and easy to configure. [...]]]></description>
			<content:encoded><![CDATA[<p>For many users, running FTP Sever in Amazon EC2 instance is headache at the first time. You need to experiment before being able to transfer data. The main problems are Ingress firewall in Amazon environment and NAT traversal.</p>
<p>Here I&#8217;m using vsftp (vsfptd) Server, which is one of the most popular and easy to configure. The instance is running from base Fedora 4 AMI but the setup should be identical to other Red Hat based distros.</p>
<p>Install vsftpd FTP server, if not installed earlier:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ yum <span style="color: #c20cb9; font-weight: bold;">install</span> vsftpd</pre></div></div>

<p>Its upto you which FTP method i.e. Active or Passive you want to use. The problem with active mode is that your computer is sending a request out of port 21 when all of a sudden, the server attempts to initiate a request with your computer on port 20.  Since communication on port 21 does not imply communication on port 20, it appears as if some unauthorized host has attempted to initiate a new connection with your computer.  Kind of sounds like a hack right?  Your firewall may think so too (or your NAT router may have no idea to which computer to route the request). Active mode is not used as default method of ftp transfer in many clients these days. </p>
<p>On the other hand, as the Ingress firewall is running in AWS, from the firewall&#8217;s standpoint, to support passive mode FTP the following communication channels need to be opened:</p>
<p>FTP server&#8217;s port 21 from anywhere (Client initiates connection).<br />
FTP server&#8217;s port 21 to ports > 1023 (Server responds to client&#8217;s control port).<br />
FTP server&#8217;s ports > 1023 from anywhere (Client initiates data connection to random port specified by server).<br />
FTP server&#8217;s ports > 1023 to remote ports > 1023 (Server sends ACKs (and data) to client&#8217;s data port).</p>
<p>That second part is the problem: FTP server listens on a random port and hands that back to the client, so the client initiates a connection to a random server port, which you must allow.</p>
<p>Opening up all ports > 1023 isn&#8217;t so good for security. But what you can do is allow the ports through the distributed firewall and then setup your own filtering inside your instance. Instead, you would better open a fixed number of ports (such as 1024 to 1048) and configure your FTP Server to only use that ports.</p>
<p>Check whether required ports are open or not in your EC2 security group. (if you are unaware about security group, it should be &#8216;defaul&#8217; unless you created a new one).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ ec2-describe-group</pre></div></div>

<p>This command will print all ports which are currently open. If you dont find port 20,21,1024-1048 then you need to open these ports but if you dont find the command itself i.e.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ ec2-describe-group
-bash: ec2-describe-group: <span style="color: #7a0874; font-weight: bold;">command</span> not found</pre></div></div>

<p>You need to install ec2 command line tools. You can find them <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&#038;categoryID=88">here</a>  and the instructions to setup/configure can be found <a href="http://docs.amazonwebservices.com/AWSEC2/2008-02-01/GettingStartedGuide/?ref=get-started">here.</a> </p>
<p>Open the ports now:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ ec2-authorize default <span style="color: #660033;">-p</span> <span style="color: #000000;">20</span>-<span style="color: #000000;">21</span>
$ ec2-authorize default <span style="color: #660033;">-p</span> <span style="color: #000000;">1024</span>-<span style="color: #000000;">1048</span></pre></div></div>

<p>Here, &#8216;default&#8217; is the name of security group. You can also open ports for specific IPs. For ease of use, you better install ElasticFox, a firefox extension to manage EC2 stuff. you can find more about it <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=609">here.</a> </p>
<p>At this moment, you can start your FTP server and if you try to connect it, the process will get failed. By checking logs, you should find something like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: <span style="color: #000000;">257</span> <span style="color: #ff0000;">&quot;/&quot;</span> is current directory.
Command: TYPE A
Response: <span style="color: #000000;">200</span> Type <span style="color: #000000; font-weight: bold;">set</span> to A
Command: PASV
Response: <span style="color: #000000;">227</span> Entering Passive Mode <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">216</span>,<span style="color: #000000;">182</span>,<span style="color: #000000;">238</span>,<span style="color: #000000;">73</span>,<span style="color: #000000;">129</span>,<span style="color: #000000;">75</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.
Command: LIST
Error: Transfer channel can<span style="color: #ff0000;">'t be opened. Reason: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Error: Could not retrieve directory listing</span></pre></div></div>

<p>Time to configure vsftpd.conf file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>vsftpd.conf
<span style="color: #666666; font-style: italic;">#&lt;em&gt;---Add following lines at the end of file---&lt;/em&gt;</span>
	<span style="color: #007800;">pasv_enable</span>=YES
	<span style="color: #007800;">pasv_min_port</span>=<span style="color: #000000;">1024</span>
	<span style="color: #007800;">pasv_max_port</span>=<span style="color: #000000;">1048</span>
	<span style="color: #007800;">pasv_address</span>=<span style="color: #000000; font-weight: bold;">&lt;</span>Public IP of your instance<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Put public IP of your EC2 instance and then Save the file. Now restart the server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vsftpd restart</pre></div></div>

<p>One another thing I noticed recently in some instances is that even after configured properly, ftp client is not able to connect. You can find the description and solution of that problem in <a href="http://linuxadminzone.com/ftp-error-500-oops-vsf_sysutil_recv_peek-while-connecting-to-vsftpd/">this post</a> on this blog. </p>
<p>You may also like to read:<br />
* <a href="http://linuxadminzone.com/5-steps-to-secure-your-linux-server/"> 5 steps to secure your Linux Server </a><br />
* <a href="http://linuxadminzone.com/setting-up-mutiple-mysql-database-servers-on-a-single-linux-machine/"> How to setup multiple mysql servers in a single Linux machine. </a><br />
* <a href="http://linuxadminzone.com/how-to-setup-mysql-cluster-in-amazon-ec2/"> Setup Mysql Cluster in Amazon EC2. </a><br />
* <a href="http://linuxadminzone.com/download-install-and-configure-perlbal-to-load-balance-web-server/"> Download, install and configure perlbal loadbalancer.  </a><br />
* <a href="http://linuxadminzone.com/find-out-the-clients-of-your-mysql-server/"> How to find out clients of your Mysql server. </a><br />
* <a href="http://linuxadminzone.com/optimize-and-fix-mysql-server-running-slow-without-any-load/"> Fix and optimize Mysql server running slow without any load. </a><br />
* <a href="http://linuxadminzone.com/script-to-sync-files-between-web-severs-having-plesk/"> Script to sync files between web servers. </a><br />
* <a href="http://linuxadminzone.com/install-and-configure-haproxy-the-software-based-loadbalancer-in-ubuntu/"> Install and configure HAProxy loadbalancer. </a><br />
* <a href="http://linuxadminzone.com/quick-web-based-php-script-to-check-replication-status-of-mysql/"> Quick web based php script to check replication status of multiple MySQL Servers </a></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxadminzone.com/install-and-configure-ftp-server-in-amazon-ec2-instance/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
	</channel>
</rss>

