A large database cluster usually contains a large amount of data put in different tables. With the resource management 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.
1 2 | CREATE TABLE t1 (id int, name varchar(20)); INSERT INTO t1 VALUES (1,'joy'),(2,'lily'); |
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.
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.
Wait for about 10 minutes until the scale-out is successful.
After about 2 minutes, the logical cluster is successfully added.
Verify that service data can be queried after the conversion.
1 | SELECT * FROM t1; |
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; |
1 2 | SET ROLE u2 PASSWORD '{password}'; SELECT * FROM t1; |
1 2 | SET ROLE dbadmin PASSWORD '{password}'; GRANT USAGE ON NODE GROUP lc1 TO u2; |
1 2 | SET ROLE u2 PASSWORD '{password}'; SELECT * FROM t1; |