Manage database and table grouping
NineData uses database and table grouping to help you manage sharded databases for query, data change, and replication workflows. Use this guide to create, update, and delete database groups and table groups.
Before you begin
Sign in to the NineData Console with an account that can manage data sources in the current organization.
Procedure
Create a database group
Sign in to the NineData Console.
Go to Datasource > Datasource.
Click the Database Grouping tab, and then click Create Database Grouping.
Configure the form using the table, and then click Create Database Grouping.
Parameter Description Database Grouping Name Enter a database group name. The name supports only letters, numbers, and underscores, and must start with a letter. Use a meaningful name so the group is easy to identify later. Description(Optional) Enter a business description for this database group. Environment Select the environment that contains the data sources for this group. Database Click Add Datasource and add data sources. - Datasource: Select one or more data sources. Search by data source name, select all, or clear selected items.
- Database Expression: Enter a database expression. NineData scans the selected data sources and extracts databases that match the expression. For expression syntax, see the Appendix.
After the database group is created, it uses the SQL development standards and approval processes configured for its environment by default. Change them when your workflow requires different standards or approvals.
Create a table group
Sign in to the NineData Console.
Go to Datasource > Datasource.
Click the Database Grouping tab, and click the name of the target database group. Alternatively, click
Details in the Actions column for the database group.
On the Database Grouping Detail page, click Create Table Grouping.
Configure the form using the table, and then click Create Table Grouping.
Parameter Description Table Grouping Name Enter a table group name. The name supports only letters, numbers, and underscores, and must start with a letter. Use a meaningful name so the group is easy to identify later. Methods Supports Add Manually and Add by Expression. Add by Expression Required when Methods is set to Add by Expression. Enter an expression and click Auto Fetch. NineData scans the target databases and extracts tables that match the expression. For expression syntax, see the Appendix. Routing Algorithm(Optional) Available when Methods is set to Add by Expression. Configure the same routing algorithm used by your application so NineData can route queries to the required tables more efficiently. Database Required when Methods is set to Add Manually. Click Add Datasource and select one or more data sources. Search by data source name, select all, or clear selected items. After clicking OK, select the required databases and tables. Some data source types also require schemas. tipTo use Routing Algorithm for direct routing and avoid scanning all sharded databases and tables, all of the following conditions must be met:
- The table group is created by an expression, not manually selected.
- Routing Algorithm is configured during table group creation and matches the routing algorithm used by your application.
- The query uses an equality condition on the routing field in the
WHEREclause.
Remove a table group
If the data structure changes or the grouping configuration is no longer suitable, remove the current table group and create a new one.
Sign in to the NineData Console.
Go to Datasource > Datasource.
Click the Database Grouping tab, and click the name of the target database group. Alternatively, click
Details in the Actions column for the database group.
On the Database Grouping Detail page, click the Table Grouping tab, click
Remove under the Actions column for the target table group, and then click OK.
Delete a database group
Sign in to the NineData Console.
Go to Datasource > Datasource.
Click the Database Grouping tab, click
Delete under the Actions column for the target database group, and then click OK.
tipIf the current database group is associated with unfinished replication tasks, the database group cannot be deleted. Terminate the corresponding replication tasks, and then try again.
Result
Database groups and table groups are updated on the database grouping tab. Use the updated grouping when managing data sources and related database permissions.