A multi-tenant API gateway data management method and system

By obtaining the data table information of the tenant database for comparative difference analysis in a multi-tenant API gateway environment and adding change identifiers in the management database, the management problem of maintaining consistency of public basic data among each tenant is solved, the centralization and standardization of data management is achieved, and the spread of dirty data is avoided.

CN114372041BActive Publication Date: 2025-09-30TRAVELSKY TECHNOLOGY LIMITED
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210021479.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-10
Publication Date
2025-09-30
Estimated Expiration
2042-01-10

AI Technical Summary

Technical Problem

In a multi-tenant API gateway environment, existing technologies cannot effectively manage common basic data to maintain consistency among each tenant, resulting in difficult management and the inability to use database-level master-slave replication technology.

Method used

By obtaining the data table information of each tenant database at preset time intervals, performing comparative difference analysis, adding change identifiers in the multi-tenant management database based on the difference results, introducing the concepts of time nodes and versions, and realizing the centralization and standardization of data management.

Benefits of technology

It realizes the centralized and standardized management of multi-tenant API gateway data, solves the problem of maintaining consistency of public basic data among each tenant, avoids the spread of dirty data, and improves the efficiency and accuracy of data management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114372041B_ABST
    Figure CN114372041B_ABST
Patent Text Reader

Abstract

The present application provides a method and system for managing multi-tenant API gateway data, the method comprising: after obtaining data tables and table data information of data tables in each tenant database at a preset time interval, comparing the data obtained this time with the data obtained last time to obtain a comparison difference result; based on the comparison difference result, adding a change identifier to the corresponding data position in the tenant database of each tenant in the multi-tenant management database; that is, the present application obtains a comparison difference result by comparing the data obtained twice before and after, and adds a change identifier to the corresponding data position in the tenant database of each tenant in the multi-tenant management database, introduces the concept of time node and version, and solves the problem that when the relevant solutions need to keep the common basic data consistent between each tenant, because the consistent data is at the table level, the master-slave replication technology at the database level cannot be used, and the management is difficult.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data management, and in particular to a method and system for managing multi-tenant API gateway data. Background Art

[0002] API gateways are gateway services that emerged with the rise of cloud platforms and microservices. They primarily provide services on open and shared enterprise-level PaaS platforms, offering service release management, unified authentication and authorization, flow control, message protocol conversion, and service auditing. These services help users achieve cross-system and cross-protocol interoperability between multiple internal systems, or between internal and external systems. In a microservices architecture, the API gateway serves as a unified external interface for internal microservices, acting as a bridge between upstream and downstream services.

[0003] On cloud platforms, multiple users (referring to multiple enterprise users, multiple business domains within an enterprise, or different user groups within a single business) may share the same system or application components, requiring data isolation for each user. Simply put, a single service runs multiple application instances, providing services to multiple tenants (customers). This is the concept of multi-tenancy, enabling multiple users to utilize the same application while ensuring data isolation between them.

[0004] like Figure 1 As shown in the figure, in tenant mode, the API gateway needs to provide multiple external application instances. In terms of deployment, ensure that the hardware of each independently deployed gateway instance is independent. In terms of data management, it is necessary to isolate the data of the multi-tenant API gateway. Currently, when using the independent database mode to implement data management and isolation, since the managed data includes both public basic data and personalized extended data (such as Figure 2 Therefore, the public basic data needs to be consistent between each tenant, but the table level consistency cannot be used. Figure 3 The master-slave replication technology at the database level shown is difficult to manage. Summary of the Invention

[0005] In this regard, the present application provides a multi-tenant API gateway data management method and system to solve the problem that when the common basic data needs to be consistent between each tenant, the consistent data is at the table level and the master-slave replication technology at the database level cannot be used, which makes management difficult.

[0006] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0007] A first aspect of the present invention discloses a method for managing multi-tenant API gateway data, comprising:

[0008] After connecting to the tenant database of each tenant, obtaining the data tables and table data information of each of the tenant databases at preset time intervals;

[0009] Comparing the data tables and table data information of the data tables in each of the tenant databases obtained this time with the data tables and table data information of the data tables in each of the tenant databases obtained last time to obtain a comparison difference result;

[0010] Based on the comparison difference result, a change identifier is added to the corresponding data position in the tenant database of each tenant in the multi-tenant data management database.

[0011] Optionally, the multi-tenant API gateway data management method described above is connected to the tenant database of each tenant, including:

[0012] Decrypting the tenant encrypted information of each tenant to obtain the tenant database plaintext connection information of each tenant;

[0013] Connect to the tenant database of the corresponding tenant according to the plaintext connection information of the tenant database of each tenant.

[0014] Optionally, the multi-tenant API gateway data management method described above compares the data tables and table data information of the data tables in each of the tenant databases obtained this time with the data tables and table data information of the data tables in each of the tenant databases obtained last time, and obtains a comparison difference result, including:

[0015] Determine the unique key corresponding to each data table in the tenant database obtained this time;

[0016] Based on the unique key, obtain the maximum table data set corresponding to each data table in the tenant database obtained this time;

[0017] The maximum table data set is traversed in the data table in the tenant database acquired last time and the table data information of the data table to obtain the comparison difference result.

[0018] Optionally, the multi-tenant API gateway data management method described above compares the data tables and table data information of the data tables in each of the tenant databases obtained this time with the data tables and table data information of the data tables in each of the tenant databases obtained last time, and obtains a comparison difference result, including:

[0019] Determine respectively the unique key corresponding to each data table in each of the tenant databases obtained this time and the unique key corresponding to each data table in each of the tenant databases obtained last time;

[0020] The table data information in the data table with the same unique key obtained twice is compared respectively to obtain the comparison difference result.

[0021] Optionally, the multi-tenant API gateway data management method described above, based on the comparison difference result, adds a change identifier to the corresponding data location in the tenant database of each tenant in the multi-tenant management database, including:

[0022] Perform reverse calculation on the primary key in the tenant database based on the comparison difference result, and generate an SQL script executed by the tenant database in the two comparison processes;

[0023] Adding a time tag and / or a custom tag to the data location corresponding to the SQL script executed on the tenant database in the multi-tenant management database;

[0024] Among them, if the data tables and table data information of the data tables in the tenant database in the two previous comparisons are more than the data tables and table data information of the data tables in the tenant database in the previous time, an insert script is generated; if the data tables and table data information of the data tables in the tenant database in the two previous comparisons are less than the table structure and table data information of the data tables in the tenant database in the previous time, a delete script is generated.

[0025] Optionally, the multi-tenant API gateway data management method further includes, after adding a change identifier to a corresponding data location in the tenant database of each tenant based on the comparison difference result:

[0026] The data in the tenant database of each tenant after adding the change identifier is displayed.

[0027] A second aspect of the present invention discloses a multi-tenant API gateway data management system, comprising:

[0028] A data acquisition module is used to, after connecting to the tenant database of each tenant, acquire the data tables and table data information of each of the tenant databases at preset time intervals;

[0029] a data comparison unit, configured to compare the data tables and table data information of the data tables in each of the tenant databases obtained this time with the data tables and table data information of the data tables in each of the tenant databases obtained last time, to obtain a comparison difference result;

[0030] The data management unit is configured to add a change identifier to a corresponding data position in a tenant database of each tenant in the multi-tenant data management database based on the comparison difference result.

[0031] Optionally, in the above-mentioned multi-tenant API gateway data management system, the data comparison module is specifically used to:

[0032] Determine the unique key corresponding to each data table in the tenant database obtained this time;

[0033] Based on the unique key, obtain the maximum table data set corresponding to each data table in the tenant database obtained this time;

[0034] The maximum table data set is traversed in the data table in the tenant database acquired last time and the table data information of the data table to obtain the comparison difference result.

[0035] Optionally, in the above-mentioned multi-tenant API gateway data management system, the data management module is specifically used to:

[0036] Perform reverse calculation on the primary key in the tenant database based on the comparison difference result, and generate an SQL script executed by the tenant database in the two comparison processes;

[0037] Adding a time tag and / or a custom tag to the data location corresponding to the SQL script executed on the tenant database in the multi-tenant management database;

[0038] Among them, if the data tables and table data information of the data tables in the tenant database in the two previous comparisons are more than the data tables and table data information of the data tables in the tenant database in the previous time, an insert script is generated; if the data tables and table data information of the data tables in the tenant database in the two previous comparisons are less than the table structure and table data information of the data tables in the tenant database in the previous time, a delete script is generated.

[0039] Optionally, the multi-tenant API gateway data management system further includes:

[0040] The display module is used to display the data in the tenant database of each tenant after the change identifier is added.

[0041] The present invention provides a method for managing multi-tenant API gateway data, comprising: after connecting to the tenant database of each tenant, obtaining data tables and table data information of the data tables in each tenant database at preset time intervals; comparing the data tables and table data information of the data tables in each tenant database obtained this time with the data tables and table data information of the data tables in each tenant database obtained last time to obtain a comparison difference result; based on the comparison difference result, adding a change identifier to the corresponding data position in the tenant database of each tenant in the multi-tenant management database; that is, the present application introduces the concept of time node by comparing the data tables and table data information of the data tables in each tenant database obtained twice before and after, and adding a change identifier to the corresponding data position in the tenant database of each tenant in the multi-tenant management database based on the comparison difference result. Through this concept, the API gateway data of any tenant can be changed to any iteration time node; and further introduces the concept of version, managing the tenant's data through iterative versions, thereby realizing the centralization, standardization and process of data management, and solving the problem that when the common basic data needs to be consistent between each tenant, the master-slave replication technology at the database level cannot be used because the consistent data is at the table level, which makes management difficult. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0043] Figure 1 This is a structural diagram of an existing multi-tenant gateway;

[0044] Figure 2 This is a data structure diagram of an existing gateway data;

[0045] Figure 3 This is a flowchart of an existing method of implementing gateway data management using master-slave replication technology;

[0046] Figure 4 A flowchart of a multi-tenant API gateway data management method provided in an embodiment of the present application;

[0047] Figure 5 A flowchart of connecting to a tenant database provided in an embodiment of the present application;

[0048] Figure 6 A flowchart of obtaining a comparison difference structure provided in an embodiment of the present application;

[0049] Figure 7 Another flowchart for obtaining a comparison difference structure provided in an embodiment of the present application;

[0050] Figure 8 A flowchart of adding a change identifier provided in an embodiment of the present application;

[0051] Figure 9 This is a flow chart of an existing method of implementing gateway data management using middleware;

[0052] Figure 10 This is a flowchart of an existing method of implementing gateway data management using base tables + extended tables;

[0053] Figure 11 A flowchart of another multi-tenant API gateway data management method provided in an embodiment of the present application;

[0054] Figure 12 A flowchart of a multi-tenant API gateway data management method provided in an embodiment of the present application;

[0055] Figure 13 A schematic diagram of the structure of a multi-tenant API gateway data management system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0057] First, the current mainstream solutions for managing multi-tenant API gateway data include: independent database mode, shared database independent mode, and shared database shared mode. Independent database mode provides one database per tenant, offering the highest level of data isolation and security, but also comes with higher costs. Shared database independent mode uses a shared database with an independent schema, allowing multiple tenants to share the database, but each tenant has their own schema. For example, Oracle supports multiple schemas within a single database. Shared database shared mode uses a shared database with a shared schema, allowing tenants to share data tables in the same database and schema, but with a TenantID multi-tenant data field added to the table. This offers the highest degree of sharing and the lowest level of isolation.

[0058] In actual applications, the gateway application data in the multi-tenant API gateway data may include: basic interface information, user authorization information, background service information, environment configuration information, etc.; correspondingly, the gateway data generally includes: the addition and offline of basic interface information, the addition and deletion of user authorization information, the addition and change of background service information, and personalized environment configuration information, etc.

[0059] Based on the above, on the basis of the independent database model, an embodiment of the present application provides a multi-tenant API gateway data management method to solve the problem that when the relevant solutions need to keep the common basic data consistent between each tenant, the consistent data is at the table level and the master-slave replication technology at the database level cannot be used, resulting in difficult management.

[0060] See Figure 4 The multi-tenant API gateway data management method may include the following steps:

[0061] S100 . After connecting to the tenant database of each tenant, obtain data tables and table data information of the data tables in each tenant database at preset time intervals.

[0062] In actual applications, the method of connecting to the tenant database of each tenant can be as follows Figure 5 As shown, the following steps may be included:

[0063] S200: Decrypt the tenant encrypted information of each tenant to obtain the tenant database plaintext connection information of each tenant.

[0064] The tenant encryption information of each tenant may be pre-set, and generally includes encrypted information such as the tenant's user name, password, tenant database name, etc.

[0065] Of course, it is not limited to this, and can also be determined according to the specific application environment and user needs. This application does not make specific limitations, and all belong to the protection scope of this application.

[0066] After decrypting the tenant encrypted information, the tenant database plaintext connection information of the corresponding tenant can be obtained.

[0067] S202: Connect to the tenant database of the corresponding tenant according to the plaintext connection information of the tenant database of each tenant.

[0068] The tenant database plain text connection information of the tenant can be used to access the corresponding tenant database, thereby obtaining the data tables and table data information of the data tables in the corresponding tenant database.

[0069] It should be noted that the specific value of the preset time interval can be determined according to the specific application environment and user needs. This application does not make any specific limitations and all fall within the scope of protection of this application.

[0070] In actual applications, you can also set a scheduled task to set the time period for obtaining data tables and table data in the tenant database.

[0071] It should also be noted that, in order to facilitate future data recovery and query, the data tables and table data information of the data tables obtained in the tenant database each time may be backed up.

[0072] S102: Compare the data tables and table data information of the data tables in each tenant database obtained this time with the data tables and table data information of the data tables in each tenant database obtained last time to obtain a comparison difference result.

[0073] In actual application, step S102 is executed to compare the data tables and table data information of each tenant database obtained this time with the data tables and table data information of each tenant database obtained last time. The specific process of obtaining the comparison difference result can be as follows: Figure 6 or Figure 7 As shown. Among them, Figure 6 The specific process shown may include the following steps:

[0074] S300: Determine the unique key corresponding to each data table in each tenant database obtained this time.

[0075] In actual applications, data in tenant databases are mostly stored in separate tables. In other words, there are multiple data tables in the tenant database, and each data table stores different table data information.

[0076] You can use the primary key of each table in each tenant's database as a unique key. Generally, the unique key values ​​for each table are different for each tenant. However, if the unique key values ​​are the same, the data in the tenant's tables corresponding to the same unique key values ​​is consistent.

[0077] In actual applications, the interface table in each tenant database can be used as the key table. By utilizing the correspondence between it and the access method table, system table, and circuit breaker and degradation table, all related data tables can be queried using the interface table as the entry point.

[0078] Since it is mainly based on the interface, the unique key processing can be performed on the unique data of the interface to obtain the unique key corresponding to each data table in each tenant database; thus, the specific value data of the unique key corresponding to all related data tables can be obtained.

[0079] S302: Based on the unique key, obtain the maximum table data set corresponding to each data table in the tenant database obtained this time.

[0080] In practical applications, after querying all data tables related to the interface table, the data is sorted to obtain data with the unique key values ​​corresponding to the interface table and the related data tables as the largest table data set.

[0081] S304: Traverse the data table and table data information of the data table in the tenant database obtained last time to obtain a comparison difference result.

[0082] In actual applications, you can first compare the data missing situations between the databases of each tenant; then compare the differences between the data tables in the databases of each tenant to obtain the comparison difference results.

[0083] Specifically, the value data of the unique key corresponding to each data table in the tenant database last obtained, as well as the value data of the unique key corresponding to each data table in all tenants, can be traversed and the key value acquisition method can be used according to the table name and unique data of each data table to compare the data differences of each data table in the tenant database of all tenants under the unique key to obtain the comparison difference results.

[0084] It should be noted that the method of comparing the data tables and table data information of the data tables in each tenant database obtained this time with the data tables and table data information of the data tables in each tenant database obtained last time can be a single-table comparison or a multi-table comparison. Among them, the single-table comparison is to select a certain table as the basis, use the primary key of the table as the unique key, compare the data in the tenant database of each tenant with the data in the table as the basis, and record the data with differences. Specifically, the difference data may include: missing, data differences and similarities, etc. The purpose of multi-table comparison is to avoid data redundancy, and the gateway entity objects are stored in multiple tables respectively, so that one of them can be selected as the basis for comparison according to the corresponding relationship of each data table.

[0085] Specifically, since the comparison difference result can be obtained by obtaining the relevant data table through the unique key, and comparing the unique key and its value data of the data table attached to the interface through the value data of the unique key, all missing data can be recorded during the comparison process. When there is differential data, that is, when there is data under the unique key of both data tables, the same data is filtered and not recorded, and the data with differences is recorded. At the same time, based on the configuration basis for not processing a certain field under a certain data table, the differential data is filtered again, and the direct missing and differential data of multiple data tables under the value data of the unique key can be obtained.

[0086] In addition to the above Figure 6 In addition to the comparison difference results shown in the following example, you can also Figure 7 The comparison results are obtained by the method shown in the following example. Figure 7 , ways to obtain comparison difference results may include:

[0087] S600: Determine the unique key corresponding to each data table in each tenant database obtained this time and the unique key corresponding to each data table in each tenant database obtained last time.

[0088] It should be noted that the specific method of determining the unique key corresponding to each data table can be found in step S300 and will not be repeated here.

[0089] S602: Compare the table data information in the data table with the same unique key obtained twice respectively to obtain a comparison difference result.

[0090] In actual applications, the table data information in the data tables with the same unique key can be compared one by one to obtain the difference between the table data information in each table data in each tenant database obtained this time and the table data information in each table data in each tenant database obtained last time, and obtain the comparison difference result.

[0091] It should also be noted that the specific method of obtaining the comparison difference results can be determined by the specific application environment and user needs. This application does not make any specific limitations and all fall within the scope of protection of this application.

[0092] S104: Based on the comparison result, a change identifier is added to the corresponding data location in the tenant database of each tenant in the multi-tenant data management database.

[0093] The multi-tenant data management database is primarily used to manage and back up each tenant's database. It records the data versions of each tenant's database, enabling expanded baseline management and change auditing for each tenant, addressing the management challenges of data isolation.

[0094] In actual application, if the comparison difference result is obtained based on a single table, then the specific execution process of step S104 is to add a change mark to the corresponding data position in the tenant database of each tenant in the multi-tenant data management library based on the comparison difference result. Figure 8 As shown, the following steps may be included:

[0095] S400: Perform reverse calculation on the primary key in the tenant database based on the comparison difference result, and generate an SQL script executed by the tenant database in the two comparison processes.

[0096] Among them, if the data tables and table data information of the data tables in the tenant database are more than the data tables and table data information of the data tables in the previous tenant database in the two comparisons, an insert script is generated; if the data tables and table data information of the data tables in the tenant database are less than the table structure and table data information in the previous tenant database in the two comparisons, a delete script is generated.

[0097] Assuming that there is one more data in table a of the latter database than in table a of the previous database, an insert SQL statement is generated; conversely, if there is one less data in table a of the latter database than in table a of the previous database, a corresponding delete SQL statement is generated.

[0098] In addition, if a statement is exactly the same at time point 1 and time point 2, the data is unchanged. If a piece of data exists at time point 1 but not at time point 2, a delete statement is generated, and a corresponding insert statement is generated for reverse rollback. If a piece of data exists at both time point 1 and time point 2 but differs, the fields in the data table are traversed, and the differences are generated into update execution SQL and rollback SQL.

[0099] S402: Add a time tag and / or a custom tag to the data location corresponding to the SQL script executed by the tenant management database.

[0100] In actual applications, time tags can be added to the data locations corresponding to the SQL scripts executed by the tenant database for subsequent use by operators in audits.

[0101] Of course, you can also add custom tags depending on the specific application, such as "Updated xx interface and other configurations on 2021-05-05". In addition, if the operator wants to view the details of the tenant database synchronized in the past, they can search by time or custom tags on the corresponding synchronization data audit page.

[0102] It should be noted that after comparing the value data of the interface unique key with the data unique key and its value data of the data table attached to the interface, and obtaining the missing and differentiated data of multiple data tables under the value data of the interface unique key, a normalized SQL script can be generated based on the differentiated data obtained above. In this case, data can be traversed through the maximum table name set of all associated data tables, first generating missing SQL data, recording the corresponding data table and primary key data and annotating them for data clarification, and then performing differential record data processing based on this method, generating the required update statements, and recording the data of the generated SQL statements.

[0103] Furthermore, while generating normalized SQL statements, the original data can be recorded for the generated update SQL statements based on the original data during the comparison process, and corresponding delete statements can be generated for the generated add SQL statements based on relevant data information such as the primary key and the table name of the data table, so as to achieve corresponding record processing of the generated rollback SQL according to needs.

[0104] It can be understood that in actual applications, a forward SQL script can be generated by using the comparison interface to compare the data in the two tenant databases involved in the comparison. At the same time, the data required to generate a rollback SQL script can be obtained by traversing the data table, thereby making it possible to generate a rollback SQL script.

[0105] Based on the above, the multi-tenant API gateway data management method provided in this embodiment compares the data tables and table data information of each tenant database obtained twice, and based on the comparison difference results, adds a change identifier to the corresponding data position in the tenant database of each tenant in the multi-tenant management database, introducing the concept of time node. Through this concept, the API gateway data of any tenant can be changed to any iteration time node; and, the version concept is also introduced, and the tenant's data is managed through iterative versions, realizing the centralization, standardization and process of data management, and solving the problem that when the relevant solutions need to keep the public basic data consistent between each tenant, the consistent data is at the table level, and the database-level master-slave replication technology cannot be used, which makes management difficult.

[0106] In addition, this application also uniformly manages the data of multiple tenants, and can perform detailed comparisons of each tenant's personalized data to find out the similarities, differences and commonalities between the personalized data of each tenant, which is convenient for future data maintenance and analysis of tenants' daily usage.

[0107] It is worth noting that although the existing scheme can be adopted as follows Figure 9 The middleware approach shown achieves table-level data synchronization, but once erroneous data is written, dirty data transmission will occur. However, this application can avoid the occurrence of erroneous data writing and dirty data transmission by comparing the differences between the two obtained data.

[0108] It is also worth mentioning that although it is also possible to Figure 10As shown, the database logic design with base table + extended table stores basic public data and personalized extended data separately at the data level. However, since the update time and frequency of public data in each tenant are also uncertain, effective data management is also impossible; and the present application can achieve effective management by comparing the data tables and table data information of the data tables in each tenant database obtained twice before and after, and based on the comparison difference results, adding change identifiers to the corresponding data locations in the tenant database of each tenant in the multi-tenant management database.

[0109] Optionally, in another embodiment provided by the present application, after executing step S104 and adding a change mark to the corresponding data position in the tenant database of each tenant in the tenant management database based on the comparison difference result, refer to Figure 11 The multi-tenant API gateway data management method also includes:

[0110] S500: Display the data in the tenant database of each tenant after adding the change identifier.

[0111] In actual applications, the data in the tenant database of each tenant after adding the change identifier can be displayed in the operation interface; of course, the data in the tenant database of each tenant after adding the change identifier can also be displayed in other display interfaces.

[0112] The operation interface may be an interface capable of human-computer interaction with management personnel; management personnel may issue instructions through the operation interface.

[0113] After receiving the data comparison instruction from the administrator, the system compares the data in the tenant database according to the tenant selected by the administrator in the operation interface, and displays the comparison results in the form of a list. The display interface will mark the missing data and differences.

[0114] After receiving the backup instruction issued by the administrator, the data in the selected tenant database is backed up at the current time according to the tenant selected by the administrator in the operation interface.

[0115] After receiving the database update instruction from the administrator, you can upload the prepared database script to perform the database update operation at each production start-up. The database update operation statements will be recorded in the library, so that you can later query which data tables have been updated during the production start-up.

[0116] It should be noted that the operation interface will also provide the changes of each tenant database in each production after each data update operation. Among them, the updated data in each production process can be displayed in a list format.

[0117] Based on the above, it can be understood that the multi-tenant API gateway data management method provided by this application can quickly analyze the differences in data of different tenants under the premise of completely independent management of API gateway data, fundamentally solving the problems brought about by data multi-heading to tenant data management. At the same time, it can realize the update and rollback operations of tenant data by automatically generating SQL scripts, and use a graphical operation interface to centrally manage all data.

[0118] Based on the method provided in the above embodiment, corresponding embodiments are provided for the content of the above embodiment. For ease of understanding, the tenant data instance in the tenant database is taken as an example. Figure 12 , the present invention specifically has the following implementation process:

[0119] During the gateway data upgrade process, after the latest baseline data is created through the gateway data management, that is, after the baseline data is constructed using the data tables and table data information previously obtained from each tenant database, the data tables and table data information obtained from each tenant database are compared with the baseline data for consistency, generating comparison differences (the comparison difference results mentioned above). Based on the comparison, a rollback SQL statement is generated and executed on the corresponding tenant data instance, rolling back the data according to the baseline.

[0120] Furthermore, the data tables and table data information in the tenant database obtained this time can be compared with the data tables and table data information in the previously obtained tenant database. Finally, after executing SQL on the corresponding tenant data instance and rolling back the data according to the baseline, version tags are created for the data tables and table data information in the tenant database obtained this time.

[0121] In conjunction with the multi-tenant API gateway data management method provided in the embodiment of the present application, the embodiment of the present application also provides a multi-tenant API gateway data management system, please refer to Figure 13 , the system may include:

[0122] The data acquisition module 100 is configured to, after connecting to the tenant database of each tenant, acquire the data tables and table data information of the data tables in each tenant database at preset time intervals.

[0123] The data comparison unit 102 is configured to compare the data tables and table data information of the data tables in each tenant database obtained this time with the data tables and table data information of the data tables in each tenant database obtained last time to obtain a comparison difference result.

[0124] The data management unit 104 is configured to add a change identifier to a corresponding data location in the tenant database of each tenant in the multi-tenant data management database based on the comparison result.

[0125] Optionally, when the data acquisition module 100 is connected to the tenant database of each tenant, it is specifically used to:

[0126] Decrypt the tenant encrypted information of each tenant to obtain the tenant database plaintext connection information of each tenant.

[0127] Connect to the tenant database of the corresponding tenant based on the plaintext connection information of the tenant database of each tenant.

[0128] Optionally, the data comparison module 102 is specifically configured to:

[0129] Determine the unique key corresponding to each data table in the tenant database obtained this time.

[0130] Based on the unique key, get the maximum table data set corresponding to each data table in the tenant database obtained this time.

[0131] The largest table data set is traversed in the data table and table data information of the data table in the tenant database obtained last time to obtain a comparison difference result.

[0132] Optionally, the data comparison module 102 is specifically configured to:

[0133] The unique key corresponding to each data table in each tenant database obtained this time and the unique key corresponding to each data table in each tenant database obtained last time are determined respectively.

[0134] The table data information in the data table with the same unique key obtained twice is compared respectively to obtain the comparison difference results.

[0135] Optionally, the data management module 104 is specifically configured to:

[0136] Based on the comparison difference results, reverse calculation is performed on the primary key in the tenant database to generate the SQL script executed by the tenant database in the two processes before and after the comparison.

[0137] In the multi-tenant management database, a time tag and / or a custom tag is added to the data location corresponding to the SQL script executed in the tenant database.

[0138] Among them, if the data tables and table data information of the data tables in the tenant database are more than the data tables and table data information of the data tables in the previous tenant database in the two comparisons, an insert script is generated; if the data tables and table data information of the data tables in the tenant database are less than the table structure and table data information of the data tables in the previous tenant database in the two comparisons, a delete script is generated.

[0139] Optionally, the management system for multi-tenant API gateway data further includes:

[0140] The display module is used to display the data in the tenant database of each tenant after adding the change identifier.

[0141] Figure 13 The specific working principle of the management system of multi-tenant API gateway data shown can refer to the steps executed by the management method of multi-tenant API gateway data provided in the embodiment of the present application, which will not be repeated here.

[0142] The management system of multi-tenant API gateway data provided by this embodiment includes: a data acquisition module 100, which is used to obtain data tables and table data information of data tables in each tenant database at preset time intervals after connecting to the tenant database of each tenant; a data comparison unit 102, which is used to compare the data tables and table data information of data tables in each tenant database obtained this time with the data tables and table data information of data tables in each tenant database obtained last time to obtain comparison difference results; a data management unit 104, which is used to add change identifiers to the corresponding data locations in the tenant database of each tenant in the multi-tenant data management database based on the comparison difference results; that is, this application is passed The data tables and table data information of the data tables in each tenant database obtained twice are compared, and based on the comparison difference results, change identifiers are added to the corresponding data locations in the tenant database of each tenant in the multi-tenant management database, introducing the concept of time nodes. Through this concept, the API gateway data of any tenant can be changed to any iteration time node; and the concept of version is also introduced to manage the tenant's data through iterative versions, realizing the centralization, standardization and process of data management, and solving the problem that when the relevant solutions need to keep the public basic data consistent between each tenant, the consistent data is at the table level, and the database-level master-slave replication technology cannot be used, which makes management difficult.

[0143] The features described in the various embodiments of this specification can be replaced or combined with each other. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0144] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0145] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

[0146] It should also be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

Claims

1. A method for managing multi-tenant API gateway data, characterized in that: include: After connecting to the tenant database of each tenant, obtaining the data tables and table data information of each of the tenant databases at preset time intervals; Comparing the data tables and table data information of the data tables in each of the tenant databases obtained this time with the data tables and table data information of the data tables in each of the tenant databases obtained last time to obtain a comparison difference result; Based on the comparison difference results, adding a change identifier to the corresponding data location in the tenant database of each tenant in the multi-tenant data management database; The data tables and table data information of the data tables in each of the tenant databases obtained this time are compared with the data tables and table data information of the data tables in each of the tenant databases obtained last time to obtain a comparison difference result, including: Determine the unique key corresponding to each data table in the tenant database obtained this time; Based on the unique key, obtain the maximum table data set corresponding to each data table in the tenant database obtained this time; The maximum table data set is traversed in the data table in the tenant database and the table data information of the data table obtained last time to obtain the comparison difference result.

2. The method for managing multi-tenant API gateway data according to claim 1, characterized in that: Connect to each tenant's tenant database, including: Decrypting the tenant encrypted information of each tenant to obtain the tenant database plaintext connection information of each tenant; Connect to the tenant database of the corresponding tenant according to the plaintext connection information of the tenant database of each tenant.

3. The method for managing multi-tenant API gateway data according to claim 1, characterized in that: Compare the data tables and table data information of the data tables in each of the tenant databases obtained this time with the data tables and table data information of the data tables in each of the tenant databases obtained last time to obtain a comparison difference result, including: Determine respectively the unique key corresponding to each data table in each of the tenant databases obtained this time and the unique key corresponding to each data table in each of the tenant databases obtained last time; The table data information in the data table with the same unique key obtained twice is compared respectively to obtain the comparison difference result.

4. The method for managing multi-tenant API gateway data according to claim 1, characterized in that: Based on the comparison difference result, a change identifier is added to the corresponding data location of each tenant's tenant database in the multi-tenant data management database, including: Perform reverse calculation on the primary key in the tenant database based on the comparison difference result, and generate an SQL script executed by the tenant database in the two comparison processes; Adding a time tag and / or a custom tag to the data location corresponding to the SQL script executed on the tenant database in the multi-tenant data management database; Among them, if the data tables and table data information of the data tables in the tenant database in the two previous comparisons are more than the data tables and table data information of the data tables in the tenant database in the previous time, an insert script is generated; if the data tables and table data information of the data tables in the tenant database in the two previous comparisons are less than the data tables and table data information of the data tables in the tenant database in the previous time, a delete script is generated.

5. The method for managing multi-tenant API gateway data according to any one of claims 1 to 4, characterized in that: After adding a change identifier to a corresponding data location in the tenant database of each tenant based on the comparison difference result, the method further includes: The data in the tenant database of each tenant after adding the change identifier is displayed.

6. A multi-tenant API gateway data management system, characterized in that: include: A data acquisition module is used to, after connecting to the tenant database of each tenant, acquire the data tables and table data information of each of the tenant databases at preset time intervals; a data comparison unit, configured to compare the data tables and table data information of the data tables in each of the tenant databases obtained this time with the data tables and table data information of the data tables in each of the tenant databases obtained last time, to obtain a comparison difference result; A data management unit, configured to add a change identifier to a corresponding data location in a tenant database of each tenant in a multi-tenant data management database based on the comparison difference result; Wherein, the data comparison unit is specifically used for: Determine the unique key corresponding to each data table in the tenant database obtained this time; Based on the unique key, obtain the maximum table data set corresponding to each data table in the tenant database obtained this time; The maximum table data set is traversed in the data table in the tenant database acquired last time and the table data information of the data table to obtain the comparison difference result.

7. The multi-tenant API gateway data management system according to claim 6, characterized in that: The data management unit is specifically used for: Perform reverse calculation on the primary key in the tenant database based on the comparison difference result, and generate an SQL script executed by the tenant database in the two comparison processes; Adding a time tag and / or a custom tag to the data location corresponding to the SQL script executed on the tenant database in the multi-tenant data management database; If the data table in the tenant database and the table data information of the data table in the two comparisons are more than the data table in the tenant database and the table data information of the data table in the previous comparison, an insert script is generated; If the data table in the tenant database and the table data information of the data table in the two comparisons are less than the data table in the tenant database and the table data information of the data table in the previous comparison, a deletion script is generated.

8. The multi-tenant API gateway data management system according to claim 6, characterized in that: Also includes: The display module is used to display the data in the tenant database of each tenant after the change identifier is added.