This document introduces the operations and instructions for database/table mapping settings in an analysis cluster.
Note:
Objects with no database/table mapping settings cannot be queried in the analysis engine. Therefore, manually set database/table mapping after the object loading configuration is completed.
Scenarios
In an analysis cluster, data from multiple data sources can be synchronized to the cluster. After data is loaded into the analysis cluster, it cannot be queried by default. This is because all objects should have a mapping name, which can be used for querying. Therefore, database/table mapping settings are required.
Prerequisites
The cluster status is Running.
Mapping Name Description
In an analysis cluster, all objects are automatically synchronized from the source database by the TDSQL-C for MySQL analysis cluster. However, objects synchronized to the analysis cluster should use mapping names to view data of table objects. Mapping names can be modified. For example, if the source database/table name is "db1.ta2", it can be set as "db3.ta3" after synchronization to the analysis cluster.
How to View the Mapping Name?
2. Click the target cluster in the cluster list on the left to enter the cluster management page.
3. On the cluster details page, click Details in Compute Node to access the instance details page.
4. In Object Information, you can see all database and table information synchronized to the analysis cluster. The mapping database names and mapping table names are their mapping names. If the mapping database name or table name of a field is empty, it indicates that no mapping is set, and queries cannot be performed in the database.
Note:
If a synchronized object has no mapping name, a red exclamation mark will appear before the mapping database name and mapping table name. You can quickly check whether database/table mapping is set through this mark.
Setting Database/Table Mapping When Modifying Objects
1. On the data object page, click Synchronization and Mapping Configuration to enter the configuration page.
2. In step 3 advanced mapping configuration, you can configure the policy for advanced mapping configuration. The setting items for different LibraDB kernel versions are as follows.
versions prior to 4.2509.x
Forcibly set mapping names for all databases and tables according to the default rule: The default rule is to name all databases synchronized to the analysis cluster in the "database name_instance ID" format. For example, if the source instance of database1 is cdb-af321a3, after this switch is toggled on, the mapping name of this database will be "database1_cdb-af321a3".
Maintain consistency with the source database and table names, and automatically cancel mapping for objects with the same name: Set the mapping names of objects in the sync list to match the source database and table names. However, in multi-source data merging scenarios, duplicate database and table names may occur. If this issue occurs, the mapping names of duplicate tables will be set to empty. Manual database/table mapping settings are required subsequently.
Note:
The above two options are disabled by default. After any switch is toggled on, all objects with modified mapping names will be refreshed, and the mapping names will be changed according to the corresponding rule. Therefore, it is recommended to select these options only during initial configuration.
versions 4.2509.x and later:
Note:
Advanced mapping configuration is supported in versions 4.2509.x and later. Previous versions only support basic mapping configuration and are unable to automatically map newly created objects.
Mapping policies can be modified at any time without any impact on table synchronization. Modifying mappings will not cause objects to resynchronize.
Basic Policy
The default basic policy is in the active state. Activating the basic policy will add one policy information in the first row of the policy table below. The rule is to map all objects synchronized to the analysis cluster based on the original database and table names. When tables with the same database and table names exist, they will be automatically merged. If the table structure inconsistency occurs, errors will be reported during querying. You can manually add other advanced policies to map the database and table of the specified instance to another name.
Existing Objects Mapping Policy
Activating this option means the mapping names of all objects already synchronized to the analysis cluster will be updated according to the rules in the Policy Table, regardless of whether the mapping name has been manually modified.
Advanced Policy
Click Add Policy to automatically create a new policy for the current analysis cluster. You can configure it in the pop-up window. The higher the rule priority, the nearer the end the policy is. The application logic matches from top to bottom. If a conflict occurs between two rules, the rule at the bottom takes precedence.
Configuration as follows in the Create Policy pop-up:
|
Source Instance | Support selection of "all" or "designated instance ID" to represent the instance range matched by the current rule. |
Matching Mode | Defaults to Regular expression match mode. |
Source Database | Support input of regular expression for source database. All source databases hit by regular expression will apply this rule. For example, .* represents all libraries. |
Source Table | Support input of regular expression for source table. All source tables hit by regular expression will apply this rule. For example, .* represents all tables. |
Target Database | Support input of library names that need to be mapped. If "Keep the same as the original object name" is checked, this option defaults to *, representing that the mapping database name synchronized to the analysis engine remains unchanged. |
Target Table | Support input of table names that need to be mapped. If "Keep the same as the original object name" is checked, this option defaults to *, representing that the mapping table name synchronized to the analysis engine remains unchanged. |
Policy Rule Scenario Examples
|
Basic rule: Map by original name | All | .* | .* | * | * |
Merge ALL databases beginning with XX_ into the XX database | All | ^XX_.* | .* | XX | * |
Merge ALL tables beginning with XX into XX.XX_TEST | All | .* | ^XX_.* | XX | XX_TEST |
A.A is mapped to B.B | Instance ID | A | A | B | B |
Database A is mapped to database B | All | A | .* | B | * |
Place all database tables of all instances together | All | .* | .* | DB2 | * |
Merge ALL databases beginning with T_ in the specified instance into the XX database | Instance ID | ^T_.* | .* | XX | * |
Merge ALL tables beginning with T_ in the specified instance into XX.T_TEST | Instance ID | .* | ^T_.* | XX | T_TEST |
Map all database names in the specified instance to xx_1 | Instance ID | .* | .* | *_1 | * |
Map table names in database A of the specified instance to B.xxx_1 | Instance ID | A | .* | B | *_1 |
Setting Database/Table Mapping in the Object List
If the Object Information list contains objects without mapping names, a red exclamation mark will appear in the mapping database name and mapping table name columns of the object list. At this point, you can click Set Mapping in the Operation column of the corresponding table to set the mapping name for the selected table.
Note:
Automatic mapping policy and manual database/table mapping do not conflict. Manual database/table mapping is a one-time operation, a temporary modification performed after automatic matching takes effect. If you check "existing objects mapping policy" when setting the automatic mapping policy, manual mapping will be disabled. If you need to solidify the mapping name of objects, configure the mapping rule through the automatic mapping policy.
Batch Setting Mapping Names for Objects
If you need to set mapping names for multiple objects simultaneously, you can select multiple objects for setting mapping names, and click Set Mapping next to Object Information. The current number of selected objects will be prompted at the top right of Set Mapping.
Note:
You can click the quantity prompt and clear the selected objects in the pop-up window.
How to Determine Whether the Mapping Name of a Database/Table Object Is Set?
If the mapping name of an object is not set, its database name and table name will be displayed in the mapping database name and mapping table name text boxes by default.
If the mapping name of an object has already been set, its modified database name and table name will be displayed in the mapping database name and mapping table name text boxes.