Migrating Multi-tenant Data Using DRS
Scenarios
After multi-tenancy is enabled, you can migrate data of all tenants using DRS.
Constraints
- If the multi-tenancy setting of the source instance is inconsistent with that of the destination instance, the pre-check will fail.
- If the source and destination instances have different versions or specifications, resource configurations of the source instance are not applied to the destination instance after the migration. You are advised to use the resource configuration syntax to adjust tenant resource configurations of the destination instance according to its specifications.
- In DRS DR synchronization scenarios, do not use the IP address and port of the destination instance for migration. If you choose to use the IP address and port, tenant metadata cannot be migrated to the destination instance.
- To ensure multi-tenancy functions properly, use DRS to migrate data between instances of 2.0.60.241200 or later.
- If multi-tenancy is enabled for both the source and destination instances, you will receive a notification during the pre-check phase if there is a non-empty table in the __taurus_sys__ database because the multi-tenant metadata table contains the initial configurations. You can clear data in the non-empty table if needed. If the data is not cleared, it will be retained during DRS DR synchronization, which may cause multi-tenancy to be unavailable. For details about how to clear data, see FAQs.
Migration Schemes
- If the kernel version of your TaurusDB instance is earlier than 2.0.60.241200, DRS does not synchronize tenant metadata. It means that tenant information will not be synchronized to the destination instance. To migrate a tenant from one instance to another, perform the following steps:
- Select an instance that supports multi-tenancy as the destination instance and manually create a tenant for the destination instance.
- Use DRS to create a database-level synchronization task. (If the tenant names at the source and destination instances are changed, you need to change the destination database name.)
- Synchronize data.
- If the kernel version of your TaurusDB instance is 2.0.60.241200 or later, you can migrate tenant metadata across instances using DRS. To do this, simply create a database-level synchronization task.
FAQs
How do I clear data in non-empty tables in the __taurus_sys__ database?
- Drop users, databases, and tablespaces of common tenants. Example:
- Run the following SQL statement to check whether there are users under a common tenant:
select user,host from mysql.user where instr(user, '@') > 0
If there are, run the following SQL statement to drop the users:drop user 'user_name@tenant_name'@'%'
- Run the following SQL statement to check whether there are databases under a common tenant:
select * from SCHEMATA where instr(SCHEMA_NAME, '@') > 0
If there are, run the following SQL statement to drop the databases:
drop user 'db_name@tenant_name'@'%'
- Run the following SQL statement to query existing databases of a common tenant:
select * from information_schema.MT_tenant_DB
Run the following SQL statement to allocate a database back to a system tenant:
alter database 'db_name' tenant = ``
- Run the following SQL statement to query tablespaces created by a common tenant:
select * from information_schema.innodb_tablespaces where instr(NAME, '@') > 0
Run the following SQL statement to drop the tablespaces:
drop tablespace tbs_name
- Run the following SQL statement to check whether there are users under a common tenant:
- Drop common tenants (user-level resource configurations will be automatically dropped) and the corresponding tenant-level resource configurations. Example:
drop tenant tenant_name;
drop resource_config config_name;
- Drop user-level resource configurations of system tenants. Example:
CALL dbms_resource_manager.clear_all_configs();
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot