aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_cluster_ps.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-07-01 23:34:51 -0700
committerchrislu <chris.lu@gmail.com>2022-07-28 23:22:07 -0700
commit87ccef72db028a0a07ca359bd2b4d39d1e622b93 (patch)
treea5af9471e9719cf53b2048fb352565a5c7dddf69 /weed/shell/command_cluster_ps.go
parentac66227798208b80b79791b3dbb68aeac3449a1c (diff)
downloadseaweedfs-87ccef72db028a0a07ca359bd2b4d39d1e622b93.tar.xz
seaweedfs-87ccef72db028a0a07ca359bd2b4d39d1e622b93.zip
cluster.ps can list brokers
Diffstat (limited to 'weed/shell/command_cluster_ps.go')
-rw-r--r--weed/shell/command_cluster_ps.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/weed/shell/command_cluster_ps.go b/weed/shell/command_cluster_ps.go
index 21d3587fb..fc5f801b1 100644
--- a/weed/shell/command_cluster_ps.go
+++ b/weed/shell/command_cluster_ps.go
@@ -40,7 +40,9 @@ func (c *commandClusterPs) Do(args []string, commandEnv *CommandEnv, writer io.W
}
var filerNodes []*master_pb.ListClusterNodesResponse_ClusterNode
+ var mqBrokerNodes []*master_pb.ListClusterNodesResponse_ClusterNode
+ // get the list of filers
err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {
resp, err := client.ListClusterNodes(context.Background(), &master_pb.ListClusterNodesRequest{
ClientType: cluster.FilerType,
@@ -57,6 +59,30 @@ func (c *commandClusterPs) Do(args []string, commandEnv *CommandEnv, writer io.W
return
}
+ // get the list of message queue brokers
+ err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {
+ resp, err := client.ListClusterNodes(context.Background(), &master_pb.ListClusterNodesRequest{
+ ClientType: cluster.BrokerType,
+ FilerGroup: *commandEnv.option.FilerGroup,
+ })
+ if err != nil {
+ return err
+ }
+
+ mqBrokerNodes = resp.ClusterNodes
+ return err
+ })
+ if err != nil {
+ return
+ }
+
+ if len(mqBrokerNodes) > 0 {
+ fmt.Fprintf(writer, "* message queue brokers %d\n", len(mqBrokerNodes))
+ for _, node := range mqBrokerNodes {
+ fmt.Fprintf(writer, " * %s (%v)\n", node.Address, node.Version)
+ }
+ }
+
fmt.Fprintf(writer, "* filers %d\n", len(filerNodes))
for _, node := range filerNodes {
fmt.Fprintf(writer, " * %s (%v)\n", node.Address, node.Version)