Managing an OpenSearch Service on Linux
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:
-
Open a terminal window, running as root.
-
Change directory to OSK_INSTALL/setup:
cd OSK_INSTALL/setup -
Run this command to add the service:
./psft-os-service.sh --add --install_base_dir BASE_DIR -
Use one of these methods to verify that the service was added:
-
The output of the following
pscommand must show a running OpenSearch process:ps -ef | grep opensearch -
Use the
systemctlcommand:systemctl status opensearchThis 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.
-
Reboot the Linux server.
-
Verify that the service has come up automatically.
Use this command to verify that the service has come up automatically:
systemctl status OpenSearchThis 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:
-
Open a terminal window, running as root.
-
Change directory to OSK_INSTALL/setup:
cd OSK_INSTALL/setup -
Run this command to remove the service:
./psft-os-service.sh --delete -
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
systemctlcommand:systemctl status opensearch
-