4 Replies Latest reply on Sep 5, 2012 6:24 AM by Brett R-Oracle

    How can I support a health check, from a load balancer?

      My company has load balancers which use health checks to determine if the end point is available for client traffic. The basic health check is a tcp ping, and will tell you if the device is on the network. The next level of health check is an http request. This request, and the response are static, you can’t create your own version of the request and response. The standard request is this:


      The standard response is this:

           “The server is available”

      I want to use the load balancer as part of my total deployment. The problem is that I am not seeing how to support this health check request and response in the MDEX engine. What I see is this request


      Will return this response

           dgraph <host>: <port> responding at <day month year time>

      It is nice that there is a built in ping, but I am not able to make use of it. I am new to Endeca and still poking around. The dgraph process listens on a port set up in <…>/config/script/AppContext.xml

      <dgraph id="Dgraph1" host-id="MDEXHost" port="3281">
      <property name="restartGroup" value="A" />
      <property name="updateGroup" value="a" />

      (I am not using the default port, as I only have an instance on a shared server and have to worry about port clashing. But that is a different thread.)

      In a standard tc Server install I can support this health check by doing this:
      * Create a directory named “healthcheck”, in the “webapps” directory.
      * Place a file name “hc.html” in that directory, which contains “The server is available”

      The one hack which comes to mind is to write a servlet which would be able to be a smart proxy for the load balancer health check. It would pass along any regular traffic to the MDEX engine. But if the request was a health check it would send “admin?op=ping” to the MDEX engine, and for a good response from the engine, create and pass back the correct response to the load balancer.

      Ideas, comments, flames, …

        • 1. Re: How can I support a health check, from a load balancer?
          You are on exactly the right track with http://host:port/admin?op=ping.

          The question is how to configure your specific load balancer device to submit this as a get request (to the proper host/port) to each dgraph instance. We do this using F5 BigIP load balancers, and the system pings our dgraphs once every few seconds. Works like a charm.

          Thanks, MP
          • 2. Re: How can I support a health check, from a load balancer?
            Brett R-Oracle
            You're on the right track with a custom servlet/JSP for the healthcheck ping, but I'd advise against trying to build your own reverse-proxy.

            You can use a simple HttpURLConnection , use your configuration to specify protocol/host/port and append /admin?op=ping, catch exceptions and return 503 or 5xx, or else print your custom good/OK message. Hopefully your load-balancer has separate health-check and traffic-routing logic.

            • 3. Re: How can I support a health check, from a load balancer?
              Hi, we are using following String to test the MDEX ping response but we get the invalid version formation on dgraph.log -

              following is on F5

              GET /admin?op=ping HTTP/1.1/r/nHost:myhost.endeca.com:19000/r/nConnection:close/r/n/r/n

              Following gets logged on Dgraph.log

              WARN 09/05/12 05:30:03.799 UTC (1346823003799) DGRAPH {dgraph} Invalid version format in 'HTTP/1.1/r/nHost:myhost.endeca.com:19000/r/nConnection:close/r/n/r/n'

              Please let me know - if you have any suggestions to solve this issue.

              I know that it works from browser and wget from unix with following commands.

              wget http://myhost.endeca.com:19000/admin?op=ping - from unix command line

              from browser: