Professional Documents
Culture Documents
Overview of The Cluster
Overview of The Cluster
The cluster configuration that we are trying to achieve is an ACTIVE – PASSIVE configuration.
THE ACTIVE CLUSTER will have 2 ACTIVE NODES each running a single instance of JBOSS EAP
7.0.0
The two active nodes would be running on two different machines but would be grouped
together as part of one server group active-cluster-server-group.
The nodes will be configured with a domain controller in a Master slave configuration
The configuration and deployment of the slaves would always be controlled from a single
point called the Domain controller (Master)
All the configuration and resources are controlled through a single profile full-ha-active for
active cluster and a single profile called full-ha-passive for passive cluster.
THE PASSIVE CLUSTER will have 2 PASSIVE NODES each running a single instance of JBOSS
EAP.
The two passive nodes would be running on two different machines but would be grouped
together as part of one server group passive-cluster-server-group.
There shall be one Machine running Apache HTTP Server for the software load balancer.
The active and the passive clusters will be front ended with a software load balancer which
in our case would be JBOSS Core Apache HTTP Server connecting to them on ports 6667 &
6668 respectively. 6667 pointing towards the active cluster group and 6668 pointing
towards the passive cluster group.
We will have the same instance of database to which both the clusters will be pointing to.
Please Note:
As of writing this document failover, load balancing and sticky sessions were achieved,
however in EAP 7.0.0 the default configuration is not supporting session replication. It is
observed that Session replication is only supported when two instances of EAP7.0 are run
on the same node but on different ports. So session replication is still a topic of discussion
which requires further study and investigation from the author.
HIGH LEVEL ARCHITECTURE OF THE EAP CLUSTERED ENVIRONMENT
active-cluster-server-group
Domain Controller
MACHINE 2
MASTER: node1
Server Name:
MACHINE 1
node1-active-
JBCS APACHE server
PORT:80
PORT:6667
Session Replication
Failover
POR
MACHINE 3
SLAVE :node2
Server Name:
node2-active-
server
Port:8080
HIGH LEVEL ARCHITECTURE OF THE EAP CLUSTERED ENVIRONMENT
passive-cluster-server-group
Domain Controller
MACHINE 4
MASTER: node3
Server Name:
MACHINE 1
node3-passive-
JBCS APACHE server
HTTP SERVER
LB Port:8080
LOAD BALANCER
UserRequest FOR PASSIVE
CLUSTER
PORT:81
PORT:6668
Session Replication
Failover
MACHINE 5
SLAVE :node4
Server Name:
node4-passive-
server
Port:8080
One common instance of the db for both the clusters, both the clusters connect to the same db.
Detailed Instruction on setting up the environment.
JDK "1.8.0_72"
Installation of Software
Machine 1:
Install Red Hat JBoss Core Services Apache HTTP Server for Linux (which ever
flavour available) (L.B)
Machine 2,3,4,5:
I will discuss here the setup of the Active Cluster; passive cluster would be similar with
differences in ports of mod cluster.
8) Go to node 1
Go to the host.xml file located under
/opt/jboss-eap-7.0/domain/configuration/host.xml
Change the host name to
<host xmlns="urn:jboss:domain:4.1" name="node1">
Save it.
10) Edit the servers section in the host.xml file to contain only this
<servers>
<system-properties>
</system-properties>
</server>
</servers>
Copy the profile full- ha and create another profile with the name
<profiles>
.</profile>
<profile name=" full-ha-active ">
.</profile>
12) In the profile full-ha-active configure data source to represent the following.
<connection-
url>jdbc:oracle:thin:@hsndsd58z1.hsntech.int:1531:SERGN1D</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>oracle</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>4</max-pool-size>
</pool>
<security>
<user-name>DEV01</user-name>
<password>DEV01</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-
datasource-class>
</driver>
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
13) Make sure the server groups element in the domain.xml represent the following
<server-groups>
<jvm name="default">
</jvm>
<socket-binding-group ref="full-ha-sockets"/>
</server-group>
</server-groups>
14) In the modules directory
oracle.zip
Now you can run the master server by executing the following command
Or
-Djboss.bind.address.management=<IP_ADDRESS_OF NODE1>
-Djboss.bind.address=<IP_ADDRESS_OF NODE1>
Check the server logs of the master make sure everything looks fine and no errors in the
logs.
http://<IP_ADDRESS_OF MASTER>:9990/console/App.html#home
user id :admin
password:password1!
Go to runtime -> server groups -> active-cluster->server-group-> and servers will be listed.
Configuration of SLAVE – Node 2
Save it.
<secret value="cGFzc3dvcmQxIQ=="/> with the secret value that you stored earlier
21) Configure this node to be part of the server group that you created earlier
<system-properties>
</system-properties>
</server>
Save it
oracle.zip
Please note that there is no configuration of data source or any other resources will be
required on the slave node and the profile of all the slave nodes will be controlled from
a single point master.
Or
Check the server logs of the slave make sure everything looks fine and no errors in the logs.
http://<IP_ADDRESS_OF MASTER>:9990/console/App.html#home
user id :admin
password:password1!
Go to runtime -> server groups -> active-cluster->server-group-> and servers will be listed.
Now the good part about the domain and the server group is that a single deployment
artefact can be deployed to all nodes that belong to a server group in a single instance
through the master domain controller.
Go to Deployments->active-cluster-server-group-> deployments
Add select the artefact and deploy and you can see it’s deployed on all nodes.
http://masternode:8080/context
http://slavenode:8080/context
Configuring the load balancer for the EAP cluster.
24) On Machine 1
Go to the location where we installed opt/jbcs-httpd24-2.4/
https://access.redhat.com/documentation/en/red-hat-jboss-core-services-apache-
http-server/2.4/apache-http-server-installation-guide/chapter-2-installing-jboss-
core-services-apache-http-server-on-red-hat-enterprise-linux
Go to the location
The jbcs-httpd24-2.4/httpd
And take a backup of the existing httpd.conf file.
The following files need to be put in conf directory. These files should only be used
as a reference as they are modified for windows environment. The linux installation
will have a different set of params.
common.conf httpd.conf
The above files need to modified for Linux environment, as they were initially
written for windows environment.
For Eg
ServerRoot "C:/jbcs-httpd24-2.4/etc/httpd"
To linux env
ServerRoot "opt/jbcs-httpd24-2.4/httpd"
<subsystem xmlns="urn:jboss:domain:modcluster:2.0">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
26) In the <socket-binding-groups> in the domain.xml under the same profile active-full-
ha Add
<outbound-socket-binding name="my-proxy-one">
<remote-destination host="<IP_ADDRESS_OF_MACHINE_1> " port="6667"/>
</outbound-socket-binding>
http:// <IP_ADDRESS_OF_MACHINE_1>:6667/mod_cluster_manager
Now to test the load balancer, failover and sticky session’s part
Deploy this test application on the server group using the EAP admin console
cluster-demo.war
Hello world page for you and request would go to node1 or node2,
Shutdown the node the request is going to from admin console of EAP and again access the
url through LB
<channels default="ee">
<channel name="ee" stack="tcp"/>
</channels>
30) Now in the same subsystem make changes to the stackname =tcp as below
<property name="initial_hosts"><IP_ADDRESS_OF
MASTER_NODE>[7600], <IP_ADDRESS_OF_SLAVE_NODE> [7600]</property>
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp"/>
<protocol type="TCPPING">
<property
name="initial_hosts">10.50.35.73[7600],10.50.35.72[7600]</property>
<property name="num_initial_members">
2
</property>
<property name="port_range">
0
</property>
<property name="timeout">
3600
</property>
</protocol>
<protocol type="MERGE3"/>
<protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
<protocol type="FD"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
</stack>
/opt/jboss-eap-7.0/bin/domain.sh -b <IP_ADDRESS_OF_MASTER>
-Djboss.bind.address.management= <IP_ADDRESS_OF_MASTER>
-Djboss.bind.address.private=<IP_ADDRESS_OF_MASTER>
Or
domain -b <IP_ADDRESS_OF_SLAVE>
-Djboss.domain.master.address=<IP_ADDRESS_OF_MASTER> --host-config=host-
slave.xml -Djboss.bind.address.private=<IP_ADDRESS_OF_SLAVE>
or
Clustering won’t happen until you start the master and slave nodes with the above
commands.
32) Now to test the session replication Do the following
You will see time now is 2:28PM and request would go to node1 or node2,
Shutdown the node the request is going to from admin console of EAP and again access the
url through LB
http://<ip_address_of_machine_1>/cluster-demo/get.jsp
This concludes EAP clustering on two nodes with load balancer, fail over, sticky session and
session fail over (session replication).
The same instructions need to be carried out for setting up passive cluster.