This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 98e30eee8f0 Migrate SOLR_HOST to SOLR_HOST_ADVERTISE (#3858)
98e30eee8f0 is described below
commit 98e30eee8f0107381d9b1210fdf33aaeeb8008f5
Author: Eric Pugh <[email protected]>
AuthorDate: Wed Nov 12 15:10:24 2025 -0500
Migrate SOLR_HOST to SOLR_HOST_ADVERTISE (#3858)
This PR completes the migration from the deprecated SOLR_HOST environment
variable to the new SOLR_HOST_ADVERTISE naming convention across the Solr
codebase. This migration was partially done in a previous PR, and this change
updates the remaining occurrences.
---
solr/bin/solr | 4 ++--
solr/bin/solr.cmd | 2 +-
solr/bin/solr.in.cmd | 2 +-
solr/bin/solr.in.sh | 2 +-
solr/packaging/test/test_ssl.bats | 14 +++++++-------
.../modules/deployment-guide/pages/solr-in-docker.adoc | 4 ++--
.../deployment-guide/pages/taking-solr-to-production.adoc | 4 ++--
.../deployment-guide/pages/upgrading-a-solr-cluster.adoc | 6 +++---
solr/solrj/src/resources/EnvToSyspropMappings.properties | 2 +-
.../src/test/org/apache/solr/common/util/EnvUtilsTest.java | 4 ++--
10 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/solr/bin/solr b/solr/bin/solr
index 4d4b4d70bf2..a2ff10cbba5 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -1134,8 +1134,8 @@ if [ "${ENABLE_REMOTE_JMX_OPTS:-false}" == "true" ]; then
"-Dcom.sun.management.jmxremote.rmi.port=$RMI_PORT")
# if the host is set, then set that as the rmi server hostname
- if [ "$SOLR_HOST" != "" ]; then
- REMOTE_JMX_OPTS+=("-Djava.rmi.server.hostname=$SOLR_HOST")
+ if [ "$SOLR_HOST_ADVERTISE" != "" ]; then
+ REMOTE_JMX_OPTS+=("-Djava.rmi.server.hostname=$SOLR_HOST_ADVERTISE")
fi
else
REMOTE_JMX_OPTS=()
diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd
index 47296a8dbd0..1d37b98056c 100755
--- a/solr/bin/solr.cmd
+++ b/solr/bin/solr.cmd
@@ -557,7 +557,7 @@ IF "%firstChar%"=="-" (
goto invalid_cmd_line
)
-set SOLR_HOST=%~2
+set SOLR_HOST_ADVERTISE=%~2
set "PASS_TO_RUN_EXAMPLE=--host %~2 !PASS_TO_RUN_EXAMPLE!"
SHIFT
SHIFT
diff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmd
index 3e63af456ce..ebada5438c5 100755
--- a/solr/bin/solr.in.cmd
+++ b/solr/bin/solr.in.cmd
@@ -66,7 +66,7 @@ REM set ZK_CLIENT_TIMEOUT=30000
REM By default the start script uses "localhost"; override the hostname here
REM for production SolrCloud environments to control the hostname exposed to
cluster state
-REM set SOLR_HOST=192.168.1.1
+REM set SOLR_HOST_ADVERTISE=192.168.1.1
REM By default Solr will try to connect to Zookeeper with 30 seconds in
timeout; override the timeout if needed
REM set SOLR_CLOUD_WAIT_FOR_ZK_SECONDS=30
diff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.sh
index 8c50528b6f9..9db413a4219 100644
--- a/solr/bin/solr.in.sh
+++ b/solr/bin/solr.in.sh
@@ -72,7 +72,7 @@
# By default the start script uses "localhost"; override the hostname here
# for production SolrCloud environments to control the hostname exposed to
cluster state
-#SOLR_HOST="192.168.1.1"
+#SOLR_HOST_ADVERTISE="192.168.1.1"
# By default Solr will try to connect to Zookeeper with 30 seconds in timeout;
override the timeout if needed
#SOLR_CLOUD_WAIT_FOR_ZK_SECONDS="30"
diff --git a/solr/packaging/test/test_ssl.bats
b/solr/packaging/test/test_ssl.bats
index 3115b7b619a..5075ec76338 100644
--- a/solr/packaging/test/test_ssl.bats
+++ b/solr/packaging/test/test_ssl.bats
@@ -49,7 +49,7 @@ teardown() {
export SOLR_SSL_TRUST_STORE_PASSWORD=secret
export SOLR_SSL_NEED_CLIENT_AUTH=false
export SOLR_SSL_WANT_CLIENT_AUTH=false
- export SOLR_HOST=localhost
+ export SOLR_HOST_ADVERTISE=localhost
solr start
solr assert --started https://localhost:${SOLR_PORT} --timeout 5000
@@ -87,7 +87,7 @@ teardown() {
export SOLR_SSL_NEED_CLIENT_AUTH=false
export SOLR_SSL_WANT_CLIENT_AUTH=false
export SOLR_SSL_CHECK_PEER_NAME=false
- export SOLR_HOST=127.0.0.1
+ export SOLR_HOST_ADVERTISE=127.0.0.1
solr start
solr assert --started https://localhost:${SOLR_PORT} --timeout 5000
@@ -149,7 +149,7 @@ teardown() {
export SOLR_SSL_NEED_CLIENT_AUTH=false
export SOLR_SSL_WANT_CLIENT_AUTH=false
export SOLR_SSL_CHECK_PEER_NAME=true
- export SOLR_HOST=localhost
+ export SOLR_HOST_ADVERTISE=localhost
solr start
solr assert --started https://localhost:${SOLR_PORT} --timeout 5000
@@ -205,7 +205,7 @@ teardown() {
export SOLR_SSL_NEED_CLIENT_AUTH=false
export SOLR_SSL_WANT_CLIENT_AUTH=true
export SOLR_SSL_CHECK_PEER_NAME=true
- export SOLR_HOST=localhost
+ export SOLR_HOST_ADVERTISE=localhost
export SOLR_SECURITY_MANAGER_ENABLED=true
run solr start
@@ -320,7 +320,7 @@ teardown() {
export SOLR_SSL_CHECK_PEER_NAME=true
# Cannot set this to true, because the client certificate does not have the
right hostname ("localhost") or IP
export SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=false
- export SOLR_HOST=localhost
+ export SOLR_HOST_ADVERTISE=localhost
solr start
solr start -z localhost:${ZK_PORT} -p ${SOLR2_PORT}
@@ -459,7 +459,7 @@ teardown() {
export SOLR_SSL_WANT_CLIENT_AUTH=true
export SOLR_SSL_CHECK_PEER_NAME=true
export SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=true
- export SOLR_HOST=localhost
+ export SOLR_HOST_ADVERTISE=localhost
solr start
solr start -z localhost:${ZK_PORT} -p ${SOLR2_PORT}
@@ -521,7 +521,7 @@ teardown() {
export SOLR_SSL_TRUST_STORE_PASSWORD=secret
export SOLR_SSL_NEED_CLIENT_AUTH=true
export SOLR_SSL_WANT_CLIENT_AUTH=false
- export SOLR_HOST=localhost
+ export SOLR_HOST_ADVERTISE=localhost
# server1 will run on $SOLR_PORT and will use server1.keystore
export SOLR_SSL_KEY_STORE=$ssl_dir/server1.keystore.p12
diff --git
a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc
b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc
index 849e2a3294a..8012b18b0b0 100644
--- a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc
+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc
@@ -157,7 +157,7 @@ The third way is to use a separate container:
[source,bash]
----
-docker run -e SOLR_HOST=solr1 --network docs_solr solr solr create -c
gettingstarted3 -p 8983
+docker run -e SOLR_HOST_ADVERTISE=solr1 --network docs_solr solr solr create
-c gettingstarted3 -p 8983
----
The fourth way is to use the remote API, from the host or from one of the
containers, or some new container on the same network (adjust the hostname
accordingly):
@@ -250,7 +250,7 @@ The same works if you use the xref:docker-compose[example
docker compose cluster
[source,bash]
----
-docker run -e SOLR_HOST=solr1 --network=mycluster_solr solr solr create -c
books -p 8983
+docker run -e SOLR_HOST_ADVERTISE=solr1 --network=mycluster_solr solr solr
create -c books -p 8983
docker run --rm -v "$PWD/mydata:/mydata" --network=mycluster_solr solr solr
post -c books /mydata/books.csv --host solr1
----
diff --git
a/solr/solr-ref-guide/modules/deployment-guide/pages/taking-solr-to-production.adoc
b/solr/solr-ref-guide/modules/deployment-guide/pages/taking-solr-to-production.adoc
index 81e63454bf1..e91be0fd62c 100644
---
a/solr/solr-ref-guide/modules/deployment-guide/pages/taking-solr-to-production.adoc
+++
b/solr/solr-ref-guide/modules/deployment-guide/pages/taking-solr-to-production.adoc
@@ -295,11 +295,11 @@ SOLR_DELETE_UNKNOWN_CORES=true
=== Solr Hostname
-Use the `SOLR_HOST` variable in the include file to set the hostname of the
Solr server.
+Use the `SOLR_HOST_ADVERTISE` variable in the include file to set the hostname
of the Solr server.
[source,bash]
----
-SOLR_HOST=solr1.example.com
+SOLR_HOST_ADVERTISE=solr1.example.com
----
Setting the hostname of the Solr server is recommended, especially when
running in SolrCloud mode, as this determines the address of the node when it
registers with ZooKeeper.
diff --git
a/solr/solr-ref-guide/modules/deployment-guide/pages/upgrading-a-solr-cluster.adoc
b/solr/solr-ref-guide/modules/deployment-guide/pages/upgrading-a-solr-cluster.adoc
index a2efff5a5aa..901bf7d487e 100644
---
a/solr/solr-ref-guide/modules/deployment-guide/pages/upgrading-a-solr-cluster.adoc
+++
b/solr/solr-ref-guide/modules/deployment-guide/pages/upgrading-a-solr-cluster.adoc
@@ -41,7 +41,7 @@ You'll be doing a rolling restart of your cluster (each node,
one-by-one), but w
. Re-build and test all custom server-side components against the new Solr JAR
files.
. Determine the values of the following variables that are used by the Solr
Control Scripts:
* `ZK_HOST`: The ZooKeeper connection string your current SolrCloud nodes use
to connect to ZooKeeper; this value will be the same for all nodes in the
cluster.
-* `SOLR_HOST`: The hostname each Solr node used to register with ZooKeeper
when joining the SolrCloud cluster; this value will be used to set the *host*
Java system property when starting the new Solr process.
+* `SOLR_HOST_ADVERTISE`: The hostname each Solr node used to register with
ZooKeeper when joining the SolrCloud cluster; this value will be used to set
the *host* Java system property when starting the new Solr process.
* `SOLR_PORT`: The port each Solr node is listening on, such as 8983.
* `SOLR_HOME`: The absolute path to the Solr home directory for each Solr node.
This value will be passed to the new Solr process using the `solr.solr.home`
system property, see: xref:configuration-guide:configuring-solr-xml.adoc[].
@@ -85,7 +85,7 @@ Open `/etc/default/solr.in.sh` with a text editor and verify
that the following
[source,properties]
ZK_HOST=
-SOLR_HOST=
+SOLR_HOST_ADVERTISE=
SOLR_PORT=
SOLR_HOME=
@@ -96,7 +96,7 @@ For instance, if you plan to run Solr as the "solr" user and
`SOLR_HOME` is `/va
=== Step 4: Start Solr
You are now ready to start the upgraded Solr node by doing: `sudo service solr
start`.
-The upgraded instance will join the existing cluster because you're using the
same `SOLR_HOME`, `SOLR_PORT`, and `SOLR_HOST` settings used by the old Solr
node; thus, the new server will look like the old node to the running cluster.
+The upgraded instance will join the existing cluster because you're using the
same `SOLR_HOME`, `SOLR_PORT`, and `SOLR_HOST_ADVERTISE` settings used by the
old Solr node; thus, the new server will look like the old node to the running
cluster.
Be sure to look in `/var/solr/logs/solr.log` for errors during startup.
=== Step 5: Run Healthcheck
diff --git a/solr/solrj/src/resources/EnvToSyspropMappings.properties
b/solr/solrj/src/resources/EnvToSyspropMappings.properties
index df8a77f6402..93067020cf7 100644
--- a/solr/solrj/src/resources/EnvToSyspropMappings.properties
+++ b/solr/solrj/src/resources/EnvToSyspropMappings.properties
@@ -10,7 +10,7 @@
SOLR_AUTH_JWT_ALLOW_OUTBOUND_HTTP=solr.auth.jwt.allowOutboundHttp
SOLR_DISABLE_REQUEST_ID=solr.disableRequestId
SOLR_HIDDEN_SYS_PROPS=solr.hiddenSysProps
SOLR_HOME=solr.solr.home
-SOLR_HOST=host
+SOLR_HOST_ADVERTISE=host
SOLR_HTTP_DISABLE_COOKIES=solr.http.disableCookies
# Couldn't we just use solr.ip.allowlist everywhere instead of
solr.jetty.inetaccess.includes?
SOLR_IP_ALLOWLIST=solr.jetty.inetaccess.includes
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java
b/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java
index 1a6eee1c227..7b360dd49cf 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java
@@ -30,7 +30,7 @@ public class EnvUtilsTest extends SolrTestCase {
Map.of(
"SOLR_HOME", "/home/solr",
"SOLR_PORT_LISTEN", "8983",
- "SOLR_HOST", "localhost",
+ "SOLR_HOST_ADVERTISE", "localhost",
"SOLR_LOG_LEVEL", "INFO",
"SOLR_BOOLEAN", "true",
"SOLR_LONG", "1234567890",
@@ -79,7 +79,7 @@ public class EnvUtilsTest extends SolrTestCase {
public void testEnvsWithCustomKeyNameMappings() {
// These have different names than the environment variables
assertEquals(ENV.get("SOLR_HOME"), EnvUtils.getProperty("solr.solr.home"));
- assertEquals(ENV.get("SOLR_HOST"), EnvUtils.getProperty("host"));
+ assertEquals(ENV.get("SOLR_HOST_ADVERTISE"), EnvUtils.getProperty("host"));
assertEquals(ENV.get("SOLR_LOGS_DIR"),
EnvUtils.getProperty("solr.logs.dir"));
}