BigtableClusterUtilities (Cloud Bigtable HBase Client for Java 1.3.0 API)

com.google.cloud.bigtable.grpc

Class BigtableClusterUtilities

  • All Implemented Interfaces:
    AutoCloseable


    public class BigtableClusterUtilities
    extends Object
    implements AutoCloseable
    This is a utility that can be used to resize a cluster. This is useful to use 20 minutes before a large job to increase Cloud Bigtable capacity and 20 minutes after a large batch job to reduce the size.
    • Method Detail

      • lookupInstanceId

        public static String lookupInstanceId(String projectId,
                                              String clusterId,
                                              String zoneId)
                                       throws IOException
        Returns:
        The instance id associated with the given project, zone and cluster. We expect instance and cluster to have one-to-one relationship.
        Throws:
        IllegalStateException - if the cluster is not found
        IOException
      • lookupCluster

        public static com.google.bigtable.admin.v2.Cluster lookupCluster(String projectId,
                                                                         String instanceId)
                                                                  throws IOException
        Returns:
        The cluster associated with the given project and instance. We expect instance and cluster to have one-to-one relationship.
        Throws:
        IllegalStateException - if the cluster is not found or if there are many clusters in this instance.
        IOException
      • getZoneId

        public static String getZoneId(com.google.bigtable.admin.v2.Cluster cluster)
      • getClusterSize

        public int getClusterSize()
        Gets the serve node count of an instance with a single cluster.
        Returns:
        the Cluster.getServeNodes() of the clusterId.
      • getClusters

        public com.google.bigtable.admin.v2.ListClustersResponse getClusters()
        Gets a ListClustersResponse that contains all of the clusters for the projectId/instanceId configuration.
        Returns:
        all clusters in the instance if the instance ID is provided; otherwise, all clusters in project are returned.
      • setClusterSize

        public void setClusterSize(String clusterId,
                                   String zoneId,
                                   int newSize)
                            throws InterruptedException
        Sets a cluster size to a specific size.
        Parameters:
        clusterId -
        zoneId -
        newSize -
        Throws:
        InterruptedException - if the cluster is in the middle of updating, and an interrupt was received
      • setClusterSize

        public void setClusterSize(int newSize)
                            throws InterruptedException
        Sets a cluster size to a specific size in an instance with a single cluster
        Throws:
        InterruptedException - if the cluster is in the middle of updating, and an interrupt was received
      • getSingleCluster

        public com.google.bigtable.admin.v2.Cluster getSingleCluster()
        Returns:
        a Single Cluster for the project and instance.
        Throws:
        IllegalStateException - for any project / instance combination that does not return exactly 1 cluster.
      • waitForOperation

        public void waitForOperation(String operationName,
                                     int maxSeconds)
                              throws InterruptedException
        Waits for an operation like cluster resizing to complete.
        Parameters:
        operationName - The fully qualified name of the operation
        maxSeconds - The maximum amount of seconds to wait for the operation to complete.
        Throws:
        InterruptedException - if a user interrupts the process, usually with a ^C.
      • getClusterNodeCount

        public int getClusterNodeCount(String clusterId,
                                       String zoneId)
        Gets the current number of nodes allocated to the cluster.
        Parameters:
        clusterId -
        zoneId -
        Returns:
        the serveNode count of the cluster.
      • getCluster

        public com.google.bigtable.admin.v2.Cluster getCluster(String clusterId,
                                                               String zoneId)
        Gets the current configuration of the cluster as encapsulated by a Cluster object.
        Parameters:
        clusterId -
        zoneId -
        Returns:
        the Cluster if it was set. If the cluster is not found, throw a NullPointerException.
      • close

        public void close()
        Shuts down the connection to the admin API.
        Specified by:
        close in interface AutoCloseable


Send feedback about...

Cloud Bigtable Documentation