From e9687622bd41b4390c5ace5c8fe20dafbd0cb194 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 15 Aug 2017 06:19:06 +0900 Subject: [PATCH] Rename CONF_DIR to ES_PATH_CONF The environment variable CONF_DIR was previously inconsistently used in our packaging to customize the location of Elasticsearch configuration files. The importance of this environment variable has increased starting in 6.0.0 as it's now used consistently to ensure Elasticsearch and all secondary scripts (e.g., elasticsearch-keystore) all use the same configuration. The name CONF_DIR is there for legacy reasons yet it's too generic. This commit renames CONF_DIR to ES_PATH_CONF. Relates #26197 --- .../gradle/test/ClusterFormationTasks.groovy | 2 +- .../org/elasticsearch/gradle/test/NodeInfo.groovy | 12 ++++++------ .../gradle/test/RestIntegTestTask.groovy | 3 +-- distribution/build.gradle | 4 ++-- .../deb/src/main/packaging/init.d/elasticsearch | 4 ++-- .../rpm/src/main/packaging/init.d/elasticsearch | 4 ++-- distribution/src/main/packaging/env/elasticsearch | 2 +- distribution/src/main/packaging/scripts/postrm | 6 +++--- .../main/packaging/systemd/elasticsearch.service | 2 +- distribution/src/main/resources/bin/elasticsearch | 8 ++++---- .../src/main/resources/bin/elasticsearch-env | 4 ++-- .../src/main/resources/bin/elasticsearch-env.bat | 4 ++-- .../src/main/resources/bin/elasticsearch-keystore | 2 +- .../main/resources/bin/elasticsearch-keystore.bat | 2 +- .../src/main/resources/bin/elasticsearch-plugin | 2 +- .../src/main/resources/bin/elasticsearch-plugin.bat | 2 +- .../main/resources/bin/elasticsearch-service.bat | 4 ++-- .../src/main/resources/bin/elasticsearch-translog | 2 +- .../main/resources/bin/elasticsearch-translog.bat | 2 +- .../src/main/resources/bin/elasticsearch.bat | 4 ++-- docs/plugins/plugin-script.asciidoc | 2 +- .../migration/migrate_6_0/packaging.asciidoc | 13 +++++++++++-- docs/reference/setup/configuration.asciidoc | 12 ++++++------ docs/reference/setup/install/deb.asciidoc | 2 +- docs/reference/setup/install/rpm.asciidoc | 2 +- .../reference/setup/install/sysconfig-file.asciidoc | 7 ++++--- docs/reference/setup/install/zip-targz.asciidoc | 2 +- docs/reference/setup/install/zip-windows.asciidoc | 9 +++++---- docs/reference/setup/rolling_upgrade.asciidoc | 5 +++-- .../resources/packaging/tests/20_tar_package.bats | 6 +++--- .../test/resources/packaging/tests/60_systemd.bats | 2 +- .../resources/packaging/tests/70_sysv_initd.bats | 2 +- .../tests/module_and_plugin_test_cases.bash | 6 +++--- .../src/test/resources/packaging/utils/plugins.bash | 6 +++--- .../src/test/resources/packaging/utils/utils.bash | 10 +++++----- 35 files changed, 86 insertions(+), 75 deletions(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy index d14ae498fe7f..90c839720fb7 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -326,7 +326,7 @@ class ClusterFormationTasks { if (unicastTransportUri != null) { esConfig['discovery.zen.ping.unicast.hosts'] = "\"${unicastTransportUri}\"" } - File configFile = new File(node.confDir, 'elasticsearch.yml') + File configFile = new File(node.pathConf, 'elasticsearch.yml') logger.info("Configuring ${configFile}") configFile.setText(esConfig.collect { key, value -> "${key}: ${value}" }.join('\n'), 'UTF-8') } diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy index 522d1fa96c09..9aadc5cf4a44 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy @@ -55,7 +55,7 @@ class NodeInfo { File homeDir /** config directory */ - File confDir + File pathConf /** data directory (as an Object, to allow lazy evaluation) */ Object dataDir @@ -110,13 +110,13 @@ class NodeInfo { pidFile = new File(baseDir, 'es.pid') this.nodeVersion = nodeVersion homeDir = homeDir(baseDir, config.distribution, nodeVersion) - confDir = confDir(baseDir, config.distribution, nodeVersion) + pathConf = pathConf(baseDir, config.distribution, nodeVersion) if (config.dataDir != null) { dataDir = "${config.dataDir(nodeNum)}" } else { dataDir = new File(homeDir, "data") } - configFile = new File(confDir, 'elasticsearch.yml') + configFile = new File(pathConf, 'elasticsearch.yml') // even for rpm/deb, the logs are under home because we dont start with real services File logsDir = new File(homeDir, 'logs') httpPortsFile = new File(logsDir, 'http.ports') @@ -158,9 +158,9 @@ class NodeInfo { args.add("${property.key.substring('tests.es.'.size())}=${property.value}") } } - env.put('CONF_DIR', confDir) + env.put('ES_PATH_CONF', pathConf) if (Version.fromString(nodeVersion).major == 5) { - args.addAll("-E", "path.conf=${confDir}") + args.addAll("-E", "path.conf=${pathConf}") } if (!System.properties.containsKey("tests.es.path.data")) { args.addAll("-E", "path.data=${-> dataDir.toString()}") @@ -240,7 +240,7 @@ class NodeInfo { return new File(baseDir, path) } - static File confDir(File baseDir, String distro, String nodeVersion) { + static File pathConf(File baseDir, String distro, String nodeVersion) { switch (distro) { case 'integ-test-zip': case 'zip': diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy index 6494e500f33a..dbfa1cdf9355 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy @@ -24,7 +24,6 @@ import org.gradle.api.DefaultTask import org.gradle.api.Task import org.gradle.api.execution.TaskExecutionAdapter import org.gradle.api.internal.tasks.options.Option -import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.tasks.Input import org.gradle.api.tasks.TaskState @@ -68,7 +67,7 @@ public class RestIntegTestTask extends DefaultTask { // we pass all nodes to the rest cluster to allow the clients to round-robin between them // this is more realistic than just talking to a single node runner.systemProperty('tests.rest.cluster', "${-> nodes.collect{it.httpUri()}.join(",")}") - runner.systemProperty('tests.config.dir', "${-> nodes[0].confDir}") + runner.systemProperty('tests.config.dir', "${-> nodes[0].pathConf}") // TODO: our "client" qa tests currently use the rest-test plugin. instead they should have their own plugin // that sets up the test cluster and passes this transport uri instead of http uri. Until then, we pass // both as separate sysprops diff --git a/distribution/build.gradle b/distribution/build.gradle index 0e2254088e53..3522becc53ec 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -521,12 +521,12 @@ Map expansionsForDistribution(distributionType) { 'rpm': '/etc/sysconfig/elasticsearch', /* There isn't one of these files for tar or zip but its important to make an empty string here so the script can properly skip it. */ - 'def': 'if [ -z "$CONF_DIR" ]; then CONF_DIR="$ES_HOME"/config; done', + 'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; done', ], 'source.path.env': [ 'deb': 'if [ -f /etc/default/elasticsearch ]; then source /etc/default/elasticsearch; fi', 'rpm': 'if [ -f /etc/sysconfig/elasticsearch ]; then source /etc/sysconfig/elasticsearch; fi', - 'def': 'if [ -z "$CONF_DIR" ]; then CONF_DIR="$ES_HOME"/config; fi', + 'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi', ], 'path.logs': [ 'deb': packagingPathLogs, diff --git a/distribution/deb/src/main/packaging/init.d/elasticsearch b/distribution/deb/src/main/packaging/init.d/elasticsearch index f1de5dc21bf5..6d3efd99ca6f 100755 --- a/distribution/deb/src/main/packaging/init.d/elasticsearch +++ b/distribution/deb/src/main/packaging/init.d/elasticsearch @@ -45,7 +45,7 @@ MAX_OPEN_FILES=65536 #MAX_LOCKED_MEMORY= # Elasticsearch configuration directory -CONF_DIR=/etc/$NAME +ES_PATH_CONF=/etc/$NAME # Maximum number of VMA (Virtual Memory Areas) a process can own MAX_MAP_COUNT=262144 @@ -73,7 +73,7 @@ DAEMON_OPTS="-d -p $PID_FILE" export ES_JAVA_OPTS export JAVA_HOME -export CONF_DIR +export ES_PATH_CONF if [ ! -x "$DAEMON" ]; then echo "The elasticsearch startup script does not exists or it is not executable, tried: $DAEMON" diff --git a/distribution/rpm/src/main/packaging/init.d/elasticsearch b/distribution/rpm/src/main/packaging/init.d/elasticsearch index 55e5e422e9c8..01dc4e691c07 100644 --- a/distribution/rpm/src/main/packaging/init.d/elasticsearch +++ b/distribution/rpm/src/main/packaging/init.d/elasticsearch @@ -35,7 +35,7 @@ fi ES_HOME="/usr/share/elasticsearch" MAX_OPEN_FILES=65536 MAX_MAP_COUNT=262144 -CONF_DIR="${path.conf}" +ES_PATH_CONF="${path.conf}" PID_DIR="/var/run/elasticsearch" @@ -57,7 +57,7 @@ pidfile="$PID_DIR/${prog}.pid" export ES_JAVA_OPTS export JAVA_HOME -export CONF_DIR +export ES_PATH_CONF export ES_STARTUP_SLEEP_TIME lockfile=/var/lock/subsys/$prog diff --git a/distribution/src/main/packaging/env/elasticsearch b/distribution/src/main/packaging/env/elasticsearch index c0f72dcb9f81..1c4095351379 100644 --- a/distribution/src/main/packaging/env/elasticsearch +++ b/distribution/src/main/packaging/env/elasticsearch @@ -9,7 +9,7 @@ #JAVA_HOME= # Elasticsearch configuration directory -CONF_DIR=${path.conf} +ES_PATH_CONF=${path.conf} # Elasticsearch PID directory #PID_DIR=/var/run/elasticsearch diff --git a/distribution/src/main/packaging/scripts/postrm b/distribution/src/main/packaging/scripts/postrm index b86901e2e258..48896109cb9f 100644 --- a/distribution/src/main/packaging/scripts/postrm +++ b/distribution/src/main/packaging/scripts/postrm @@ -50,7 +50,7 @@ LOG_DIR="/var/log/elasticsearch" PLUGINS_DIR="/usr/share/elasticsearch/plugins" PID_DIR="/var/run/elasticsearch" DATA_DIR="/var/lib/elasticsearch" -CONF_DIR="/etc/elasticsearch" +ES_PATH_CONF="/etc/elasticsearch" # Source the default env file if [ "$SOURCE_ENV_FILE" = "true" ]; then @@ -86,8 +86,8 @@ if [ "$REMOVE_DIRS" = "true" ]; then fi # delete the conf directory if and only if empty - if [ -d "$CONF_DIR" ]; then - rmdir --ignore-fail-on-non-empty "$CONF_DIR" + if [ -d "$ES_PATH_CONF" ]; then + rmdir --ignore-fail-on-non-empty "$ES_PATH_CONF" fi fi diff --git a/distribution/src/main/packaging/systemd/elasticsearch.service b/distribution/src/main/packaging/systemd/elasticsearch.service index e33e6c871c5f..b52f97d875fc 100644 --- a/distribution/src/main/packaging/systemd/elasticsearch.service +++ b/distribution/src/main/packaging/systemd/elasticsearch.service @@ -6,7 +6,7 @@ After=network-online.target [Service] Environment=ES_HOME=/usr/share/elasticsearch -Environment=CONF_DIR=${path.conf} +Environment=ES_PATH_CONF=${path.conf} Environment=PID_DIR=/var/run/elasticsearch EnvironmentFile=-${path.env} diff --git a/distribution/src/main/resources/bin/elasticsearch b/distribution/src/main/resources/bin/elasticsearch index d0c06be0adc8..6602a9aa7ee3 100755 --- a/distribution/src/main/resources/bin/elasticsearch +++ b/distribution/src/main/resources/bin/elasticsearch @@ -5,7 +5,7 @@ # This script relies on a few environment variables to determine startup # behavior, those variables are: # -# CONF_DIR -- Path to config directory +# ES_PATH_CONF -- Path to config directory # ES_JAVA_OPTS -- External Java Opts on top of the defaults set # # Optionally, exact memory values can be set using the `ES_JAVA_OPTS`. Note that @@ -22,7 +22,7 @@ parse_jvm_options() { fi } -ES_JVM_OPTIONS="$CONF_DIR"/jvm.options +ES_JVM_OPTIONS="$ES_PATH_CONF"/jvm.options ES_JAVA_OPTS="`parse_jvm_options "$ES_JVM_OPTIONS"` $ES_JAVA_OPTS" @@ -32,7 +32,7 @@ if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' > /dev/null; "$JAVA" \ $ES_JAVA_OPTS \ -Des.path.home="$ES_HOME" \ - -Des.path.conf="$CONF_DIR" \ + -Des.path.conf="$ES_PATH_CONF" \ -cp "$ES_CLASSPATH" \ org.elasticsearch.bootstrap.Elasticsearch \ "$@" @@ -41,7 +41,7 @@ else "$JAVA" \ $ES_JAVA_OPTS \ -Des.path.home="$ES_HOME" \ - -Des.path.conf="$CONF_DIR" \ + -Des.path.conf="$ES_PATH_CONF" \ -cp "$ES_CLASSPATH" \ org.elasticsearch.bootstrap.Elasticsearch \ "$@" \ diff --git a/distribution/src/main/resources/bin/elasticsearch-env b/distribution/src/main/resources/bin/elasticsearch-env index c72d26970e94..83737ae12534 100644 --- a/distribution/src/main/resources/bin/elasticsearch-env +++ b/distribution/src/main/resources/bin/elasticsearch-env @@ -67,7 +67,7 @@ fi ${source.path.env} -if [ -z "$CONF_DIR" ]; then - echo "CONF_DIR must be set to the configuration path" +if [ -z "$ES_PATH_CONF" ]; then + echo "ES_PATH_CONF must be set to the configuration path" exit 1 fi diff --git a/distribution/src/main/resources/bin/elasticsearch-env.bat b/distribution/src/main/resources/bin/elasticsearch-env.bat index 8e2f1c3528b1..7f3c9f99f037 100644 --- a/distribution/src/main/resources/bin/elasticsearch-env.bat +++ b/distribution/src/main/resources/bin/elasticsearch-env.bat @@ -44,6 +44,6 @@ if not "%JAVA_OPTS%" == "" ( rem check the Java version %JAVA% -cp "%ES_CLASSPATH%" "org.elasticsearch.tools.JavaVersionChecker" || exit /b 1 -if "%CONF_DIR%" == "" ( - set CONF_DIR=!ES_HOME!\config +if "%ES_PATH_CONF%" == "" ( + set ES_PATH_CONF=!ES_HOME!\config ) diff --git a/distribution/src/main/resources/bin/elasticsearch-keystore b/distribution/src/main/resources/bin/elasticsearch-keystore index 61d7bb8e5d42..8797e7c07a61 100755 --- a/distribution/src/main/resources/bin/elasticsearch-keystore +++ b/distribution/src/main/resources/bin/elasticsearch-keystore @@ -6,7 +6,7 @@ exec \ "$JAVA" \ $ES_JAVA_OPTS \ -Des.path.home="$ES_HOME" \ - -Des.path.conf="$CONF_DIR" \ + -Des.path.conf="$ES_PATH_CONF" \ -cp "$ES_CLASSPATH" \ org.elasticsearch.common.settings.KeyStoreCli \ "$@" diff --git a/distribution/src/main/resources/bin/elasticsearch-keystore.bat b/distribution/src/main/resources/bin/elasticsearch-keystore.bat index cea6838d6cee..f12ffd60092d 100644 --- a/distribution/src/main/resources/bin/elasticsearch-keystore.bat +++ b/distribution/src/main/resources/bin/elasticsearch-keystore.bat @@ -7,7 +7,7 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1 %JAVA% ^ %ES_JAVA_OPTS% ^ -Des.path.home="%ES_HOME%" ^ - -Des.path.conf="%CONF_DIR%" ^ + -Des.path.conf="%ES_PATH_CONF%" ^ -cp "%ES_CLASSPATH%" ^ org.elasticsearch.common.settings.KeyStoreCli ^ %* diff --git a/distribution/src/main/resources/bin/elasticsearch-plugin b/distribution/src/main/resources/bin/elasticsearch-plugin index 4b48964f97d1..a2e228d490af 100755 --- a/distribution/src/main/resources/bin/elasticsearch-plugin +++ b/distribution/src/main/resources/bin/elasticsearch-plugin @@ -6,7 +6,7 @@ exec \ "$JAVA" \ $ES_JAVA_OPTS \ -Des.path.home="$ES_HOME" \ - -Des.path.conf="$CONF_DIR" \ + -Des.path.conf="$ES_PATH_CONF" \ -cp "$ES_CLASSPATH" \ org.elasticsearch.plugins.PluginCli \ "$@" diff --git a/distribution/src/main/resources/bin/elasticsearch-plugin.bat b/distribution/src/main/resources/bin/elasticsearch-plugin.bat index 4efbdfc69416..95de9c1c4178 100644 --- a/distribution/src/main/resources/bin/elasticsearch-plugin.bat +++ b/distribution/src/main/resources/bin/elasticsearch-plugin.bat @@ -7,7 +7,7 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1 %JAVA% ^ %ES_JAVA_OPTS% ^ -Des.path.home="%ES_HOME%" ^ - -Des.path.conf="%CONF_DIR%" ^ + -Des.path.conf="%ES_PATH_CONF%" ^ -cp "%ES_CLASSPATH%" ^ org.elasticsearch.plugins.PluginCli ^ %* diff --git a/distribution/src/main/resources/bin/elasticsearch-service.bat b/distribution/src/main/resources/bin/elasticsearch-service.bat index bb986d4e663a..b1270ec02983 100644 --- a/distribution/src/main/resources/bin/elasticsearch-service.bat +++ b/distribution/src/main/resources/bin/elasticsearch-service.bat @@ -97,7 +97,7 @@ if exist "%JAVA_HOME%\bin\server\jvm.dll" ( ) :foundJVM -set ES_JVM_OPTIONS=%CONF_DIR%\jvm.options +set ES_JVM_OPTIONS=%ES_PATH_CONF%\jvm.options if not "%ES_JAVA_OPTS%" == "" set ES_JAVA_OPTS=%ES_JAVA_OPTS: =;% @@ -174,7 +174,7 @@ if "%JVM_SS%" == "" ( goto:eof ) -set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%CONF_DIR%" +set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.path.conf="%ES_PATH_CONF%" if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0 diff --git a/distribution/src/main/resources/bin/elasticsearch-translog b/distribution/src/main/resources/bin/elasticsearch-translog index 4326bab8683f..dcb52c29ea38 100755 --- a/distribution/src/main/resources/bin/elasticsearch-translog +++ b/distribution/src/main/resources/bin/elasticsearch-translog @@ -6,7 +6,7 @@ exec \ "$JAVA" \ $ES_JAVA_OPTS \ -Des.path.home="$ES_HOME" \ - -Des.path.conf="$CONF_DIR" \ + -Des.path.conf="$ES_PATH_CONF" \ -cp "$ES_CLASSPATH" \ org.elasticsearch.index.translog.TranslogToolCli \ "$@" diff --git a/distribution/src/main/resources/bin/elasticsearch-translog.bat b/distribution/src/main/resources/bin/elasticsearch-translog.bat index f79a1b827951..9b375f283c29 100644 --- a/distribution/src/main/resources/bin/elasticsearch-translog.bat +++ b/distribution/src/main/resources/bin/elasticsearch-translog.bat @@ -7,7 +7,7 @@ call "%~dp0elasticsearch-env.bat" || exit /b 1 %JAVA% ^ %ES_JAVA_OPTS% ^ -Des.path.home="%ES_HOME%" ^ - -Des.path.conf="%CONF_DIR%" ^ + -Des.path.conf="%ES_PATH_CONF%" ^ -cp "%ES_CLASSPATH%" ^ org.elasticsearch.index.translog.TranslogToolCli ^ %* diff --git a/distribution/src/main/resources/bin/elasticsearch.bat b/distribution/src/main/resources/bin/elasticsearch.bat index fe46c8d78868..057e686cdad1 100644 --- a/distribution/src/main/resources/bin/elasticsearch.bat +++ b/distribution/src/main/resources/bin/elasticsearch.bat @@ -40,7 +40,7 @@ IF ERRORLEVEL 1 ( EXIT /B %ERRORLEVEL% ) -set "ES_JVM_OPTIONS=%CONF_DIR%\jvm.options" +set "ES_JVM_OPTIONS=%ES_PATH_CONF%\jvm.options" @setlocal rem extract the options from the JVM options file %ES_JVM_OPTIONS% @@ -48,6 +48,6 @@ rem such options are the lines beginning with '-', thus "findstr /b" for /F "usebackq delims=" %%a in (`findstr /b \- "%ES_JVM_OPTIONS%"`) do set JVM_OPTIONS=!JVM_OPTIONS! %%a @endlocal & set ES_JAVA_OPTS=%JVM_OPTIONS% %ES_JAVA_OPTS% -%JAVA% %ES_JAVA_OPTS% -Delasticsearch -Des.path.home="%ES_HOME%" -Des.path.conf="%CONF_DIR%" -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams! +%JAVA% %ES_JAVA_OPTS% -Delasticsearch -Des.path.home="%ES_HOME%" -Des.path.conf="%ES_PATH_CONF%" -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" !newparams! endlocal diff --git a/docs/plugins/plugin-script.asciidoc b/docs/plugins/plugin-script.asciidoc index 8b72509c057a..e7f4d2580238 100644 --- a/docs/plugins/plugin-script.asciidoc +++ b/docs/plugins/plugin-script.asciidoc @@ -172,7 +172,7 @@ can do this as follows: [source,sh] --------------------- -sudo CONF_DIR=/path/to/conf/dir bin/elasticsearch-plugin install +sudo ES_PATH_CONF=/path/to/conf/dir bin/elasticsearch-plugin install --------------------- [float] diff --git a/docs/reference/migration/migrate_6_0/packaging.asciidoc b/docs/reference/migration/migrate_6_0/packaging.asciidoc index 5ca3cccdd4a0..1eec3d72000e 100644 --- a/docs/reference/migration/migrate_6_0/packaging.asciidoc +++ b/docs/reference/migration/migrate_6_0/packaging.asciidoc @@ -16,9 +16,18 @@ Previous versions of Elasticsearch enabled setting `path.conf` as a setting. This was rather convoluted as it meant that you could start Elasticsearch with a config file that specified via `path.conf` that Elasticsearch should use another config file. Instead, to configure a custom -config directory, use the <>. +==== `CONF_DIR` is no longer supported + +Previous versions of Elasticsearch enabled using the `CONF_DIR` environment +variable to specify a custom configuration directory for some configuration +files and some scripts (it was used inconsistently). Starting in Elasticsearch +6.0.0, the usage of this environment variable has been superceded by +`ES_PATH_CONF`, and this new environment variable is consistently used for all +configuration files and scripts. + ==== Default path settings are removed Previous versions of Elasticsearch enabled setting `default.path.data` and @@ -56,7 +65,7 @@ are no longer maintaining this attempt. The environment variable `ES_JVM_OPTIONS` that enabled a custom location for the `jvm.options` file has been removed in favor of using the environment variable -`CONF_DIR`. This environment variable is already used in the packaging to +`ES_PATH_CONF`. This environment variable is already used in the packaging to support relocating the configuration files so this change merely aligns the other configuration files with the location of the `jvm.options` file. diff --git a/docs/reference/setup/configuration.asciidoc b/docs/reference/setup/configuration.asciidoc index c6741f9181e2..bad6da3701fb 100644 --- a/docs/reference/setup/configuration.asciidoc +++ b/docs/reference/setup/configuration.asciidoc @@ -25,24 +25,24 @@ on whether or not the installation is from an archive distribution (`tar.gz` or For the archive distributions, the config directory location defaults to `$ES_HOME/config`. The location of the config directory can be changed via the -`CONF_DIR` environment variable as follows: +`ES_PATH_CONF` environment variable as follows: [source,sh] ------------------------------- -CONF_DIR=/path/to/my/config ./bin/elasticsearch +ES_PATH_CONF=/path/to/my/config ./bin/elasticsearch ------------------------------- -Alternatively, you can `export` the `CONF_DIR` environment variable via the +Alternatively, you can `export` the `ES_PATH_CONF` environment variable via the command line or via your shell profile. For the package distributions, the config directory location defaults to `/etc/elasticsearch`. The location of the config directory can also be changed -via the `CONF_DIR` environment variable, but note that setting this in your +via the `ES_PATH_CONF` environment variable, but note that setting this in your shell is not sufficient. Instead, this variabled is sourced from `/etc/default/elasticsearch` (for the Debian package) and `/etc/sysconfig/elasticsearch` (for the RPM package). You will need to edit the -`CONF_DIR=/etc/elasticsearch` entry in one of these files accordingly to change -the config directory location. +`ES_PATH_CONF=/etc/elasticsearch` entry in one of these files accordingly to +change the config directory location. [float] diff --git a/docs/reference/setup/install/deb.asciidoc b/docs/reference/setup/install/deb.asciidoc index 86bffa5b2177..680753b99a2e 100644 --- a/docs/reference/setup/install/deb.asciidoc +++ b/docs/reference/setup/install/deb.asciidoc @@ -197,7 +197,7 @@ locations for a Debian-based system: | conf | Configuration files including `elasticsearch.yml` | /etc/elasticsearch - | <> + | <> | conf | Environment variables including heap size, file descriptors. diff --git a/docs/reference/setup/install/rpm.asciidoc b/docs/reference/setup/install/rpm.asciidoc index 420c6da96b00..a62e324ad8c2 100644 --- a/docs/reference/setup/install/rpm.asciidoc +++ b/docs/reference/setup/install/rpm.asciidoc @@ -185,7 +185,7 @@ locations for an RPM-based system: | conf | Configuration files including `elasticsearch.yml` | /etc/elasticsearch - | <> + | <> | conf | Environment variables including heap size, file descriptors. diff --git a/docs/reference/setup/install/sysconfig-file.asciidoc b/docs/reference/setup/install/sysconfig-file.asciidoc index c932493e1155..76a9fa22bfc8 100644 --- a/docs/reference/setup/install/sysconfig-file.asciidoc +++ b/docs/reference/setup/install/sysconfig-file.asciidoc @@ -21,10 +21,11 @@ about `max_map_count`. This is set via `sysctl` before starting elasticsearch. Defaults to `262144`. -`CONF_DIR`:: +`ES_PATH_CONF`:: - Configuration file directory (which needs to include `elasticsearch.yml` - and `log4j2.properties` files), defaults to `/etc/elasticsearch`. + Configuration file directory (which needs to include `elasticsearch.yml`, + `jvm.options`, and `log4j2.properties` files); defaults to + `/etc/elasticsearch`. `ES_JAVA_OPTS`:: diff --git a/docs/reference/setup/install/zip-targz.asciidoc b/docs/reference/setup/install/zip-targz.asciidoc index 19b79363d791..9f95a195cf3c 100644 --- a/docs/reference/setup/install/zip-targz.asciidoc +++ b/docs/reference/setup/install/zip-targz.asciidoc @@ -164,7 +164,7 @@ directory so that you do not delete important data later on. | conf | Configuration files including `elasticsearch.yml` | $ES_HOME/config - | <> + | <> | data | The location of the data files of each index / shard allocated diff --git a/docs/reference/setup/install/zip-windows.asciidoc b/docs/reference/setup/install/zip-windows.asciidoc index bbfd089fced7..748d411f3a52 100644 --- a/docs/reference/setup/install/zip-windows.asciidoc +++ b/docs/reference/setup/install/zip-windows.asciidoc @@ -169,10 +169,11 @@ The Elasticsearch service can be configured prior to installation by setting the via the setting `path.logs` in the `elasticsearch.yml` configuration file, or on the command line. -`CONF_DIR`:: +`ES_PATH_CONF`:: - Configuration file directory (which needs to include `elasticsearch.yml` - and `log4j2.properties` files), defaults to `%ES_HOME%\conf`. + Configuration file directory (which needs to include `elasticsearch.yml`, + `jvm.options`, and `log4j2.properties` files), defaults to + `%ES_HOME%\config`. `ES_JAVA_OPTS`:: @@ -234,7 +235,7 @@ directory so that you do not delete important data later on. | conf | Configuration files including `elasticsearch.yml` | %ES_HOME%\config - | <> + | <> | data | The location of the data files of each index / shard allocated diff --git a/docs/reference/setup/rolling_upgrade.asciidoc b/docs/reference/setup/rolling_upgrade.asciidoc index 2f5338928afd..f5b29913cdb2 100644 --- a/docs/reference/setup/rolling_upgrade.asciidoc +++ b/docs/reference/setup/rolling_upgrade.asciidoc @@ -68,7 +68,7 @@ default. It is a good idea to place these directories in a different location so that there is no chance of deleting them when upgrading Elasticsearch. These custom -paths can be <> with the `CONF_DIR` environment +paths can be <> with the `ES_PATH_CONF` environment variable, and the `path.logs`, and `path.data` settings. The <> and <> packages place these directories in the @@ -89,7 +89,8 @@ To upgrade using a zip or compressed tarball: * Either copy the files in the `config` directory from your old installation to your new installation, or set the environment variable - <> to point to a custom config directory. + <> to point to a custom config + directory. * Either copy the files in the `data` directory from your old installation to your new installation, or configure the location of the data directory diff --git a/qa/vagrant/src/test/resources/packaging/tests/20_tar_package.bats b/qa/vagrant/src/test/resources/packaging/tests/20_tar_package.bats index b6ef96b91e7c..645c8331317e 100644 --- a/qa/vagrant/src/test/resources/packaging/tests/20_tar_package.bats +++ b/qa/vagrant/src/test/resources/packaging/tests/20_tar_package.bats @@ -111,7 +111,7 @@ setup() { @test "[TAR] start Elasticsearch with custom JVM options" { local es_java_opts=$ES_JAVA_OPTS - local conf_dir=$CONF_DIR + local es_path_conf=$ES_PATH_CONF local temp=`mktemp -d` cp "$ESCONFIG"/elasticsearch.yml "$temp" cp "$ESCONFIG"/log4j2.properties "$temp" @@ -123,13 +123,13 @@ setup() { # manager exception before we have configured logging; this will fail # startup since we detect usages of logging before it is configured echo "-Dlog4j2.disable.jmx=true" >> "$temp/jvm.options" - export CONF_DIR="$temp" + export ES_PATH_CONF="$temp" export ES_JAVA_OPTS="-XX:-UseCompressedOops" start_elasticsearch_service curl -s -XGET localhost:9200/_nodes | fgrep '"heap_init_in_bytes":536870912' curl -s -XGET localhost:9200/_nodes | fgrep '"using_compressed_ordinary_object_pointers":"false"' stop_elasticsearch_service - export CONF_DIR=$CONF_DIR + export ES_PATH_CONF=$es_path_conf export ES_JAVA_OPTS=$es_java_opts } diff --git a/qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats b/qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats index 97087b0ae2e5..3cce81a65f89 100644 --- a/qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats +++ b/qa/vagrant/src/test/resources/packaging/tests/60_systemd.bats @@ -201,7 +201,7 @@ setup() { # startup since we detect usages of logging before it is configured echo "-Dlog4j2.disable.jmx=true" >> "$temp/jvm.options" cp $ESENVFILE "$temp/elasticsearch" - echo "CONF_DIR=\"$temp\"" >> $ESENVFILE + echo "ES_PATH_CONF=\"$temp\"" >> $ESENVFILE echo "ES_JAVA_OPTS=\"-XX:-UseCompressedOops\"" >> $ESENVFILE service elasticsearch start wait_for_elasticsearch_status diff --git a/qa/vagrant/src/test/resources/packaging/tests/70_sysv_initd.bats b/qa/vagrant/src/test/resources/packaging/tests/70_sysv_initd.bats index 4184a1c1c3d6..63186e63fb52 100644 --- a/qa/vagrant/src/test/resources/packaging/tests/70_sysv_initd.bats +++ b/qa/vagrant/src/test/resources/packaging/tests/70_sysv_initd.bats @@ -132,7 +132,7 @@ setup() { # startup since we detect usages of logging before it is configured echo "-Dlog4j2.disable.jmx=true" >> "$temp/jvm.options" cp $ESENVFILE "$temp/elasticsearch" - echo "CONF_DIR=\"$temp\"" >> $ESENVFILE + echo "ES_PATH_CONF=\"$temp\"" >> $ESENVFILE echo "ES_JAVA_OPTS=\"-XX:-UseCompressedOops\"" >> $ESENVFILE service elasticsearch start wait_for_elasticsearch_status diff --git a/qa/vagrant/src/test/resources/packaging/tests/module_and_plugin_test_cases.bash b/qa/vagrant/src/test/resources/packaging/tests/module_and_plugin_test_cases.bash index bb5d1a58c481..db94bf983d54 100644 --- a/qa/vagrant/src/test/resources/packaging/tests/module_and_plugin_test_cases.bash +++ b/qa/vagrant/src/test/resources/packaging/tests/module_and_plugin_test_cases.bash @@ -117,11 +117,11 @@ fi move_config - CONF_DIR="$ESCONFIG" install_jvm_example - CONF_DIR="$ESCONFIG" start_elasticsearch_service + ES_PATH_CONF="$ESCONFIG" install_jvm_example + ES_PATH_CONF="$ESCONFIG" start_elasticsearch_service diff <(curl -s localhost:9200/_cat/configured_example | sed 's/ //g') <(echo "foo") stop_elasticsearch_service - CONF_DIR="$ESCONFIG" remove_jvm_example + ES_PATH_CONF="$ESCONFIG" remove_jvm_example } @test "[$GROUP] install jvm-example plugin from a directory with a space" { diff --git a/qa/vagrant/src/test/resources/packaging/utils/plugins.bash b/qa/vagrant/src/test/resources/packaging/utils/plugins.bash index a788fb06c650..4d7e100ba9f9 100644 --- a/qa/vagrant/src/test/resources/packaging/utils/plugins.bash +++ b/qa/vagrant/src/test/resources/packaging/utils/plugins.bash @@ -38,11 +38,11 @@ install_plugin() { assert_file_exist "$path" - if [ ! -z "$CONF_DIR" ] ; then + if [ ! -z "$ES_PATH_CONF" ] ; then if is_dpkg; then - echo "CONF_DIR=$CONF_DIR" >> /etc/default/elasticsearch; + echo "ES_PATH_CONF=$ES_PATH_CONF" >> /etc/default/elasticsearch; elif is_rpm; then - echo "CONF_DIR=$CONF_DIR" >> /etc/sysconfig/elasticsearch; + echo "ES_PATH_CONF=$ES_PATH_CONF" >> /etc/sysconfig/elasticsearch; fi fi diff --git a/qa/vagrant/src/test/resources/packaging/utils/utils.bash b/qa/vagrant/src/test/resources/packaging/utils/utils.bash index b426d273ac29..58d49558b1be 100644 --- a/qa/vagrant/src/test/resources/packaging/utils/utils.bash +++ b/qa/vagrant/src/test/resources/packaging/utils/utils.bash @@ -335,12 +335,12 @@ start_elasticsearch_service() { run_elasticsearch_service() { local expectedStatus=$1 local commandLineArgs=$2 - # Set the CONF_DIR setting in case we start as a service - if [ ! -z "$CONF_DIR" ] ; then + # Set the ES_PATH_CONF setting in case we start as a service + if [ ! -z "$ES_PATH_CONF" ] ; then if is_dpkg; then - echo "CONF_DIR=$CONF_DIR" >> /etc/default/elasticsearch; + echo "ES_PATH_CONF=$ES_PATH_CONF" >> /etc/default/elasticsearch; elif is_rpm; then - echo "CONF_DIR=$CONF_DIR" >> /etc/sysconfig/elasticsearch; + echo "ES_PATH_CONF=$ES_PATH_CONF" >> /etc/sysconfig/elasticsearch; fi fi @@ -362,7 +362,7 @@ run_elasticsearch_service() { # This line is attempting to emulate the on login behavior of /usr/share/upstart/sessions/jayatana.conf [ -f /usr/share/java/jayatanaag.jar ] && export JAVA_TOOL_OPTIONS="-javaagent:/usr/share/java/jayatanaag.jar" # And now we can start Elasticsearch normally, in the background (-d) and with a pidfile (-p). -export CONF_DIR=$CONF_DIR +export ES_PATH_CONF=$ES_PATH_CONF export ES_JAVA_OPTS=$ES_JAVA_OPTS $timeoutCommand/tmp/elasticsearch/bin/elasticsearch $background -p /tmp/elasticsearch/elasticsearch.pid $commandLineArgs BASH