Cluster(
cluster_id,
instance,
location_id=None,
serve_nodes=None,
default_storage_type=None,
kms_key_name=None,
_state=None,
min_serve_nodes=None,
max_serve_nodes=None,
cpu_utilization_percent=None,
)
Representation of a Google Cloud Bigtable Cluster.
We can use a Cluster
to:
reload
itselfcreate
itselfupdate
itselfdelete
itselfdisable_autoscaling
itself
Parameters | |
---|---|
Name | Description |
cluster_id |
str
The ID of the cluster. |
instance |
Instance
The instance where the cluster resides. |
location_id |
str
(Creation Only) The location where this cluster's nodes and storage reside . For best performance, clients should be located as close as possible to this cluster. For list of supported locations refer to https://cloud.google.com/bigtable/docs/locations |
serve_nodes |
int
(Optional) The number of nodes in the cluster for manual scaling. If any of the autoscaling configuration are specified, then the autoscaling configuration will take precedent. |
default_storage_type |
int
(Optional) The type of storage Possible values are represented by the following constants: :data: |
kms_key_name |
str
(Optional, Creation Only) The name of the KMS customer managed encryption key (CMEK) to use for at-rest encryption of data in this cluster. If omitted, Google's default encryption will be used. If specified, the requirements for this key are: 1) The Cloud Bigtable service account associated with the project that contains the cluster must be granted the |
_state |
int
( |
min_serve_nodes |
int
(Optional) The minimum number of nodes to be set in the cluster for autoscaling. Must be 1 or greater. If specified, this configuration takes precedence over |
max_serve_nodes |
int
(Optional) The maximum number of nodes to be set in the cluster for autoscaling. If specified, this configuration takes precedence over |
Properties
kms_key_name
str: Customer managed encryption key for the cluster.
name
Cluster name used in requests.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_cluster_name] :end-before: [END bigtable_api_cluster_name] :dedent: 4
The cluster name is of the form
`"projects/{project}/instances/{instance}/clusters/{cluster_id}"`
Returns | |
---|---|
Type | Description |
str | The cluster name. |
state
google.cloud.bigtable.enums.Cluster.State: state of cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_cluster_state] :end-before: [END bigtable_api_cluster_state] :dedent: 4
Methods
create
create()
Create this cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_create_cluster] :end-before: [END bigtable_api_create_cluster] :dedent: 4
Exceptions | |
---|---|
Type | Description |
`ValueErro |
Returns | |
---|---|
Type | Description |
| The long-running operation corresponding to the create operation. |
delete
delete()
Delete this cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_delete_cluster] :end-before: [END bigtable_api_delete_cluster] :dedent: 4
Marks a cluster and all of its tables for permanent deletion in 7 days.
Immediately upon completion of the request:
- Billing will cease for all of the cluster's reserved resources.
- The cluster's
delete_time
field will be set 7 days in the future.
Soon afterward:
- All tables within the cluster will become unavailable.
At the cluster's delete_time
:
- The cluster and all of its tables will immediately and irrevocably disappear from the API, and their data will be permanently deleted.
disable_autoscaling
disable_autoscaling(serve_nodes)
Disable autoscaling by specifying the number of nodes.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_cluster_disable_autoscaling] :end-before: [END bigtable_api_cluster_disable_autoscaling] :dedent: 4
Parameter | |
---|---|
Name | Description |
serve_nodes |
int
The number of nodes in the cluster. |
exists
exists()
Check whether the cluster already exists.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_check_cluster_exists] :end-before: [END bigtable_api_check_cluster_exists] :dedent: 4
Returns | |
---|---|
Type | Description |
bool | True if the table exists, else False. |
from_pb
from_pb(cluster_pb, instance)
Creates a cluster instance from a protobuf.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_cluster_from_pb] :end-before: [END bigtable_api_cluster_from_pb] :dedent: 4
Parameters | |
---|---|
Name | Description |
cluster_pb |
An instance protobuf object. |
instance |
Instance
The instance that owns the cluster. |
Exceptions | |
---|---|
Type | Description |
`ValueErro |
Returns | |
---|---|
Type | Description |
| The Cluster parsed from the protobuf response. |
reload
reload()
Reload the metadata for this cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_reload_cluster] :end-before: [END bigtable_api_reload_cluster] :dedent: 4
update
update()
Update this cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_update_cluster] :end-before: [END bigtable_api_update_cluster] :dedent: 4
Returns | |
---|---|
Type | Description |
| The long-running operation corresponding to the update operation. |