Klustron Tenant Creation Configuration Operations and Testing
Klustron Tenant Creation Configuration Operations and Testing
Note:
Unless specifically stated, any version number mentioned can be substituted with any released version number. For all released versions, please visit: http://doc.klustron.com/zh/Release_notes.html.
Objective:
This article assumes that the reader is familiar with how to create a cluster in the Klustron database and how to perform routine operations on the Klustron database cluster instance via the XPanel web interface service.
In this document, we will demonstrate how to create a tenant in a Klustron database cluster instance, create tables in the tenant database, and insert data into these tables. We will then perform a logical backup of a schema in one cluster instance and restore it to another cluster instance within the tenant. Detailed steps will be provided.
01 Environment Description:
The XPanel service is installed on the server with IP 192.168.56.112. Open your browser and enter the address: http://192.168.56.112:18080/KunlunXPanel/#/login?redirect=%2Fdashboard
(The initial login username and password are: super_dba/super_dba. You need to change the super_dba password on first login).
After logging in, check the "Cluster List". Two clusters are already configured:
Cluster Name: “cluster”, with the compute node IP: 192.168.56.112, service port: 47001.
[Image: Tenant creation and configuration screenshot]
Cluster Name: “cluster2”, with the compute node IP: 192.168.56.113, service port: 47001.
[Image: Tenant creation and configuration screenshot]
Before performing the logical backup, you need to configure the backup storage target in XPanel. Prior to this, ensure that HDFS service is ready. For the detailed configuration process of the HDFS service, please refer to the “Klustron HDFS Backup Storage Configuration”. In this environment, the HDFS service is configured on node 192.168.56.115. Add it to the system via “Backup Storage Target Management” in XPanel as shown in the following interface:
[Image: Tenant creation and configuration screenshot]
02 Create Tenant
2.1 Enter http://192.168.56.112:18080/KunlunXPanel/#/login?redirect=%2Fcluster in your browser, then click "Register" to enter the tenant registration interface.
[Image: Tenant creation and configuration screenshot]
2.2 In the tenant registration interface, enter the desired tenant name (e.g., kunlunuser) and password, then click “Register Now”.
[Image: Tenant creation and configuration screenshot]
2.3 On the login interface, enter the tenant name (e.g., kunlunuser) and password, then click login.
[Image: Tenant creation and configuration screenshot]
2.4 After logging in, you can see the created clusters, Cluster and Cluster2.
[Image: Tenant creation and configuration screenshot]
03 Create Tables and Operate Data in the Tenant Database
3.1 Connect to the Cluster tenant (_kunlunuser) database, create tables, and insert data into them.
postgres=# psql -h 192.168.56.112 -p 47001 -U abc postgres
postgres=#\l
postgres=#\c _kunlunuser
postgres=# create table testtable1 (id int primary key);
postgres=# insert into testtable1 select generate_series(1,10);
[Image: Tenant creation and configuration screenshot]
3.2 View the data in table testtable1.
postgres=#select * from testtable1;
[Image: Tenant creation and configuration screenshot]
04 Tenant Database Logical Backup
4.1 Click the "Settings" button on the right side of the cluster "cluster".
[Image: Tenant creation and configuration screenshot]
4.2 Click "Logical Backup" in the left menu bar.
[Image: Tenant creation and configuration screenshot]
4.3 In the backup type, select: schema. In the backup table, choose the schema name for which you want to perform a logical backup.
[Image: Tenant creation and configuration screenshot]
4.4 Click "Save" to start the backup operation.
[Image: Tenant creation and configuration screenshot]
4.5 After a successful backup, the following message will be displayed:
[Image: Tenant creation and configuration screenshot]
The subsequent schema logical recovery tasks will be completed based on the parameters specified in the recovery operations, selecting the appropriate backup set.
Tenant Database Logical Recovery
5.1 Click the "Settings" button on the right side of the cluster "cluster2".
[Image: Tenant creation and configuration screenshot]
5.2 Click "Logical Recovery" in the left menu bar.
[Image: Tenant creation and configuration screenshot]
5.3 In the recovery type, select "schema". In "Target Table Cluster:", choose cluster2 (in this document, it's cluster_1716780062_000001), select the backup record and start time.
[Image: Tenant creation and configuration screenshot]
5.4 Click "Save" to start executing the schema logical recovery.
[Image: Tenant creation and configuration screenshot]
5.5 After successful schema recovery, the following message will be displayed:
[Image: Tenant creation and configuration screenshot]
06 Tenant Database Recovery Verification
6.1 Connect to the tenant database in Cluster2 (_kunlunuser) and verify that table testtable1 has been restored to the tenant database in Cluster2 (_kunlunuser).
[Image: Tenant creation and configuration screenshot]
6.2 Verify the data in table testtable1 in the tenant database of Cluster2 (_kunlunuser). The data has been restored.
[Image: Tenant creation and configuration screenshot]
07 Resource Isolation for Multi-Tenant
The test demonstrates the resource isolation functionality for multi-tenants, meaning one tenant cannot access another tenant's data.
7.1 First, you need to set enable_catalog_security_policy=true in the compute node configuration file, then restart. The results after setting are shown below:
[Image: Tenant creation and configuration screenshot]
7.2 Using the tenant _kunlunuser, connect to your own database. You can see the tenant's own data information as shown below:
[Image: Tenant creation and configuration screenshot]
7.3 Using the tenant _dbuser to connect and access another tenant _kunlunuser's database, tenant _dbuser cannot view the data under the _kunlunuser tenant, as shown below:
[Image: Tenant creation and configuration screenshot]