155155: " ${SOLR_START_WAIT:= $SOLR_STOP_WAIT } " # defaulting to $SOLR_STOP_WAIT for backwards compatibility reasons
156156
157157# Store whether a solr port was explicitly provided, for the "solr stop" command.
158- PROVIDED_SOLR_PORT=" ${SOLR_PORT :- } "
159- : " ${SOLR_PORT := 8983} "
160- export SOLR_PORT
158+ PROVIDED_SOLR_PORT=" ${SOLR_PORT_LISTEN :- } "
159+ : " ${SOLR_PORT_LISTEN := 8983} "
160+ export SOLR_PORT_LISTEN
161161
162162# test that Java exists, is executable and correct version
163163JAVA_VER=$( " $JAVA " -version 2>&1 )
@@ -382,8 +382,8 @@ function print_usage() {
382382 echo " --host <host> Specify the hostname for this Solr instance"
383383 echo " "
384384 echo " -p/--port <port> Specify the port to start the Solr HTTP listener on; default is 8983"
385- echo " The specified port (SOLR_PORT ) will also be used to determine the stop port"
386- echo " STOP_PORT=(\$ SOLR_PORT -1000) and JMX RMI listen port RMI_PORT=(\$ SOLR_PORT +10000). "
385+ echo " The specified port (SOLR_PORT_LISTEN ) will also be used to determine the stop port"
386+ echo " STOP_PORT=(\$ SOLR_PORT_LISTEN -1000) and JMX RMI listen port RMI_PORT=(\$ SOLR_PORT_LISTEN +10000). "
387387 echo " For instance, if you set -p 8985, then the STOP_PORT=7985 and RMI_PORT=18985"
388388 echo " "
389389 echo " --server-dir <dir> Specify the Solr server directory; defaults to server"
@@ -475,21 +475,21 @@ function solr_pid_by_port() {
475475 fi
476476}
477477
478- # extract the value of the -Djetty .port parameter from a running Solr process
479- function jetty_port () {
478+ # extract the value of the -Dsolr .port.listen parameter from a running Solr process
479+ function solr_port_listen () {
480480 SOLR_PID=" $1 "
481- SOLR_PROC=$( ps -fww -p " $SOLR_PID " | grep start\. jar | grep jetty \. port)
481+ SOLR_PROC=$( ps -fww -p " $SOLR_PID " | grep start\. jar | grep solr \. port\. listen )
482482 IFS=' ' read -a proc_args <<< " $SOLR_PROC"
483483 for arg in " ${proc_args[@]} "
484484 do
485485 IFS=' =' read -a pair <<< " $arg"
486- if [ " ${pair[0]} " == " -Djetty .port" ]; then
487- local jetty_port =" ${pair[1]} "
486+ if [ " ${pair[0]} " == " -Dsolr .port.listen " ]; then
487+ local solr_port =" ${pair[1]} "
488488 break
489489 fi
490490 done
491- echo " $jetty_port "
492- } # end jetty_port func
491+ echo " $solr_port "
492+ } # end solr_port_listen func
493493
494494# run a Solr command-line tool using the SolrCLI class;
495495# useful for doing cross-platform work from the command-line using Java
@@ -511,13 +511,13 @@ function run_tool() {
511511function stop_solr() {
512512
513513 DIR=" $1 "
514- SOLR_PORT =" $2 "
515- THIS_STOP_PORT=" ${STOP_PORT:- $((SOLR_PORT - 1000))} "
514+ SOLR_PORT_LISTEN =" $2 "
515+ THIS_STOP_PORT=" ${STOP_PORT:- $((SOLR_PORT_LISTEN - 1000))} "
516516 STOP_KEY=" $3 "
517517 SOLR_PID=" $4 "
518518
519519 if [ -n " $SOLR_PID " ]; then
520- echo -e " Sending stop command to Solr running on port $SOLR_PORT ... waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop gracefully."
520+ echo -e " Sending stop command to Solr running on port $SOLR_PORT_LISTEN ... waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop gracefully."
521521 # shellcheck disable=SC2086,SC2164
522522 " $JAVA " -Djava.io.tmpdir=" $( cd " ${TMPDIR:- ${TEMP:- ${TMP:-/ tmp} } } " ; pwd -P) " $SOLR_SSL_OPTS $AUTHC_OPTS ${SOLR_TOOL_OPTS:- } \
523523 -jar " $DIR /start.jar" " STOP.PORT=$THIS_STOP_PORT " " STOP.KEY=$STOP_KEY " --stop || true
@@ -542,7 +542,7 @@ function stop_solr() {
542542 fi
543543 done) &
544544 spinner $!
545- rm -f " $SOLR_PID_DIR /solr-$SOLR_PORT .pid"
545+ rm -f " $SOLR_PID_DIR /solr-$SOLR_PORT_LISTEN .pid"
546546 else
547547 echo -e " No Solr nodes found to stop."
548548 exit 0
@@ -561,7 +561,7 @@ function stop_solr() {
561561 echo -e " Solr process $SOLR_PID is still running; forcefully killing it now."
562562 kill -9 " $SOLR_PID "
563563 echo " Killed process $SOLR_PID "
564- rm -f " $SOLR_PID_DIR /solr-$SOLR_PORT .pid"
564+ rm -f " $SOLR_PID_DIR /solr-$SOLR_PORT_LISTEN .pid"
565565 sleep 10
566566 fi
567567
@@ -752,8 +752,8 @@ if [ $# -gt 0 ]; then
752752 print_usage " $SCRIPT_CMD " " Hostname is required when using the $1 option!"
753753 exit 1
754754 fi
755- SOLR_HOST =" $2 "
756- PASS_TO_RUN_EXAMPLE+=(" --host" " $SOLR_HOST " )
755+ SOLR_HOST_ADVERTISE =" $2 "
756+ PASS_TO_RUN_EXAMPLE+=(" --solr. host.advertise " " $SOLR_HOST_ADVERTISE " )
757757 shift 2
758758 ;;
759759 -m|--memory)
@@ -770,9 +770,9 @@ if [ $# -gt 0 ]; then
770770 print_usage " $SCRIPT_CMD " " Port number is required when using the $1 option!"
771771 exit 1
772772 fi
773- SOLR_PORT =" $2 "
774- PROVIDED_SOLR_PORT=" ${SOLR_PORT } "
775- PASS_TO_RUN_EXAMPLE+=(" -p" " $SOLR_PORT " )
773+ SOLR_PORT_LISTEN =" $2 "
774+ PROVIDED_SOLR_PORT=" ${SOLR_PORT_LISTEN } "
775+ PASS_TO_RUN_EXAMPLE+=(" -p" " $SOLR_PORT_LISTEN " )
776776 shift 2
777777 ;;
778778 -z|--zk-host)
@@ -892,13 +892,21 @@ if $verbose ; then
892892 " $JAVA " -version
893893fi
894894
895- if [ -n " ${SOLR_HOST:- } " ]; then
896- SOLR_HOST_ARG=(" -Dhost=$SOLR_HOST " )
897- elif [[ " ${SOLR_JETTY_HOST:- 127.0.0.1} " == " 127.0.0.1" ]]; then
895+ # Check for deprecated SOLR_JETTY_HOST and show warning
896+ if [[ -n " ${SOLR_JETTY_HOST:- } " && -z " ${SOLR_HOST_BIND:- } " ]]; then
897+ echo " WARNING: SOLR_JETTY_HOST is deprecated and will be removed in a future release."
898+ echo " Please update your configuration to use SOLR_HOST_BIND instead of SOLR_JETTY_HOST."
899+ SOLR_HOST_BIND=" $SOLR_JETTY_HOST "
900+ fi
901+
902+
903+ if [ -n " ${SOLR_HOST_ADVERTISE:- } " ]; then
904+ SOLR_HOST_ADVERTISE_ARG=(" -Dsolr.host.advertise=$SOLR_HOST_ADVERTISE " )
905+ elif [[ " ${SOLR_HOST_BIND:- 127.0.0.1} " == " 127.0.0.1" ]]; then
898906 # Jetty will only bind on localhost interface, so nodes must advertise themselves with localhost
899- SOLR_HOST_ARG =(" -Dhost =localhost" )
907+ SOLR_HOST_ADVERTISE_ARG =(" -Dsolr.host.advertise =localhost" )
900908else
901- SOLR_HOST_ARG =()
909+ SOLR_HOST_ADVERTISE_ARG =()
902910fi
903911
904912: " ${STOP_KEY:= solrrocks} "
@@ -910,7 +918,7 @@ if [[ "$SCRIPT_CMD" == "stop" ]]; then
910918 find " $SOLR_PID_DIR " -name " solr-*.pid" -type f | while read PIDF
911919 do
912920 NEXT_PID=$( cat " $PIDF " )
913- port=$( jetty_port " $NEXT_PID " )
921+ port=$( solr_port_listen " $NEXT_PID " )
914922 if [ " $port " != " " ]; then
915923 stop_solr " $SOLR_SERVER_DIR " " $port " " $STOP_KEY " " $NEXT_PID "
916924 none_stopped=false
@@ -932,7 +940,7 @@ if [[ "$SCRIPT_CMD" == "stop" ]]; then
932940 PID=" $( cat " $( find " $SOLR_PID_DIR " -name " solr-*.pid" -type f) " ) "
933941 CHECK_PID=$( ps -o pid=' ' -p " $PID " | tr -d ' ' )
934942 if [ " $CHECK_PID " != " " ]; then
935- port=$( jetty_port " $CHECK_PID " )
943+ port=$( solr_port_listen " $CHECK_PID " )
936944 if [ " $port " != " " ]; then
937945 stop_solr " $SOLR_SERVER_DIR " " $port " " $STOP_KEY " " $CHECK_PID "
938946 none_stopped=false
@@ -956,11 +964,11 @@ if [ -n "${SOLR_PORT_ADVERTISE:-}" ]; then
956964 SCRIPT_SOLR_OPTS+=(" -Dsolr.port.advertise=$SOLR_PORT_ADVERTISE " )
957965fi
958966
959- if [ -n " ${SOLR_JETTY_HOST :- } " ]; then
960- SCRIPT_SOLR_OPTS+=(" -Dsolr.jetty. host= $SOLR_JETTY_HOST " )
967+ if [ -n " ${SOLR_HOST_BIND :- } " ]; then
968+ SCRIPT_SOLR_OPTS+=(" -Dsolr.host.bind= $SOLR_HOST_BIND " )
961969fi
962970
963- : " ${STOP_PORT:= $((SOLR_PORT - 1000))} "
971+ : " ${STOP_PORT:= $((SOLR_PORT_LISTEN - 1000))} "
964972
965973if [ " $SCRIPT_CMD " == " start" ] || [ " $SCRIPT_CMD " == " restart" ] ; then
966974 if [[ $EUID -eq 0 ]] && [[ " $FORCE " == " false" ]] ; then
972980
973981if [[ " $SCRIPT_CMD " == " start" ]]; then
974982 # see if Solr is already running
975- SOLR_PID=$( solr_pid_by_port " $SOLR_PORT " )
983+ SOLR_PID=$( solr_pid_by_port " $SOLR_PORT_LISTEN " )
976984
977985 if [ -z " ${SOLR_PID:- } " ]; then
978986 # not found using the pid file ... but use ps to ensure not found
979- SOLR_PID=$( ps auxww | grep start\. jar | awk " /\-Djetty \.port= $SOLR_PORT /" ' {print $2}' | sort -r)
987+ SOLR_PID=$( ps auxww | grep start\. jar | awk " /\-Dsolr \.port\.listen= $SOLR_PORT_LISTEN /" ' {print $2}' | sort -r)
980988 fi
981989
982990 if [ -n " ${SOLR_PID:- } " ]; then
983- echo -e " \nPort $SOLR_PORT is already being used by another process (pid: $SOLR_PID )\nPlease choose a different port using the -p option.\n"
991+ echo -e " \nPort $SOLR_PORT_LISTEN is already being used by another process (pid: $SOLR_PID )\nPlease choose a different port using the -p option.\n"
984992 exit 1
985993 fi
986994else
987995 # either stop or restart
988996 # see if Solr is already running
989- SOLR_PID=$( solr_pid_by_port " $SOLR_PORT " )
997+ SOLR_PID=$( solr_pid_by_port " $SOLR_PORT_LISTEN " )
990998 if [ -z " $SOLR_PID " ]; then
991999 # not found using the pid file ... but use ps to ensure not found
992- SOLR_PID=$( ps auxww | grep start\. jar | awk " /\-Djetty\.port=$SOLR_PORT /" ' {print $2}' | sort -r)
1000+ SOLR_PID=$( ps auxww | grep start\. jar | awk " /\-Djetty\.port=$SOLR_PORT_LISTEN /" ' {print $2}' | sort -r)
9931001 fi
9941002 if [ " $SOLR_PID " != " " ]; then
995- stop_solr " $SOLR_SERVER_DIR " " $SOLR_PORT " " $STOP_KEY " " $SOLR_PID "
1003+ stop_solr " $SOLR_SERVER_DIR " " $SOLR_PORT_LISTEN " " $STOP_KEY " " $SOLR_PID "
9961004 else
9971005 if [ " $SCRIPT_CMD " == " stop" ]; then
998- echo -e " No process found for Solr node running on port $SOLR_PORT "
1006+ echo -e " No process found for Solr node running on port $SOLR_PORT_LISTEN "
9991007 exit 1
10001008 fi
10011009 fi
@@ -1072,8 +1080,8 @@ if [ "${SOLR_MODE:-}" == 'solrcloud' ]; then
10721080 if [ -n " ${ZK_HOST:- } " ]; then
10731081 CLOUD_MODE_OPTS+=(" -DzkHost=$ZK_HOST " )
10741082 else
1075- if [ $SOLR_PORT -gt 64535 ]; then
1076- echo -e " \nZK_HOST is not set and Solr port is $SOLR_PORT , which would result in an invalid embedded Zookeeper port!\n"
1083+ if [ $SOLR_PORT_LISTEN -gt 64535 ]; then
1084+ echo -e " \nZK_HOST is not set and Solr port is $SOLR_PORT_LISTEN , which would result in an invalid embedded Zookeeper port!\n"
10771085 exit 1
10781086 fi
10791087 if $verbose ; then
@@ -1111,7 +1119,7 @@ IP_ACL_OPTS=("-Dsolr.jetty.inetaccess.includes=${SOLR_IP_ALLOWLIST:-}" \
11111119if [ " ${ENABLE_REMOTE_JMX_OPTS:- false} " == " true" ]; then
11121120
11131121 if [ -z " $RMI_PORT " ]; then
1114- RMI_PORT=$(( SOLR_PORT + 10000 ))
1122+ RMI_PORT=$(( SOLR_PORT_LISTEN + 10000 ))
11151123 if [ $RMI_PORT -gt 65535 ]; then
11161124 echo -e " \nRMI_PORT is $RMI_PORT , which is invalid!\n"
11171125 exit 1
@@ -1204,8 +1212,8 @@ function start_solr() {
12041212
12051213 # If SSL-related system props are set, add them to SCRIPT_SOLR_OPTS
12061214 if [ " $SOLR_SSL_ENABLED " == " true" ]; then
1207- # If using SSL and solr.jetty.https.port not set explicitly, use the jetty .port
1208- SSL_PORT_PROP=" -Dsolr.jetty.https.port=$SOLR_PORT "
1215+ # If using SSL and solr.jetty.https.port not set explicitly, use the solr .port.listen
1216+ SSL_PORT_PROP=" -Dsolr.jetty.https.port=$SOLR_PORT_LISTEN "
12091217 SCRIPT_SOLR_OPTS+=($SOLR_SSL_OPTS " $SSL_PORT_PROP " )
12101218 fi
12111219
@@ -1233,8 +1241,8 @@ function start_solr() {
12331241 echo -e " JAVA = $JAVA "
12341242 echo -e " SOLR_SERVER_DIR = $SOLR_SERVER_DIR "
12351243 echo -e " SOLR_HOME = $SOLR_HOME "
1236- echo -e " SOLR_HOST = ${SOLR_HOST :- } "
1237- echo -e " SOLR_PORT = $SOLR_PORT "
1244+ echo -e " SOLR_HOST_ADVERTISE = ${SOLR_HOST_ADVERTISE :- } "
1245+ echo -e " SOLR_PORT_LISTEN = $SOLR_PORT_LISTEN "
12381246 echo -e " STOP_PORT = $STOP_PORT "
12391247 echo -e " JAVA_MEM_OPTS = ${JAVA_MEM_OPTS[*]} "
12401248 echo -e " GC_TUNE = ${GC_TUNE_ARR[*]} "
@@ -1288,11 +1296,11 @@ function start_solr() {
12881296 # shellcheck disable=SC2164
12891297 SOLR_START_OPTS=(' -server' " ${JAVA_MEM_OPTS[@]} " " ${GC_TUNE_ARR[@]} " " ${GC_LOG_OPTS[@]} " " ${IP_ACL_OPTS[@]} " \
12901298 " ${REMOTE_JMX_OPTS[@]} " " ${CLOUD_MODE_OPTS[@]} " -Dsolr.logs.dir=" $SOLR_LOGS_DIR " \
1291- " -Djetty .port= $SOLR_PORT " " -DSTOP.PORT=$stop_port " " -DSTOP.KEY=$STOP_KEY " \
1299+ " -Dsolr .port.listen= $SOLR_PORT_LISTEN " " -DSTOP.PORT=$stop_port " " -DSTOP.KEY=$STOP_KEY " \
12921300 " -Djava.io.tmpdir=$( cd " ${TMPDIR:- ${TEMP:- ${TMP:-/ tmp} } } " ; pwd -P) " \
12931301 # '-OmitStackTraceInFastThrow' ensures stack traces in errors,
12941302 # users who don't care about useful error msgs can override in SOLR_OPTS with +OmitStackTraceInFastThrow
1295- " ${SOLR_HOST_ARG [@]} " " -Duser.timezone=$SOLR_TIMEZONE " " -XX:-OmitStackTraceInFastThrow" \
1303+ " ${SOLR_HOST_ADVERTISE_ARG [@]} " " -Duser.timezone=$SOLR_TIMEZONE " " -XX:-OmitStackTraceInFastThrow" \
12961304 # '+CrashOnOutOfMemoryError' ensures that Solr crashes whenever
12971305 # OOME is thrown. Program operation after OOME is unpredictable.
12981306 " -XX:+CrashOnOutOfMemoryError" " -XX:ErrorFile=${SOLR_LOGS_DIR} /jvm_crash_%p.log" \
@@ -1318,7 +1326,7 @@ function start_solr() {
13181326 # shellcheck disable=SC2086
13191327 nohup " $JAVA " " ${SOLR_START_OPTS[@]} " $SOLR_ADDL_ARGS -Dsolr.log.muteconsole \
13201328 -jar start.jar " ${SOLR_JETTY_CONFIG[@]} " $SOLR_JETTY_ADDL_CONFIG \
1321- 1> " $SOLR_LOGS_DIR /solr-$SOLR_PORT -console.log" 2>&1 & echo $! > " $SOLR_PID_DIR /solr-$SOLR_PORT .pid"
1329+ 1> " $SOLR_LOGS_DIR /solr-$SOLR_PORT_LISTEN -console.log" 2>&1 & echo $! > " $SOLR_PID_DIR /solr-$SOLR_PORT_LISTEN .pid"
13221330
13231331 # Check and warn about low entropy on Linux systems
13241332 if [ -e /proc/sys/kernel/random ]; then
@@ -1345,34 +1353,34 @@ function start_solr() {
13451353
13461354 # no lsof on cygwin though
13471355 if lsof -v 2>&1 | grep -q revision; then
1348- echo -n " Waiting up to $SOLR_START_WAIT seconds to see Solr running on port $SOLR_PORT "
1356+ echo -n " Waiting up to $SOLR_START_WAIT seconds to see Solr running on port $SOLR_PORT_LISTEN "
13491357 # Launch in a subshell to show the spinner
13501358 (loops=0
13511359 while true
13521360 do
1353- running=$( lsof -t -PniTCP:$SOLR_PORT -sTCP:LISTEN || :)
1361+ running=$( lsof -t -PniTCP:$SOLR_PORT_LISTEN -sTCP:LISTEN || :)
13541362 if [ -z " ${running:- } " ]; then
13551363 slept=$(( loops * 2 ))
13561364 if [ $slept -lt $SOLR_START_WAIT ]; then
13571365 sleep 2
13581366 loops=$(( loops+ 1 ))
13591367 else
1360- echo -e " Still not seeing Solr listening on $SOLR_PORT after $SOLR_START_WAIT seconds!"
1368+ echo -e " Still not seeing Solr listening on $SOLR_PORT_LISTEN after $SOLR_START_WAIT seconds!"
13611369 tail -30 " $SOLR_LOGS_DIR /solr.log"
13621370 exit # subshell!
13631371 fi
13641372 else
1365- SOLR_PID=$( ps auxww | grep start\. jar | awk " /\-Djetty \.port= $SOLR_PORT /" ' {print $2}' | sort -r)
1366- echo -e " \nStarted Solr server on port $SOLR_PORT (pid=$SOLR_PID ). Happy searching!\n"
1373+ SOLR_PID=$( ps auxww | grep start\. jar | awk " /\-Dsolr \.port\.listen= $SOLR_PORT_LISTEN /" ' {print $2}' | sort -r)
1374+ echo -e " \nStarted Solr server on port $SOLR_PORT_LISTEN (pid=$SOLR_PID ). Happy searching!\n"
13671375 exit # subshell!
13681376 fi
13691377 done) &
13701378 spinner $!
13711379 else
1372- echo -e " NOTE: Please install lsof as this script needs it to determine if Solr is listening on port $SOLR_PORT ."
1380+ echo -e " NOTE: Please install lsof as this script needs it to determine if Solr is listening on port $SOLR_PORT_LISTEN ."
13731381 sleep 10
1374- SOLR_PID=$( ps auxww | grep start\. jar | awk " /\-Djetty \.port= $SOLR_PORT /" ' {print $2}' | sort -r)
1375- echo -e " \nStarted Solr server on port $SOLR_PORT (pid=$SOLR_PID ). Happy searching!\n"
1382+ SOLR_PID=$( ps auxww | grep start\. jar | awk " /\-Dsolr \.port\.listen= $SOLR_PORT_LISTEN /" ' {print $2}' | sort -r)
1383+ echo -e " \nStarted Solr server on port $SOLR_PORT_LISTEN (pid=$SOLR_PID ). Happy searching!\n"
13761384 return ;
13771385 fi
13781386 fi
0 commit comments