-
1. Re: Apache Rewrite with proxy_mod_cluster
jfclere Jul 29, 2015 2:40 AM (in response to koi03)Why you don't use 2 virtual-host in AS and have one with application1 as root and the other applications2 as root?
Then use UseAlias 1 httpd.conf for the mod_cluster configuration and remove all the mod_rewrite stuff.
-
2. Re: Apache Rewrite with proxy_mod_cluster
koi03 Jul 29, 2015 1:00 PM (in response to jfclere)I like that option do you know of a sample configuration or a document that I could follow on the configuration?
-
3. Re: Apache Rewrite with proxy_mod_cluster
mbabacek Aug 3, 2015 5:23 AM (in response to koi03)Sure thing Rob, here you go:
Apache HTTP Server load balancer
mod_cluster.conf:
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so LoadModule manager_module modules/mod_manager.so LoadModule advertise_module modules/mod_advertise.so MemManagerFile /tmp/jws-3.0/httpd/cache/mod_cluster <IfModule manager_module> Listen 6666 <VirtualHost *:6666> <Directory /> # Change it! Require all granted </Directory> ServerAdvertise on UseAlias 1 EnableMCPMReceive <Location /mod_cluster_manager> SetHandler mod_cluster-manager # Change it! Require all granted </Location> </VirtualHost> </IfModule>
JBoss AS7x example
standalone-ha.xml:
<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" instance-id="workerXXX" native="false"> <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/> <connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost"/> <alias name="example.com"/> </virtual-server> <virtual-server name="web1" default-web-module="simplecontext-web1"> <alias name="web1.rhel7GAx86-64"/> </virtual-server> <virtual-server name="web2" default-web-module="simplecontext-web2"> <alias name="web2.rhel7GAx86-64"/> </virtual-server> </subsystem>
The modcluster subsystem is left to its default. The two example deployments have this setting: simplecontext-web1.war/WEB-INF/jboss-web.xml:
<?xml version="1.0" encoding="UTF-8"?> <jboss-web version="6.0" xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_6_0.xsd"> <virtual-host>web1</virtual-host> <context-root>/</context-root> </jboss-web>
For your convenience, I attached the two test applications bundled in a zip file.
When you start Apache HTTP Server and your JBoss AS7 instance, you should see a similar output on the mod_cluster manager console. Please, note that I'm running the setup on a single dev box, having the following in /etc/hosts:
192.168.122.172 rhel7GAx86-64 web1.rhel7GAx86-64 web2.rhel7GAx86-64 web1 web2
Now, you can see that the whole setup works just as you needed, if I understood correctly your requirements:
curl http://web1.rhel7GAx86-64:6666 <html> <body> <h2>Hello World! Simplecontext Web1!</h2> </body> </html> curl http://web2.rhel7GAx86-64:6666 <html> <body> <h2>Hello World! Simplecontext web2 !</h2> </body> </html>
Please, let us know if it worked for you :-)
Cheers
-K-
-
simplecontext-examples.zip 3.8 KB
-
-
4. Re: Apache Rewrite with proxy_mod_cluster
koi03 Aug 3, 2015 11:32 AM (in response to mbabacek)Thank you Michal as this helped a ton. I was able to configure and then use the UseAlias 1 and set the alias's to the URL(host) I wanted in apache config and worked fantastic.