<?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>RedHatVN Network &#124; Ho Tro Linux &#124; Support Linux &#124; Linux VN &#187; Cluster</title>
	<atom:link href="http://redhatvn.net/tag/cluster/feed" rel="self" type="application/rss+xml" />
	<link>http://redhatvn.net</link>
	<description>Shared Linux problems</description>
	<lastBuildDate>Fri, 03 Sep 2010 08:03:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Clustering a Service with Server 2008 Failover Clustering</title>
		<link>http://redhatvn.net/clustering-a-service-with-server-2008-failover-clustering</link>
		<comments>http://redhatvn.net/clustering-a-service-with-server-2008-failover-clustering#comments</comments>
		<pubDate>Wed, 02 Dec 2009 08:57:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[win2k8]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=692</guid>
		<description><![CDATA[We’ve covered setting  up a two node failover cluster in Windows Server 2008 and now that we have that running we can start to cluster some services and/or applications.  In this example we’ll cluster File Services to create a highly available file share.  To start we can simply right-click Services and Application under the cluster [...]]]></description>
			<content:encoded><![CDATA[<p>We’ve covered <a href="http://redhatvn.net/building-a-2-node-server-core-failover-cluster">setting  up a two node failover cluster in Windows Server 2008</a> and now that we have that running we can start to cluster some services and/or applications.  In this example we’ll cluster File Services to create a highly available file share.  To start we can simply right-click Services and Application under the cluster and choose Configure a Service or Application.<br />
<span id="more-692"></span><br />
<a href="http://redhatvn.net/images/win2k8/HAServices1.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-1" src="http://redhatvn.net/images/win2k8/HAServices1_thumb.jpg" border="0" alt="HA-Services-1" width="564" height="213" /></a></p>
<p>From there we are presented with a list of services and applications that can be clustered.</p>
<p><a href="http://redhatvn.net/images/win2k8/HAServices2.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-2" src="http://redhatvn.net/images/win2k8/HAServices2_thumb.jpg" border="0" alt="HA-Services-2" width="564" height="388" /></a></p>
<p>Simply choose the service or application you want to make highly available…</p>
<p><a href="http://redhatvn.net/images/win2k8/HAServices3.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-3" src="http://redhatvn.net/images/win2k8/HAServices3_thumb.jpg" border="0" alt="HA-Services-3" width="564" height="388" /></a></p>
<p>A quick system check will ensure you have the required components in place.  The proper install order would be:</p>
<ul>
<li>Clustering Role</li>
<li>Role, Service or Application to be clustered</li>
</ul>
<p>We will choose the File Server role as it is already installed.</p>
<p><a href="http://redhatvn.net/images/win2k8/HAServices4.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-4" src="http://redhatvn.net/images/win2k8/HAServices4_thumb.jpg" border="0" alt="HA-Services-4" width="564" height="388" /></a></p>
<p>You will have to provide a name (used by NetBIOS and DNS) as well as the public IP address you wish to use.  This will be the IP that users connect to gain access to resources.</p>
<p><a href="http://redhatvn.net/images/win2k8/HAServices5.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-5" src="http://redhatvn.net/images/win2k8/HAServices5_thumb.jpg" border="0" alt="HA-Services-5" width="564" height="388" /></a></p>
<p>Next select the disk you wish to assign to this cluster.  This will be the disk that contains the shares and files.</p>
<p><a href="http://redhatvn.net/images/win2k8/HAServices6.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-6" src="http://redhatvn.net/images/win2k8/HAServices6_thumb.jpg" border="0" alt="HA-Services-6" width="564" height="388" /></a></p>
<p>Finish out the wizard and once it is complete you will see the service or application appear in the list as well as it’s status, the type and the current owner (aka the node holding the role at this time).</p>
<p><a href="http://redhatvn.net/images/win2k8/HAServices7.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-7" src="http://redhatvn.net/images/win2k8/HAServices7_thumb.jpg" border="0" alt="HA-Services-7" width="564" height="142" /></a></p>
<p>If you wish to move it to the other node in the cluster simply right-click the name and choose Move this Service or Application to Another Node and choose the node.</p>
<p><a href="http://redhatvn.net/images/win2k8/HAServices8.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-8" src="http://redhatvn.net/images/win2k8/HAServices8_thumb.jpg" border="0" alt="HA-Services-8" width="564" height="310" /></a></p>
<p>The resources will be re-assigned to the other node and after a brief outage be back online for users to access.</p>
<p><a href="http://redhatvn.net/images/win2k8/HAServices9.jpg"><img style="border: 0px none ; display: inline;" title="HA-Services-9" src="http://redhatvn.net/images/win2k8/HAServices9_thumb.jpg" border="0" alt="HA-Services-9" width="564" height="137" /></a></p>
<p>For more information see:</p>
<p><a href="http://go.microsoft.com/?linkid=8958020">TechNet Virtual Lab: Creating a Highly Available Infrastructure</a></p>
<p><a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032345932&amp;EventCategory=3&amp;culture=en-US&amp;CountryCode=US">TechNet Virtual Lab: Windows Server 2008 Enterprise Failover Clustering Lab</a></p>
<p><a href="http://technet2.microsoft.com/WindowsServer2008/en/library/adbf1eb3-a225-4344-9086-115a9389a2691033.mspx">Step-by-Step Guide for Configuring a Two-Node File Server Failover Cluster in Windows Server 2008</a></p>
<p><a href="http://www.microsoft.com/windowsserver2008/en/us/clustering-resources.aspx">Failover Clustering Resource Center</a></p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/clustering-a-service-with-server-2008-failover-clustering/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Building a 2-Node Server Core Failover Cluster</title>
		<link>http://redhatvn.net/building-a-2-node-server-core-failover-cluster</link>
		<comments>http://redhatvn.net/building-a-2-node-server-core-failover-cluster#comments</comments>
		<pubDate>Wed, 02 Dec 2009 08:46:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[win2k8]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=687</guid>
		<description><![CDATA[If you have ever set up a Windows cluster in Windows 2003, 2000 or if you were brave enough NT4 you know it has always posed a number of challenges that usually required some specialized skills.  Well in Windows Server 2008 that has changed thankfully and we can whip together a two node failover cluster [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever set up a Windows cluster in Windows 2003, 2000 or if you were brave enough NT4 you know it has always posed a number of challenges that usually required some specialized skills.  Well in Windows Server 2008 that has changed thankfully and we can whip together a two node failover cluster in minutes!  Before you get started you will need the following:</p>
<ol>
<li>3 servers at minimum (1DC, 2 Nodes)</li>
<li>Shared storage (iSCSI or FibreChannel)</li>
<li>3 Networks (Public, iSCSI, Heartbeat)</li>
</ol>
<p><span id="more-687"></span><br />
With that in place the first thing to do is get the cluster role installed on both nodes.  On Sever Core you can do that with the following command (case sensitive):</p>
<p><strong><em>OCSETUP FailoverCluster-Core</em></strong></p>
<p><a href="http://redhatvn.net/images/win2k8/WFCS1.jpg"><img style="border-width: 0px; display: inline;" title="WFCS-1" src="http://redhatvn.net/images/win2k8/WFCS1_thumb.jpg" border="0" alt="WFCS-1" width="564" height="280" /></a></p>
<p>We can verify that the install was successful with the following command (case sensitive):</p>
<p><strong><em>OCLIST</em></strong></p>
<p><a href="http://redhatvn.net/images/win2k8/WFCS2.jpg"><img style="border-width: 0px; display: inline;" title="WFCS-2" src="http://redhatvn.net/images/win2k8/WFCS2_thumb.jpg" border="0" alt="WFCS-2" width="564" height="280" /></a></p>
<p>With that complete launch the Failover Cluster Administrator MMC from the DC and click on Create  a Cluster under the Management section.</p>
<p><a href="http://redhatvn.net/images/win2k8/WFCS3.jpg"><img style="border-width: 0px; display: inline;" title="WFCS-3" src="http://redhatvn.net/images/win2k8/WFCS3_thumb.jpg" border="0" alt="WFCS-3" width="564" height="280" /></a></p>
<p>Add the two servers that will act as the cluster nodes…</p>
<p><a href="http://redhatvn.net/images/win2k8/WFCS4.jpg"><img style="border-width: 0px; display: inline;" title="WFCS-4" src="http://redhatvn.net/images/win2k8/WFCS4_thumb.jpg" border="0" alt="WFCS-4" width="564" height="280" /></a></p>
<p>…and perform a validation.  You don’t have to perform one but it is a best practice to ensure everything is configured properly and it is required to get support with your cluster from Microsoft.  It is also a handy troubleshooting tool to boot!</p>
<p><a href="http://redhatvn.net/images/win2k8/WFCS5.jpg"><img style="border-width: 0px; display: inline;" title="WFCS-5" src="http://redhatvn.net/images/win2k8/WFCS5_thumb.jpg" border="0" alt="WFCS-5" width="564" height="280" /></a></p>
<p>Once the validation is complete and everything checks out, give the cluster a name and set the IP address.  This is the public IP that clients will use to connect.</p>
<p><a href="http://redhatvn.net/images/win2k8/WFCS6.jpg"><img style="border-width: 0px; display: inline;" title="WFCS-6" src="http://redhatvn.net/images/win2k8/WFCS6_thumb.jpg" border="0" alt="WFCS-6" width="564" height="280" /></a></p>
<p>Confirm the settings and click Next to start the cluster creation.</p>
<p><a href="http://redhatvn.net/images/win2k8/WFCS7.jpg"><img style="border-width: 0px; display: inline;" title="WFCS-7" src="http://redhatvn.net/images/win2k8/WFCS7_thumb.jpg" border="0" alt="WFCS-7" width="564" height="280" /></a></p>
<p>Once complete you can view the report and the install summary.</p>
<p><a href="http://redhatvn.net/images/win2k8/WFCS8.jpg"><img style="border-width: 0px; display: inline;" title="WFCS-8" src="http://redhatvn.net/images/win2k8/WFCS8_thumb.jpg" border="0" alt="WFCS-8" width="564" height="280" /></a></p>
<p>That is it!  You now have a 2 node failover cluster installed!  Don’t believe it is that easy?  Check out the TechNet Virtual Labs below and do it yourself!</p>
<p>For more information see:</p>
<p><a href="http://go.microsoft.com/?linkid=8958020">TechNet Virtual Lab: Creating a Highly Available Infrastructure</a></p>
<p><a href="http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032345932&amp;EventCategory=3&amp;culture=en-US&amp;CountryCode=US">TechNet Virtual Lab: Windows Server 2008 Enterprise Failover Clustering Lab</a></p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/building-a-2-node-server-core-failover-cluster/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Create A Cluster Testbed Using CentOS 5 Virtualization And iSCSI</title>
		<link>http://redhatvn.net/how-to-create-a-cluster-testbed-using-centos-5-virtualization-and-iscsi</link>
		<comments>http://redhatvn.net/how-to-create-a-cluster-testbed-using-centos-5-virtualization-and-iscsi#comments</comments>
		<pubDate>Tue, 01 Dec 2009 04:33:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=597</guid>
		<description><![CDATA[A. Overview This guide attempts to provide a Xen based test environment where you can practice setting up a two node cluster (cluster setup itself is not discussed here &#8211; I&#8217;m merely giving you what you need to set it up). XEN can host two type of guest systems para-virtualized and fully-virtualized: for para-virtualized guests [...]]]></description>
			<content:encoded><![CDATA[<h3>A. Overview</h3>
<p>This guide attempts to provide a Xen based test environment where you can practice setting up a two node cluster (cluster setup itself is not discussed here &#8211; I&#8217;m merely giving you what you need to set it up).</p>
<p>XEN can host two type of guest systems para-virtualized and fully-virtualized:</p>
<ul>
<li>for para-virtualized guests you require the Red Hat Enterprise Linux 5 installation tree available over NFS, FTP or HTTP.</li>
<li>for fully-virtualized guest installations you will require DVD or CD-ROM distribution media or a bootable .iso file and a network accessible installation tree</li>
</ul>
<p>For details, please refer to the <a href="https://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/en-US/RHEL510/Virtualization_Guide/index.html" target="_blank">RHEL5 Virtualization Manual</a>.</p>
<p><span id="more-597"></span>I&#8217;ll be using para-virtualized guests here in my setup. There will be three systems involved here:</p>
<ul>
<li><span>node00</span> &#8211; physical system<br />
virtual IPs: <span>192.168.222.1</span> (public1 vlan)<br />
<span>192.168.100.1</span> (private1 vlan)</li>
<li><span>node01</span> &#8211; para-virtualized guest 1<br />
virtual IPs: <span>192.168.222.10</span> (public1 vlan)<br />
<span>192.168.100.10</span> (private1 vlan)</li>
<li><span>node02</span> &#8211; para-virtualized guest 1<br />
virtual IPs: <span>192.168.222.20</span> (public1 vlan)<br />
<span>192.168.100.20</span> (private1 vlan)</li>
</ul>
<h3>B. What I used</h3>
<ul>
<li>an HP Blade bl25p machine with 4G of RAM (this is actually an AMD64 blade machine). A machine with decent amount of RAM and processing speed should do.</li>
<li>Centos i386 5 update 1 <a href="http://www.centos.org/" target="_blank">www.centos.org</a> DVD ISO downloaded    HTTP, NFS and FTP installation sources were created from this iso. Also, the    yum repository that can be used by host and guest systems will be generated    from the centos iso image.</li>
<li>logical volumes hosting the guests and the &#8220;virtual luns&#8221; via iscsi (you can also use disk partitions &#8211; please refer to the virtualization guide for details).</li>
</ul>
<h4>1. My LVM setup</h4>
<p>The following is my LVM configuration. The lvLUN0* entries are the ones I used for iSCSI setup and will be shared by the two virtual guest systems.</p>
<p><code>lvs</code></p>
<blockquote><p>  LV       VG          Attr   LSize   Origin Snap%  Move Log Copy%<br />
  lvLUN01  Virtual00VG -wi-ao  50.00G<br />
  lvLUN02  Virtual00VG -wi-ao  50.00G<br />
  lvNODE01 Virtual00VG -wi-ao  30.00G<br />
  lvNODE02 Virtual00VG -wi-ao  30.00G<br />
  lvNODE03 Virtual00VG -wi-ao  15.00G<br />
  lvsys00  vg00        -wi-ao 512.00M<br />
  lvsys01  vg00        -wi-ao   8.00G<br />
  lvsys02  vg00        -wi-ao   8.00G<br />
  lvsys03  vg00        -wi-ao 512.00M<br />
  lvsys04  vg00        -wi-ao 128.00M<br />
  lvsys05  vg00        -wi-ao   1.00G<br />
  lvsys06  vg00        -wi-ao 256.00M</p></blockquote>
<h3>C. Host Preparation</h3>
<p>I&#8217;m assuming that you know how to install CentOS or other RHEL based distributions and that you are familiar with rpm installation. Since I do a lot of setup for test/dev environments at work, I already have an installation server making it easy to do a network based install via PXE. The kickstart file for <span>node00</span> is provided below. You can do a local media install (you have the ISO so you can burn it to a DVD) and just refer to the kickstart file for some of the configuration. The list of packages I used is in the <span>%packages</span> section of <span>node00</span>&#8216;s kickstart file. You can install them manually using yum, like:<br />
# will list centos installation groups</p>
<p><code>yum grouplist</code></p>
<p># will install Virtualization group</p>
<p><code>yum groupinstall Virtualization</code></p>
<h4>1. ks file and installation</h4>
<p><strong> 1.a kickstart file I use for the host (node00)</strong></p>
<p>You&#8217;ll have to modify the following to suit your setup.</p>
<blockquote><p>## START node00_ks.cfg<br />
#modify for your own settings<br />
install<br />
nfs &#8211;server=remote_server &#8211;dir=/path/to/CENTOS5U1/i386<br />
lang en_US.UTF-8<br />
keyboard us<br />
skipx<br />
reboot<br />
network &#8211;device eth2 &#8211;bootproto static &#8211;ip a.b.c.1 &#8211;netmask 255.255.255.0 &#8211;gateway a.b.c.2 &#8211;nameserver x.y.z.n &#8211;hostname node00.example.com<br />
# grub and root password is a1s2d3f4g5<br />
rootpw &#8211;iscrypted $1$3CXK2$CG9WlX2PuPpp7nxYMQGwP0<br />
firewall &#8211;disabled<br />
authconfig &#8211;enableshadow<br />
selinux &#8211;disabled<br />
timezone Asia/Singapore<br />
bootloader &#8211;location=mbr &#8211;driveorder=cciss/c0d0 &#8211;append=&#8221;rhgb quiet&#8221; &#8211;md5pass=$1$3CXK2$CG9WlX2PuPpp7nxYMQGwP0<br />
clearpart &#8211;all &#8211;initlabel &#8211;drives=cciss/c0d0<br />
part /boot &#8211;fstype ext3 &#8211;size=100 &#8211;ondisk=cciss/c0d0<br />
part pv.100000 &#8211;size=100 &#8211;grow &#8211;ondisk=cciss/c0d0 &#8211;asprimary<br />
volgroup vg00 &#8211;pesize=32768 pv.100000<br />
logvol /tmp &#8211;fstype ext3 &#8211;name=lvsys05 &#8211;vgname=vg00 &#8211;size=1024<br />
logvol /opt &#8211;fstype ext3 &#8211;name=lvsys04 &#8211;vgname=vg00 &#8211;size=128<br />
logvol /var &#8211;fstype ext3 &#8211;name=lvsys03 &#8211;vgname=vg00 &#8211;size=512<br />
logvol /usr &#8211;fstype ext3 &#8211;name=lvsys02 &#8211;vgname=vg00 &#8211;size=8192<br />
logvol swap &#8211;fstype swap &#8211;name=lvsys01 &#8211;vgname=vg00 &#8211;size=8192<br />
logvol /home &#8211;fstype ext3 &#8211;name=lvsys06 &#8211;vgname=vg00 &#8211;size=256<br />
logvol / &#8211;fstype ext3 &#8211;name=lvsys00 &#8211;vgname=vg00 &#8211;size=512<br />
%packages<br />
@development-libs<br />
@editors<br />
@system-tools<br />
@text-internet<br />
@x-software-development<br />
@virtualization<br />
@dns-server<br />
@core<br />
@base<br />
@ftp-server<br />
@network-server<br />
@legacy-software-development<br />
@base-x<br />
@web-server<br />
@printing<br />
@server-cfg<br />
@sql-server<br />
@admin-tools<br />
@development-tools<br />
lsscsi<br />
createrepo<br />
audit<br />
net-snmp-utils<br />
iptraf<br />
tftp<br />
lynx<br />
mesa-libGLU-devel<br />
kexec-tools<br />
bridge-utils<br />
device-mapper-multipath<br />
vnc-server<br />
xorg-x11-server-Xnest<br />
xorg-x11-server-Xvfb<br />
imake<br />
openmotif<br />
-vim-enhanced<br />
-zisofs-tools<br />
-zsh<br />
-bluez-hcidump<br />
-sysreport<br />
## END of node00_ks.cfg</p></blockquote>
<h4>2. Host configuration</h4>
<p>Setting up an HTTP, NFS and FTP installation server:</p>
<p><strong>2.a  web server</strong></p>
<blockquote><p>#/etc/httpd/conf.d/centos5u1.conf<br />
Alias /centos5u1 /var/ftp/pub/centos5u1<br />
&lt;Location /centos5u1&gt;<br />
Options Indexes FollowSymLinks MultiViews<br />
IndexOptions FancyIndexing<br />
Order deny,allow<br />
Deny from all<br />
Allow from 127.0.0.1 ::1 all<br />
&lt;Location&gt;</p></blockquote>
<p>Then start the httpd service and make sure it does during startup:</p>
<p><code>service httpd start<br />
chkconfig httpd on</code></p>
<p><strong>2.b  NFS server </strong></p>
<p>Edit <span>/etc/exports</span> and put the following into it:</p>
<blockquote><p># /etc/exports<br />
/var/ftp/pub/centos5u1 192.168*(ro)</p></blockquote>
<p><code>service nfs start<br />
chkconfig nfs on</code></p>
<p><strong>2.c FTP server </strong></p>
<p>Since we already have the source in <span>/var/ftp/pub/centos5u1</span>, all that is needed is to start vsftpd:</p>
<p><code>service vsftpd start<br />
chkconfig vsftpd on</code></p>
<p><strong>2.d YUM repository </strong></p>
<p>For this setup, I only use a local yum repository from the Centos DVD ISO I downloaded. First, I loopback mount it in <span>/var/ftp/pub/centos5u1/i386/</span>:</p>
<p><code>cd /var/ftp/pub/centos5u1/<br />
mkdir temp<br />
mount -o loop CentOS-5.1-i386-bin-DVD.iso  temp<br />
cp -pr temp i386<br />
umount temp<br />
createrepo -g i38</p>
<p>(<span>i386/repodata/</span> will then be updated.)6</code></p>
<p>For RHEL5, it&#8217;s different:</p>
<p><code>createrepo -g repodata/comps-rhel5-server-core.xml  Server</code></p>
<p>You need to do this inside the i386 directory (after loopback mounting and copying the whole directory structure).</p>
<p><strong>2.d.1  the yum repo configuration:</strong></p>
<p>I renamed the default repo files in <span>/etc/yum.repos.d/</span> to *-repo (instead of *.repo) to disable them. I then created this file:</p>
<blockquote><p>#/etc/yum.repos.d/CentOS5.repo<br />
[centos5-Server]<br />
name=CentOS5 Server<br />
baseurl=http://node00/centos5u1/i386<br />
enabled=1<br />
gpgcheck=1<br />
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5</p></blockquote>
<p><span>node00</span> needs to be defined in <span>/etc/hosts</span> for the above file to work. Or just replace <span>node00</span> with its IP address.</p>
<p><strong>2.e  VNC server</strong></p>
<p>You won&#8217;t be needing a vnc connection if you have local console access to the physical machine. All you need to do is switch into gui mode:</p>
<p><code>telinit 5</code></p>
<p>and open a gui terminal (like gnome-terminal or kde konsole). But since I do everything remotely, I use vncserver and vncviewer to do gui based stuff.</p>
<p><strong> 2.e.1  run vncserver:</strong></p>
<p>This will bringvup a vncserver in <span>node00</span> that is accessible via &#8220;vncviewer&#8221; at <span>node00:1</span> (assuming <span>node00</span> is resolveable from your vncviewer host).</p>
<p><code>vncserver</code></p>
<blockquote><p>You will require a password to access your desktops.</p>
<p>	  Password:<br />
	  Verify:<br />
	  xauth:  creating new authority file /root/.Xauthority</p>
<p>	  New &#8216;node00.example.com:1 (root)&#8217; desktop is node00.example.com:1</p>
<p>	  Creating default startup script /root/.vnc/xstartup<br />
	  Starting applications specified in /root/.vnc/xstartup<br />
	  Log file is /root/.vnc/node00.example.com:1.log</p></blockquote>
<h3>D.  Virtualization</h3>
<h4>1. virtual networks</h4>
<p>As root, run</p>
<p><code>virt-manager</code></p>
<p>The Virtual Machine Manager window should appear. You&#8217;ll see Domain-0 and the resources it is using.</p>
<p><strong>1.a to create the virtual network:</strong></p>
<ul>
<li> On the menu, click on Edit and then  &#8220;Host details&#8221;.</li>
<li> In the Host Details window, you will only see &#8220;default&#8221; on the left frame. Below, click on         &#8220;Add&#8221;.</li>
<li> The &#8220;Create a new virtual network&#8221; window will appear, click forward.</li>
<li> Use &#8220;public1&#8243; (no quotes) and then hit forward.</li>
<li> Network should be &#8220;192.168.222.0/24&#8243;  then hit forward.</li>
<li> DHCP range: Start: 192.168.222.128 end: 192.168.222.254 then hit forward.</li>
<li> This will be an &#8220;Isolated virtual network&#8221;. Hit forward.</li>
<li> Summary:Network Name: <span>public1</span><br />
IPV4 network:<br />
Network: <span>192.168.222.0/24</span><br />
Gateway: <span>192.168.222.1</span><br />
Netmask: <span>255.255.255.0</span><br />
DHCP<br />
Start address: <span>192.168.222.128</span><br />
End address  : <span>192.168.222.254</span><br />
Forwarding:<br />
Connectivity: Isolated virtual network</li>
<li> Hit Finish.</li>
</ul>
<p>You&#8217;ll go back to the Host Details window and the <span>public1</span> entry will appear. Now to the same steps for network <span>private1</span> with the following settings:</p>
<p>Network Name: <span>private1</span><br />
IPV4 network:<br />
Network: <span>192.168.100.0/24</span><br />
Gateway: <span>192.168.100.1</span><br />
Netmask: <span>255.255.255.0</span><br />
DHCP<br />
Start address: <span>192.168.100.128</span><br />
End address  : <span>192.168.100.254</span><br />
Forwarding:<br />
Connectivity: Isolated virtual network</p>
<p>When you are done, in the Host Details window, click on &#8220;File &gt; Close&#8221; to go back to the Virtual Machine Manager Window. Then click on &#8220;File &gt; Quit&#8221;. <strong>NOTE:</strong> Don&#8217;t leave the Virtual Manager window running if you are not going to use it. It     will eat up a lot of memory. If this happens, you need to restart Xen.</p>
<p>Once done, <span>vnet0</span> and <span>vnet1</span> can be seen when you run</p>
<p><code>ifconfig</code></p>
<blockquote><p>
    vnet0      Link encap:Ethernet  HWaddr 00:00:00:00:00:00<br />
              inet addr:192.168.222.1  Bcast:192.168.222.255  Mask:255.255.255.0<br />
              inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link<br />
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br />
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0</p>
<p>              TX packets:28 errors:0 dropped:0 overruns:0 carrier:0<br />
              collisions:0 txqueuelen:0<br />
              RX bytes:0 (0.0 b)  TX bytes:7782 (7.5 KiB)</p>
<p>    vnet1      Link encap:Ethernet  HWaddr 00:00:00:00:00:00<br />
              inet addr:192.168.100.1  Bcast:192.168.100.255  Mask:255.255.255.0<br />
              inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link<br />
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1</p>
<p>              RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br />
              TX packets:27 errors:0 dropped:0 overruns:0 carrier:0<br />
              collisions:0 txqueuelen:0<br />
              RX bytes:0 (0.0 b)  TX bytes:7712 (7.5 KiB)</p></blockquote>
<h4>2. kickstart files</h4>
<p>I&#8217;m providing the kickstart file for <span>node01</span> that you can also use for <span>node02</span>. You just need to mofiy the IP addresses and hostname entries.</p>
<p><strong>2.a for node01</strong></p>
<blockquote><p>#START of node01_ks.cfg<br />
install<br />
text<br />
reboot<br />
#uncomment the line you want to use<br />
# for nfs<br />
nfs &#8211;server=192.168.222.1 &#8211;dir=/var/ftp/pub/centos5u1<br />
##url &#8211;url ftp://&lt;username&gt;:&lt;password&gt;@&lt;server&gt;/&lt;dir&gt;<br />
# this will be an anonymous ftp access<br />
#url &#8211;url ftp://192.168.222.1/pub/centos5u1/i386<br />
#key &#8211;skip<br />
lang en_US.UTF-8<br />
keyboard us<br />
skipx<br />
# private<br />
network &#8211;device eth1 &#8211;bootproto static &#8211;ip 192.168.100.10 &#8211;netmask 255.255.255.0<br />
# public &#8211; disabled on initial install<br />
network &#8211;device eth0 &#8211;bootproto static &#8211;ip 192.168.222.10 &#8211;netmask 255.255.255.0 &#8211;gateway 192.168.222.1 &#8211;nameserver 192.168.222.1 &#8211;hostname node01.example.com<br />
## password is n0de01pass<br />
rootpw &#8211;iscrypted $1$Lqk1Y$Y8TIWCMLiiPjVt1GjRS0F1<br />
## password is n0de02pass<br />
#rootpw &#8211;iscrypted $1$Rn47b$DDwgrOv3IFGf3HVhsxv9X0<br />
firewall &#8211;disabled<br />
authconfig &#8211;enableshadow &#8211;enablemd5<br />
selinux &#8211;disabled<br />
timezone &#8211;utc Asia/Singapore<br />
services &#8211;disabled ipsec,iptables,bluetooth,hplip,firstboot,cups,sendmail,xfs<br />
bootloader &#8211;location=mbr &#8211;driveorder=xvda,xvdb &#8211;append=&#8221;rhgb quiet&#8221;<br />
clearpart &#8211;all &#8211;initlabel &#8211;drives=xvda<br />
part /boot &#8211;fstype ext3 &#8211;size=100 &#8211;ondisk=xvda<br />
part pv.2 &#8211;size=0 &#8211;grow &#8211;ondisk=xvda<br />
volgroup VolGroup00 &#8211;pesize=32768 pv.2<br />
logvol swap &#8211;fstype swap &#8211;name=LogVol01 &#8211;vgname=VolGroup00 &#8211;size=1000 &#8211;grow &#8211;maxsize=1984<br />
logvol / &#8211;fstype ext3 &#8211;name=LogVol00 &#8211;vgname=VolGroup00 &#8211;size=1024 &#8211;grow<br />
%packages<br />
@development-libs<br />
@system-tools<br />
@gnome-software-development<br />
@text-internet<br />
@x-software-development<br />
@dns-server<br />
@core<br />
@authoring-and-publishing<br />
@base<br />
@ftp-server<br />
@network-server<br />
@legacy-software-development<br />
@java<br />
@legacy-software-support<br />
@smb-server<br />
@base-x<br />
@web-server<br />
@printing<br />
@server-cfg<br />
@sql-server<br />
@admin-tools<br />
@development-tools<br />
emacs<br />
lsscsi<br />
gnutls-utils<br />
hwbrowser<br />
audit<br />
iptraf<br />
mesa-libGLU-devel<br />
kexec-tools<br />
device-mapper-multipath<br />
vnc-server<br />
xorg-x11-utils<br />
xorg-x11-server-Xnest<br />
xorg-x11-server-Xvfb<br />
imake<br />
iscsi-initiator-utils<br />
ypserv<br />
-sysreport</p>
<p>%post<br />
cat &lt;&lt;EOT &gt;&gt; /etc/hosts<br />
# private  or replace with nodeXY-<br />
192.168.100.10  node01-priv<br />
192.168.100.20  node02-priv<br />
192.168.100.1   node00-priv</p>
<p>#public or replace with nodeXY<br />
192.168.222.10 node01<br />
192.168.222.20 node02<br />
192.168.222.1  node00<br />
EOT</p>
<p># yum local repo<br />
mv /etc/yum.repos.d/*.repo /tmp<br />
cat &gt; /etc/yum.repos.d/centos5.repo &lt;&lt; EOF<br />
[centos5-Server]<br />
name=CEntos5 Server<br />
baseurl=http://node00/centos5u1/i386<br />
enabled=1<br />
gpgcheck=1<br />
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5<br />
EOF</p>
<p>#change default runlevel<br />
ed /etc/inittab &lt;&lt; EOF</p>
<p>,s/id:5:initdefault:/id:3:initdefault:/g<br />
.<br />
w<br />
EOF</p>
<p># vncserver stuff<br />
cat &lt;&lt; EOT &gt; /opt/vnc_xstartup<br />
#!/bin/sh</p>
<p># run vncserver and copy to your $HOME/.vnc/xstartup file<br />
# Uncomment the following two lines for normal desktop:<br />
# unset SESSION_MANAGER<br />
# exec /etc/X11/xinit/xinitrc</p>
<p>[ -x /etc/vnc/xstartup ] &amp;&amp; exec /etc/vnc/xstartup</p>
<p>[ -r $HOME/.Xresources ] &amp;&amp; xrdb $HOME/.Xresources<br />
xsetroot -solid grey<br />
vncconfig -iconic &amp;<br />
xterm -geometry 130&#215;30+12+12 -ls -bg black -fg green -title &#8220;$VNCDESKTOP Desktop&#8221; &amp;<br />
mwm &amp;<br />
EOT<br />
# END of nod01_ks.cfg</p></blockquote>
<p><strong> 2.b for node02</strong></p>
<p>Copy the <span>node01_ks.cfg</span> file above to <span>node02_ks.cfg</span> and change the appropriate entries for <span>node02</span> (hostname and IP addresses).</p>
<h4>3.  Installing the guest systems (node01 and node02)</h4>
<p>For the installation, we&#8217;ll be invoking it in the CLI, using</p>
<p><code>virt-install</code></p>
<p>But first, generate the MAC addresses for the NICS of the virtual systems:</p>
<p><strong>3.a MAC Address generation</strong></p>
<p>We&#8217;ll use a python script provided by the Red Hat Virtualization Guide:</p>
<blockquote><p>#!/usr/bin/python<br />
# macgen.py script to generate a MAC address for Red Hat Virtualization guests<br />
import random<br />
#<br />
def randomMAC():<br />
   mac = [ 0x00, 0x16, 0x3e,<br />
     random.randint(0x00, 0x7f),</p>
<p>     random.randint(0x00, 0xff),<br />
     random.randint(0x00, 0xff) ]<br />
   return &#8216;:&#8217;.join(map(lambda x: &#8220;%02x&#8221; % x, mac))<br />
#<br />
print randomMAC()<br />
# careful with the indention<br />
# this is from the Virtualization guide from redhat.com<br />
# http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.2/html/Virtualization/index.html<br />
node01 NICs<br />
# for eth0 . public1<br />
[root@node00 ~]# ./macgen.py<br />
00:16:3e:33:32:07<br />
# for eth1 . private1<br />
[root@ node00 ~]# ./macgen.py<br />
00:16:3e:55:6b:83</p></blockquote>
<p>Then do the same for <span>node02</span>&#8216;s virtual NICs.</p>
<p><strong> 3.b virt-install command for node01</strong></p>
<p><code>virt-install -p -n node01 -r 768 -f /dev/Virtual00VG/lvNODE01  -m 00:16:3e:33:32:07 \<br />
-w network:public1 -m 00:16:3e:55:6b:83 -w network:private1 \<br />
-l nfs:192.168.222.1:/var/ftp/pub/centos5u1/i386 \<br />
-x "ksdevice=eth0 ks=http://192.168.222.1/centos5u1/node01_ks.cfg" --vnc</code></p>
<p>Parameters:<br />
<span>-n node01</span> = name of the guest system<br />
<span>-r 768</span> = amount of RAM in MB<br />
<span>-f /dev/Virtual00VG/lvNODE01</span> = disk to be used by the guest system (can be an unused partition in your system, like /dev/sda3 or /dev/hda9).<br />
<span>-m 00:16:3e:33:32:07</span> = mac address for eth0<br />
<span>-w network:public1</span> = eth0&#8242;s network<br />
<span>-m 00:16:3e:55:6b:83</span> = mac address for eth1<br />
<span>-w network:private1</span> = eth0&#8242;s network<br />
<span>-l nfs:192.168.222.1:/var/ftp/pub/centos5u1/i386</span> = installation source (not the actual one used during ks install<br />
<span>-x &#8220;ksdevice=eth0 ks=http://192.168.222.1/centos5u1/node01_ks.cfg&#8221;</span> = kickstart directives. This will use dhcp to startup installation.<br />
<span>&#8211;vnc</span> = will launch a gui window for you to view (if you are running virt-install from a vnc session or a gui terminal).</p>
<p><strong> 3.c virt-install command for node02</strong></p>
<p><code>virt-install -p -n node02 -r 768 -f /dev/Virtual00VG/lvNODE02  -m 00:16:3e:1e:05:b6 \<br />
-w network:public1 -m 00:16:3e:40:3d:b0 -w network:private1 \<br />
-l nfs:192.168.222.1:/var/ftp/pub/centos5u1/i386 \<br />
-x "ksdevice=eth0 ks=http://192.168.222.1/centos5u1/node02_ks.cfg" --vnc</code></p>
<p>I ran the above virt-install inside a vnc session in the physical host so the the guest installation screens automatically appear. You can start it in the physical host&#8217;s console and the installation of the guest systems will run in the background. Their installation can be viewed by running virt-manager and then opening the guests.</p>
<h3>E. iSCSI</h3>
<p>iSCSI is a Storage Area Network protocol allowing shared storage going through an exising network infrastructure. In my setup, I used iscsitarget from <a href="http://iscsitarget.sourceforge.net/" target="_blank">http://iscsitarget.sourceforge.net</a>.</p>
<h4>1. iSCSI server installation and configuration</h4>
<p><strong>1.a compiling the iscsi application tarball </strong></p>
<p>This needs to be done on the physical host.</p>
<ul>
<li> Get the tarball from <a href="http://sourceforge.net/project/showfiles.php?group_id=108475" target="_blank">SourceForge</a> and put it in <span>/usr/local/src</span>.</li>
<li>cd to <span>/usr/local/src</span>:cd /usr/local/src</li>
<li> Then extract the files:tar xvf iscsitarget-0.4.16.tar.gz<br />
cd iscsitarget-0.4.16</li>
<li>Then run:make<br />
make install</li>
</ul>
<p><strong>1.b configuration needed</strong></p>
<p>This is my <span>ietd.conf</span> configuration  defining the &#8220;LUNs&#8221; to be allocated to the guests from the physical host&#8217;s disks:</p>
<blockquote><p>#/etc/ietd.conf<br />
# NOTE: the config files has more entries than what i&#8217;m showing here.<br />
# but i&#8217;ve commented out the original entries and made the following<br />
Target iqn.2008-07.NODE00:LUN01.NODE00<br />
   MaxConnections         2<br />
   Lun 1 Path=/dev/Virtual00VG/lvLUN01,Type=fileio<br />
   Alias LUN01<br />
Target iqn.2008-07.NODE00:LUN02.NODE00<br />
   MaxConnections         2<br />
   Lun 2 Path=/dev/Virtual00VG/lvLUN02,Type=fileio<br />
   Alias LUN02<br />
# end of ietd.conf</p></blockquote>
<p>In my physical host system, I have created two logical volumes 50G each in size. You can also use files or disk partitions, just change the <span>Path</span> entries in the <span>ietd.conf</span> file.</p>
<p><strong>1.c ACL</strong></p>
<p>iscsitarget has <span>/etc/initiators.allow</span> and <span>/etc/initiators.deny</span> that work like <span>hosts.allow</span> and <span>hosts.deny</span>. In my setup, I will allow <span>node01</span> and <span>node02</span> to access the two LUNs defined in <span>ietd.conf</span>.</p>
<blockquote><p>#/etc/initiators.allow<br />
#this should correspond to the definition in your /etc/ietd.conf<br />
iqn.2008-07.NODE00:LUN01.NODE00 192.168.100.10, 192.168.100.20<br />
iqn.2008-07.NODE00:LUN02.NODE00 192.168.100.10, 192.168.100.20<br />
# endof initiators.allow</p></blockquote>
<ul>
<li>Start the iscsi-target service:service iscsi-target start</li>
<li> and make sure it starts during bootup:<br />
<code>chkconfig --add  iscsi-target<br />
chkconfig   iscsi-target on<br />
chkconfig --list  iscsi-target</code><br />
iscsi-target    0:off   1:off   2:on    3:on    4:on    5:on    6:off</li>
</ul>
<h4>2  Client Side</h4>
<p>The package <span>iscsi-initiator-utils-6.2.0.865-0.8.el5</span> should already be installed (as it is included in the kickstart file above).</p>
<p><strong>2.a configuration</strong></p>
<ul>
<li>Edit the file <span>/etc/iscsi/initiatorname.iscsi</span> to define the targets.</li>
<li>My <span>/etc/iscsi/initiatorname.iscsi</span> is as follows:<br />
<blockquote><p>#/etc/iscsi/initiatorname.iscsi<br />
InitiatorName=iqn.2008-07.NODE00:LUN01.NODE00<br />
InitiatorName=iqn.2008-07.NODE00:LUN02.NODE00<br />
# end of #/etc/iscsi/initiatorname.iscsi</p></blockquote>
</li>
<li>Run iscsid service and try to discover the LUNs:service iscsid start
<p>Turning off network shutdown. Starting iSCSI daemon: [  OK  ]</p>
<p><code>iscsiadm -m discovery -t st -p node00</code></p>
<p>192.168.222.1:3260,1 iqn.2008-07.NODE00:LUN01.NODE00<br />
192.168.222.1:3260,1 iqn.2008-07.NODE00:LUN02.NODE00</li>
<li>Then start the iscsi service. You&#8217;ll then see the LUN definitions created earlier:service iscsi start
<p>will then show the following:</p>
<blockquote><p>	iscsid (pid 964 963) is running&#8230;<br />
	Setting up iSCSI targets: Login session [iface: default, target: \</p>
<p>	iqn.2008-07.NODE00:LUN02.NODE00, portal: 192.168.222.1,3260]<br />
	Login session [iface: default, target: iqn.2008-07.NODE00:LUN01.\<br />
	NODE00, portal: 192.168.222.1,3260] [  OK  ]</p></blockquote>
</li>
<li>Check system logs to see if the disks have been seen:dmesg<br />
<blockquote><p>        scsi0 : iSCSI Initiator over TCP/IP<br />
         Vendor: IET       Model: VIRTUAL-DISK      Rev: 0<br />
         Type:   Direct-Access                      ANSI SCSI revision: 04<br />
        scsi 0:0:0:2: Attached scsi generic sg0 type 0<br />
        SCSI device sda: 104857600 512-byte hdwr sectors (53687 MB)<br />
        sda: Write Protect is off<br />
        sda: Mode Sense: 77 00 00 08<br />
        SCSI device sda: drive cache: write through<br />
        SCSI device sda: 104857600 512-byte hdwr sectors (53687 MB)</p>
<p>        sda: Write Protect is off<br />
        sda: Mode Sense: 77 00 00 08<br />
        SCSI device sda: drive cache: write through<br />
         sda: unknown partition table<br />
        sd 0:0:0:2: Attached scsi disk sda<br />
        scsi1 : iSCSI Initiator over TCP/IP<br />
          Vendor: IET       Model: VIRTUAL-DISK      Rev: 0<br />
          Type:   Direct-Access                      ANSI SCSI revision: 04<br />
        SCSI device sdb: 104857600 512-byte hdwr sectors (53687 MB)</p>
<p>        sdb: Write Protect is off<br />
        sdb: Mode Sense: 77 00 00 08<br />
        SCSI device sdb: drive cache: write through<br />
        SCSI device sdb: 104857600 512-byte hdwr sectors (53687 MB)<br />
        sdb: Write Protect is off<br />
        sdb: Mode Sense: 77 00 00 08<br />
        SCSI device sdb: drive cache: write through<br />
         sdb: unknown partition table<br />
        sd 1:0:0:1: Attached scsi disk sdb</p>
<p>        sd 1:0:0:1: Attached scsi generic sg1 type 0</p></blockquote>
<p>I now have sda and sdb, each with 53687 MB in size (results for your setup may be different.</li>
<li>Running fdisk:fdisk -l<br />
<blockquote><p>        Disk /dev/xvda: 32.2 GB, 32212254720 bytes<br />
        255 heads, 63 sectors/track, 3916 cylinders<br />
        Units = cylinders of 16065 * 512 = 8225280 bytes</p>
<p>            Device Boot      Start         End      Blocks   Id  System<br />
        /dev/xvda1   *           1          13      104391   83  Linux<br />
        /dev/xvda2              14        3916    31350847+  8e  Linux LVM</p>
<p>        Disk /dev/sda: 53.6 GB, 53687091200 bytes<br />
        64 heads, 32 sectors/track, 51200 cylinders<br />
        Units = cylinders of 2048 * 512 = 1048576 bytes</p>
<p>        Disk /dev/sda doesn&#8217;t contain a valid partition table</p>
<p>        Disk /dev/sdb: 53.6 GB, 53687091200 bytes<br />
        64 heads, 32 sectors/track, 51200 cylinders<br />
        Units = cylinders of 2048 * 512 = 1048576 bytes</p>
<p>        Disk /dev/sdb doesn&#8217;t contain a valid partition table</p></blockquote>
</li>
</ul>
<p>Now do the same for <span>node02</span>. Once the disks are seen by both guests, you can then start setting up a two-node cluster. I&#8217;ve used this configuration to test a two-node Oracle 10gR2 RAC setup with shared ASM storage and OCFS2 on a 64-bit system.</p>
<h3>F. Conclusion</h3>
<p>This kind of setup will help you to learn the basics of clustering without the need of acquiring additional hardware. In no way can this setup be used in a &#8220;live&#8221; environment. Once you have familiarized yourself with the concept of how a cluster is prepared, you can apply the concept when building real, physical setups that you need for your organization. I hope you&#8217;ll find this useful.</p>
<h3>G. Further Readings</h3>
<ul>
<li> <a href="https://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/en-US/RHEL510/Virtualization_Guide/index.html" target="_blank">RHEL5 Virtualization Manual</a></li>
<li> <a href="http://iscsitarget.sourceforge.net/" target="_blank">http://iscsitarget.sourceforge.net </a></li>
<li><a href="http://www.oracle.com/technology/pub/articles/hunter_rac10gr2_iscsi.html" target="_blank">Oracle RAC HowTO</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/how-to-create-a-cluster-testbed-using-centos-5-virtualization-and-iscsi/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Configuring A High Availability Cluster (Heartbeat) On CentOS</title>
		<link>http://redhatvn.net/configuring-a-high-availability-cluster-heartbeat-on-centos</link>
		<comments>http://redhatvn.net/configuring-a-high-availability-cluster-heartbeat-on-centos#comments</comments>
		<pubDate>Tue, 01 Dec 2009 08:32:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[cluster httpd]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=611</guid>
		<description><![CDATA[This guide shows how you can set up a two node, high-availability HTTP cluster with heartbeat on CentOS. Both nodes use the Apache web server to serve the same content. Pre-Configuration Requirements Assign hostname node01 to primary node with IP address 172.16.4.80 to eth0. Assign hostname node02 to slave node with IP address 172.16.4.81. Note: [...]]]></description>
			<content:encoded><![CDATA[<p>This guide shows how you can set up a two node, high-availability HTTP cluster with heartbeat on CentOS. Both nodes use the Apache web server to serve the same content.<br />
<span id="more-611"></span></p>
<h3>Pre-Configuration Requirements</h3>
<ol>
<li>Assign hostname <span>node01</span> to primary node with IP address <span>172.16.4.80</span> to eth0.</li>
<li>Assign hostname <span>node02</span> to slave node with IP address <span>172.16.4.81</span>.</li>
</ol>
<p>Note: on node01</p>
<p><code>uname -n</code></p>
<p>must return <span>node01</span>.</p>
<p>On node02</p>
<p><code>uname -n</code></p>
<p>must return <span>node02</span>.</p>
<p><span>172.16.4.82</span> is the virtual IP address that will be used for our Apache webserver (i.e., Apache will listen on that address).</p>
<h3>Configuration</h3>
<p>1. Download and install the heartbeat package. In our case we are using CentOS so we will install heartbeat with yum:</p>
<p><code>yum install heartbeat</code></p>
<p>or download these packages:</p>
<blockquote><p>heartbeat-2.08<br />
heartbeat-pils-2.08<br />
heartbeat-stonith-2.08</p></blockquote>
<p>2. Now we have to configure heartbeat on our two node cluster. We will deal with three files. These are:</p>
<blockquote><p>authkeys<br />
ha.cf<br />
haresources</p></blockquote>
<p>3. Now moving to our configuration. But there is one more thing to do, that is to copy these files to the <span>/etc/ha.d</span> directory. In our case we copy these files as given below:</p>
<p><code>cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/<br />
cp /usr/share/doc/heartbeat-2.1.2/ha.cf /etc/ha.d/<br />
cp /usr/share/doc/heartbeat-2.1.2/haresources /etc/ha.d/</code></p>
<p>4. Now let&#8217;s start configuring heartbeat. First we will deal with the <span>authkeys</span> file, we will use authentication method 2 (sha1). For this we will make changes in the <span>authkeys</span> file as below.</p>
<p><code>vi /etc/ha.d/authkeys</code></p>
<p>Then add the following lines:</p>
<blockquote><p>auth 2<br />
2 sha1 test-ha</p></blockquote>
<p>Change the permission of the <span>authkeys</span> file:</p>
<p><code>chmod 600 /etc/ha.d/authkeys</code></p>
<p>5. Moving to our second file (<span>ha.cf</span>) which is the most important. So edit the <span>ha.cf</span> file with <span>vi</span>:</p>
<p><code>vi /etc/ha.d/ha.cf</code></p>
<p>Add the following lines in the <span>ha.cf</span> file:</p>
<blockquote><p>logfile /var/log/ha-log<br />
logfacility local0<br />
keepalive 2<br />
deadtime 30<br />
initdead 120<br />
bcast eth0<br />
udpport 694<br />
auto_failback on<br />
node node01<br />
node node02</p></blockquote>
<p>Note: <span>node01</span> and <span>node02</span> is the output generated by</p>
<p><code>uname -n</code></p>
<p>6. The final piece of work in our configuration is to edit the <span>haresources</span> file. This file contains the information about resources which we want to highly enable. In our case we want the webserver (<span>httpd</span>) highly available:</p>
<p><code>vi /etc/ha.d/haresources</code></p>
<p>Add the following line:</p>
<blockquote><p>node01 172.16.4.82 httpd</p></blockquote>
<p>7. Copy the <span>/etc/ha.d/</span> directory from <span>node01</span> to <span>node02</span>:</p>
<p><code>scp -r /etc/ha.d/ root@node02:/etc/</code></p>
<p>8. As we want httpd highly enabled let&#8217;s start configuring httpd:</p>
<p><code>vi /etc/httpd/conf/httpd.conf</code></p>
<p>Add this line in <span>httpd.conf</span>:</p>
<blockquote><p>Listen 172.16.4.82:80</p></blockquote>
<p>9. Copy the <span>/etc/httpd/conf/httpd.conf</span> file to <span>node02</span>:</p>
<p><code>scp /etc/httpd/conf/httpd.conf root@node02:/etc/httpd/conf/</code></p>
<p>10. Create the file <span>index.html</span> on both nodes (<span>node01</span> &amp; <span>node02</span>):</p>
<p>On <span>node01</span>:</p>
<p><code>echo "node01 apache test server" &gt; /var/www/html/index.html</code></p>
<p>On <span>node02</span>:</p>
<p><code>echo "node02 apache test server" &gt; /var/www/html/index.htm</code>l</p>
<p>11. Now start heartbeat on the primary <span>node01</span> and slave <span>node02</span>:</p>
<p><code>/etc/init.d/heartbeat start</code></p>
<p>12. Open web-browser and type in the URL:</p>
<p>http://172.16.4.82</p>
<p>It will show <span>node01 apache test server</span>.</p>
<p>13. Now stop the hearbeat daemon on <span>node01</span>:</p>
<p><code>/etc/init.d/heartbeat stop</code></p>
<p>In your browser type in the URL <span>http://172.16.4.82</span> and press enter.</p>
<p>It will show <span>node02 apache test server</span>.</p>
<p>14. We don&#8217;t need to create a virtual network interface and assign an IP address (<span>172.16.4.82</span>) to it. Heartbeat will do this for you, and start the service (<span>httpd</span>) itself. So don&#8217;t worry about this.</p>
<p>Don&#8217;t use the IP addresses <span>172.16.4.80</span> and <span>172.16.4.81</span> for services. These addresses are used by heartbeat for communication between <span>node01</span> and <span>node02</span>. When any of them will be used for services/resources, it will disturb hearbeat and will not work. Be carefull!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/configuring-a-high-availability-cluster-heartbeat-on-centos/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Set Up A Load-Balanced MySQL Cluster With MySQL 5.1</title>
		<link>http://redhatvn.net/how-to-set-up-a-load-balanced-mysql-cluster-with-mysql-5-1</link>
		<comments>http://redhatvn.net/how-to-set-up-a-load-balanced-mysql-cluster-with-mysql-5-1#comments</comments>
		<pubDate>Wed, 02 Dec 2009 03:16:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Cluster]]></category>
		<category><![CDATA[Load-Balanced]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=627</guid>
		<description><![CDATA[This tutorial is based on Falko Timme&#8217;s tutorial for MySQL Cluster 5.0. It shows how to configure a MySQL 5.1 cluster with five nodes: 1 x management, 2 x storage nodes and 2 x balancer nodes. This cluster is load-balanced by an Ultra Monkey package which provides heartbeat (for checking if the other node is [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial is based on Falko Timme&#8217;s tutorial for MySQL Cluster 5.0. It shows how to configure a MySQL 5.1 cluster with five nodes: 1 x management, 2 x storage nodes and 2 x balancer nodes. This cluster is load-balanced by an Ultra Monkey package which provides heartbeat (for checking if the other node is still alive) and ldirectord (to split up the requests to the nodes of the MySQL cluster).</p>
<p>In this document I use Debian Etch 4.0 for all nodes. Therefore the setup might differ a bit for other distributions. The two data nodes were x64 to use all of the 8GB RAM. Servers were compiled from source so you should be able to make it running on any platform. The MySQL version I use in this setup is 5.1.24-rc. It&#8217;s a release candidate, but I wanted to use 5.1 to take advantage of Memory-Disk Based tables.</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.[<a href="http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-disk-data.html" target="_blank">More here</a>]</p>
<p>This howto is just a scratch to make it running, for many of you I am suggesting to read some off docs from MySQL page to be prepared to how manage the whole cluster and always know whats going on.</p>
<p>This document comes without warranty of any kind! Bare in mind you need to make tests and prepare your databases before using it in production mode.<br />
<span id="more-627"></span></p>
<h3>1 My Servers</h3>
<p>I will use the following Debian servers that are all in the same network (10.0.1.x in this example):</p>
<ul>
<li>mysql-mngt.example.com:<strong>10.0.1.30</strong> [ MySQL cluster management server ]</li>
<li>lb1.example.com:<strong> 10.0.1.31</strong> [ Load Balancer 1 ]</li>
<li>lb2.example.com:<strong> 10.0.1.32</strong> [ Load Balancer 2 ]</li>
<li>mysql-data1.example.com:<strong> 10.0.1.33</strong> [ MySQL cluster node 1 ]</li>
<li>mysql-data2.example.com:<strong> 10.0.1.34</strong> [ MySQL cluster node 2 ]</li>
</ul>
<p>In addition to that we need a virtual IP address : 10.0.1.10. It will be assigned to the MySQL cluster by the load balancer so that applications have a single IP address to access the cluster.</p>
<p>Although we want to have two MySQL cluster nodes in our MySQL cluster, we still need a third node, the MySQL cluster management server, for mainly one reason: 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 (&#8220;split brain&#8221;). We also need it for configuring the MySQL cluster.</p>
<p>2 MySQL data  nodes + 1 cluster management server + 2 Load Balancers = 5</p>
<p>Here is my hardware configuration:</p>
<p><strong>MySQL Data :</strong> DELL R300 Intel(R) Quad Core Xeon(R) CPU           X3353  @ 2.66GHz, 2x SAS  146GB Drives (Raid 1), 8GB RAM</p>
<p><strong>MySQL LoadBalancer :</strong> DELL R200 Intel(R) Xeon(R) CPU            3065  @ 2.33GHz, 2x SATA  250 GB Drives (Raid 1), 1GB RAM</p>
<p><strong>MySQL Management :</strong> DELL R200 Intel(R) Celeron(R) CPU          430  @ 1.80GHz, 1x SATA  160 GB Drives (Raid 1), 1GB RAM</p>
<p>As the MySQL cluster management server does not use many resources, you can put additional load balancer on this machine or you can use it for monitoring the whole cluster by <a href="http://www.nagios.org/" target="_blank">Nagios</a> or <a href="http://www.cacti.net/" target="_blank">Cacti</a>.</p>
<h3>2 Set Up The MySQL Cluster Management Server</h3>
<p>First we have to download MySQL 5.1.24 (the sources version) and install the cluster management server (ndb_mgmd) and the cluster management client (ndb_mgm &#8211; it can be used to monitor what&#8217;s going on in the cluster). The following steps are carried out on mysql-mngt.example.com (10.0.1.30):</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>cd /usr/src<br />
wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.24-rc.tar.gz<br />
tar xvzf mysql-5.1.24-rc.tar.gz<br />
#Lets add proper user and group<br />
groupadd mysql<br />
useradd -g mysql mysql<br />
./configure --prefix=/usr/local/mysql --enable-community-features \<br />
--with-mysqld-user=mysql --with-mysqlmanager --with-plugins=ndbcluster<br />
make<br />
make install</code></p>
<p>This way we are wasting about 124MB space since we do not need all the actual MySQL files, but believe me it&#8217;s way easier to make any cleanup/upgrade in just one dir /usr/local/mysql instead of  searching for all files in /usr/bin and so on. After compiling we have two directories we are interested in /usr/local/mysql/bin and /usr/local/mysql/libexec [last one contains the ndb management exec].</p>
<p>Just to make life easier let&#8217;s add this below  to your PATH environment, to do so we have to edit file /root/.bash_profile:</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>echo "PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/libexec" &gt;&gt;/root/.bash_profile<br />
echo "export PATH" &gt;&gt;/root/.bash_profile</code></p>
<p>Next, we must create the cluster configuration file, /usr/local/mysql/var/mysql-cluster/config.ini: [<a href="http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-multi-config.html" target="_blank">Hints here</a>]</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>mkdir /usr/local/mysql/var/mysql-cluster<br />
cd /usr/local/mysql/var/mysql-cluster<br />
vi config.ini</code></p>
<blockquote><p>[NDBD DEFAULT]<br />
NoOfReplicas=2<br />
DataMemory=80M    # How much memory to allocate for data storage<br />
IndexMemory=18M   # How much memory to allocate for index storage<br />
# For DataMemory and IndexMemory, we have used the<br />
# default values. Since the &#8220;world&#8221; database takes up<br />
# only about 500KB, this should be more than enough for<br />
# this example Cluster setup.<br />
[MYSQLD DEFAULT]<br />
[NDB_MGMD DEFAULT]<br />
[TCP DEFAULT]<br />
# Section for the cluster management node<br />
[NDB_MGMD]<br />
# IP address of the management node (this system)<br />
HostName=10.0.1.30<br />
# Section for the storage nodes<br />
[NDBD]<br />
# IP address of the first storage node<br />
HostName=10.0.1.33<br />
DataDir=/usr/local/mysql/var/mysql-cluster<br />
BackupDataDir=/usr/local/mysql/var/mysql-cluster/backup<br />
DataMemory=2048M<br />
[NDBD]<br />
# IP address of the second storage node<br />
HostName=10.0.1.34<br />
DataDir=/usr/local/mysql/var/mysql-cluster<br />
BackupDataDir=/usr/local/mysql/var/mysql-cluster/backup<br />
DataMemory=2048M</p>
<p># one [MYSQLD] per storage node<br />
[MYSQLD]<br />
[MYSQLD]</p></blockquote>
<p>Please replace the IP addresses in the file appropriately to your setup.</p>
<p>Then we proceed to DataSQL nodes to make necessary dirs and files setup.</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>ndb_mgmd -f /usr/local/mysql/var/mysql-cluster/config.ini</code></p>
<p>It makes sense to automatically start the management server at system boot time, so we create a very simple init script and the appropriate startup links:</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>echo '/usr/local/mysql/libexec/ndb_mgmd -f /usr/local/mysql/var/mysql-cluster/config.ini' &gt; /etc/init.d/ndb_mgmd<br />
chmod 755 /etc/init.d/ndb_mgmd<br />
update-rc.d ndb_mgmd defaults</code></p>
<h3>3 Set Up The MySQL Cluster Nodes (Storage Nodes)</h3>
<p>Now we install mysql-5.1.14-rc on both mysql-data1.example.com and mysql-data2.example.com:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>cd /usr/src<br />
wget http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.24-rc.tar.gz<br />
tar xvzf mysql-5.1.24-rc.tar.gz<br />
groupadd mysql<br />
useradd -g mysql mysql<br />
cd /usr/src/mysql-5.1.24-rc<br />
./configure --prefix=/usr/local/mysql --enable-community-features --with-mysqld-user=mysql --with-plugins=ndbcluster<br />
make<br />
make install<br />
/usr/src/mysql-5.1.24-rc/scripts/mysql_install_db --user=mysql<br />
cd /usr/local/mysql<br />
chown -R root:mysql .<br />
chown -R mysql.mysql /usr/local/mysql/var</code></p>
<p><code>cd /usr/src/mysql-5.1.24-rc<br />
cp support-files/mysql.server /etc/init.d/<br />
chmod 755 /etc/init.d/mysql.server<br />
cd /etc/init.d<br />
update-rc.d mysql.server defaults</code></p>
<p>Then we create the MySQL configuration file /etc/my.cnf on both nodes:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>vi /etc/my.cnf</code></p>
<blockquote><p>[client]<br />
port=3306<br />
socket=/tmp/mysql.sock<br />
[mysqld]<br />
ndbcluster<br />
# IP address of the cluster management node<br />
ndb-connectstring=10.0.1.30<br />
default-storage-engine=NDBCLUSTER</p>
<p>#Those are for future tuning<br />
#max_connections=341<br />
#query_cache_size=16M<br />
#thread_concurrency = 4<br />
[mysql_cluster]<br />
# IP address of the cluster management node<br />
ndb-connectstring=10.0.1.30</p></blockquote>
<p>Make sure to fill in the correct IP address of the MySQL cluster management server.</p>
<p>Lets add PATH env. to data nodes also:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>echo "PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/libexec" &gt;&gt;/root/.bash_profile<br />
echo "export PATH" &gt;&gt;/root/.bash_profile</code></p>
<p>Next we create the data and backup directories and start the MySQL server on both cluster nodes:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>mkdir /usr/local/mysql/var/mysql-cluster<br />
mkdir /usr/local/mysql/var/mysql-cluster/backup<br />
cd /var/lib/mysql-cluster<br />
ndbd --initial<br />
/etc/init.d/mysql.server start</code></p>
<p>(Please note: we have to run ndbd &#8211;initial only when we start MySQL for the first time, and if /usr/local/mysql/mysql-cluster/config.ini on mysql-mngt.example.com changes.)</p>
<p>Now is a good time to set a password for the MySQL root user:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>mysqladmin -u root password yourrootsqlpassword</code></p>
<p>We want to start the cluster nodes at boot time, so we create an ndbd init script and the appropriate system startup links:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>echo '/usr/local/mysql/libexec/ndbd' &gt; /etc/init.d/ndbd<br />
chmod 755 /etc/init.d/ndbd<br />
update-rc.d ndbd defaults</code></p>
<h3>4 Test The MySQL Cluster</h3>
<p>Our MySQL cluster configuration is already finished, now it&#8217;s time to test it. On the cluster management server (loadb1.example.com), run the cluster management client ndb_mgm to check if the cluster nodes are connected:</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>ndb_mgm</code></p>
<p>You should see this:</p>
<blockquote><p>&#8211; NDB Cluster &#8212; Management Client &#8211;<br />
ndb_mgm&gt;</p></blockquote>
<p>Now type show; at the command prompt:</p>
<p><code>show;</code></p>
<p>The output should be like this:</p>
<blockquote><p>ndb_mgm&gt; show;<br />
Connected to Management Server at: localhost:1186<br />
Cluster Configuration<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[ndbd(NDB)] 2 node(s)<br />
id=2 @10.0.1.33 (Version: 5.1.24, Nodegroup: 0, Master)<br />
id=3 @10.0.1.34 (Version: 5.1.24, Nodegroup: 0)</p>
<p>[ndb_mgmd(MGM)] 1 node(s)<br />
id=1 @10.0.1.30 (Version: 5.1.24)</p>
<p>[mysqld(API)] 2 node(s)<br />
id=4 @10.0.1.34 (Version: 5.1.24)<br />
id=5 @10.0.1.33 (Version: 5.1.24)</p>
<p>ndb_mgm&gt;</p></blockquote>
<p>If you see that your nodes are connected, then everything&#8217;s ok!</p>
<p>Type</p>
<p><code>quit;</code></p>
<p>to leave the ndb_mgm client console.</p>
<p>Now we have to create a test database with a test table and some data on mysql-data1.example.com:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com:</span></p>
<p><code>mysql -u root -p<br />
CREATE DATABASE mysqlclustertest;<br />
USE mysqlclustertest;<br />
CREATE TABLE testtable (I INT) ENGINE=NDBCLUSTER;<br />
INSERT INTO testtable () VALUES (1);<br />
SELECT * FROM testtable;<br />
quit;</code></p>
<p>(Have a look at the CREATE statement: We must use ENGINE=NDBCLUSTER for all database tables that we want to get clustered! If you use another engine, then clustering will not work!)</p>
<p>The result of the SELECT statement should be:</p>
<blockquote><p>mysql&gt; SELECT * FROM testtable;<br />
+&#8212;&#8212;+<br />
| I    |<br />
+&#8212;&#8212;+<br />
| 1    |<br />
+&#8212;&#8212;+<br />
1 row in set (0.03 sec)</p></blockquote>
<p>Now we have to create the same database on sql2.example.com (yes, we still have to create it, but afterwards testtable and its data should be replicated to mysql-data2.example.com because testtable uses ENGINE=NDBCLUSTER):</p>
<p><span style="color: #ff0000;">mysql-data2.example.com:</span></p>
<p><code>mysql -u root -p<br />
CREATE DATABASE mysqlclustertest;<br />
USE mysqlclustertest;<br />
SELECT * FROM testtable;</code></p>
<p>The SELECT statement should deliver you the same result as before on mysql-data1.example.com: [The CREATE statement should fail due to NDBCLUSTER Engine]</p>
<blockquote><p>mysql&gt; SELECT * FROM testtable;<br />
+&#8212;&#8212;+<br />
| I    |<br />
+&#8212;&#8212;+<br />
| 1    |<br />
+&#8212;&#8212;+<br />
1 row in set (0.04 sec)</p></blockquote>
<p>So the data was replicated from mysql-data1.example.com to mysql-data2.example.com. Now we insert another row into testtable:</p>
<p><span style="color: #ff0000;">mysql-data2.example.com:</span></p>
<p><code>INSERT INTO testtable () VALUES (2);<br />
quit;</code></p>
<p>Now let&#8217;s go back to mysql-data1.example.com and check if we see the new row there:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com:</span></p>
<p><code>mysql -u root -p<br />
USE mysqlclustertest;<br />
SELECT * FROM testtable;<br />
quit;</code></p>
<p>You should see something like this:</p>
<blockquote><p>mysql&gt; SELECT * FROM testtable;<br />
+&#8212;&#8212;+<br />
| I    |<br />
+&#8212;&#8212;+<br />
| 1    |<br />
| 2    |<br />
+&#8212;&#8212;+<br />
2 rows in set (0.05 sec)</p></blockquote>
<p>So both MySQL cluster nodes always have the same data!</p>
<p>Now let&#8217;s see what happens if we stop node 1 (mysql-data1.example.com): Run</p>
<p><span style="color: #ff0000;">mysql-data1.example.com:</span></p>
<p><code>killall ndbd</code></p>
<p>and check with</p>
<p><code>ps aux | grep ndbd | grep -iv grep</code></p>
<p>that all ndbd processes have terminated. If you still see ndbd processes, run another</p>
<p><code>killall ndbd</code></p>
<p>until all ndbd processes are gone.</p>
<p>Now let&#8217;s check the cluster status on our management server (mysql-mngt.example.com):</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>ndb_mgm</code></p>
<p>On the ndb_mgm console, issue</p>
<p><code>show;</code></p>
<p>and you should see this:</p>
<blockquote><p>ndb_mgm&gt; show;<br />
Connected to Management Server at: localhost:1186<br />
Cluster Configuration<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
[ndbd(NDB)] 2 node(s)<br />
id=2 (not connected, accepting connect from 10.0.1.33)<br />
id=3 @10.0.1.34 (Version: 5.1.24, Nodegroup: 0, Master)</p>
<p>[ndb_mgmd(MGM)] 1 node(s)<br />
id=1 @10.0.1.30 (Version: 5.1.24)</p>
<p>[mysqld(API)] 2 node(s)<br />
id=4 @10.0.1.34 (Version: 5.1.24)<br />
id=5 @10.0.1.33 (Version: 5.1.24)</p>
<p>ndb_mgm&gt;</p></blockquote>
<p>You see, mysql-data1.example.com is not connected anymore.</p>
<p>Type</p>
<p><code>quit;</code></p>
<p>to leave the ndb_mgm console.</p>
<p>Let&#8217;s check mysql-data2.example.com:</p>
<p><span style="color: #ff0000;">mysql-data2.example.com:</span></p>
<p><code>mysql -u root -p<br />
USE mysqlclustertest;<br />
SELECT * FROM testtable;<br />
quit;</code></p>
<p>The result of the SELECT query should still be</p>
<blockquote><p>mysql&gt; SELECT * FROM testtable;<br />
+&#8212;&#8212;+<br />
| I    |<br />
+&#8212;&#8212;+<br />
| 1    |<br />
| 2    |<br />
+&#8212;&#8212;+<br />
2 rows in set (0.17 sec)</p></blockquote>
<p>Ok, all tests went fine, so let&#8217;s start our mysql-data1.example.com node again:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com:</span></p>
<p><code>ndbd</code></p>
<h3>5 How To Restart The Cluster</h3>
<p>Now let&#8217;s asume you want to restart the MySQL cluster, for example because you have changed /usr/local/mysql/var/mysql-cluster/config.ini on mysql-mngt.example.com or for some other reason. To do this, you use the ndb_mgm cluster management client on mysql-mngt.example.com:</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>ndb_mgm</code></p>
<p>On the ndb_mgm console, you type</p>
<p><code>shutdown;</code></p>
<p>You will then see something like this:</p>
<blockquote><p>ndb_mgm&gt; shutdown;<br />
Node 3: Cluster shutdown initiated<br />
Node 2: Node shutdown completed.<br />
2 NDB Cluster node(s) have shutdown.<br />
NDB Cluster management server shutdown.<br />
ndb_mgm&gt;</p></blockquote>
<p>This means that the cluster data nodes mysql-data1.example.com and mysql-data2.example.com and also the cluster management server have shut down.</p>
<p>Run</p>
<p><code>quit;</code></p>
<p>to leave the ndb_mgm console.</p>
<p>To start the cluster management server, do this on mysql-mngt.example.com:</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>ndb_mgmd -f /usr/local/mysql/mysql-cluster/config.ini</code></p>
<p>and on mysql-data1.example.com and mysql-data2.example.com you can run</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>ndbd</code></p>
<p>or, if you have changed /usr/local/mysql/var/mysql-cluster/config.ini on mysql-mngt.example.com:</p>
<p><code>ndbd --initial</code></p>
<p>Afterwards, you can check on mysql-mngt.example.com if the cluster has restarted:</p>
<p><span style="color: #ff0000;">mysql-mngt.example.com:</span></p>
<p><code>ndb_mgm</code></p>
<p>On the ndb_mgm console, type</p>
<p><code>show;</code></p>
<p>to see the current status of the cluster. It might take a few seconds after a restart until all nodes are reported as connected.</p>
<p>Type</p>
<p><code>quit;</code></p>
<p>to leave the ndb_mgm console.</p>
<h3>6 Configure The Load Balancers</h3>
<p>Our MySQL cluster is finished now, and you could start using it now. However, we don&#8217;t have a single IP address that we can use to access the cluster, which means you must configure your applications in a way that a part of it uses the MySQL cluster node 1 (mysql-data1.example.com), and the rest uses the other node (mysql-data2.example.com). Of course, all your applications could just use one node, but what&#8217;s the point then in having a cluster if you do not split up the load between the cluster nodes? Another problem is, what happens if one of the cluster nodes fails? Then the applications that use this cluster node cannot work anymore.</p>
<p>The solution is to have a load balancer in front of the MySQL cluster which (as its name suggests) balances the load between the MySQL cluster nodes. The load blanacer configures a virtual IP address that is shared between the cluster nodes, and all your applications use this virtual IP address to access the cluster. If one of the nodes fails, then your applications will still work, because the load balancer redirects the requests to the working node.</p>
<p>Now in this scenario the load balancer becomes the bottleneck. What happens if the load balancer fails? Therefore we will configure two load balancers (mysql-lb1.example.com and mysql-b2.example.com) in an active/passive setup, which means we have one active load balancer, and the other one is a hot-standby and becomes active if the active one fails. Both load balancers use heartbeat to check if the other load balancer is still alive, and both load balancers also use ldirectord, the actual load balancer the splits up the load onto the cluster nodes. heartbeat and ldirectord are provided by the Ultra Monkey package that we will install.</p>
<p>It is important that mysql-lb1.example.com and mysql-lb2.example.com have support for IPVS (IP Virtual Server) in their kernels. IPVS implements transport-layer load balancing inside the Linux kernel.</p>
<h4>6.1 Install Ultra Monkey</h4>
<p>Ok, let&#8217;s start: first we enable IPVS on mysql-lb1.example.com and mysql-lb2.example.com:</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>modprobe ip_vs_dh<br />
modprobe ip_vs_ftp<br />
modprobe ip_vs<br />
modprobe ip_vs_lblc<br />
modprobe ip_vs_lblcr<br />
modprobe ip_vs_lc<br />
modprobe ip_vs_nq<br />
modprobe ip_vs_rr<br />
modprobe ip_vs_sed<br />
modprobe ip_vs_sh<br />
modprobe ip_vs_wlc<br />
modprobe ip_vs_wrr</code></p>
<p>In order to load the IPVS kernel modules at boot time, we list the modules in /etc/modules:</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>vi /etc/modules</code></p>
<blockquote><p>ip_vs_dh<br />
ip_vs_ftp<br />
ip_vs<br />
ip_vs_lblc<br />
ip_vs_lblcr<br />
ip_vs_lc<br />
ip_vs_nq<br />
ip_vs_rr<br />
ip_vs_sed<br />
ip_vs_sh<br />
ip_vs_wlc<br />
ip_vs_wrr</p></blockquote>
<p>Now we edit /etc/apt/sources.list and add the Ultra Monkey repositories (don&#8217;t remove the other repositories), and then we install Ultra Monkey:</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>vi /etc/apt/sources.list</code></p>
<blockquote><p>deb http://www.ultramonkey.org/download/3/ sarge main<br />
deb-src http://www.ultramonkey.org/download/3 sarge main</p></blockquote>
<p><code>apt-get update<br />
apt-get install ultramonkey libdbi-perl libdbd-mysql-perl libmysqlclient14-dev</code></p>
<p>Now Ultra Monkey is being installed. If you see this warning:</p>
<blockquote><p>¦ libsensors3 not functional                                               ¦<br />
¦                                                                          ¦<br />
¦ It appears that your kernel is not compiled with sensors support. As a   ¦<br />
¦ result, libsensors3 will not be functional on your system.               ¦<br />
¦                                                                          ¦<br />
¦ If you want to enable it, have a look at &#8220;I2C Hardware Sensors Chip      ¦<br />
¦ support&#8221; in your kernel configuration.                                   ¦</p></blockquote>
<p>you can ignore it.</p>
<p>Answer the following questions:</p>
<p>Do you want to automatically load IPVS rules on boot?<br />
&lt;&#8211; No</p>
<p>Select a daemon method.<br />
&lt;&#8211; none</p>
<p>The libdbd-mysql-perl package we&#8217;ve just installed does not work with MySQL 5 (we use MySQL 5 on our MySQL cluster&#8230;), so we install the newest DBD::mysql Perl package:</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>cd /tmp<br />
wget http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-3.0002.tar.gz<br />
tar xvfz DBD-mysql-3.0002.tar.gz<br />
cd DBD-mysql-3.0002<br />
perl Makefile.PL<br />
make<br />
make install</code></p>
<p>We must enable packet forwarding:</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>vi /etc/sysctl.conf</code></p>
<blockquote><p># Enables packet forwarding<br />
net.ipv4.ip_forward = 1</p></blockquote>
<p><code>sysctl -p</code></p>
<h4>6.2 Configure heartbeat</h4>
<p>Next we configure heartbeat by creating three files (all three files must be identical on mysql-lb1.example.com and mysql-lb2.example.com):</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>vi /etc/ha.d/ha.cf</code></p>
<blockquote><p>logfacility        local0<br />
bcast        eth0<br />
mcast eth0 225.0.0.1 694 1 0<br />
auto_failback off<br />
node        mysql-lb1<br />
node        mysql-lb2<br />
respawn hacluster /usr/lib/heartbeat/ipfail<br />
apiauth ipfail gid=haclient uid=hacluster</p></blockquote>
<p>Please note: you must list the node names (in this case mysql-lb1 and lmysql-lb2) as shown by</p>
<p><code>uname -n</code></p>
<p>IP addresses does not work here, it is also good idea to add proper entries on both load balancers(mysql-lb1 and lmysql-lb2) in</p>
<p><code>vi /etc/hosts</code></p>
<blockquote><p>127.0.0.1       localhost<br />
10.0.1.31       mysql-lb1.example.com    mysql-lb1<br />
10.0.1.32       mysql-lb2.example.com    mysql-lb2</p></blockquote>
<p>Now let&#8217;s change here your Virtual MySQL IP:</p>
<p><code>vi /etc/ha.d/haresources</code></p>
<blockquote><p>loadb1        \<br />
ldirectord::ldirectord.cf \<br />
LVSSyncDaemonSwap::master \<br />
IPaddr2::<strong>10.0.1.10</strong>/24/eth0/<strong>10.0.1.255</strong></p></blockquote>
<p>You must list one of the load balancer node names (here: mysql-lb1) and list the virtual IP address (10.0.1.10) together with the correct netmask (24) and broadcast address (10.0.1.255). If you are unsure about the correct settings, <a href="http://www.subnetmask.info/" target="_blank">http://www.subnetmask.info/</a> might help you.</p>
<p><code>vi /etc/ha.d/authkeys</code></p>
<blockquote><p>auth 3<br />
3 md5 somerandomstring</p></blockquote>
<p>somerandomstring is a password which the two heartbeat daemons on loadb1 and loadb2 use to authenticate against each other. Use your own string here. You have the choice between three authentication mechanisms. I use md5 as it is the most secure one.</p>
<p>/etc/ha.d/authkeys should be readable by root only, therefore we do this:</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>chmod 600 /etc/ha.d/authkeys</code></p>
<h4>6.3 Configure ldirectord</h4>
<p>Now we create the configuration file for ldirectord, the load balancer:</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>vi /etc/ha.d/ldirectord.cf</code></p>
<blockquote><p># Global Directives<br />
checktimeout=10<br />
checkinterval=2<br />
autoreload=no<br />
logfile=&#8221;local0&#8243;<br />
quiescent=yes<br />
virtual = 10.0.1.10:3306<br />
service = mysql<br />
real = 10.0.1.33:3306 gate<br />
real = 10.0.1.34:3306 gate<br />
checktype = negotiate<br />
login = &#8220;ldirector&#8221;<br />
passwd = &#8220;ldirectorpassword&#8221;<br />
database = &#8220;ldirectordb&#8221;<br />
request = &#8220;SELECT * FROM connectioncheck&#8221;<br />
scheduler = wrr</p></blockquote>
<p>Please fill in the correct virtual IP address (10.0.1.10) and the correct IP addresses of your MySQL cluster nodes (10.0.1.33 and 10.0.1.34). 3306 is the port that MySQL runs on by default. We also specify a MySQL user (ldirector) and password (ldirectorpassword), a database (ldirectordb) and an SQL query. ldirectord uses this information to make test requests to the MySQL cluster nodes to check if they are still available. We are going to create the ldirector database with the ldirector user in the next step.</p>
<p>Now we create the necessary system startup links for heartbeat and remove those of ldirectord (bacause ldirectord will be started by heartbeat):</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>update-rc.d -f heartbeat remove<br />
update-rc.d heartbeat start 75 2 3 4 5 . stop 05 0 1 6 .<br />
update-rc.d -f ldirectord remove</code></p>
<h4>6.4 Create A Database Called ldirector</h4>
<p>Next we create the ldirector database on our MySQL cluster nodes mysql-data1.example.com and mysql-data2.example.com. This database will be used by our load balancers to check the availability of the MySQL cluster nodes.</p>
<p><span style="color: #ff0000;">mysql-data1.example.com:</span></p>
<p><code>mysql -u root -p<br />
GRANT ALL ON ldirectordb.* TO 'ldirector'@'%' IDENTIFIED BY 'ldirectorpassword';<br />
FLUSH PRIVILEGES;<br />
CREATE DATABASE ldirectordb;<br />
USE ldirectordb;<br />
CREATE TABLE connectioncheck (I INT) ENGINE=NDBCLUSTER;<br />
INSERT INTO connectioncheck () VALUES (1);<br />
quit;</code></p>
<p><span style="color: #ff0000;">mysql-data2.example.com:</span></p>
<p><code>mysql -u root -p<br />
GRANT ALL ON ldirectordb.* TO 'ldirector'@'%' IDENTIFIED BY 'ldirectorpassword';<br />
FLUSH PRIVILEGES;<br />
CREATE DATABASE ldirectordb;<br />
quit;</code></p>
<h4>6.5 Prepare The MySQL Cluster Nodes For Load Balancing</h4>
<p>Finally we must configure our MySQL cluster nodes mysql-data1.example.com and mysql-data2.example.com to accept requests on the virtual IP address 192.168.0.105.</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>apt-get install iproute</code></p>
<p>Add the following to /etc/sysctl.conf:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>vi /etc/sysctl.conf</code></p>
<blockquote><p># Enable configuration of arp_ignore option<br />
net.ipv4.conf.all.arp_ignore = 1</p>
<p># When an arp request is received on eth0, only respond if that address is<br />
# configured on eth0. In particular, do not respond if the address is<br />
# configured on lo<br />
net.ipv4.conf.eth0.arp_ignore = 1</p>
<p># Ditto for eth1, add for all ARPing interfaces<br />
#net.ipv4.conf.eth1.arp_ignore = 1</p>
<p># Enable configuration of arp_announce option<br />
net.ipv4.conf.all.arp_announce = 2</p>
<p># When making an ARP request sent through eth0 Always use an address that<br />
# is configured on eth0 as the source address of the ARP request.  If this<br />
# is not set, and packets are being sent out eth0 for an address that is on<br />
# lo, and an arp request is required, then the address on lo will be used.<br />
# As the source IP address of arp requests is entered into the ARP cache on<br />
# the destination, it has the effect of announcing this address.  This is<br />
# not desirable in this case as adresses on lo on the real-servers should<br />
# be announced only by the linux-director.<br />
net.ipv4.conf.eth0.arp_announce = 2</p>
<p># Ditto for eth1, add for all ARPing interfaces<br />
#net.ipv4.conf.eth1.arp_announce = 2</p></blockquote>
<p><code>sysctl -p</code></p>
<p>Add this section for the virtual IP address to /etc/network/interfaces:</p>
<p><span style="color: #ff0000;">mysql-data1.example.com / mysql-data2.example.com:</span></p>
<p><code>vi /etc/network/interfaces</code></p>
<blockquote><p>auto lo:0<br />
iface lo:0 inet static<br />
address 10.0.1.10<br />
netmask 255.255.255.255<br />
pre-up sysctl -p &gt; /dev/null</p></blockquote>
<p><code>ifup lo:0</code></p>
<h3>7 Start The Load Balancer And Do Some Testing</h3>
<p>Now we can start our two load balancers for the first time:</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>/etc/init.d/ldirectord stop<br />
/etc/init.d/heartbeat start</code></p>
<p>If you don&#8217;t see errors, you should now reboot both load balancers.If you do see errors go to the end of this tutorial I might know whats the problem <img src='http://redhatvn.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  [Chapter 8]</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>shutdown -r now</code></p>
<p>After the reboot we can check if both load balancers work as expected :</p>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>ip addr sh eth0</code></p>
<p>The active load balancer should list the virtual IP address (10.0.1.10):</p>
<blockquote><p>2: eth0: &lt;BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc pfifo_fast qlen 1000<br />
link/ether 00:16:3e:45:fc:f8 brd ff:ff:ff:ff:ff:ff<br />
inet 10.0.1.31/24 brd 192.168.0.255 scope global eth0<br />
inet 10.0.1.10/24 brd 192.168.0.255 scope global secondary eth0</p></blockquote>
<p>The hot-standby should show this:</p>
<blockquote><p>2: eth0: &lt;BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc pfifo_fast qlen 1000<br />
link/ether 00:16:3e:16:c1:4e brd ff:ff:ff:ff:ff:ff<br />
inet 10.0.1.32/24 brd 192.168.0.255 scope global eth0</p></blockquote>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>ldirectord ldirectord.cf status</code></p>
<p>Output on the active load balancer:</p>
<blockquote><p>ldirectord for /etc/ha.d/ldirectord.cf is running with pid: 1603</p></blockquote>
<p>Output on the hot-standby:</p>
<blockquote><p>ldirectord is stopped for /etc/ha.d/ldirectord.cf</p></blockquote>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>ipvsadm -L -n</code></p>
<p>Output on the active load balancer:</p>
<blockquote><p>IP Virtual Server version 1.2.1 (size=4096)<br />
Prot LocalAddress:Port Scheduler Flags<br />
-&gt; RemoteAddress:Port           Forward Weight ActiveConn InActConn<br />
TCP  10.0.1.10:3306 wrr<br />
-&gt; 10.0.1.33:3306               Route   1      0          0<br />
-&gt; 10.0.1.34:3306               Route   1      0          0</p></blockquote>
<p>Output on the hot-standby:</p>
<blockquote><p>IP Virtual Server version 1.2.1 (size=4096)<br />
Prot LocalAddress:Port Scheduler Flags<br />
-&gt; RemoteAddress:Port           Forward Weight ActiveConn InActConn</p></blockquote>
<p><span style="color: #ff0000;">mysql-lb1.example.com / mysql-lb2.example.com:</span></p>
<p><code>/etc/ha.d/resource.d/LVSSyncDaemonSwap master status</code></p>
<p>Output on the active load balancer:</p>
<blockquote><p>master running<br />
(ipvs_syncmaster pid: 1766)</p></blockquote>
<p>Output on the hot-standby:</p>
<blockquote><p>master stopped<br />
(ipvs_syncbackup pid: 1440)</p></blockquote>
<p>If your tests went fine, you can now try to access the MySQL database from a totally different server in the same network (10.0.1.x) using the virtual IP address 10.0.1.10:</p>
<p><code>mysql -h 10.0.1.10 -u ldirector -p</code></p>
<p>(Please note: your MySQL client must at least be of version 4.1; older versions do not work with MySQL 5.)</p>
<p>You can now switch off one of the MySQL cluster nodes for test purposes; you should then still be able to connect to the MySQL database.</p>
<h3>8 Annotations and hints</h3>
<p>Errors with <strong>ldirectord:</strong></p>
<p><code>/etc/init.d/ldirectord stop<br />
/etc/init.d/heartbeat start</code><br />
Stopping ldirectord Error [] reading file /etc/ha.d/ldirectord.cf at line 8: &gt;Unknown command service=mysql</p>
<p>This error is due to formatting, it took me some time to figure it out.<br />
The serivce= mysql is probably connected to /etc/services which is correct.<br />
If you have libmysqlclient15 or 14 installed, fixing right formatting will do the trick  like here:</p>
<p><code>vi /etc/heartbeat/ldirectord.cf</code></p>
<blockquote><p># Global Directives<br />
checktimeout=10<br />
checkinterval=2<br />
autoreload=no<br />
logfile=&#8221;local0&#8243;<br />
quiescent=yes<br />
#after virtual=&#8230; make TABS (or double spaces) in every line<br />
virtual = 10.0.1.10:3306<br />
service = mysql<br />
real = 10.0.1.33:3306 gate<br />
real = 10.0.1.34:3306 gate<br />
checktype = negotiate<br />
login = &#8220;ldirector&#8221;<br />
passwd = &#8220;ldirector&#8221;<br />
database = &#8220;ldirectordb&#8221;<br />
request = &#8220;SELECT * FROM connectioncheck&#8221;<br />
scheduler = wrr</p></blockquote>
<p>And that should be it.</p>
<p><span style="text-decoration: underline;">There are some important things to keep in mind when running a MySQL cluster:</span></p>
<p>1.If you have your databases and you want to use them in MySQL cluster please read <a href="http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-multi-load-data-queries.html" target="_blank">this</a> as it will guide you through how to change ENGINE=MyISAM to NDBCLUSTER.</p>
<p>2. Adding user to mysql database and changing GRANTS <strong>must be</strong> done on all data nodes since mysql database is MyISAM/InoDB. You can of course convert it&#8217;s engine.</p>
<p>3.<strong>All data is stored in RAM!</strong> as a default, but Therefore you need lots of RAM on your cluster nodes. The formula how much RAM you need on each node goes like this:</p>
<p>(SizeofDatabase × NumberOfReplicas × 1.1 ) / NumberOfDataNodes</p>
<p>So if you have a database that is 1 GB of size, you would need 1.1 GB RAM <strong>on each node</strong>!</p>
<p>4.The cluster management node listens on port 1186, and anyone can connect. So that&#8217;s definitely not secure, and therefore you should run your cluster in an isolated private network! Since it would be harder to manage it may be a good idea to make changes to /etc/hosts.deny or prepare iptables based firewall.</p>
<p>5.It&#8217;s a good idea to have a look at the MySQL Cluster FAQ: <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster-faq.html" target="_blank">http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-faq.html</a> and also at the MySQL Cluster documentation: <a href="http://dev.mysql.com/doc/refman/5.0/en/ndbcluster.html" target="_blank">http://dev.mysql.com/doc/refman/5.1/en/ndbcluster.html</a></p>
<h3>Links</h3>
<ul>
<li>MySQL: <a href="http://www.mysql.com/" target="_blank">http://www.mysql.com/</a></li>
<li>MySQL Cluster documentation: <a href="http://dev.mysql.com/doc/refman/5.0/en/ndbcluster.html" target="_blank">http://dev.mysql.com/doc/refman/5.1/en/ndbcluster.html</a></li>
<li>MySQL Cluster FAQ: <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster-faq.html" target="_blank">http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-faq.html</a></li>
<li>Ultra Monkey: <a href="http://www.ultramonkey.org/" target="_blank">http://www.ultramonkey.org/</a></li>
<li>The High-Availability Linux Project: <a href="http://www.linux-ha.org/" target="_blank">http://www.linux-ha.org/</a></li>
<li>MySQL 5.1 Cluster Replication <a href="http://blog.dbadojo.com/2007/08/mysql-51-ndb-cluster-replication-on-ec2.html" target="_blank">http://blog.dbadojo.com/2007/08/mysql-51-ndb-cluster-replication-on-ec2.html</a></li>
<li>How to stress test my MySQL Cluster 5.1 <a href="http://blogs.techrepublic.com.com/howdoi/?p=133" target="_blank">http://blogs.techrepublic.com.com/howdoi/?p=133</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/how-to-set-up-a-load-balanced-mysql-cluster-with-mysql-5-1/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->