wildfly 10 in domain mode + apache2 on ubuntu + mod_cluster

I'm trying to get the following setup working:

OS: Ubuntu 14.04.3 LTS Apache2: Apache/2.4.7 (Ubuntu) mod_cluster 1.3.1 wildfly: wildfly-10.0.0.CR2 domain mode (server-one in main-server-group and server-two in other-server-group on same ubuntu server) test deployment: cluster-demo

After 2 weeks I have apache with mod_cluster working, but wildfly doesn't work as expected.

My apache config:

sites-enabled/wildfly.conf

Listen 80

<VirtualHost *:80>
    ServerAdmin info@domain.de
    ServerName myserver.com
    ServerAlias www.myserver.com

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

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

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

sites-enabled/000-default.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ProxyPass / ajp://host:8009/
    ProxyPassReverse / ajp://host:8009/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

mods-enabled/mod_cluster.conf

CreateBalancers 1

<IfModule manager_module>
    Listen host:10001

      ManagerBalancerName myclustern

    <VirtualHost host:10001>
        KeepAliveTimeout 300
        MaxKeepAliveRequests 0
        AdvertiseFrequency 5
        ServerAdvertise On http://host:10001
        EnableMCPMReceive
        AdvertiseGroup 224.0.1.105:23364

        <Location />
          Order deny,allow
          Deny from all
          Allow from all
          Require all granted
        </Location>

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

mods-enabled/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 cluster_slotmem_module /usr/lib/apache2/modules/mod_cluster_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-manager is available, the demo page from cluster-demo is also available. But the apache error log shows following errors:

[Mon Oct 19 21:18:34.798472 2015] [proxy:error] [pid 30588:tid 139836923037440] (111)Connection refused: AH00957: ajp: attempt to connect to host:27233 (host) failed
[Mon Oct 19 21:18:34.798523 2015] [proxy:error] [pid 30588:tid 139836923037440] AH00959: ap_proxy_connect_backend disabling worker for (host) for 60s
[Mon Oct 19 21:18:44.799481 2015] [proxy:error] [pid 30588:tid 139836902057728] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:18:54.800456 2015] [proxy:error] [pid 30588:tid 139836881078016] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:04.801415 2015] [proxy:error] [pid 30588:tid 139836870588160] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:14.802499 2015] [proxy:error] [pid 30589:tid 139836755199744] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:24.803463 2015] [proxy:error] [pid 30589:tid 139836744709888] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:34.804541 2015] [proxy:error] [pid 30588:tid 139836849608448] (111)Connection refused: AH00957: ajp: attempt to connect to host:27233 (host) failed
[Mon Oct 19 21:19:34.804602 2015] [proxy:error] [pid 30588:tid 139836849608448] AH00959: ap_proxy_connect_backend disabling worker for (host) for 60s
[Mon Oct 19 21:19:44.805589 2015] [proxy:error] [pid 30589:tid 139837055608576] AH00940: ajp: disabled connection for (host)
[Mon Oct 19 21:19:54.806578 2015] [proxy:error] [pid 30589:tid 139837045118720] AH00940: ajp: disabled connection for (host)

When I stop server-one from main-server-group server-two said,

(Incoming-2,ee,master:server-two) ISPN000094: Received new cluster view for channel web: [master:server-two|12] (1) [master:server-two]

but in the browser I get instead of the cluster-demo page:

Service unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

My wildfly domain.xml config is the standard config from the server aside from these two chanches:

    <socket-binding-groups>
    <socket-binding-group name="full-ha-sockets" default-interface="public">
        ...
        <outbound-socket-binding name="mc-prox1">
            <remote-destination host="host" port="10001"/>
        </outbound-socket-binding>
    </socket-binding-group>
</socket-binding-groups>

and

<subsystem xmlns="urn:jboss:domain:modcluster:2.0">
    <mod-cluster-config advertise-socket="modcluster" proxies="mc-prox1" sticky-session="true" sticky-session-remove="false" sticky-session-force="false" connector="ajp">
        <dynamic-load-provider>
            <load-metric type="cpu"/>
        </dynamic-load-provider>
    </mod-cluster-config>
</subsystem>

Is for apache the 000-default.conf necessary? If I remove the proxypass and proxypassreverse annotation I can’t reach the demo page. Why I need the proxies annotation in wildfly to get the apache running? Is there something wrong with advertise module?

Hope somone can help me.

Answers


i came here searching for solution when mod cluster cant ping port 27233. In the previous weeks i was trying to set up cluster of wildflys first with httpd 2.4. and mod cluster 1.3.1 Since it didn't work i tried with with httpd 2.2 and modcluster 1.2.6. It worked for me. That was important, so i know i have right configurations. Now i am back, trying set up with modcluster 1.3.1 but i belive something is with that port. That port isnt even open, so for sure it cant ping it.

I think there is some bug in new mod_cluster. Try using older components it works great.


Your ProxyPass settings are superfluous; please, remove all of them from your configuration. Vanilla mod_cluster config is enough for your scenario. The only situation when one needs additional ProxyPass settings is when one needs to tune Proxy balancers; e.g. make Apache to serve static content from the balacner itself and forward only specific URL paths etc.

Furthermore, you must make sure that:

  1. both your Apache HTTP Server instance and all of your workers are bound to a non-localhost IP address
  2. Apache HTTP Server can reach out to all of your workers on their respective IP address:port they reported to the balancer. I'm almost sure that it is not the case in your setup; hence the fail-over to another worker node doesn't work.
  3. Last but not least, set instance-id attribute for your Undertow subsystem element; a different one for each of your workers. If the balacner is uncertain as to your worker's names, it could try to contact the wrong worker.

Lemme know if it helped.


If you get 27233 Port error in apache errorLog, your system is not compatible with the binary .so files from modcluster 1.3.1.

In this case you have to build mod cluster from source against your system.

Worked fine for us


We need to configure WildFly for accepting calls from Apache HTTP, Open the admin console, and selection the Configuration: Profiles Profile: full Subsystem: Web/HTTP - Undertow Settings: HTTP

Select the AJP Listener above, and click Add.

Name: default.ajp Socket binding: ajp

Click Save, then ensure the Enabled attribute is set to true.

Wildfly 10

It's works for me. It' was 5 days looking what was the error.


Need Your Help

How to proxy spring milestone repo using nexus

java spring maven-2 nexus

I want to proxy the spring milestone repository using nexus.

How to retrieve name of Javascript events attached to form in CRM 2016 server side

javascript c# dynamics-crm dom-events dynamics-crm-2016

I am trying to retrieve All the Javascript events/libraries attached to the form of particular entity from the server side.