-
1. Re: mod_cluster : Need details on CreateBalancers directive
jfclere Sep 24, 2014 1:56 AM (in response to jjapache)How are you testing that? You are probably always hinting the main server (how is it defined by the way?).
-
2. Re: mod_cluster : Need details on CreateBalancers directive
jjapache Sep 24, 2014 2:41 AM (in response to jfclere)Maybe I don't understand what you qualify by 'main server'. Your talking about JBoss or Apache ?
Actually I have 4 VHosts on port 80, 81, 443 and 444, and I can hit my JBoss cluster through any of them even if I have 'CreateBalancers 2'.
-
3. Re: mod_cluster : Need details on CreateBalancers directive
jfclere Sep 24, 2014 3:49 AM (in response to jjapache)I am taking of VirtualHost in httpd.conf the main server is always there it is any configuration which isn't between <VirtualHost...> and </VirtualHost.>
If you are taking about the virtual-host in the application sever you need UseAlias 1 in httpd.conf that is the Host: hostname that is used for the routing in that case.
-
4. Re: mod_cluster : Need details on CreateBalancers directive
jjapache Sep 24, 2014 5:14 AM (in response to jfclere)Well, I really don't understand how it works.
In httpd.conf, I have:
ServerName main.test.com
Listen 10.11.12.13:80
Listen 10.11.12.13:81
Then <VirtualHost 10.11.12.13:80> with : ServerName vh1.test.com
And <VirtualHost 10.11.12.13:81> with : ServerName vh2.test.com
If I use CreateBalancers 0 or 2, I can reach my JBoss cluster on both vhosts vh1 and vh2
If I add UseAlias 1 and CreateBalancers 0 or 2 I get HTTP 404 error on both vhosts vh1 and vh2
So, I don't know how to test the difference between CreateBalancers 0 or 2.
-
5. Re: mod_cluster : Need details on CreateBalancers directive
jfclere Sep 24, 2014 7:40 AM (in response to jjapache)With the configuration you have 0 or 2 will behave the same (I am a bit guessing your configuration). You need to add something in the VirtualHost to see the difference... Like adding a header to using mod_rewrite or even a different access_log.
If you get 404 with UseAlias 1 it is because the <alias name="... /> are not correct in the virtual-server you are using. You need alias name="vh1.test.com" or alias name="vh1" and same for vh2 in the other virtual-server.
-
6. Re: mod_cluster : Need details on CreateBalancers directive
jjapache Sep 24, 2014 9:29 AM (in response to jfclere)Well, it's OK now for the 404 error.
I have this on JBoss:
<virtual-server name="default-host" enable-welcome-root="false">
<alias name="vh1.test.com"/>
</virtual-server>
On Apache side I have this :
- httpd.conf
Include /app/tests/p3_cluster/apache2.4/conf/vh1.conf
Include /app/tests/p3_cluster/apache2.4/conf/vh2.conf
Include /app/tests/p3_cluster/apache2.4/conf/mod_cluster.conf
ServerAdmin root@test.com
ServerName main.test.com
Listen 10.11.12.13:81
Listen 10.11.12.13:80
- vh1.conf
<VirtualHost 10.11.12.13:80>
LoadModule cache_module modules/mod_cache.so
DocumentRoot /app/tests/p3_cluster/apache_2.4/htdocs/vh1/
ServerName vh1.test.com
ServerAdmin vh1@test.com
CustomLog "|/soft/apache/2.4/bin/rotatelogs /var/tests/p3_cluster/apache_2.4/log/vh1_access_%Y%m%d.log 86400" combined
ErrorLog "|/soft/apache/2.4/bin/rotatelogs /var/tests/p3_cluster/apache_2.4/log/vh1_error_%Y%m%d.log 86400"
</VirtualHost>
- vh2.conf
<VirtualHost 10.11.12.13:81>
DocumentRoot /app/tests/p3_cluster/apache_2.4/htdocs/vh2/
ServerName vh2.test.com
ServerAdmin vh2@test.com
CustomLog "|/soft/apache/2.4/bin/rotatelogs /var/tests/p3_cluster/apache_2.4/log/vh2_access_%Y%m%d.log 86400" combined
ErrorLog "|/soft/apache/2.4/bin/rotatelogs /var/tests/p3_cluster/apache_2.4/log/vh2_error_%Y%m%d.log 86400"
</VirtualHost>
- mod_cluster.conf
Has not changed since the first post.
Even like that, I still have the same behavior with CreateBalancers 0 or 2. JBoss cluster is reachable by both vhosts.
-
7. Re: mod_cluster : Need details on CreateBalancers directive
jfclere Sep 24, 2014 12:08 PM (in response to jjapache)According to your configuration any request is going to be on one of the VirtualHost... Nothing goes to the main server.
What are you trying to do?
-
8. Re: mod_cluster : Need details on CreateBalancers directive
jjapache Sep 24, 2014 12:23 PM (in response to jfclere)Actually I'm just trying to understand the difference between 'CreateBalancers 0' and 'CreateBalancers 2' .
If you have a test configuration that I can use to figure it out, I will be happy.
-
9. Re: mod_cluster : Need details on CreateBalancers directive
jfclere Sep 25, 2014 11:22 AM (in response to jjapache)After trying to reproduce it, it seems there is something wrong the proxy_server_conf is the same on all servers. Please create a mod_cluster JIRA for the problem.
-
10. Re: mod_cluster : Need details on CreateBalancers directive
jjapache Sep 26, 2014 4:05 AM (in response to jfclere)OK, it makes more sense now.
Here is the JIRA : [MODCLUSTER-430] CreateBalancers behave the same with option 0 or 2 - JBoss Issue Tracker
-
11. Re: mod_cluster : Need details on CreateBalancers directive
jfclere Apr 11, 2019 9:00 AM (in response to jjapache)After reviewing the problem in fact option 0 and 2 behave differently if only the VirtualHost contains a proxy directive. If the VirtualHost doesn't contain a proxy it is ignored by mod_proxy (and mod_cluster).
I have used:
CreateBalancers 0 / 2
# VirtualHost...
<VirtualHost 10.36.116.185:8000>
ServerName 10.36.116.185
ErrorLog "logs/error_log.10.36.116.185"
CustomLog "logs/access_log.10.36.116.185" common
ProxyRequests Off
</VirtualHost>
<VirtualHost 192.168.1.35:8000>
ServerName 192.168.1.35
ErrorLog "logs/error_log.192.168.1.35"
CustomLog "logs/access_log.192.168.1.35" common
ProxyRequests Off
</VirtualHost>
To validate the logic...
And check https://httpd.apache.org/docs/2.4/vhosts/examples.html to get the VirtualHost logic right ;-)