Skip to content

Commit

Permalink
nodetool: parse and forward -h|--host to nodetool
Browse files Browse the repository at this point in the history
Our launcher script (bin/nodetool) currently silently ignores the host
parameter and nodetool will use the default value (127.0.0.1). This
patch parses and forwards the host parameter to nodetool, so that it is
possible to start JMX on other ips than 127.0.0.1.
  • Loading branch information
denesb authored and avikivity committed Oct 5, 2023
1 parent 9dddad2 commit 3c09ab9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/nodetool
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fi
ARGS=""
JVM_ARGS=""
SSL_FILE=$HOME/.cassandra/nodetool-ssl.properties
JMX_HOST="127.0.0.1"
while true
do
if [ ! $1 ]; then break; fi
Expand All @@ -72,6 +73,17 @@ do
JMX_PORT=$2
shift
;;
-h)
JMX_HOST=$2
shift
;;
--host=*)
JMX_HOST=$(echo $1 | cut -d '=' -f 2)
;;
--host)
JMX_HOST=$2
shift
;;
--ssl)
if [ -f $SSL_FILE ]
then
Expand Down Expand Up @@ -100,6 +112,6 @@ fi
-Dlogback.configurationFile=logback-tools.xml \
$JVM_ARGS \
$CONFIGURATION_FILE_OPT \
org.apache.cassandra.tools.NodeTool -p $JMX_PORT $ARGS
org.apache.cassandra.tools.NodeTool -p $JMX_PORT -h $JMX_HOST $ARGS

# vi:ai sw=4 ts=4 tw=0 et

0 comments on commit 3c09ab9

Please sign in to comment.