diff --git a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala index af62906946..e3429cfdb3 100644 --- a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala +++ b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala @@ -323,7 +323,6 @@ trait ClusterNodeMBean { def isConvergence: Boolean def isAvailable: Boolean - def ping(): String def join(address: String) def leave(address: String) def down(address: String) @@ -444,8 +443,6 @@ class Cluster(system: ExtendedActorSystem) extends Extension { clusterNode ⇒ // ===================== PUBLIC API ===================== // ====================================================== - def ping = "pong" - def self: Member = latestGossip.members .find(_.address == remoteAddress) .getOrElse(throw new IllegalStateException("Can't find 'this' Member (" + remoteAddress + ") in the cluster membership ring")) @@ -1086,8 +1083,6 @@ class Cluster(system: ExtendedActorSystem) extends Extension { clusterNode ⇒ // JMX commands - def ping(): String = clusterNode.ping - def join(address: String) = clusterNode.join(AddressFromURIString(address)) def leave(address: String) = clusterNode.leave(AddressFromURIString(address)) diff --git a/akka-kernel/src/main/dist/README b/akka-kernel/src/main/dist/README index b531da6164..d15368f696 100644 --- a/akka-kernel/src/main/dist/README +++ b/akka-kernel/src/main/dist/README @@ -13,7 +13,7 @@ Contents -------- - README - this document -- bin - start scripts for the Akka Microkernel +- bin - start scripts for the Akka Microkernel and Akka Cluster admin tool - config - config files for microkernel applications - deploy - deploy dir for microkernel applications - doc - Akka documentation and Scaladoc API @@ -32,3 +32,12 @@ There is a sample microkernel application included in this download. Start this application with the following command: bin/akka sample.kernel.hello.HelloKernel + + +Cluster Administration Tool +--------------------------- + +The 'akka-cluster' tool is an administration tool for managing Akka cluster nodes. +Learn more by invoking: + + bin/akka-cluster --help diff --git a/akka-kernel/src/main/dist/bin/akka-cluster b/akka-kernel/src/main/dist/bin/akka-cluster index 2c0d0493fe..877d7a6faf 100755 --- a/akka-kernel/src/main/dist/bin/akka-cluster +++ b/akka-kernel/src/main/dist/bin/akka-cluster @@ -14,10 +14,10 @@ JMX_CLIENT="java -jar $AKKA_HOME/lib/cmdline-jmxclient-0.10.3.jar -" SELF=`basename $0` # script name HOST=$1 # cluster node:port to talk to through JMX -function checkNodeIsRunning { - REPLY=$($JMX_CLIENT $HOST akka:type=Cluster ping 2>&1 >/dev/null) # redirects STDERR to STDOUT before capturing it - if [[ "$REPLY" != *pong* ]]; then - echo "Akka cluster node is not running on $HOST" +function ensureNodeIsRunningAndAvailable { + REPLY=$($JMX_CLIENT $HOST akka:type=Cluster Available 2>&1 >/dev/null) # redirects STDERR to STDOUT before capturing it + if [[ "$REPLY" != *true ]]; then + echo "Akka cluster node is not available on $HOST" exit 1 fi } @@ -25,26 +25,13 @@ function checkNodeIsRunning { # switch on command case "$2" in - ping) - if [ $# -ne 2 ]; then - echo "Usage: $SELF ping" - exit 1 - fi - - checkNodeIsRunning - shift - - echo "Pinging $HOST" - $JMX_CLIENT $HOST akka:type=Cluster ping - ;; - join) if [ $# -ne 3 ]; then echo "Usage: $SELF join " exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift ACTOR_SYSTEM_URL=$2 @@ -58,7 +45,7 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift ACTOR_SYSTEM_URL=$2 @@ -72,7 +59,7 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift ACTOR_SYSTEM_URL=$2 @@ -86,7 +73,7 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift ACTOR_SYSTEM_URL=$2 @@ -100,7 +87,7 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift echo "Querying member status for $HOST" @@ -113,7 +100,7 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift echo "Querying cluster status" @@ -126,7 +113,7 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift echo "Checking leader status" @@ -139,7 +126,7 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift echo "Checking for singleton cluster" @@ -152,7 +139,7 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift echo "Checking for cluster convergence" @@ -165,10 +152,10 @@ case "$2" in exit 1 fi - checkNodeIsRunning + ensureNodeIsRunningAndAvailable shift - echo "Checking if $ACTOR_SYSTEM_URL is AVAILABLE" + echo "Checking if member node on $HOST is AVAILABLE" $JMX_CLIENT $HOST akka:type=Cluster Available ;; @@ -176,7 +163,6 @@ case "$2" in printf "Usage: $SELF ...\n" printf "\n" printf "Supported commands are:\n" - printf "%26s - %s\n" ping "Sends a PING command to the node to see if it is up and available" printf "%26s - %s\n" "join " "Sends request a JOIN node with the specified URL" printf "%26s - %s\n" "leave " "Sends a request for node with URL to LEAVE the cluster" printf "%26s - %s\n" "remove " "Sends a request for node with URL to be instantly REMOVED from the cluster" @@ -189,7 +175,7 @@ case "$2" in printf "%26s - %s\n" has-convergence "Checks if there is a cluster convergence" printf "Where the should be on the format of 'akka://actor-system-name@hostname:port'\n" printf "\n" - printf "Examples: $SELF localhost:9999 ping\n" + printf "Examples: $SELF localhost:9999 is-available\n" printf " $SELF localhost:9999 join akka://MySystem@darkstar:2552\n" printf " $SELF localhost:9999 cluster-status\n" exit 1