4 Replies Latest reply on Oct 30, 2012 2:54 PM by ahnc

    load balancing CQ5.5 author cluster

    jlewis@42lines.net

      Hello,

       

      I've setup a cluster of CQ5.5 author instances.  All authors are behind a VIP on a BigIP load balancer.  The BigIP service check is hitting port 4502 every 5 seconds and causing the following to get logged in error.log, which is quite annoying.

       

      04.09.2012 11:37:02.769 *INFO* [95.80.105.21 [1346783822769] GET / HTTP/1.1] org.apache.sling.auth.core.impl.SlingAuthenticator getAnonymousResolver: Anonymous access not allowed by configuration - requesting credentials

       

      Anyone have suggestions for different URIs to hit for a load balancer service check?  I suppose I could write a custom monitor.  Anyone with experience using CQ5 + BigIP, have a custom monitor they're willing to share?

       

      Thanks,
      Jeffrey

        • 1. Re: load balancing CQ5.5 author cluster
          Sham HC Level 7

          Hi Jeffrey,

           

            IIRC For author you might check for [1] & rest of pages asks for authentication and logs those messages.   Better would be write a custom servlet & extend to check for specific problem. Sample at [2]

           

           

          [1]   http://<host>:<port>/libs/cq/core/content/login.html

           

          [2]

          public class HealthCheckServlet extends SlingSafeMethodsServlet {

           

              private static final Logger log = LoggerFactory.getLogger(HealthCheckServlet.class);

           

              /**

               * @scr.property name="sling.servlet.paths"

               */

              private static final String[] SERVLET_PATHS = new String[]{"/services/systemhealthcheck"};

            

              /** @scr.reference */

              private ResourceResolverFactory resourceResolverFactory;

           

              @Override

              protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {

                  ResourceResolver resolver = null;

                  try {

                      resolver = resourceResolverFactory.getAdministrativeResourceResolver(null);

                      Resource testResource = resolver.getResource("/content/geometrixx/en/jcr:content");

                      if (testResource != null) {

                          String statusValue = "success";

                          /*

                              Check for other things

                          */

                          response.getWriter().println(statusValue);

                      } else {

                          log.error("Failed to get resource for base check page - must be a system failure");

                          response.getWriter().println("System Failure");

                      }

                  } catch (Throwable t) {

                      log.error("An exception occurred during a healthcheck: ", t);

                      response.getWriter().println("System Failure");

                  } finally {

                      if (resolver != null) {

                          resolver.close();

                      }

                  }

              }

          }

          • 2. Re: load balancing CQ5.5 author cluster
            Yogesh Upadhyay Level 4

            You can also create a very simple HTML page and give anonymous access to it and then check status code in Big IP for health.

             

            Yogesh

            • 3. Re: load balancing CQ5.5 author cluster
              jlewis@42lines.net Level 1

              Thanks.  Looks like /libs/cq/core/content/login.html is valid for author and publish instances, at least in CQ5.5 Update 1.

              • 4. Re: load balancing CQ5.5 author cluster
                ahnc

                You can create a page under your site and not cache the page (i.e. dispatcher will always get the page form publish instance).  The page can also be hidden from navigation vi the page properties.

                 

                We have our dispatcher instance connected to a specific publish instance (e.g. dispatcher01 connected to pub01 and dispatcher02 connected pub02), so our load balancer checks against the monitor page (looking for a specific text like "I'm ok") on each dispatcher instance.  Since the monitor page is never cached, if the LB doesn't see the text, that means the corresponding publish instance is down.  You can exclude a page from the dispatcher cache via dispatcher.any config.