[jboss-user] [Beginner's Corner] - Re: More JBoss-AS 5 clusters and more Apache Virtual Hosts

August Simonelli do-not-reply at jboss.com
Tue Dec 14 15:20:41 EST 2010


August Simonelli [http://community.jboss.org/people/augustsimonelli] created the discussion

"Re: More JBoss-AS 5 clusters and more Apache Virtual Hosts"

To view the discussion, visit: http://community.jboss.org/message/575990#575990

--------------------------------------------------------------
Here's what I wound up doing with our mod_cluster 1.0.4/EAP5.1 setup. I don't use multicast so keep that in mind ...

mod_cluster.conf:

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

Listen 127.0.0.1:6666
<VirtualHost 127.0.0.1:6666>

    <Directory />
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>

    KeepAliveTimeout 60
    MaxKeepAliveRequests 0

    ManagerBalancerName mycluster
    AdvertiseFrequency 5
    ServerAdvertise Off

    Createbalancers 1


</VirtualHost>

"Createbalancers 1" means we can don't automatically have the balancer in all virtuals, which i like cause it means i can have non-mod-clustered virtuals for static files/other sites/etc. ALL JBoss instances hit this 6666 port (in this case it's on localhost but obviously in reality you'd need it exposed).

0.conf:

<VirtualHost *:80>
        ServerName redcloud.local
        DocumentRoot /var/www/html/redcloud/
        ErrorLog logs/redcloud.local-error_log
        CustomLog logs/redcloud.local-access_log common
        LogLevel debug

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

</VirtualHost>

a hacky way to ensure the default virtual is this one. i like this cause it allows me to use it as my "working" virtual with my clustermanager and such. i tend to attach my hostname to it cause that's logical in my mind.

virtual.conf

NameVirtualHost *:80

<VirtualHost *:80>

        ServerName modcluster.redcloud.local
        DocumentRoot /var/www/html/cluster
        ErrorLog logs/modcluster.redcloud.local-error_log
        CustomLog logs/modcluster.redcloud.local-access_log common
        LogLevel debug

        ProxyPass / balancer://ogbalancer/sample stickysession=JSESSIONID|jsessionid 
        ProxyPassReverse / balancer://ogbalancer/sample

        #RewriteEngine on

        #RewriteCond %{REQUEST_URI} !/mod_cluster-manager
        #RewriteRule ^/(.*)$ balancer://ogbalancer/sample/$1 [P,L]
        #RewriteRule ^/(.*)$ balancer://ogbalancer/$1 [P,L]
        #RewriteRule ^/sample/(.*)$ balancer://ogbalancer/sample/$1 [P,L]

</VirtualHost>

because of "createbalancers 1" each virtual needs the balancer created with a proxypass line. So in this example I create ogbalancer for this virtual only. On the jboss side, besides the jbossweb changes needed by 1.0.4, i add

<property name="balancer">ogbalancer</property>

to ./deploy/mod-cluster.sar/META-INF/mod-cluster-jboss-beans.xml

This links the jboss instance to that virtual only. If i have another virtual it won't pass anything to ogbalancer unless i give it a proxypass line for that balancer within the virtual.

Now, i can stand up another jboss instance, connect it to the same 6666 port (in my case with jboss.modcluster.proxyList) as all the others, set ITS balancer name:

<property name="balancer">someotherbalancer</property>

And then call that balancer from another virtual host with its own proxypass line. Now all traffic for this virtual goes to that JBoss instance, and all traffic for my example virtual goes to ogbalancer.

Should work fine with mutlicast; we just have network implications for using that.

August

BTW ... i left the rewrite stuff i was using in as it does work, but i  think the proxypass stuff makes more sense. plus when it comes to  passing querystrings with mod_rewrite i ran into this:   http://community.jboss.org/message/521202#521202 http://community.jboss.org/message/521202 ...
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/575990#575990]

Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101214/8eba09b1/attachment-0001.html 


More information about the jboss-user mailing list