Keep OpenSearch Windows Service up 24/7 with Service Protector

How to Keep the OpenSearch Windows Service Running 24/7 with Service Protector

Automatically restart OpenSearch if it loses its network connection stops for any reason. Ensure that your search-based applications are always available.

OpenSearch is a powerful (and popular) open-source search engine.

For production environments, OpenSearch usually runs as a Windows Service — to start automatically at boot and run unattended in the background:

Installing as a service is a great start but what happens if OpenSearch fails? Or if someone accidentally shuts down the service? If your goal is 100% uptime, you should deploy Service Protector to keep a watchful eye on OpenSearch — and quickly jump in if it detects a problem.




To monitor OpenSearch with Service Protector:

  1. Download and install Service Protector, if necessary.

  2. Start Service Protector.

  3. Select Protector > Add to open the Add Protector window:

    Add Protector

  4. On the General tab, in the Service to protect drop-down, select the OpenSearch service.

    You can leave all other settings at their defaults, which should work well for OpenSearch:

    OpenSearch Windows Service: General Tab

  5. Switch to the Monitor tab.

    OpenSearch is a TCP/IP-based service that should always be accepting network requests. Let's set up a "sanity check" that will automatically restart OpenSearch if it ever stops processing incoming queries.

    1. Check the Whenever it fails a periodic sanity check box and click the Set button on the right:

      OpenSearch Windows Service: Enable sanity check

    2. In the Add Sanity Check window, select the Check that your service has open network connections option and click Next to proceed:

      Add a network connections check

    3. The next page allows you to specify what kind of network connections to look for. Since OpenSearch is a server that must always have a listening connection, check the Fail if there are no listening/server connections box.

      OpenSearch network connections sanity check: Options

      Click Next to continue.

    4. At this point, specify how often Service Protector should check that OpenSearch has an outbound network connection. Every 5 minutes should be good enough but feel free to adjust as you see fit:

      OpenSearch network connections sanity check: Frequency

      After you're done, click Next to move on.

    5. And finally, confirm your settings:

      Confirm your OpenSearch sanity check settings

      If everything looks good, click Add to record your new sanity check and return to the Monitor tab.

    One final recommendation on the Monitor tab: Set up a nightly restart of OpenSearch, to cure memory leaks and other bugs that arise when the software runs for too long.

    To do that:

    1. Check the At the following times box and click the Add button on the right.

      OpenSearch Windows Service: Enable scheduled stop

    2. In the Add Time window that comes up, enter the time when you would like to restart the OpenSearch service. Be sure to pick a "quiet" time, when the software is likely to be idle. For example, midnight works for us:

      Enter the time to restart the OpenSearch service

      Click OK to save your time.

    And after all that, your Monitor tab should look something like this:

    OpenSearch Windows Service: Monitor tab

  6. We're done configuring OpenSearch so click the Save button. In a few seconds, a new entry for OpenSearch will appear in Service Protector:

    OpenSearch Windows Service: Protected

    You can click the green "Running" circle to see how the OpenSearch service is performing:

    OpenSearch Windows Service: Running status

    And if you click the green shield icon, you'll see how long protection has been in place.

  7. That's it! Next time your computer boots, OpenSearch will start automatically and Service Protector will babysit the service and promptly restart it if it stops for any reason.

    We encourage you to edit OpenSearch in Service Protector and review the many other settings that may be appropriate for your environment. For example, send an email if the service fails, terminate OpenSearch if it gets stuck starting, and much more.



Trouble protecting the OpenSearch Windows Service?