Data Warehouse Service (DWS)¶
GaussDB(DWS) is an online data processing database that runs on the cloud infrastructure to provide scalable, fully-managed, and out-of-the-box analytic database service, freeing you from complex database management and monitoring. It is a native cloud service based on the converged data warehouse GaussDB, and is fully compatible with the standard ANSI SQL 99 and SQL 2003, as well as the PostgreSQL and Oracle ecosystems. GaussDB(DWS) provides competitive solutions for PB-level big data analysis in various industries.
DWS Cluster¶
List DWS Clusters¶
This interface is used to query an DWS cluster list.
Cluster
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
print(list(conn.dws.clusters()))
Create DWS Cluster¶
This interface is used to create a DWS cluster with
parameters.
Cluster
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
attrs = {
'name': 'dws-1',
'flavor': 'dws.m3.xlarge',
'num_nodes': 3,
'availability_zone': 'eu-de-01',
'router_id': 'router-uuid',
'network_id': 'network-uuid',
'security_group_id': 'security-group-uuid',
'port': 8000,
'user_name': 'dbadmin',
'user_pwd': 'Password!',
'public_ip': {
'public_bind_type': 'auto_assign',
'eip_id': ''
}
}
result = conn.dws.create_cluster(**attrs)
print(result)
Get DWS Cluster¶
This interface is used to get details of DWS Cluster by
cluster_id or instance of Cluster class.
Cluster
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
cluster_id = 'cluster-uuid'
resp = conn.dws.get_cluster(cluster_id)
print(resp)
Find DWS Cluster¶
This interface is used to find a DWS cluster by id or name.
Cluster
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
name_or_id = 'dws-test-1'
resp = conn.dws.find_cluster(name_or_id, ignore_missing=False)
print(resp)
Restart DWS Cluster¶
This interface is used to restart DWS Cluster by cluster
name_or_id or instance of Cluster class.
Cluster
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
cluster_id = 'cluter-uuid'
conn.dws.restart_cluster(cluster_id)
ScaleOut DWS Cluster¶
This interface is used to scale out nodes of DWS Cluster
by cluster name_or_id or instance of Cluster class.
Cluster
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
cluster_id = 'cluster-uuid'
add_nodes = 3
conn.dws.scale_out_cluster(cluster_id, add_nodes)
Reset DWS Password¶
This interface is used to reset the password of DWS cluster
administrator by cluster name_or_id or instance of Cluster class.
Cluster
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
cluster_id = 'cluster-uuid'
new_password = 'NewPassword!'
conn.dws.reset_password(cluster_id, new_password)
Delete DWS Cluster¶
This interface is used to delete DWS Cluster by cluster name
or id or instance of Cluster class.
Cluster
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
cluster_id = 'cluster-uuid'
conn.dws.delete_cluster(cluster_id)
DWS Cluster Snapshot¶
A GaussDB(DWS) snapshot is a complete backup of a cluster. Snapshots are stored in the storage space of Object Storage Service (OBS). A snapshot can be used to restore a cluster to a newly created one that has the same flavor. Currently, you can only restore a cluster to a new one.
List Snapshots¶
This interface is used to query all DWS snapshots in a project.
Snapshot
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
print(list(conn.dws.snapshots()))
Create Snapshot¶
This interface is used to manually create snapshots for a specified
DWS cluster.
Snapshot
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
cluster_id = 'cluster-uuid'
attrs = {
'name': 'snapshot-3',
'cluster_id': cluster_id,
'description': 'Snapshot-3 description'
}
result = conn.dws.create_snapshot(**attrs)
print(result)
Get Snapshot¶
This interface is used to query details of DWS Snapshot by
snapshot_id or instance of Snapshot class.
Snapshot
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
snapshot_id = 'snapshot-uuid'
resp = conn.dws.get_snapshot(snapshot_id)
print(resp)
Find Snapshot¶
This interface is used to find a DWS Snapshot by id or name.
Snapshot
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
name_or_id = 'dws-1-snapshot-3'
resp = conn.dws.find_snapshot(name_or_id, ignore_missing=False)
print(resp)
Restore Snapshot¶
This interface is used to restore snapshot to a DWS cluster to a newly
created one.
Restore
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
attrs = {
'name': 'dws-1',
'availability_zone': 'eu-de-01',
'port': 8000,
'vpc_id': 'router-uuid',
'subnet_id': 'network-uuid',
'security_group_id': 'security-group-uuid',
'public_ip': {
'public_bind_type': 'auto_assign',
'eip_id': ''
}
}
snapshot_id = 'snapshot-uuid'
response = conn.dws.restore_snapshot(snapshot_id, **attrs)
print(response)
Delete Snapshot¶
This interface is used to delete a manually created
snapshot of a cluster. This interface requires snapshot
name_or_id or instance of Snapshot class.
Snapshot
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
snapshot_id = 'snapshot-uuid'
conn.dws.delete_snapshot(snapshot_id)
DWS Flavor¶
List DWS Flavors¶
This interface is used to query list of node types (flavors)
supported by DWS Cluster.
Flavor
.
import openstack
openstack.enable_logging(True)
conn = openstack.connect(cloud='otc')
print(list(conn.dws.flavors()))