3 Replies Latest reply on Aug 8, 2007 11:09 PM by Larry Ludlow

    :: Regarding using Software Load balancer Mod_jk1.2.23 with

    BhaktavatsalamReddy Newbie

      Hi,

      I am not sure if I am in the right forum regarding setting up the load balancer with JBoss4.2.0 GA.

      I have clearly followed the step by step procedure mentioned in the following link:

      http://www.jboss.org/wiki/Wiki.jsp?page=UsingMod_jk1.2WithJBoss


      Configuration files and properties files required to set up are:
      1. httpd.conf
      2. mod-jk.conf
      3. workers.properties
      4. uriworkermap.properties
      All of the above files are placed under

      apache2/conf

      5. server.xml
      placed under
      default/deploy/conf/jbossweb-tomcat55.sar

      6. jboss-service.xml
      placed under
      default/deploy/conf/jbossweb-tomcat55.sar


      1. httpd.conf
      Added the following piece to the existing file under the mensioned dir:

      # Include mod_jk configuration file
      Include conf/mod-jk.conf
      
      # Configure mod_jk
      #
      JkWorkersFile conf/workers.properties
      JkLogFile logs/mod_jk.log
      JkLogLevel debug
      
      JkMount /web-console/* node1
      JkMount /jmx-console/* node1
      JkMount /mambo/* node1
      JkMount /*.jsp node1
      JkMount /servlet/* node1
      
      LoadModule jk_module modules/mod_jk.so
      


      2. mod-jk.conf

      # Load mod_jk module
      # Specify the filename of the mod_jk lib
      LoadModule jk_module modules/mod_jk.so
      
      # Where to find workers.properties
      JkWorkersFile conf/workers.properties
      
      # Where to put jk logs
      JkLogFile logs/mod_jk.log
      
      # Set the jk log level [debug/error/info]
      JkLogLevel debug
      
      # Select the log format
      JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
      
      # JkOptions indicates to send SSK KEY SIZE
      # Note: Changed from +ForwardURICompat.
      # See http://tomcat.apache.org/security-jk.html
      JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
      
      # JkRequestLogFormat
      JkRequestLogFormat "%w %V %T"
      
      # Mount your applications
      JkMount /web-console/* loadbalancer
      JkMount /jmx-console/* loadbalancer
      JkMount /mambo/* loadbalancer
      
      # You can use external file for mount points.
      # It will be checked for updates each 60 seconds.
      # The format of the file is: /url=worker
      # /examples/*=loadbalancer
      JkMountFile conf/uriworkermap.properties
      
      # Add shared memory.
      # This directive is present with 1.2.10 and
      # later versions of mod_jk, and is needed for
      # for load balancing to work properly
      # Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to
      # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
      JkShmFile logs/jk.shm
      
      # Add jkstatus for managing runtime data
      <Location /jkstatus/>
      JkMount status
      Order deny,allow
      Deny from all
      Allow from 127.0.0.1
      </Location>
      


      3. workers.properties
      # Define list of workers that will be used
      # for mapping requests
      # The configuration directives are valid
      # for the mod_jk version 1.2.18 and later
      #
      workers.tomcat_home=C:\jboss-4.2.0.GA
      worker.list=loadbalancer,status
      
      # Define Node1
      # modify the host as your host IP or DNS name.
      worker.node1.port=8009
      worker.node1.host=localhost
      worker.node1.type=ajp13
      worker.node1.cachesize=50
      worker.node1.cache_timeout=600
      worker.node1.socket_keepalive=1
      worker.node1.recycle_timeout=300
      
      worker.node1.lbfactor=1
      # worker.node1.connection_pool_size=10 (1)
      
      # Load-balancing behaviour
      worker.loadbalancer.type=lb
      worker.loadbalancer.balance_workers=node1
      worker.loadbalancer.sticky_session=Off
      
      # Status worker for managing load balancer
      worker.status.type=status
      


      4. uriworkermap.properties
      # Simple worker configuration file
      #
      # Mount the Servlet context to the ajp13 worker
      /jmx-console=loadbalancer
      /jmx-console/*=loadbalancer
      /web-console=loadbalancer
      /web-console/*=loadbalancer
      /mambo=loadbalancer
      /mambo/*=loadbalancer
      


      5. server.xml
      Adde following snippets to the existing file:
      <Connector
       protocol="AJP/1.3"
       port="8009"
       minProcessors="5"
       maxProcessors="75"
       enableLookups="false"
       redirectPort="8443"
       acceptCount="10"
       debug="0"
       connectionTimeout="0"
       useURIValidationHack="false"/>
      

      and
      <Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">


      6. jboss-service.xml
      Modified the existing file as follows and added the following snippet:
      <attribute name="UseJK">true</attribute>


      I am trying to access it via:
      http://localhost/web-console
      or
      http://localhost/jmx-console
      0r
      http://localhost/mambo

      I am getting the following error:
      Service Temporarily Unavailable
      The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
      
      --------------------------------------------------------------------------------
      
      Apache/2.0.59 (Win32) mod_jk/1.2.23 Server at 10.1.5.231 Port 80


      The access.log is as follows:
      [Wed Jul 18 13:04:23 2007] [warn] module jk_module is already loaded, skipping
      [Wed Jul 18 13:04:33 2007] [warn] module jk_module is already loaded, skipping
      127.0.0.1 - - [18/Jul/2007:13:05:02 -0700] "GET /mambo HTTP/1.1" 503 412
      127.0.0.1 - - [18/Jul/2007:13:57:17 -0700] "GET /mambo HTTP/1.1" 503 412
      [Wed Jul 18 14:10:53 2007] [warn] module jk_module is already loaded, skipping
      127.0.0.1 - - [18/Jul/2007:14:11:00 -0700] "GET /mambo HTTP/1.1" 503 412


      The error.log is as follows :
      [Wed Jul 18 14:10:55 2007] [debug] child.c(697): Child 6916: Worker thread 237 starting.
      [Wed Jul 18 14:10:55 2007] [debug] child.c(697): Child 6916: Worker thread 239 starting.
      [Wed Jul 18 14:10:55 2007] [debug] child.c(697): Child 6916: Worker thread 241 starting.
      [Wed Jul 18 14:10:55 2007] [debug] child.c(697): Child 6916: Worker thread 243 starting.
      [Wed Jul 18 14:10:55 2007] [debug] child.c(697): Child 6916: Worker thread 245 starting.
      [Wed Jul 18 14:10:55 2007] [debug] child.c(697): Child 6916: Worker thread 247 starting.


      The mod_jk.log is as follows:
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (726): File C:/ApacheGroup/Apache2/conf/uriworkermap.properties is not modified
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (589): Attempting to map URI '/mambo' from 12 maps
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/jmx-console/*=loadbalancer' source 'uriworkermap'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/web-console/*=loadbalancer' source 'uriworkermap'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/web-console/*=node1' source 'JkMount'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/jmx-console/*=node1' source 'JkMount'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/servlet/*=node1' source 'JkMount'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/jkstatus/=status' source 'JkMount'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/mambo/*=loadbalancer' source 'uriworkermap'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/mambo/*=node1' source 'JkMount'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/jmx-console=loadbalancer' source 'uriworkermap'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/web-console=loadbalancer' source 'uriworkermap'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (601): Attempting to map context URI '/mambo=loadbalancer' source 'uriworkermap'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_uri_worker_map.c (627): Found an exact match '/mambo=loadbalancer'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] mod_jk.c (2111): Into handler jakarta-servlet worker=loadbalancer r->proxyreq=0
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_worker.c (114): found a worker loadbalancer
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_worker.c (321): Maintaining worker loadbalancer
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_ajp_common.c (2416): reached pool min size 25 from 50 cache slots
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_ajp_common.c (2424): recycled 0 sockets in 0 seconds from 50 pool slots
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_lb_worker.c (543): decay with 2^23
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_lb_worker.c (444): worker node1 is marked for recovery
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_worker.c (290): Found worker type 'lb'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] mod_jk.c (607): Service protocol=HTTP/1.1 method=GET host=(null) addr=127.0.0.1 name=10.1.5.231 port=80 auth=(null) user=(null) laddr=127.0.0.1 raddr=127.0.0.1
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_lb_worker.c (915): service sticky_session=0 id='empty'
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_lb_worker.c (935): service worker=node1 route=node1
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_ajp_common.c (2343): acquired connection pool slot=0
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_ajp_common.c (548): ajp marshaling done
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_ajp_common.c (1796): processing node1 with 2 retries
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_connect.c (335): socket TCP_NODELAY set to On
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_connect.c (348): socket SO_KEEPALIVE set to On
      [Wed Jul 18 14:39:27 2007][6916:11872] [debug] jk_connect.c (433): trying to connect socket 824 to 127.0.0.1:8080
      [Wed Jul 18 14:39:28 2007][6916:11872] [info] jk_connect.c (451): connect to 127.0.0.1:8080 failed (errno=61)
      [Wed Jul 18 14:39:28 2007][6916:11872] [info] jk_ajp_common.c (876): Failed opening socket to (127.0.0.1:8080) (errno=61)
      [Wed Jul 18 14:39:28 2007][6916:11872] [info] jk_ajp_common.c (1273): (node1) error connecting to the backend server (errno=61)
      [Wed Jul 18 14:39:28 2007][6916:11872] [info] jk_ajp_common.c (1941): (node1) sending request to tomcat failed, recoverable operation attempt=1
      [Wed Jul 18 14:39:28 2007][6916:11872] [debug] jk_connect.c (335): socket TCP_NODELAY set to On
      [Wed Jul 18 14:39:28 2007][6916:11872] [debug] jk_connect.c (348): socket SO_KEEPALIVE set to On
      [Wed Jul 18 14:39:28 2007][6916:11872] [debug] jk_connect.c (433): trying to connect socket 824 to 127.0.0.1:8080
      [Wed Jul 18 14:39:29 2007][6916:11872] [info] jk_connect.c (451): connect to 127.0.0.1:8080 failed (errno=61)
      [Wed Jul 18 14:39:29 2007][6916:11872] [info] jk_ajp_common.c (876): Failed opening socket to (127.0.0.1:8080) (errno=61)
      [Wed Jul 18 14:39:29 2007][6916:11872] [info] jk_ajp_common.c (1273): (node1) error connecting to the backend server (errno=61)
      [Wed Jul 18 14:39:29 2007][6916:11872] [info] jk_ajp_common.c (1941): (node1) sending request to tomcat failed, recoverable operation attempt=2
      [Wed Jul 18 14:39:29 2007][6916:11872] [error] jk_ajp_common.c (1953): (node1) Connecting to tomcat failed. Tomcat is probably not started or is listening on the wrong port
      [Wed Jul 18 14:39:29 2007][6916:11872] [debug] jk_ajp_common.c (2286): recycling connection pool slot=0 for worker node1
      [Wed Jul 18 14:39:29 2007][6916:11872] [info] jk_lb_worker.c (1098): service failed, worker node1 is in error state
      [Wed Jul 18 14:39:29 2007][6916:11872] [debug] jk_lb_worker.c (1111): recoverable error... will try to recover on other worker
      [Wed Jul 18 14:39:29 2007][6916:11872] [info] jk_lb_worker.c (1160): All tomcat instances are busy or in error state
      [Wed Jul 18 14:39:29 2007]loadbalancer 10.1.5.231 1.921875
      [Wed Jul 18 14:39:29 2007][6916:11872] [info] mod_jk.c (2254): Service error=0 for worker=loadbalancer


      Help in this regard would be highly appreciated.

      Thanks in advance,
      Bhakta

        • 1. Re: :: Regarding using Software Load balancer Mod_jk1.2.23 w
          BhaktavatsalamReddy Newbie

          BTW
          Cluster is established. For the sake of simplicity,
          only one server is added in the cluster.

          Farming deployment is working fine as it is saying that the ear file in the farm directory is pushed on to the cluster successfully.

          The Treecache is also replicating.i.e., it is trying to push the treecache updates on to cluster periodically.


          Thanks,
          Bhakta

          • 2. Re: :: Regarding using Software Load balancer Mod_jk1.2.23 w
            Brian Stansberry Master

             

            [Wed Jul 18 14:39:28 2007][6916:11872] [info] jk_connect.c (451): connect to 127.0.0.1:8080 failed (errno=61)


            Don't have time to look in detail, but mod_jk is trying to reach Tomcat on 8080 instead of 8009. Must be some problem in your mod_jk config.

            • 3. Re: :: Regarding using Software Load balancer Mod_jk1.2.23 w
              Larry Ludlow Newbie

              You seem to be referencing your mod_jk config twice.

              1.

              1. httpd.conf
              Added the following piece to the existing file under the mensioned dir:

              Code:

              # Include mod_jk configuration file
              Include conf/mod-jk.conf

              # Configure mod_jk
              #
              JkWorkersFile conf/workers.properties
              JkLogFile logs/mod_jk.log
              JkLogLevel debug

              JkMount /web-console/* node1
              JkMount /jmx-console/* node1
              JkMount /mambo/* node1
              JkMount /*.jsp node1
              JkMount /servlet/* node1

              LoadModule jk_module modules/mod_jk.so

              By having "Include conf/mod-jk.conf" you are reading the mod_jk.conf below

              2.

              2. mod-jk.conf
              # Mount your applications
              JkMount /web-console/* loadbalancer
              JkMount /jmx-console/* loadbalancer
              JkMount /mambo/* loadbalancer

              # You can use external file for mount points.
              # It will be checked for updates each 60 seconds.
              # The format of the file is: /url=worker
              # /examples/*=loadbalancer
              JkMountFile conf/uriworkermap.properties


              From what I can see you are mounting your applications 2 times with different workers and loading the mod_jk.so twice as well.

              Also there is no need to use JkMount and have the workers listed in the uriworkermap.properties.

              To simplify things I put the include in my httpd.conf, and remove the uriworkermap.properties (comment out or delete from mod_jk.conf)

              Hope this helps