Wednesday, January 26, 2022

Apache HTTP Server 2.4.52 (httpd) and mod_cluster-1.3.16 cohesion with Jboss EAP 7

 

Apache HTTP Server 2.4.52 (httpd) and mod_cluster-1.3.16 cohesion with Jboss EAP 7

 

https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.bz2

https://github.com/modcluster/mod_cluster/archive/refs/tags/1.3.16.Final.tar.gz


Apache HTTP Server

 

Host Details:

 

[jadm@lab1 ~]$ hostname ; hostname -i

lab1.sri.com

192.168.100.151

[jadm@lab1 ~]$

 

OS:

 

[jadm@lab1 ~]$ uname -a

Linux lab1.sri.com 2.6.32-754.el6.x86_64 #1 SMP Thu May 24 18:18:25 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux

[jadm@lab1 ~]$

[jadm@lab1 ~]$ cat /etc/redhat-release

Red Hat Enterprise Linux Server release 6.10 (Santiago)

[jadm@lab1 ~]$

 

Apache HTTP version and details:

 

[jadm@lab1 ~]$ /usr/local/apache2/bin/apachectl -V

Server version: Apache/2.4.52 (Unix)

Server built:   Jan 14 2022 20:03:55

Server's Module Magic Number: 20120211:121

Server loaded:  APR 1.7.0, APR-UTIL 1.6.1

Compiled using: APR 1.7.0, APR-UTIL 1.6.1

Architecture:   64-bit

Server MPM:     event

  threaded:     yes (fixed thread count)

    forked:     yes (variable process count)

Server compiled with....

 -D APR_HAS_SENDFILE

 -D APR_HAS_MMAP

 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)

 -D APR_USE_PROC_PTHREAD_SERIALIZE

 -D APR_USE_PTHREAD_SERIALIZE

 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT

 -D APR_HAS_OTHER_CHILD

 -D AP_HAVE_RELIABLE_PIPED_LOGS

 -D DYNAMIC_MODULE_LIMIT=256

 -D HTTPD_ROOT="/usr/local/apache2"

 -D SUEXEC_BIN="/usr/local/apache2/bin/suexec"

 -D DEFAULT_PIDLOG="logs/httpd.pid"

 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"

 -D DEFAULT_ERRORLOG="logs/error_log"

 -D AP_TYPES_CONFIG_FILE="conf/mime.types"

 -D SERVER_CONFIG_FILE="conf/httpd.conf"

[jadm@lab1 ~]$

 

UID & GID:

 

[jadm@lab1 ~]$ id

uid=501(jadm) gid=501(jadm) groups=501(jadm) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[jadm@lab1 ~]$

Jboss server1

 

Host details:

 

[jadm@lab2 jboss-eap-7.3]$ hostname ; hostname -i

lab2.sri.com

192.168.100.152

[jadm@lab2 jboss-eap-7.3]$

 

OS:

 

[jadm@lab2 jboss-eap-7.3]$ uname -a

Linux lab2.sri.com 2.6.32-754.el6.x86_64 #1 SMP Thu May 24 18:18:25 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux

[jadm@lab2 jboss-eap-7.3]$

 

[jadm@lab2 jboss-eap-7.3]$ cat /etc/redhat-release

Red Hat Enterprise Linux Server release 6.10 (Santiago)

[jadm@lab2 jboss-eap-7.3]$

 

Jboss Install path:

 

[jadm@lab2 jboss-eap-7.3]$ pwd

/lab/JBOSS/jboss-eap-7.3

[jadm@lab2 jboss-eap-7.3]$

 

 

Jboss Version:

 

[jadm@lab2 jboss-eap-7.3]$ /lab/JBOSS/jboss-eap-7.3/bin/jboss-cli.sh "patch info"

Version:             7.3.10.GA

Cumulative patch ID: jboss-eap-7.3.10.CP

One-off patches:     none

[jadm@lab2 jboss-eap-7.3]$

 

Standalone JVMs:

 

[jadm@lab2 jboss-eap-7.3]$ ls -lrthd /lab/JBOSS/jboss-eap-7.3/lab2jvm*

drwxr-xr-x. 8 jadm jadm 4.0K Jan 14 18:36 /lab/JBOSS/jboss-eap-7.3/lab2jvm2

drwxr-xr-x. 8 jadm jadm 4.0K Jan 14 18:36 /lab/JBOSS/jboss-eap-7.3/lab2jvm1

[jadm@lab2 jboss-eap-7.3]$

 

UID & GID:

 

[jadm@lab2 jboss-eap-7.3]$ id

uid=501(jadm) gid=501(jadm) groups=501(jadm) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[jadm@lab2 jboss-eap-7.3]$

Jboss server2

 

Host details:

 

[jadm@lab3 jboss-eap-7.3]$ hostname ; hostname -i

lab3.sri.com

192.168.100.153

[jadm@lab3 jboss-eap-7.3]$

 

OS:

 

[jadm@lab3 jboss-eap-7.3]$ uname -a

Linux lab3.sri.com 2.6.32-754.el6.x86_64 #1 SMP Thu May 24 18:18:25 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux

[jadm@lab3 jboss-eap-7.3]$

[jadm@lab3 jboss-eap-7.3]$ cat /etc/redhat-release

Red Hat Enterprise Linux Server release 6.10 (Santiago)

[jadm@lab3 jboss-eap-7.3]$

 

Jboss Install path:

 

[jadm@lab3 jboss-eap-7.3]$ pwd

/lab/JBOSS/jboss-eap-7.3

[jadm@lab3 jboss-eap-7.3]$

 

Jboss Version:

 

[jadm@lab3 jboss-eap-7.3]$ /lab/JBOSS/jboss-eap-7.3/bin/jboss-cli.sh "patch info"

Version:             7.3.10.GA

Cumulative patch ID: jboss-eap-7.3.10.CP

One-off patches:     none

[jadm@lab3 jboss-eap-7.3]$

 

Standalone JVMs:

 

[jadm@lab3 jboss-eap-7.3]$ ls -lrthd /lab/JBOSS/jboss-eap-7.3/lab3jvm*

drwxr-xr-x. 8 jadm jadm 4.0K Jan 16 17:53 /lab/JBOSS/jboss-eap-7.3/lab3jvm2

drwxr-xr-x. 8 jadm jadm 4.0K Jan 16 17:53 /lab/JBOSS/jboss-eap-7.3/lab3jvm1

[jadm@lab3 jboss-eap-7.3]$

 

UID & GID:

 

[jadm@lab3 jboss-eap-7.3]$ id

uid=501(jadm) gid=501(jadm) groups=501(jadm) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

[jadm@lab3 jboss-eap-7.3]$

 

Pre-setup & readiness:

 

Lab is already setup with Jboss EAP and Apache with mod_cluster module complied and kept ready.

 

Jboss EAP JVMs started and Apache HTTP started.

 

[jadm@lab2 jboss-eap-7.3]$ /lab/JBOSS/jboss-eap-7.3/bin/standalone.sh -Djboss.node.name=lab2jvm1 -Djboss.server.base.dir=/lab/JBOSS/jboss-eap-7.3/lab2jvm1 -c standalone-full-ha.xml &

[jadm@lab2 jboss-eap-7.3]$ /lab/JBOSS/jboss-eap-7.3/bin/standalone.sh -Djboss.node.name=lab2jvm2 -Djboss.server.base.dir=/lab/JBOSS/jboss-eap-7.3/lab2jvm2 -c standalone-full-ha.xml &

 

[jadm@lab3 jboss-eap-7.3]$ /lab/JBOSS/jboss-eap-7.3/bin/standalone.sh -Djboss.node.name=lab3jvm2 -Djboss.server.base.dir=/lab/JBOSS/jboss-eap-7.3/lab3jvm2 -c standalone-full-ha.xml &

[jadm@lab3 jboss-eap-7.3]$ /lab/JBOSS/jboss-eap-7.3/bin/standalone.sh -Djboss.node.name=lab3jvm1 -Djboss.server.base.dir=/lab/JBOSS/jboss-eap-7.3/lab3jvm1 -c standalone-full-ha.xml &

 

[jadm@lab1 ~]$ /usr/local/apache2/bin/apachectl -t

Syntax OK

[jadm@lab1 ~]$ /usr/local/apache2/bin/apachectl -k start

[jadm@lab1 ~]$

 

Pre-installed sample SRIEARV4.0.war in all JVMs:

http://192.168.100.152:8180/SRIEARV4.0/sayhi2sri.jsp

http://192.168.100.152:8280/SRIEARV4.0/sayhi2sri.jsp

http://192.168.100.153:8180/SRIEARV4.0/sayhi2sri.jsp

http://192.168.100.153:8280/SRIEARV4.0/sayhi2sri.jsp

 

Apache HTTP and mod_cluster cohesion with Jboss EAP:

 

Integrating mod_proxy_cluster and Apache HTTP:

 

mod_proxy_cluster modules are copied to Apache HTTP modules directly (pre-compiled and stagged).

 

[jadm@lab1 mod_proxy_cluster]$ ls -lrth /usr/local/apache2/modules/ | tail

-rwxr-xr-x. 1 jadm jadm  36K Jan 14 20:09 mod_dir.so

-rwxr-xr-x. 1 jadm jadm  31K Jan 14 20:09 mod_actions.so

-rwxr-xr-x. 1 jadm jadm  38K Jan 14 20:09 mod_speling.so

-rwxr-xr-x. 1 jadm jadm  32K Jan 14 20:09 mod_userdir.so

-rwxr-xr-x. 1 jadm jadm  49K Jan 14 20:09 mod_alias.so

-rwxr-xr-x. 1 jadm jadm 177K Jan 14 20:09 mod_rewrite.so

-rwxr-xr-x. 1 jadm jadm  55K Jan 14 20:33 mod_advertise.so

-rwxr-xr-x. 1 jadm jadm  44K Jan 14 20:36 mod_cluster_slotmem.so

-rwxr-xr-x. 1 jadm jadm 244K Jan 14 20:38 mod_manager.so

-rwxr-xr-x. 1 jadm jadm 184K Jan 14 20:40 mod_proxy_cluster.so

[jadm@lab1 mod_proxy_cluster]$

 

Next step to enable newly created mod_cluster modules mod_advertise.so, mod_cluster_slotmem.so, mod_manager.so, mod_proxy_cluster.so

 

[jadm@lab1 conf]$ echo "LoadModule advertise_module modules/mod_advertise.so" >> httpd.conf

[jadm@lab1 conf]$ echo "LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so" >> httpd.conf

[jadm@lab1 conf]$ echo "LoadModule manager_module modules/mod_manager.so" >> httpd.conf

[jadm@lab1 conf]$ echo "LoadModule proxy_cluster_module modules/mod_proxy_cluster.so" >> httpd.conf

 

Uncomment "LoadModule proxy_module modules/mod_proxy.so" & "LoadModule proxy_ajp_module modules/mod_proxy_ajp.so" in httpd.conf

 

[jadm@lab1 ~]$ cat /usr/local/apache2/conf/httpd.conf

.

.

LoadModule proxy_module modules/mod_proxy.so

.

.

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

.

.

LoadModule advertise_module modules/mod_advertise.so

LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so

LoadModule manager_module modules/mod_manager.so

LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

[jadm@lab1 ~]$

 

Make mod_proxy_cluster HTTP configuration to advertise and learn Jboss EAP’s AJP availability.

 

Add following directives into httpd.conf:

 

# Sri Lab Mod Cluster Balancer entries

<IfModule manager_module>

  Listen lab1.sri.com:8888

  # if you use uppercase in name you will find warning as below in stop/start of httpd and it will auto lower all name case.

  # [:warn] [pid 40571:tid 139763313415936] Balancer name contained an upper case character. We will use "srilabmodclusterbalancer" instead.

  ManagerBalancerName srilabmodclusterbalancer

 

  <VirtualHost lab1.sri.com:8888>

    <Directory />

       Require all granted

    </Directory>

 

    # Where your worker nodes connect from

    <Location />

       Require all granted

    </Location>

 

    # ServerAdvertise On -- Use the advertise mechanism to tell the JBoss AS/JBossWeb/Tomcat to whom it should send the cluster information.

    # One needs to configure EnableMCPMReceive in the VirtualHost where you received the MCMP elements in the Apache httpd configuration.

    # EnableMCPMReceive -- allow the VirtualHost to receive mod_cluster management protocol (MCMP) messages.

    # You need one EnableMCPMReceive in your httpd configuration to allow mod_cluster to work, put it in the VirtualHost where you configure advertise.

    ServerAdvertise On

    EnableMCPMReceive

 

    # Where administrator reads the console from

    # This directive allows you to view mod_cluster status at URL http://ip:8888/mod_cluster-manager

    <Location /mod_cluster-manager>

       SetHandler mod_cluster-manager

       Require all granted

    </Location>

 

  </VirtualHost>

 

</IfModule>

 

Your config file be like as follow:

 

[jadm@lab1 ~]$ cat /usr/local/apache2/conf/httpd.conf | tail -40

 

LoadModule advertise_module modules/mod_advertise.so

LoadModule cluster_slotmem_module modules/mod_cluster_slotmem.so

LoadModule manager_module modules/mod_manager.so

LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

 

# Sri Lab Mod Cluster Balancer entries

<IfModule manager_module>

  Listen lab1.sri.com:8888

  # if you use uppercase in name you will find warning as below in stop/start of httpd and it will auto lower all name case.

  # [:warn] [pid 40571:tid 139763313415936] Balancer name contained an upper case character. We will use "srilabmodclusterbalancer" instead.

  ManagerBalancerName srilabmodclusterbalancer

 

  <VirtualHost lab1.sri.com:8888>

    <Directory />

       Require all granted

    </Directory>

 

    # Where your worker nodes connect from

    <Location />

       Require all granted

    </Location>

 

    # ServerAdvertise On -- Use the advertise mechanism to tell the JBoss AS/JBossWeb/Tomcat to whom it should send the cluster information.

    # One needs to configure EnableMCPMReceive in the VirtualHost where you received the MCMP elements in the Apache httpd configuration.

    # EnableMCPMReceive -- allow the VirtualHost to receive mod_cluster management protocol (MCMP) messages.

    # You need one EnableMCPMReceive in your httpd configuration to allow mod_cluster to work, put it in the VirtualHost where you configure advertise.

    ServerAdvertise On

    EnableMCPMReceive

 

    # Where administrator reads the console from

    # This directive allows you to view mod_cluster status at URL http://ip:8888/mod_cluster-manager

    <Location /mod_cluster-manager>

       SetHandler mod_cluster-manager

       Require all granted

    </Location>

 

  </VirtualHost>

 

</IfModule>

[jadm@lab1 ~]$

 

Restart Apache HTTP

 

[jadm@lab1 ~]$ /usr/local/apache2/bin/apachectl -k stop

[jadm@lab1 ~]$ /usr/local/apache2/bin/apachectl -k start

[jadm@lab1 ~]$

 

Access mod_cluster web page to confirm and verify Apache http and mod_cluster coupled successfully.

 

http://192.168.100.151:8888/mod_cluster-manager

 



 

Jboss configuration to listen Apache HTTP reverse proxy advertisement and update HTTP with JVM status through AJP:

 

Add reverse proxy Apache HTTP details directive to Jboss EAP standalone-full-ha.xml under socket-binding-group subsystem for all JVM and in all Jboss servers.

 

[jadm@lab2 configuration]$ tail -25 /lab/JBOSS/jboss-eap-7.3/lab2jvm1/configuration/standalone-full-ha.xml

    </interfaces>

    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:100}">

        <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>

        <socket-binding name="http" port="${jboss.http.port:8080}"/>

        <socket-binding name="https" port="${jboss.https.port:8443}"/>

        <socket-binding name="iiop" interface="unsecure" port="3528"/>

        <socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>

        <socket-binding name="jgroups-mping" interface="private" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>

        <socket-binding name="jgroups-tcp" interface="private" port="7600"/>

        <socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>

        <socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>

        <socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>

        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>

        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>

        <socket-binding name="modcluster" multicast-address="${jboss.modcluster.multicast.address:224.0.1.105}" multicast-port="23364"/>

        <socket-binding name="txn-recovery-environment" port="4712"/>

        <socket-binding name="txn-status-manager" port="4713"/>

        <outbound-socket-binding name="mail-smtp">

            <remote-destination host="localhost" port="25"/>

        </outbound-socket-binding>

        <outbound-socket-binding name="srilabproxy">

            <remote-destination host="192.168.100.151" port="8888"/>

        </outbound-socket-binding>

    </socket-binding-group>

</server>[jadm@lab2 configuration]$

 

Repeat same for:

/lab/JBOSS/jboss-eap-7.3/lab2jvm1/configuration/standalone-full-ha.xml

/lab/JBOSS/jboss-eap-7.3/lab3jvm1/configuration/standalone-full-ha.xml

/lab/JBOSS/jboss-eap-7.3/lab3jvm2/configuration/standalone-full-ha.xml

 

Now configure Jboss EAP standalone-full-ha.xml under jboss:domain:modcluster subsystem to update JVM status through AJP to HTTP reverse proxy.

 

[jadm@lab2 ~]$ less /lab/JBOSS/jboss-eap-7.3/lab2jvm1/configuration/standalone-full-ha.xml

        <subsystem xmlns="urn:wildfly:microprofile-opentracing-smallrye:1.0"/>

        <subsystem xmlns="urn:jboss:domain:modcluster:5.0">

            <proxy name="default" advertise-socket="modcluster" listener="ajp" proxies="srilabproxy">

                <dynamic-load-provider>

                    <load-metric type="cpu"/>

                </dynamic-load-provider>

            </proxy>

        </subsystem>

 

Repeat same for:

/lab/JBOSS/jboss-eap-7.3/lab2jvm1/configuration/standalone-full-ha.xml

/lab/JBOSS/jboss-eap-7.3/lab3jvm1/configuration/standalone-full-ha.xml

/lab/JBOSS/jboss-eap-7.3/lab3jvm2/configuration/standalone-full-ha.xml

 

Restart all JVMs (rolling restart in PRODUCTION environment definitely)

 

/lab/JBOSS/jboss-eap-7.3/bin/standalone.sh -Djboss.node.name=lab2jvm1 -Djboss.server.base.dir=/lab/JBOSS/jboss-eap-7.3/lab2jvm1 -c standalone-full-ha.xml &

/lab/JBOSS/jboss-eap-7.3/bin/standalone.sh -Djboss.node.name=lab2jvm2 -Djboss.server.base.dir=/lab/JBOSS/jboss-eap-7.3/lab2jvm2 -c standalone-full-ha.xml &

/lab/JBOSS/jboss-eap-7.3/bin/standalone.sh -Djboss.node.name=lab3jvm2 -Djboss.server.base.dir=/lab/JBOSS/jboss-eap-7.3/lab3jvm2 -c standalone-full-ha.xml &

/lab/JBOSS/jboss-eap-7.3/bin/standalone.sh -Djboss.node.name=lab3jvm1 -Djboss.server.base.dir=/lab/JBOSS/jboss-eap-7.3/lab3jvm1 -c standalone-full-ha.xml &

 

Validate Apache HTTP mod_cluster able to learn and ready reverse HTTP requests to available JVMs:

 

http://192.168.100.151:8888/mod_cluster-manager

 



 

Validate and confirm Apache HTTP can reverse proxy and route request to all available JVMs.

 

http://192.168.100.151:8888/SRIEARV4.0/sayhi2sri.jsp

 











 

High level concept of proxy and reverse proxy:

 

Proxy or forward proxy:

 


 

Reverse proxy: