1

我需要以编程方式确定 Redshift 集群中的节点数。我希望 AWS Java API 会在集群描述中提供它,但我无法找到它。谁能指出我正确的方向?

4

1 回答 1

1

是的,这是可能的,通过DescribeCluster。传递给客户端的区域内的每个集群都被列为具有属性的集群项。NumberOfNodes例如:

final AmazonRedshiftClient client = new AmazonRedshiftClient(credentials).withRegion(com.amazonaws.regions.Regions.US_WEST_2);
final DescribeClustersResult describeResult = client.describeClusters();
describeResult.getClusters()
              .stream()
              .forEach(cluster -> System.out.println(String.format("Cluster: %s \nNumber of nodes: %d",
                                                                   cluster.getClusterIdentifier(),
                                                                   cluster.getNumberOfNodes())));

给我:

Cluster: cluster-22gsextori36
Number of nodes: 1
Cluster: cluster-22gsextori38 
Number of nodes: 1
Cluster: cluster-22gsextori40 
Number of nodes: 1
于 2016-03-12T19:27:24.840 回答