From f9ea9db45c66496e5364adc67fccf32128b76e1f Mon Sep 17 00:00:00 2001 From: AntonEliatra Date: Mon, 17 Jun 2024 15:45:02 +0100 Subject: [PATCH 1/4] setting-envars-docs #3582 Signed-off-by: AntonEliatra --- .../configuring-opensearch/index.md | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/_install-and-configure/configuring-opensearch/index.md b/_install-and-configure/configuring-opensearch/index.md index ecbce1310d..9c553782c6 100755 --- a/_install-and-configure/configuring-opensearch/index.md +++ b/_install-and-configure/configuring-opensearch/index.md @@ -25,6 +25,10 @@ Certain operations are static and require you to modify the `opensearch.yml` [co ## Specifying settings as environment variables +You can specify environment variables in different ways. + +### Arguments as start up + You can specify environment variables as arguments using `-E` when launching OpenSearch: ```bash @@ -32,6 +36,45 @@ You can specify environment variables as arguments using `-E` when launching Ope ``` {% include copy.html %} +### Directly in the shell environment + +You can configure the environment variables directly in shell before starting OpenSearch: + +```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: + +```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: + +```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: + +```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: From 5b457740edea5d2c9c122a958e21b19403774aab Mon Sep 17 00:00:00 2001 From: AntonEliatra Date: Mon, 24 Jun 2024 10:53:22 +0100 Subject: [PATCH 2/4] Update index.md Signed-off-by: AntonEliatra --- _install-and-configure/configuring-opensearch/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_install-and-configure/configuring-opensearch/index.md b/_install-and-configure/configuring-opensearch/index.md index 9c553782c6..e599b05b9d 100755 --- a/_install-and-configure/configuring-opensearch/index.md +++ b/_install-and-configure/configuring-opensearch/index.md @@ -47,7 +47,7 @@ export OPENSEARCH_PATH_CONF="/etc/opensearch" ``` {% include copy.html %} -### Systemd Service File +### Systemd service file When running OpenSearch as a service managed by systemd, you can specify environment variables in the service file: @@ -65,9 +65,9 @@ sudo systemctl restart opensearch ``` {% include copy.html %} -### Docker Environment Variables +### Docker environment variables -When running OpenSearch in Docker, you can specify environment variables using the -e option with docker run: +When running OpenSearch in Docker, you can specify environment variables using the -e option with Docker run: ```bash docker run -e "OPENSEARCH_JAVA_OPTS=-Xms2g -Xmx2g" -e "OPENSEARCH_PATH_CONF=/usr/share/opensearch/config" opensearchproject/opensearch:latest @@ -156,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 -``` \ No newline at end of file +``` From b4c48dd717a09beb5e4459fbb49ae6ebdaff469a Mon Sep 17 00:00:00 2001 From: AntonEliatra Date: Thu, 4 Jul 2024 10:18:24 +0100 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com> Signed-off-by: AntonEliatra --- _install-and-configure/configuring-opensearch/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/_install-and-configure/configuring-opensearch/index.md b/_install-and-configure/configuring-opensearch/index.md index e599b05b9d..17b4d968bf 100755 --- a/_install-and-configure/configuring-opensearch/index.md +++ b/_install-and-configure/configuring-opensearch/index.md @@ -25,7 +25,7 @@ Certain operations are static and require you to modify the `opensearch.yml` [co ## Specifying settings as environment variables -You can specify environment variables in different ways. +You can specify environment variables in the following ways. ### Arguments as start up @@ -38,7 +38,7 @@ You can specify environment variables as arguments using `-E` when launching Ope ### Directly in the shell environment -You can configure the environment variables directly in shell before starting OpenSearch: +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" @@ -49,7 +49,7 @@ export OPENSEARCH_PATH_CONF="/etc/opensearch" ### Systemd service file -When running OpenSearch as a service managed by systemd, you can specify environment variables in the 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 @@ -57,7 +57,7 @@ When running OpenSearch as a service managed by systemd, you can specify environ 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: +After creating or modifying the file, reload the systemd configuration and restart the service using the following command: ```bash sudo systemctl daemon-reload @@ -67,7 +67,7 @@ sudo systemctl restart opensearch ### Docker environment variables -When running OpenSearch in Docker, you can specify environment variables using the -e option with Docker run: +When running OpenSearch in Docker, you can specify environment variables using the -e option with Docker run, 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 From 545c049e86f3d01e992b31c4db9efdebddd98c05 Mon Sep 17 00:00:00 2001 From: AntonEliatra Date: Tue, 9 Jul 2024 17:01:53 +0100 Subject: [PATCH 4/4] Update index.md Signed-off-by: AntonEliatra --- _install-and-configure/configuring-opensearch/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_install-and-configure/configuring-opensearch/index.md b/_install-and-configure/configuring-opensearch/index.md index 17b4d968bf..c2ffbf571b 100755 --- a/_install-and-configure/configuring-opensearch/index.md +++ b/_install-and-configure/configuring-opensearch/index.md @@ -27,7 +27,7 @@ Certain operations are static and require you to modify the `opensearch.yml` [co You can specify environment variables in the following ways. -### Arguments as start up +### Arguments at startup You can specify environment variables as arguments using `-E` when launching OpenSearch: @@ -67,7 +67,7 @@ sudo systemctl restart opensearch ### Docker environment variables -When running OpenSearch in Docker, you can specify environment variables using the -e option with Docker run, as shown in the following command: +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