我需要以编程方式确定Redshift群集中的节点数。我希望AWS Java API能够在集群描述中提供它,但我无法找到它。有人能指出我正确的方向吗?
答案 0 :(得分:1)
是的,可以通过DescribeCluster来实现。传递给客户端的区域内的每个群集都列为Cluster项,其具有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