$ cp -r $GATEIN_HOME/ node1 $ cp -r $GATEIN_HOME/ node2
Let's assume that you want to setup 2-nodes cluster of GateIn Portal servers on JBoss AS7 and one loadbalancer server, which will use Apache HTTPD+Mod_jk
Unzip your GateIn Portal bundle (assuming directory $GATEIN_HOME where bundle is unzipped) and create a copy for each cluster node:
$ cp -r $GATEIN_HOME/ node1 $ cp -r $GATEIN_HOME/ node2
Let's assume that you have 2 available IP addresses 192.168.210.101 (here node1 will be executed) and 192.168.210.102 (here node2 will be executed). You can use either:
Two separate physical servers. In this case you need to have folder "node1" available on first server and folder "node2" needs to be available on second server.
One physical server, which is using two virtual IP addresses (Consult documentation of your OS on how to setup virtual IP addresses)
All portal servers in cluster need to share same database. You need to choose one of two approaches:
If you have setup with one physical server and two virtual IP addresses, you can use preconfigured H2 database without need to setup your own database. You can run the DB server (from GATEIN_HOME directory)
$ java -cp modules/com/h2database/h2/main/h2-1.3.168.jar org.h2.tools.Server
For production setup with real cluster, it's recommended to install and setup other database and configure both nodes to use it. More info about database configuration via JBoss datasources is in Database Configuration chapter.
You need to edit file standalone-ha.xml instead of standalone.xml because it's clustered setup
Run the servers. From the node1 directory:
$ ./bin/standalone.sh --server-config=standalone-ha.xml -Djboss.node.name=node1 -b 192.168.210.101 -u 239.23.42.2 -Djboss.bind.address.management=192.168.210.101
And from the node2 directory:
$ ./bin/standalone.sh --server-config=standalone-ha.xml -Djboss.node.name=node2 -b 192.168.210.102 -u 239.23.42.2 -Djboss.bind.address.management=192.168.210.102
Now you can directly access node1 on http://192.168.210.101:8080/portal and node2 on http://192.168.210.102:8080/portal
Install the apache server and mod_jk module
On Fedora, the package containing Apache HTTP Server is named httpd. You will probably need to build and install mod_jk from sources, in which case the package httpd-devel might be useful. Verify that the file mod_jk.so is present in /etc/httpd/modules .
On Ubuntu the packages are named apache2 and libapache2-mod-jk.
Setup apache to use mod_jk
When using Fedora and recent version of Apache (2.2+), put file mod-jk.conf into /etc/httpd/conf.d. Don't forget to load the module by appending the following line to /etc/httpd/conf/httpd.conf .
LoadModule jk_module modules/mod_jk.so
File mod-jk.conf needs to look like this:
# Where to find workers.properties JkWorkersFile workers.properties # Where to put jk logs JkLogFile /var/log/apache2/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel debug # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y]" # JkOptions indicates to send SSK KEY SIZE JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat #JkRequestLogFormat "%w %V %T" JkMountFile uriworkermap.properties # Add shared memory. # This directive is present with 1.2.10 and # later versions of mod_jk, and is needed for # for load balancing to work properly JkShmFile /var/log/apache2/jk.shm # Add jkstatus for managing runtime data <Location /jkstatus/> JkMount status </Location>
When using Ubuntu, you can create file mod-jk.conf with above content into /etc/apache2/mods-enabled
Setup workers
in /etc/httpd/ (or /etc/apache2/ in case of Ubuntu) create workers.properties file. And make sure that balanced workers have same names as the name of jboss.node.name+ attribute used to run both nodes, which has been configured in previous steps. In our case, we used names _node1 and node2 in server.xml. This means that particular balanced workers in workers.properties file also need to have same names node1 and node2 . File workers.properties in our case can look like this:
# Define list of workers that will be used # for mapping requests worker.list=loadbalancer,status # modify the host as your host IP or DNS name worker.node1.port=8009 worker.node1.host=192.168.210.101 worker.node1.type=ajp13 worker.node1.lbfactor=1 ## modify the host as your host IP or DNS name worker.node2.port=8009 worker.node2.host=192.168.210.102 worker.node2.type=ajp13 worker.node2.lbfactor=1 # Load-balancing behaviour worker.loadbalancer.type=lb worker.loadbalancer.method=Session worker.loadbalancer.balance_workers=node1,node2 worker.loadbalancer.sticky_session=1 #worker.list=loadbalancer worker.status.type=status
And file uriworkermap.properties which should be like this
/portal=loadbalancer /portal/*=loadbalancer /eXo*=loadbalancer /eXoResources*/*=loadbalancer /exo*=loadbalancer /exo*/*=loadbalancer /web=loadbalancer /web/*=loadbalancer /integration=loadbalancer /integration/*=loadbalancer /dashboard=loadbalancer /dashboard/*=loadbalancer /rest=loadbalancer /rest/*=loadbalancer /jpp_branding_skin|/*=loadbalancer /jpp-branding-skin|/*=loadbalancer /jpp-branding-extension|/*=loadbalancer /status=status /status/*=status
Problems & Solutions
You've configured everything properly, yet you're unable to access the portal via Apache.
Description: When accessing EPP via Apache, you're getting "503 Service Temporarily Unavailable" response.
The cluster itself is working and you can access individual EPP nodes directly.
According to mod_jk.log, mod_jk is working, but Tomcat is reported as likely not to be running on the specified port.
Possible cause:
If you're using Fedora, SELinux might be stopping httpd from accessing something important, e.g. jk.shm. Check SELinux alerts to see if that's the case.
Solution:
Ideally, you would create a policy to deal with this. A quick workaround is to temporarily disable SELinux to allow Apache to initialize the mod_jk connector properly. You can do this using the following command:
setenforce 0