Posted by: UNIX_geek February 15, 2011
Login in to Rate this Post:
1
?
Liked by
This is good.
Before learning we need to know how deep we were in Clustering wheter it is Veritas Cluster.,Sun Cluster or through
Vmware using Centos or ESX redundancy.
SO learning how to set up the high performace cluster using CentOS.
This is just an example IP i always take it coz i learn it from this ip
Configuration: Assign hostname node1 to primary node with IP address 192.168.9.172 to eth0.
Assign hostname node2 to slave node with IP address 192.168.9.173
Note: on node1
uname -n on both server
192.168.9.173 its virtual IP address that will be used for our web server (ie Apache will listen on that address).
Configuration.
Download and install the heartbeat package. In our case we are using CentOS so we will install heartbeat with yum:
yum install heartbeat or for this you have to configure yum if not do below
or download these packages: Its just a version we figure it out by server platform
heartbeat-2.08
heartbeat-pils-2.08
heartbeat-stonith-2.08
So we have to configure heartbeat on our two node cluster. We will deal with these files.
authkeys
ha.cf
haresources
Now moving to our configuration. But there is one more thing to do, that is to copy these files to the /etc/ha.d directory. In our case we copy these files as given below:
cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.2/ha.cf /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.2/haresources /etc/ha.d/
start configuring heartbeat. First we will deal with the authkeys file
. For this we will make changes in the authkeys file as below.
EDIT /etc/ha.d/authkeys
auth 2
2 sha1 test-ha add it
chmod 600 /etc/ha.d/authkeys
Moving to our second file (ha.cf) which is the most important. So edit the ha.cf file with vi:
vi /etc/ha.d/ha.cf
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
bcast eth0
udpport 694
auto_failback on
node node01
node1 and node2 save and quit!
Now edit the haresources file. This file contains the information about resources which we want to highly enable. In our case we want the webserver (httpd) highly available:
Edit /etc/ha.d/haresources
node1 192.168.9.174 httpd save it !!!
winscp/sftp/scp -r /etc/ha.d/ root@node02:/etc/ from both node
Finally Edit /etc/httpd/conf/httpd.conf
Listen 172.16.4.82:80 save save same in node 2 tooo
scp -r /etc/httpd/conf/httpd.conf root@node02:/etc/httpd/conf/
we have to create Index on both server
echo “node1 apache test server” > /var/www/html/index.html
echo “node2 apache test server” > /var/www/html/index.html
start heartbeat on both server
/etc/init.d/heartbeat start
NOW
http://192.168.9.174
This will show node01 apache test server.
In your browser type in the URL http://192.168.9.174
If you dont understand the process just knock me i will be able to help you.
But frankly speaking i have done clustering through ESX Server, Big corporate recommend this one.
Once you know the concept of clusternig than getting command is nothing.
Thanks
Geek
Before learning we need to know how deep we were in Clustering wheter it is Veritas Cluster.,Sun Cluster or through
Vmware using Centos or ESX redundancy.
SO learning how to set up the high performace cluster using CentOS.
This is just an example IP i always take it coz i learn it from this ip
Configuration: Assign hostname node1 to primary node with IP address 192.168.9.172 to eth0.
Assign hostname node2 to slave node with IP address 192.168.9.173
Note: on node1
uname -n on both server
192.168.9.173 its virtual IP address that will be used for our web server (ie Apache will listen on that address).
Configuration.
Download and install the heartbeat package. In our case we are using CentOS so we will install heartbeat with yum:
yum install heartbeat or for this you have to configure yum if not do below
or download these packages: Its just a version we figure it out by server platform
heartbeat-2.08
heartbeat-pils-2.08
heartbeat-stonith-2.08
So we have to configure heartbeat on our two node cluster. We will deal with these files.
authkeys
ha.cf
haresources
Now moving to our configuration. But there is one more thing to do, that is to copy these files to the /etc/ha.d directory. In our case we copy these files as given below:
cp /usr/share/doc/heartbeat-2.1.2/authkeys /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.2/ha.cf /etc/ha.d/
cp /usr/share/doc/heartbeat-2.1.2/haresources /etc/ha.d/
start configuring heartbeat. First we will deal with the authkeys file
. For this we will make changes in the authkeys file as below.
EDIT /etc/ha.d/authkeys
auth 2
2 sha1 test-ha add it
chmod 600 /etc/ha.d/authkeys
Moving to our second file (ha.cf) which is the most important. So edit the ha.cf file with vi:
vi /etc/ha.d/ha.cf
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
bcast eth0
udpport 694
auto_failback on
node node01
node1 and node2 save and quit!
Now edit the haresources file. This file contains the information about resources which we want to highly enable. In our case we want the webserver (httpd) highly available:
Edit /etc/ha.d/haresources
node1 192.168.9.174 httpd save it !!!
winscp/sftp/scp -r /etc/ha.d/ root@node02:/etc/ from both node
Finally Edit /etc/httpd/conf/httpd.conf
Listen 172.16.4.82:80 save save same in node 2 tooo
scp -r /etc/httpd/conf/httpd.conf root@node02:/etc/httpd/conf/
we have to create Index on both server
echo “node1 apache test server” > /var/www/html/index.html
echo “node2 apache test server” > /var/www/html/index.html
start heartbeat on both server
/etc/init.d/heartbeat start
NOW
http://192.168.9.174
This will show node01 apache test server.
In your browser type in the URL http://192.168.9.174
If you dont understand the process just knock me i will be able to help you.
But frankly speaking i have done clustering through ESX Server, Big corporate recommend this one.
Once you know the concept of clusternig than getting command is nothing.
Thanks
Geek
Last edited: 15-Feb-11 08:30 PM