Added instructions for enabling opensearch as a service with systemd (#1771)
* Added instructions for enabling opensearch as a service with systemd Signed-off-by: JeffH-AWS <jeffhuss@amazon.com> * Placeholder changes Signed-off-by: JeffH-AWS <jeffhuss@amazon.com> * Added disclaimer and cleaned up some wording Signed-off-by: JeffH-AWS <jeffhuss@amazon.com> * Fixed wording Signed-off-by: JeffH-AWS <jeffhuss@amazon.com> Signed-off-by: JeffH-AWS <jeffhuss@amazon.com>
This commit is contained in:
parent
f7ba853a85
commit
d55288339a
|
@ -152,6 +152,9 @@ After you set the configurations, start OpenSearch on all nodes:
|
|||
sudo systemctl start opensearch.service
|
||||
```
|
||||
|
||||
Installing OpenSearch from a tar archive will not automatically create a service with `systemd`. See [Run OpenSearch as a service with systemd]({{site.url}}{{site.baseurl}}/opensearch/install/tar/#run-opensearch-as-a-service-with-systemd) for instructions on how to create and start the service if you receive an error like `Failed to start opensearch.service: Unit not found.`
|
||||
{: .tip}
|
||||
|
||||
Then go to the logs file to see the formation of the cluster:
|
||||
|
||||
```bash
|
||||
|
@ -172,7 +175,7 @@ x.x.x.x 34 38 0 0.12 0.07 0.06 md - o
|
|||
x.x.x.x 23 38 0 0.12 0.07 0.06 md - opensearch-c1
|
||||
```
|
||||
|
||||
To better understand and monitor your cluster, use the [cat API]({{site.url}}{{site.baseurl}}/opensearch/catapis/).
|
||||
To better understand and monitor your cluster, use the [CAT API]({{site.url}}{{site.baseurl}}/opensearch/catapis/).
|
||||
|
||||
## (Advanced) Step 6: Configure shard allocation awareness or forced awareness
|
||||
|
||||
|
|
|
@ -453,6 +453,86 @@ $ curl https://your.host.address:9200 -u admin:yournewpassword -k
|
|||
}
|
||||
```
|
||||
|
||||
### Run OpenSearch as a service with systemd
|
||||
|
||||
Create a service for OpenSearch and register it with `systemd`. After the service has been defined, you can enable, start, and stop the OpenSearch service using `systemctl` commands. The commands in this section reflect an environment where OpenSearch has been installed to `/opt/opensearch` and should be changed depending on your installation path.
|
||||
|
||||
The following configuration is only suitable for testing in a non-production environment. We do not recommend using the following configuration in a production environment. You should install OpenSearch with the [RPM]({{site.url}}{{site.baseurl}}/opensearch/install/rpm/) distribution if you want to run OpenSearch as a systemd-managed service on your host. The tarball installation does not define a specific installation path, users, roles, or permissions. Failure to properly secure your host environment can result in unexpected behavior.
|
||||
{: .warning}
|
||||
|
||||
1. Create a user for the OpenSearch service.
|
||||
```bash
|
||||
sudo adduser --system --shell /bin/bash -U --no-create-home opensearch
|
||||
```
|
||||
|
||||
1. Add your user to the `opensearch` user group.
|
||||
```bash
|
||||
sudo usermod -aG opensearch $USER
|
||||
```
|
||||
|
||||
1. Change the file owner to `opensearch`. Make sure to change the path if your OpenSearch files are in a different directory.
|
||||
```bash
|
||||
sudo chown -R opensearch /opt/opensearch/
|
||||
```
|
||||
|
||||
1. Create the service file and open it for editing.
|
||||
```bash
|
||||
sudo vi /etc/systemd/system/opensearch.service
|
||||
```
|
||||
|
||||
1. Enter the following example service configuration. Make sure to change references to the path if your OpenSearch files are in a different directory.
|
||||
```bash
|
||||
[Unit]
|
||||
Description=OpenSearch
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
RuntimeDirectory=data
|
||||
|
||||
WorkingDirectory=/opt/opensearch
|
||||
ExecStart=/opt/opensearch/bin/opensearch -d
|
||||
|
||||
User=opensearch
|
||||
Group=opensearch
|
||||
StandardOutput=journal
|
||||
StandardError=inherit
|
||||
LimitNOFILE=65535
|
||||
LimitNPROC=4096
|
||||
LimitAS=infinity
|
||||
LimitFSIZE=infinity
|
||||
TimeoutStopSec=0
|
||||
KillSignal=SIGTERM
|
||||
KillMode=process
|
||||
SendSIGKILL=no
|
||||
SuccessExitStatus=143
|
||||
TimeoutStartSec=75
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
1. Reload `systemd` manager configuration.
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
1. Enable the OpenSearch service.
|
||||
```bash
|
||||
sudo systemctl enable opensearch.service
|
||||
```
|
||||
|
||||
1. Start the OpenSearch service.
|
||||
```bash
|
||||
sudo systemctl start opensearch
|
||||
```
|
||||
|
||||
1. Verify that the service is running.
|
||||
```bash
|
||||
sudo systemctl status opensearch
|
||||
```
|
||||
|
||||
## Related links
|
||||
|
||||
- [OpenSearch configuration]({{site.url}}{{site.baseurl}}/opensearch/configuration/)
|
||||
|
|
Loading…
Reference in New Issue