Skip to content

Commit

Permalink
Merge branch 'main' into fix-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Naarcha-AWS committed Jul 9, 2024
2 parents cc230cd + 8f6ea3f commit a2cb123
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion _install-and-configure/configuring-opensearch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,56 @@ Certain operations are static and require you to modify the `opensearch.yml` [co

## Specifying settings as environment variables

You can specify environment variables in the following ways.

### Arguments at startup

You can specify environment variables as arguments using `-E` when launching OpenSearch:

```bash
./opensearch -Ecluster.name=opensearch-cluster -Enode.name=opensearch-node1 -Ehttp.host=0.0.0.0 -Ediscovery.type=single-node
```
{% include copy.html %}

### Directly in the shell environment

You can configure the environment variables directly in a shell environment before starting OpenSearch, as shown in the following example:

```bash
export OPENSEARCH_JAVA_OPTS="-Xms2g -Xmx2g"
export OPENSEARCH_PATH_CONF="/etc/opensearch"
./opensearch
```
{% include copy.html %}

### Systemd service file

When running OpenSearch as a service managed by `systemd`, you can specify environment variables in the service file, as shown in the following example:

```bash
# /etc/systemd/system/opensearch.service.d/override.conf
[Service]
Environment="OPENSEARCH_JAVA_OPTS=-Xms2g -Xmx2g"
Environment="OPENSEARCH_PATH_CONF=/etc/opensearch"
```
After creating or modifying the file, reload the systemd configuration and restart the service using the following command:

```bash
sudo systemctl daemon-reload
sudo systemctl restart opensearch
```
{% include copy.html %}

### Docker environment variables

When running OpenSearch in Docker, you can specify environment variables using the `-e` option with `docker run` command, as shown in the following command:

```bash
docker run -e "OPENSEARCH_JAVA_OPTS=-Xms2g -Xmx2g" -e "OPENSEARCH_PATH_CONF=/usr/share/opensearch/config" opensearchproject/opensearch:latest
```
{% include copy.html %}


## Updating cluster settings using the API

The first step in changing a setting is to view the current settings by sending the following request:
Expand Down Expand Up @@ -113,4 +156,4 @@ If you are working on a client application running against an OpenSearch cluster
- http.cors.enabled:true
- http.cors.allow-headers:X-Requested-With,X-Auth-Token,Content-Type,Content-Length,Authorization
- http.cors.allow-credentials:true
```
```

0 comments on commit a2cb123

Please sign in to comment.