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: Dividing a New Physical Cluster into Logical Clusters

Tutorial: Dividing a New Physical Cluster into Logical Clusters

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

Scenario

This section describes how to divide a new six-node physical cluster (having no service data) into two logical clusters. If your physical cluster already has service data, perform operations by referring to Tutorial: Converting a Physical Cluster That Contains Data into a Logical Cluster.

Prerequisites

Create a six-node cluster. For details, see Creating a Cluster.

Dividing a Cluster into Logical Clusters

  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 a host ring (three nodes) on the right, add it to the list on the left, enter the logical cluster name lc1, and click OK.

    After about 2 minutes, the logical cluster is added.

  3. Repeat the preceding steps to create the second logical cluster lc2.

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

  1. Connect to the database as system administrator dbadmin and run the following SQL statement to check whether the logical cluster is created:

    1
    SELECT group_name FROM PGXC_GROUP;
    

  2. Create users u1 and u2 and associate them with logical clusters lc1 and lc2, respectively.

    1
    2
    CREATE USER u1  NODE GROUP "lc1" password '{password}';
    CREATE USER u2  NODE GROUP "lc2" password '{password}';
    

  3. Switch to user u1, create table t1, and insert data into the table.

    1
    2
    3
    SET ROLE u1 PASSWORD '{password}';
    CREATE TABLE u1.t1 (id int);
    INSERT INTO u1.t1 VALUES (1),(2);
    

  4. Switch to user u2, create table t2, and insert data into the table.

    1
    2
    3
    SET ROLE u2 PASSWORD '{password}';
    CREATE TABLE u2.t2 (id int);
    INSERT INTO u2.t2 VALUES (1),(2);
    

  5. Query the u1.t1 table as user u2. The command output indicates that the user does not have the permission.

    1
    SELECT * FROM u1.t1;
    

  6. Switch back to the system administrator dbadmin and query the u1.t1 and u2.t2 tables, which are created in clusters lc1 and lc2, respectively, corresponding to two services. In this way, data is isolated based on logical clusters.

    1
    2
    3
    SET ROLE dbadmin PASSWORD '{password}';
    SELECT p.oid,relname,pgroup,nodeoids FROM pg_class p LEFT JOIN pgxc_class pg ON p.oid = pg.pcrelid WHERE p.relname = 't1';
    SELECT p.oid,relname,pgroup,nodeoids FROM pg_class p LEFT JOIN pgxc_class pg ON p.oid = pg.pcrelid WHERE p.relname = 't2';
    

  7. Grant user u2 the permissions to access logical cluster lc1, schema u1, and table u1.t1.

    1
    2
    3
    GRANT usage ON NODE GROUP lc1 TO u2;
    GRANT usage ON SCHEMA u1 TO u2;
    GRANT select ON TABLE u1.t1 TO u2;
    
    NOTE:

    Logical clusters implement permission isolation (by node groups) based on physical clusters. To let a user access data across logical clusters, you need to grant the logical cluster (node-group layer) permissions, schema permissions, and table permissions to the user in sequence. If no logical cluster permissions are granted, the error message "permission denied for node group xx" will be displayed.

  8. Switch to user u2 and query the u1.t1 table. The query is successful. The logical cluster implements data isolation and allows cross-logical cluster access after user authorization.

    1
    2
    SET ROLE u2 PASSWORD '{password}';
    SELECT * FROM u1.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