Skip to content

Instantly share code, notes, and snippets.

@slok
Created December 31, 2011 09:06
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save slok/1543449 to your computer and use it in GitHub Desktop.
Save slok/1543449 to your computer and use it in GitHub Desktop.
Setup for jboss 7 with apache and mod_cluster in ubuntu 11.10

Installation of Jboss

Download Jboss 7 from [jboss donwnload site] (http://www.jboss.org/jbossas/downloads) Extract jboss in the proper place for example /usr/share

$ cd /usr/share
# tar xvf /home/xxxxx/Downloads/jboss-as-7.0.2.Final.tar.gz

Installation of mod_cluster

Download the libs, [actually mod_cluster 1.1.3] (http://www.jboss.org/mod_cluster/downloads/1-1-3) Extract the libs

$ cd /home/xxxx/Downloads
$ mkdir ./mod_cluster_libs
$ cd ./mod_cluster_libs
$ tar xvf ./mod_cluster-1.1.3.Final-linux2-XXXX-so.tar.gz
$ rm ./

Copy libs (not all, mod_proxy_ajp.so, mod_proxy_http.so and mod_proxy.so NO) to apache modules dir (i.e /usr/lib/apache2/modules/)

# cp ./mod_advertise.so  ./mod_manager.so  ./mod_proxy_cluster.so  ./mod_slotmem.so  /usr/lib/apache2/modules/

Configuration of mod_cluster in Jboss

Configure jboss Standalone mode to enable mod_cluster. Edit the standalone.xml file in $JBOSS_HOME/standalone/configuration/standalone.xml and add this two lines in their sections

Extension

<extension module="org.jboss.as.modcluster"/>

Subsystem

<subsystem xmlns="urn:jboss:domain:modcluster:1.0" />

Configuration of mod_cluster in apache

Create two files in mods-available (/etc/apache2/mods-available)

mod_cluster.load

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule proxy_ajp_module /usr/lib/apache2/modules/mod_proxy_ajp.so
LoadModule slotmem_module /usr/lib/apache2/modules/mod_slotmem.so
LoadModule manager_module /usr/lib/apache2/modules/mod_manager.so
LoadModule proxy_cluster_module /usr/lib/apache2/modules/mod_proxy_cluster.so
LoadModule advertise_module /usr/lib/apache2/modules/mod_advertise.so

mod_cluster.conf

CreateBalancers 1

<IfModule manager_module>
    Listen 127.0.0.1:6666
    ManagerBalancerName mycluster
 
    <VirtualHost 127.0.0.1:6666> 
        KeepAliveTimeout 300
        MaxKeepAliveRequests 0
        AdvertiseFrequency 5
        ServerAdvertise On
 
        <Location />
            Order deny,allow
            Allow from 127.0.0
        </Location>

     </VirtualHost>

</IfModule>

And enable the module

# a2enmod mod_cluster

Configuration of jboss (mod_cluster/proxy) in apache

Create a file (virtual host) for jboss in sites-available (/etc/apache2/sites-available)

jboss

NameVirtualHost *:80
<VirtualHost *:80> 
    #ServerAdmin info@domain.de
    ServerName jboss.mdiss.info
    ServerAlias jboss.mdiss.info

    ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=On
    ProxyPassReverse / balancer://mycluster
    ProxyPreserveHost On

    <Location />
        Order deny,allow
        Allow from All
    </Location>

   <Location /mod_cluster-manager>
      SetHandler mod_cluster-manager
      Order deny,allow
      #Deny from all
      Allow from 127.0.0
   </Location>

</VirtualHost>

Fix mod_cluster log problem

There is a problem with mod_cluster (in ubuntu?), needs the log directory in /etc/apache2

We can do two things, create the dir or create a symbloic link to /var/log/apache2

Creating the dir

# mkdir /etc/apache2/logs

Creating the symbolic link

#ln -s /var/log/apache2 /etc/apache2/logs

Install Jenkins

Download and deploy jenkins war

We download Jenkins from the [site] (http://mirrors.jenkins-ci.org/war/latest/jenkins.war) and we deploy the war.

Connect to the jboss admin console

# $JBOSS_HOME/bin/jboss-admin.sh
$ connect
$ deploy /home/xxxx/Downloads/jenkins.war
$ exit
@ahoehn
Copy link

ahoehn commented Oct 7, 2012

Thanks for this good howto for mod_cluster. Unfortantly i don't get forwarded (when i access my servers url on port 80) to my jboss server (port 8080). Is there something else needed to get forwarded to jboss?

@profversaggi
Copy link

ahoehn, have a look at this article: http://stackoverflow.com/questions/17117368/can-not-access-admin-console-of-jboss-eap-6-at-standalone-mode

Evidently, the stock vintage of EAP 6 by default binds and connects to the 127.0.0.1 IP address instead of the live one. By altering the standalone.xml and switching the live IP for the 127.0.0.1, it'll work just fine.

And a BIG thank you to the author for the awesome article, it saved my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment