Managing OpenSearch Services

This appendix describes how you can manage an OpenSearch service.

After installing OpenSearch, you can add an OpenSearch service, verify that the service starts automatically, and remove the service.

Adding OpenSearch as a Service

To add OpenSearch as a service and verify that the service is created:

  1. Open a terminal window, running as root.

  2. Change directory to OSK_INSTALL/setup:

    cd OSK_INSTALL/setup

  3. Run this command to add the service:

    ./psft-os-service.sh --add --install_base_dir BASE_DIR

  4. Use one of these methods to verify that the service was added:

    • The output of the following ps command must show a running OpenSearch process:

      ps -ef | grep opensearch

    • Use the systemctl command:

      systemctl status opensearch

      This should give an output with the status "active (running)," as shown in the following sample:

      opensearch.service - OpenSearch
      Loaded: loaded (/etc/systemd/system/opensearch.service; enabled; vendor preset: disabled)
      Active: active (running) since Wed 2023-03-29 07:31:14 UTC; 17s ago
      Docs: https://opensearch.org/
      Main PID: 121629 (java)
      Tasks: 34 (limit: 190191)
      Memory: 2.2G
      CGroup: /system.slice/opensearch.service

Verifying that the OpenSearch Service Starts Automatically

After you install the OpenSearch service and verify the installation, test to make sure the service starts automatically after you reboot the Linux server.

  1. Reboot the Linux server.

  2. Verify that the service has come up automatically.

    Use this command to verify that the service has come up automatically:

    systemctl status OpenSearch

    This should give an output with the status "active (running)," as shown in the following sample:

    opensearch.service - OpenSearch
    Loaded: loaded (/etc/systemd/system/opensearch.service; enabled; vendor preset: disabled)
    Active: active (running) since Wed 2023-03-29 07:31:14 UTC; 17s ago
    Docs: https://opensearch.org/
    Main PID: 121629 (java)
    Tasks: 34 (limit: 190191)
    Memory: 2.2G
    CGroup: /system.slice/opensearch.service

Removing the OpenSearch Service

To remove the OpenSearch service:

  1. Open a terminal window, running as root.

  2. Change directory to OSK_INSTALL/setup:

    cd OSK_INSTALL/setup

  3. Run this command to remove the service:

    ./psft-os-service.sh --delete

  4. Use one of these methods to verify that the service was deleted

    • The output of the following ps command should not include any OpenSearch process:

      ps -ef | grep opensearch

    • Use the systemctl command:

      systemctl status opensearch