Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ GaussDB(DWS)/ More Documents/ User Guide (Paris Region)/ Managing Logical Clusters/ Tutorial: Converting a Physical Cluster That Contains Data into a Logical Cluster

Tutorial: Converting a Physical Cluster That Contains Data into a Logical Cluster

Updated on 2024-06-11 GMT+08:00

Scenario

A large database cluster usually contains a large amount of data put in different tables. With the feature, you can create resource pools to isolate the resources of different services. Different service users can be allocated to different resource pools to reduce resource (CPU, memory, I/O, and storage) competition between services.

As the service scale grows, the number of services in the cluster system also increases. Creating multiple resource pools becomes less effective in controlling resource competition. GaussDB(DWS) uses the distributed architecture. and its data is distributed on multiple nodes. Each table is distributed across all DNs in the cluster, an operation on a data table may involve all DNs, which increases network loads and system resource consumption. To solve this problem, scale-out is not effective. You are advised to divide a GaussDB(DWS) cluster into multiple logical clusters.

You can create a separate logical cluster and assign new services to it. This way, new services have little impact on existing services. Also, if the service scale in existing logical clusters grows, you can scale out the existing logical clusters.

Figure 1 shows an example. The original service data tables of a company are stored in the original physical cluster dws-demo (in green). After services are switched over to the logical cluster lc1 (in blue), a new logical cluster lc2 is added to the physical cluster through scale-out. The original service data tables are switched to logical cluster lc1, and new service data tables are written to logical cluster lc2. In this way, the data of old and new services is isolated. User u2 associated with logical cluster lc2 can access the tables of logical cluster lc1 across logical clusters after authorization.

  • Cluster scale: Scale out the original physical cluster from three nodes to six nodes and split it into two logical clusters.
  • Service isolation: New and old service data is isolated in different logical clusters.
Figure 1 Accessing data across logical clusters

Creating a Cluster and Preparing Table Data

  1. Create a cluster. For details, see Creating a Cluster.
  2. After connecting to the database, create table t1 as the system administrator dbadmin and insert two data records into the table.

    1
    2
    CREATE TABLE t1 (id int, name varchar(20));
    INSERT INTO t1 VALUES (1,'joy'),(2,'lily');
    

Converting to Logical Cluster lc1

NOTICE:

During the conversion, you can run simple DML statements, such as adding, deleting, modifying, and querying data. Complex DDL statements, such as operations on database objects, will block services. You are advised to perform the conversion during off-peak hours.

  1. Log in to the GaussDB(DWS) console. In the navigation pane, choose Clusters > Dedicated Cluster. Click the name of a cluster to go to the Cluster Information page.
  2. Toggle on the Logical Cluster switch.

    Figure 2 Enabling the logical cluster function

  3. In the navigation pane, choose Logical Clusters. Click Add Logical Cluster in the upper right corner, enter the logical cluster name lc1, and click OK.

    During the switchover, the current cluster is unavailable. Wait for about 2 minutes (the conversion time varies depending on the service data volume). If lc1 is displayed on the logical cluster page, the conversion is successful.

    Figure 3 Adding a logical cluster
    Figure 4 Logical cluster conversion succeeded

Adding Nodes to the elastic_group Cluster

  1. Return to the Cluster Management page. In the Operation column of the cluster, choose More > Scale Node > Scale Out.

    Figure 5 Scaling out a cluster

  2. Set New Nodes to 3. Enable Online Scale-out. Set elastic_group as the target logical cluster. Confirm the settings, select the confirmation check box, and click Next: Confirm.

    Figure 6 Scale-out process

  3. Click Next: Confirm, and then click OK.

    Wait for about 10 minutes until the scale-out is successful.

Adding Logical Cluster lc2

  1. On the Cluster Management page, click the name of a cluster to go to the cluster details page. In the navigation pane, choose Logical Clusters.
  2. Click Add Logical Cluster in the upper right corner, select three nodes from the right pane to add to the left pane, enter the logical cluster name lc2, and click OK.

    After about 2 minutes, the logical cluster is successfully added.

    Figure 7 Adding a logical cluster
    Figure 8 Selecting a host ring
    Figure 9 Logical cluster added

Creating Logical Clusters, Associating Them with Users, and Querying Data Across Logical Clusters

  1. Connect to the database as the system administrator and run the following SQL statement to query the original service table t1:

    Verify that service data can be queried after the conversion.

    1
    SELECT * FROM t1;
    

  2. Run the following statements to associate u1 with logical cluster lc1 and u2 with logical cluster lc2, and grant all permissions of the original service table t1 to user u1:

    1
    2
    3
    CREATE USER u1 NODE GROUP 'lc1' password '{password}';
    CREATE USER u2 NODE GROUP 'lc2' password '{password}';
    GRANT ALL ON TABLE t1 TO u1;
    

  3. Switch to user u2 and query data in the original service table t1. A message is displayed, indicating that you do not have the permission to access logical cluster lc1. This indicates data is isolated between logical clusters.

    1
    2
    SET ROLE u2 PASSWORD '{password}';
    SELECT * FROM t1;
    

  4. Switch back to system administrator dbadmin and grant the access permission of logical cluster lc1 to user u2.

    1
    2
    SET ROLE dbadmin PASSWORD '{password}';
    GRANT USAGE ON NODE GROUP lc1 TO u2;
    

  5. Switch to user u2 and query the t1 table. This proves that the user bound to logical cluster lc2 can query the original service table t1 across logical clusters. In this way, data is shared between logical clusters.

    1
    2
    SET ROLE u2 PASSWORD '{password}';
    SELECT * FROM t1;
    

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback