From c107f0bcb9ef43913ec80490cb60b2ff765d0727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20H=C3=A4nsel?= Date: Fri, 6 Feb 2015 21:23:59 +0100 Subject: [PATCH] Export the hostname as environment variable and mention it in the docs --- bin/elasticsearch | 2 ++ bin/elasticsearch.bat | 2 ++ docs/reference/setup/configuration.asciidoc | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/bin/elasticsearch b/bin/elasticsearch index 6f3d9a992f9..23591222fb0 100755 --- a/bin/elasticsearch +++ b/bin/elasticsearch @@ -148,6 +148,8 @@ launch_service() LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 + export HOSTNAME=`hostname -s` + # The es-foreground option will tell Elasticsearch not to close stdout/stderr, but it's up to us not to daemonize. if [ "x$daemonized" = "x" ]; then es_parms="$es_parms -Des.foreground=yes" diff --git a/bin/elasticsearch.bat b/bin/elasticsearch.bat index c1f122cf1f7..fb39780d01f 100644 --- a/bin/elasticsearch.bat +++ b/bin/elasticsearch.bat @@ -33,6 +33,8 @@ FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO ( ) ) +SET HOSTNAME=%COMPUTERNAME% + CALL "%~dp0elasticsearch.in.bat" IF ERRORLEVEL 1 ( IF NOT DEFINED nopauseonerror ( diff --git a/docs/reference/setup/configuration.asciidoc b/docs/reference/setup/configuration.asciidoc index c768a490f53..05041555505 100644 --- a/docs/reference/setup/configuration.asciidoc +++ b/docs/reference/setup/configuration.asciidoc @@ -208,6 +208,17 @@ node: name: -------------------------------------------------- +The hostname of the machine is provided in an +environment variable, so you can set the node name +to the hostname, if on that machine you only run _a +single elasticsearch node_ for that cluster. + +[source,yaml] +-------------------------------------------------- +node: + name: ${HOSTNAME} +-------------------------------------------------- + Internally, all settings are collapsed into "namespaced" settings. For example, the above gets collapsed into `node.name`. This means that its easy to support other configuration formats, for example,