Merge pull request #16366 from kustosz/role-info-in-jmx-api

+clu #15489 expose cluster member roles in JMX getClusterStatus
This commit is contained in:
Konrad Malawski 2014-11-24 12:43:07 +01:00
commit c73603f707
4 changed files with 39 additions and 9 deletions

View file

@ -42,19 +42,31 @@ trait ClusterNodeMBean {
* "members": [ * "members": [
* { * {
* "address": "akka.tcp://system@host1:2552", * "address": "akka.tcp://system@host1:2552",
* "status": "Up" * "status": "Up",
* "roles": [
* "frontend"
* ]
* }, * },
* { * {
* "address": "akka.tcp://system@host2:2552", * "address": "akka.tcp://system@host2:2552",
* "status": "Up" * "status": "Up",
* "roles": [
* "frontend"
* ]
* }, * },
* { * {
* "address": "akka.tcp://system@host3:2552", * "address": "akka.tcp://system@host3:2552",
* "status": "Down" * "status": "Down",
* "roles": [
* "backend"
* ]
* }, * },
* { * {
* "address": "akka.tcp://system@host4:2552", * "address": "akka.tcp://system@host4:2552",
* "status": "Joining" * "status": "Joining",
* "roles": [
* "backend"
* ]
* } * }
* ], * ],
* "unreachable": [ * "unreachable": [
@ -137,7 +149,10 @@ private[akka] class ClusterJmx(cluster: Cluster, log: LoggingAdapter) {
val members = clusterView.members.toSeq.sorted(Member.ordering).map { m val members = clusterView.members.toSeq.sorted(Member.ordering).map { m
s"""{ s"""{
| "address": "${m.address}", | "address": "${m.address}",
| "status": "${m.status}" | "status": "${m.status}",
| "roles": [
| ${m.roles.map("\"" + _ + "\"").mkString(",\n ")}
| ]
| }""".stripMargin | }""".stripMargin
} mkString (",\n ") } mkString (",\n ")

View file

@ -22,6 +22,7 @@ object MBeanMultiJvmSpec extends MultiNodeConfig {
commonConfig(debugConfig(on = false).withFallback(ConfigFactory.parseString(""" commonConfig(debugConfig(on = false).withFallback(ConfigFactory.parseString("""
akka.cluster.jmx.enabled = on akka.cluster.jmx.enabled = on
akka.cluster.roles = [testNode]
""")).withFallback(MultiNodeClusterSpec.clusterConfig)) """)).withFallback(MultiNodeClusterSpec.clusterConfig))
} }
@ -119,19 +120,31 @@ abstract class MBeanSpec
| "members": [ | "members": [
| { | {
| "address": "${sortedNodes(0)}", | "address": "${sortedNodes(0)}",
| "status": "Up" | "status": "Up",
| "roles": [
| "testNode"
| ]
| }, | },
| { | {
| "address": "${sortedNodes(1)}", | "address": "${sortedNodes(1)}",
| "status": "Up" | "status": "Up",
| "roles": [
| "testNode"
| ]
| }, | },
| { | {
| "address": "${sortedNodes(2)}", | "address": "${sortedNodes(2)}",
| "status": "Up" | "status": "Up",
| "roles": [
| "testNode"
| ]
| }, | },
| { | {
| "address": "${sortedNodes(3)}", | "address": "${sortedNodes(3)}",
| "status": "Up" | "status": "Up",
| "roles": [
| "testNode"
| ]
| } | }
| ], | ],
| "unreachable": [ | "unreachable": [

View file

@ -624,6 +624,7 @@ From JMX you can:
* see what members that are part of the cluster * see what members that are part of the cluster
* see status of this node * see status of this node
* see roles of each member
* join this node to another node in cluster * join this node to another node in cluster
* mark any node in the cluster as down * mark any node in the cluster as down
* tell any node in the cluster to leave * tell any node in the cluster to leave

View file

@ -672,6 +672,7 @@ From JMX you can:
* see what members that are part of the cluster * see what members that are part of the cluster
* see status of this node * see status of this node
* see roles of each member
* join this node to another node in cluster * join this node to another node in cluster
* mark any node in the cluster as down * mark any node in the cluster as down
* tell any node in the cluster to leave * tell any node in the cluster to leave