Create Apache scalable service with 3 nodes:
First as always we add, whats going to be our shared-ip address to the /etc/hosts on all the nodes:
19.132.168.194 apache-shared
Then we need to create a failover resource group for the IP resource:
[root@vm1:/]# clrg create APA-sharedip-rg
[root@vm1:/]#clressharedaddress create -g APA-sharedip-rg -h apache-shared apache-shared-ip
Once we have the shared IP resource group configured, we create the scalable apache RG, and put the IP failover resource as a dependencie:
[root@vm1:/]#clresourcegroup create -p Maximum_primaries=3 -p Desired_primaries=3 -p RG_dependencies=APA-sharedip-rg APASHAREDrg
And finally we create the Apache scalable resource inside the APASHAREDrg RG, and using apache-shared-ip we created before.
[root@vm3:/]# clresource create -g APASHAREDrg -t SUNW.apache -p Bin_dir=/usr/apache/bin -p Network_resources_used=apache-shared-ip -p Scalable=True -p Port_list=80/tcp apache-shared-ap
Once we have all this working, I wrote a quick index.html file for each server that showed the servers name:
THIS IS SERVER VM2
Once I had one on each server, we start first the APA-sharedip-rg and then APASHAREDrg:
[root@vm2:apache/htdocs]# clrg status (12-02 15:33)
=== Cluster Resource Groups ===
Group Name Node Name Suspended Status
---------- --------- --------- ------
NFSrg vm1 No Online
vm2 No Offline
vm3 No Offline
APACHE1rg vm2 No Offline
vm1 No Offline
vm3 No Offline
APA2-rg vm1:zone1 No Online
vm2:zone1 No Offline
APA-sharedip-rg vm3 No Online
vm2 No Offline
vm1 No Offline
APASHAREDrg vm3 No Online
vm2 No Online
vm1 No Online
No if we test it out from another host, we can see the load balancing policy going each time to a different apache server:
root@x4200m2 # telnet apache-shared 80
Trying 19.132.168.194...
Connected to apache-shared.
Escape character is '^]'.
GET /index.html
THIS IS SERVER VM1
Connection to apache-shared closed by foreign host.
root@x4200m2 # telnet apache-shared 80
Trying 19.132.168.194...
Connected to apache-shared.
Escape character is '^]'.
GET /index.html
THIS IS SERVER VM2
Connection to apache-shared closed by foreign host.
root@x4200m2 # telnet apache-shared 80
Trying 19.132.168.194...
Connected to apache-shared.
Escape character is '^]'.
GET /index.html
THIS IS SERVER VM3
Connection to apache-shared closed by foreign host.
Add new comment