What are the steps to do clustering on JBoss AS 7 with mod_cluster in HTTP server?
j_pramanik Jan 2, 2013 12:47 AMHi All,
Can any one please tell me what are typical steps to implement application clustering and Load balancing in Jboss AS 7 with mod_cluster in Apache HTTP Server? I have tried following steps but not sure whether these are fully correct. If any corrections needs to be done please tell me.
Operating system used : Windows XP prof.
Configuration done on JBoss side
I need to mention that I have configured "standard-ha.xml" for each of the four nodes as below-
1. <server name="node1" xmlns="urn:jboss:domain:1.2">
name="nodeX" is mentioned for each of the four node for <server> tag.
2. mod_cluster is configured:
<subsystem xmlns="urn:jboss:domain:modcluster:1.0">
<mod-cluster-config advertise-socket="modcluster" proxy-list="127.0.0.1:6666">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
3. Instance Id is mentioned :
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" instance-id="${jboss.node.name}">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
For Apache HTTP Server 2.2 - I have configured following things for mod_cluster and SSL configuration -
APACHE HOME is C:\ApacheHTTP
1. Certificate is generated using openSSL command -
A. C:\ApacheHTTP\bin> openssl genrsa -des3 -out server.key 1024
B. C:\ApacheHTTP\bin> openssl rsa -in server.key -out server.pem
C. C:\ApacheHTTP\bin> openssl req -new -key server.key -out server.csr
D. C:\ApacheHTTP\bin> openssl x509 -req -days 30 -in server.csr -signkey server.key -out server.crt
Above commands have been given sequentially, and during creation of SERVER.CSR file system asked to enter values for few fields e.g. passphrase, country, organisation, commonname(entered "localhost") etc.
server.pem and server.crt files have been copied to C:\ApacheHTTP\conf
httpd.conf file has been modified as below -
Following modules added
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
LoadModule advertise_module modules/mod_advertise.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule ssl_module modules/mod_ssl.so
Uncomment following lines :
#Include conf/extra/httpd-default.conf --> Include conf/extra/httpd-default.conf
#0Include conf/extra/httpd-ssl.conf ----> Include conf/extra/httpd-ssl.conf
in httpd-ssl.conf
following line is added
SSLCertificateFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.crt"
SSLCertificateKeyFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/server.pem"
Lines were present but commented out. I have changed the path of certificate files and uncomment the lines.
HTTP server was restarted.
Changes done in Application web.xml and in jboss-web.xml:
The <distributable/> tag is used in web.xml for each deployed application.
jboss-web.xml is added under WEB-INF folder of the web application for SESSION REPLICATION.
<jboss-web>
<replication-config>
<replication-trigger>SET_AND_NON_PRIMITIVE_GET</replication-trigger>
<replication-granularity>SESSION</replication-granularity>
</replication-config>
</jboss-web>
An application WAR is copied to %JBOSS_HOME%/standalone/deployment/ for each instance of jboss.
Each jboss node is started with following commands: (http port no. is kept same, port-offset is used different)
Node 1) E:/server1/jboss7/bin> standalone.bat -Djboss.node.name=node1 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=100
Node 2) E:/server2/jboss7/bin> standalone.bat -Djboss.node.name=node2 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=200
Node 3) E:/server3/jboss7/bin> standalone.bat -Djboss.node.name=node3 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=300
Node 4) E:/server4/jboss7/bin> standalone.bat -Djboss.node.name=node4 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=400
But when accessing the application from browser with the URL :
https://localhost/Greenworld initially it shows login screen but on login it crashes and shows the URL : http://localhost:8185/Greenworld/login.xhtml and the page remains same. Nothing happens after that.
Can anyone please tell what wrong I'm doing ?
Regards,
Jayanta P.