cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [2/6] git commit: Nodetool gets default JMX port from cassandra-env.sh Patch by Sam Tunnicliffe, reviewed by brandonwilliams for CASSANDRA-6273
Date Wed, 30 Oct 2013 20:07:25 GMT
Nodetool gets default JMX port from cassandra-env.sh
Patch by Sam Tunnicliffe, reviewed by brandonwilliams for CASSANDRA-6273


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/b461c3bf
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/b461c3bf
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/b461c3bf

Branch: refs/heads/cassandra-2.0
Commit: b461c3bfad66eb4f491803bc26bc6023d043e906
Parents: 18f7935
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Wed Oct 30 15:05:02 2013 -0500
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Wed Oct 30 15:05:02 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt  |  1 +
 bin/nodetool | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b461c3bf/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 6d95cef..e2fcbb8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,7 @@
  * (Hadoop) Make LOCAL_ONE the default consistency level (CASSANDRA-6214)
  * Require logging in for Thrift CQL2/3 statement preparation (CASSANDRA-6254)
  * restrict max_num_tokens to 1536 (CASSANDRA-6267)
+ * Nodetool gets default JMX port from cassandra-env.sh (CASSANDRA-6273)
 
 
 1.2.11

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b461c3bf/bin/nodetool
----------------------------------------------------------------------
diff --git a/bin/nodetool b/bin/nodetool
index ef79f66..d4c0439 100755
--- a/bin/nodetool
+++ b/bin/nodetool
@@ -47,6 +47,36 @@ if [ -z "$CASSANDRA_CONF" -o -z "$CLASSPATH" ]; then
     exit 1
 fi
 
+# Run cassandra-env.sh to pick up JMX_PORT
+if [ -f "$CASSANDRA_CONF/cassandra-env.sh" ]; then
+    . "$CASSANDRA_CONF/cassandra-env.sh"
+fi
+
+# JMX Port passed via cmd line args (-p 9999 / --port 9999 / --port=9999)
+# should override the value from cassandra-env.sh
+ARGS=""
+while true
+do
+  if [ ! $1 ]; then break; fi
+  case $1 in
+    -p)
+      JMX_PORT=$2
+      shift
+      ;;
+    --port=*)
+      JMX_PORT=$(echo $1 | cut -d '=' -f 2)
+      ;;
+    --port)
+      JMX_PORT=$2
+      shift
+      ;;
+    *)
+      ARGS="$ARGS $1"
+      ;;
+  esac
+  shift
+done
+
 # Special-case path variables.
 case "`uname`" in
     CYGWIN*) 
@@ -59,6 +89,6 @@ esac
       -Xmx32m \
       -Dlog4j.configuration=log4j-tools.properties \
       -Dstorage-config="$CASSANDRA_CONF" \
-      org.apache.cassandra.tools.NodeCmd ${1+"$@"}
+      org.apache.cassandra.tools.NodeCmd -p $JMX_PORT $ARGS
 
 # vi:ai sw=4 ts=4 tw=0 et


Mime
View raw message