A method, device and related equipment for data processing between database clusters
By sending data pull requests to the service gateway and processing the data source table structure, the problem of data exchange and analysis between different database clusters is solved, and the data exchange and analysis functions of cross-platform compatibility are realized.
Patent Information
- Application Number
- CN202410789311.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Existing data sharing or exchange methods are mainly limited to databases of the same type, and cannot effectively solve the data exchange and analysis problems between different database clusters.
By sending data pull requests to the service gateway, receiving and processing the data source table structure, creating local temporary tables, and obtaining corresponding types of data from the source database according to the data pull requests, data exchange and analysis across database clusters are realized.
It realizes data exchange and analysis between different database clusters, has good cross-platform compatibility, and solves the problem of data exchange between different database systems.
Smart Images

Figure CN118364033B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device and related equipment for data processing between database clusters. Background Art
[0002] Since large-scale integrated service platforms usually contain numerous subsystems, there are various exchange protocols and business process associations between the systems. If effective processing is not done, the large amount of data generated during the business process will not be managed uniformly. Therefore, the construction of a data sharing and data exchange system is precisely to avoid a series of problems such as repeated data collection, data redundancy, asynchronous shared data updates, inaccurate data, poor information communication, and inconsistent data formats between systems. All information data is uniformly stored and planned through this system, so that different subsystems can share their own data.
[0003] However, current data sharing or exchange is only used in databases of the same type. There is an urgent need for a method that can satisfy data exchange and analysis between different database clusters, that is, data exchange and analysis across database clusters. Summary of the invention
[0004] Based on this, it is necessary to provide a data processing method, device and related equipment that can realize data exchange and analysis across database clusters in response to the above technical problems.
[0005] In a first aspect, the present application provides a method for processing data between database clusters, which is applied to a target database end, and the method includes:
[0006] Send a data pull request to the service gateway and receive the data source table structure returned by the service gateway;
[0007] Create a local temporary table based on the table structure on the data source side, and obtain data of the corresponding type from the source database side based on the data source type indicated in the data pull request;
[0008] Pull the corresponding data from the source database to the local temporary table to complete the data processing.
[0009] In one embodiment, sending a data pull request to a service gateway and receiving a data source end table structure returned by the service gateway includes:
[0010] In the case of a homogeneous scene:
[0011] Send a data pull request to the service gateway, where the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source table structure to the source database end, and receive the data source table structure from the source database end;
[0012] Receive the data source table structure from the service gateway.
[0013] In one embodiment, sending a data pull request to a service gateway and receiving a data source end table structure returned by the service gateway includes:
[0014] In the case of a heterogeneous scene:
[0015] Send a data pull request to the service gateway, the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source table structure to the source database end, and receive the data source table structure from the source database end; determine the type of the source database end according to the data pull request, send the structured query language SQL of the data source table structure to the source database end, format the heterogeneous database end into the format corresponding to the data source table structure at the source database end, and receive the data source table structure from the source database end;
[0016] Receive the data source table structure from the service gateway.
[0017] In one embodiment, obtaining data of a corresponding type from a source database according to a data source type indicated in a data pull request includes:
[0018] In the case of a homogeneous scene:
[0019] Determine whether the data nodes of the target database and the source database can communicate;
[0020] If yes, directly obtain the data file of the corresponding type from the source database according to the data source type indicated in the data pull request;
[0021] If not, the control service gateway executes the query statement to obtain data according to the type of the source database end, and formats the data into data of the corresponding type.
[0022] In one embodiment, obtaining data of a corresponding type from a source database according to a data source type indicated in a data pull request includes:
[0023] In the case of a heterogeneous scene:
[0024] The control service gateway executes query statements to obtain data according to the type of the source database, and formats the data into data of the corresponding type.
[0025] In a second aspect, the present application further provides a data processing device between database clusters, which is applied to a target database terminal side, and the device includes:
[0026] The receiving module is used to send a data pull request to the service gateway and receive the data source end table structure returned by the service gateway;
[0027] The acquisition module is used to create a local temporary table according to the table structure of the data source end, and obtain data of the corresponding type from the source database end according to the data source type indicated in the data pull request;
[0028] The pull module is used to pull the corresponding data from the source database to the local temporary table to complete data processing.
[0029] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned data processing method between database clusters when executing the computer program.
[0030] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned method for processing data between database clusters when executed by a processor.
[0031] In a fifth aspect, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned data processing method between database clusters are implemented.
[0032] The above-mentioned data processing method between database clusters, when applied to the target database end, sends a data pull request to the service gateway, and receives the data source end table structure returned by the service gateway; creates a local temporary table according to the data source end table structure, and obtains data of the corresponding type from the source database end according to the data source type indicated in the data pull request; pulls the corresponding data from the source database end to the local temporary table to complete the data processing. The data processing method between database clusters of the present application can realize data exchange and analysis across database clusters. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A schematic diagram of a flow chart of a method for processing data between database clusters in one embodiment;
[0034] Figure 2 A schematic diagram of a process of sending a data pull request to a service gateway and receiving a data source end table structure returned by the service gateway in one embodiment;
[0035] Figure 3 A schematic diagram of a process for obtaining data of a corresponding type from a source database in one embodiment;
[0036] Figure 4 is a structural block diagram of a data processing device between database clusters in one embodiment;
[0037] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0039] Since large-scale integrated service platforms usually include numerous subsystems, there are various exchange protocols and business process associations between the systems. If effective processing is not made, the large amount of data generated by the business process will not be managed in a unified manner. Therefore, the construction of data sharing and data exchange systems is precisely to avoid a series of problems such as repeated data collection, data redundancy, asynchronous shared data updates, inaccurate data, poor information communication, and inconsistent data formats between systems. All information data are uniformly stored and planned through the system, so that different subsystems can share their respective data. However, current data sharing or exchange is used in the same type of database, and there is an urgent need for a method that can meet the data exchange and analysis between different database clusters, that is, data exchange and analysis across database clusters. Based on this, an embodiment of the present application provides a data processing method between database clusters to improve the above-mentioned technical problems.
[0040] In one embodiment, Figure 1 A data processing method between database clusters is provided according to an embodiment of the present application, and is described by taking the method applied to a target database end as an example. The method includes the following steps:
[0041] S101, sending a data pull request to the service gateway, and receiving the data source end table structure returned by the service gateway.
[0042] Optionally, the transparent gateway is a separate service process, written in Java and can be deployed separately on an independent node. The transparent gateway provides data transmission functions between GBase8a clusters, including online data import functions from third-party databases such as Oracle, MySQL, etc. to GBase8a cluster databases.
[0043] At the same time, the transparent gateway provides data transmission functions between GBase8a clusters, including online data import functions from third-party databases such as Oracle, MySQL, etc. to GBase8a cluster databases.
[0044] S102, creating a local temporary table according to the table structure of the data source, and acquiring data of the corresponding type from the source database according to the data source type indicated in the data pull request.
[0045] Optionally, data transmission scenarios are divided into two scenarios. Scenarios of the same type, such as GBase8A and GBase8A, are called homogeneous scenarios, and GBase8A and other databases (MySQL / Oracle / Teradata / Oceanbase) are called heterogeneous scenarios.
[0046] For homogeneous scenarios, the GBase8a data file format is compatible across versions and can be exchanged between different clusters by transferring data files. The role of the transparent gateway is to connect the two clusters for communication and coordinate data nodes for data transmission. For heterogeneous scenarios, the data file formats are not compatible. The transparent gateway needs to obtain the result set of heterogeneous data, convert it into SQL statements and send it to the GBase8A database to achieve data transmission. Similarly, GBase8a data sent to other heterogeneous databases is also collected through the transparent gateway, converted into different SQL statements according to different types of databases, and sent to the corresponding database to complete online data transmission.
[0047] Optionally, the implementation scheme of this application can meet the data transmission requirements between different GBase8a database clusters, including online data exchange with third-party databases (such as Oracle, MySQL, etc.). Through this solution, users can realize the database requirements of data sharing and exchange between cross-database clusters. Therefore, the implementation scheme of this application realizes the online data transmission function across database clusters, solves the problem of data exchange between different database systems; it has good cross-platform compatibility and can be applied to database clusters in different environments.
[0048] S103, pull the corresponding data from the source database to the local temporary table to complete the data processing.
[0049] Optionally, the present application implements the data online analysis function: the transparent gateway provides the GBase8a database with the function of using external database data online analysis, and the select statement can directly use the transparent gateway to establish a connection with other external databases.
[0050] Optionally, data analysis scenarios are divided into homogeneous scenarios and heterogeneous scenarios.
[0051] In homogeneous scenarios such as GBase8a, GBase8a first obtains metadata information of related tables on the data source side through a transparent gateway, creates a temporary table with the same table structure on the local target side, and pulls the source data into the temporary table, thereby completing the online data query and analysis function.
[0052] In heterogeneous scenarios, similar to homogeneous scenarios, the table structure information of the heterogeneous data source is obtained first. The data type and table structure of the heterogeneous database may be different from GBase8a. After obtaining the table structure on the data source side, the transparent gateway formats it, creates a temporary table on the target side, transfers the source data to the temporary table, and completes the online data analysis on the target side.
[0053] The above-mentioned data processing method between database clusters, when applied to the target database end, sends a data pull request to the service gateway, and receives the data source end table structure returned by the service gateway; creates a local temporary table according to the data source end table structure, and obtains data of the corresponding type from the source database end according to the data source type indicated in the data pull request; pulls the corresponding data from the source database end to the local temporary table to complete the data processing. The data processing method between database clusters of the present application can realize data exchange and analysis across database clusters.
[0054] Based on the above embodiments, Figure 2 The steps of sending a data pull request to the service gateway and receiving the data source table structure returned by the service gateway are broken down and refined. Figure 2 As shown, the implementation process includes the following:
[0055] In the case of a homogeneous scene:
[0056] S201, sending a data pull request to the service gateway, the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source end table structure to the source database end, and receive the data source end table structure from the source database end.
[0057] S202, receiving a data source table structure from a service gateway.
[0058] At the same time, in the case of a heterogeneous scene:
[0059] A data pull request is sent to the service gateway, and the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source table structure to the source database end, and receive the data source table structure from the source database end; the type of the source database end is determined according to the data pull request, and the structured query language SQL of the data source table structure is sent to the source database end, and the heterogeneous database end is formatted into the format corresponding to the data source table structure at the source database end, and the data source table structure is received from the source database end.
[0060] It can be understood that this embodiment provides a possible implementation method of sending a data pull request to the service gateway and receiving the data source end table structure returned by the service gateway. The method is simple and easy to operate, and can realize data exchange and analysis across database clusters.
[0061] Based on the above embodiments, Figure 3 The steps for obtaining the corresponding type of data from the source database are broken down and refined. Figure 3 As shown, the implementation process includes the following:
[0062] In the case of a homogeneous scene:
[0063] S301, determining whether the data nodes of the target database end and the source database end can communicate.
[0064] S302: If yes, directly obtain a data file of a corresponding type from the source database according to the data source type indicated in the data pull request.
[0065] S303: If not, the control service gateway executes the query statement to obtain data according to the type of the source database end, and formats the data into data of the corresponding type.
[0066] At the same time, in the case of a heterogeneous scenario: the control service gateway executes query statements to obtain data according to the type of the source database end, and formats the data into data of the corresponding type.
[0067] It can be understood that this embodiment provides a possible implementation method for obtaining data of the corresponding type from the source database end. The method is simple and easy to operate, and can realize data exchange and analysis across database clusters.
[0068] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0069] Based on the same inventive concept, the embodiment of the present application also provides a data processing device between database clusters for implementing the data processing method between database clusters involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the data processing device between one or more database clusters provided below can refer to the limitations of the data processing method between database clusters above, and will not be repeated here.
[0070] In one embodiment, by Figure 4 FIG. 1 shows a structural block diagram of a data processing device between database clusters in one embodiment. Figure 4 As shown, a data processing device 4 between database clusters is provided, which is applied to the target database end, wherein the data processing device 4 includes a receiving module 40, an acquisition module 41, and a pulling module 42, wherein:
[0071] The receiving module 40 is used to send a data pull request to the service gateway and receive the data source end table structure returned by the service gateway;
[0072] The acquisition module 41 is used to create a local temporary table according to the table structure of the data source end, and obtain data of the corresponding type from the source database end according to the data source type indicated in the data pull request;
[0073] The pulling module 42 is used to pull the corresponding data from the source database to the local temporary table to complete the data processing.
[0074] The above-mentioned data processing device between database clusters, when applied to the target database end, sends a data pull request to the service gateway, and receives the data source end table structure returned by the service gateway; creates a local temporary table according to the data source end table structure, and obtains data of the corresponding type from the source database end according to the data source type indicated in the data pull request; pulls the corresponding data from the source database end to the local temporary table to complete the data processing. The data processing device between database clusters of the present application can realize data exchange and analysis across database clusters.
[0075] In one embodiment, the receiving module 40 is specifically used for:
[0076] In the case of a homogeneous scenario: a data pull request is sent to the service gateway, the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source table structure to the source database end, and receive the data source table structure from the source database end; receive the data source table structure from the service gateway.
[0077] In one embodiment, the receiving module 40 is further specifically used for:
[0078] In the case of a heterogeneous scenario: a data pull request is sent to the service gateway, the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source table structure to the source database end, and receive the data source table structure from the source database end; the type of the source database end is determined according to the data pull request, the structured query language SQL of the data source table structure is sent to the source database end, the heterogeneous database end is formatted into the format corresponding to the data source table structure at the source database end, and the data source table structure is received from the source database end.
[0079] In one embodiment, the acquisition module 41 is specifically used for:
[0080] In the case of a homogeneous scene:
[0081] Determine whether the data nodes of the target database and the source database can communicate;
[0082] If yes, directly obtain the data file of the corresponding type from the source database according to the data source type indicated in the data pull request;
[0083] If not, the control service gateway executes the query statement to obtain data according to the type of the source database end, and formats the data into data of the corresponding type.
[0084] In one embodiment, the acquisition module 41 is further specifically configured to:
[0085] In the case of a heterogeneous scene:
[0086] The control service gateway executes query statements to obtain data according to the type of the source database, and formats the data into data of the corresponding type.
[0087] Each module in the data processing device between the above database clusters can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0088] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface and a transceiver connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The transceiver of the computer device is used to perform operations of receiving data or sending data under the control of the processor. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as sample data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data processing method between database clusters is implemented.
[0089] Those skilled in the art will understand that Figure 5The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. Specifically, the computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0090] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory. The principles and specific processes of implementing the embodiments by the processor can be found in the description of the data processing method between database clusters in the aforementioned embodiment, which will not be repeated here.
[0091] In one of the embodiments, a computer-readable storage medium is provided on which a computer program is stored. When the computer program is executed by a processor, the principles and specific processes in each embodiment are implemented. Please refer to the description in the embodiment of the data processing method between database clusters in the aforementioned embodiment, which will not be repeated here.
[0092] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the principles and specific processes in each embodiment are implemented. Please refer to the description in the embodiment of the data processing method between database clusters in the aforementioned embodiment, which will not be repeated here.
[0093] It should be noted that the information involved in this application (including but not limited to the information involved in the data processing process between database clusters in this application, etc.) is information or data that has been fully authorized by all parties.
[0094] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0095] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0096] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data processing method between database clusters, characterized in that: Applied to the target database side, the method includes: S101: If the scene is a homogeneous scene; Send a data pull request to the service gateway, wherein the data pull request is used to instruct the service gateway to send a structured query language SQL of a data source end table structure to the source database end, and receive the data source end table structure from the source database end; Receiving the data source end table structure from the service gateway; If the scene is a heterogeneous scene: Send a data pull request to the service gateway, the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source end table structure to the source database end, and receive the data source end table structure from the source database end; determine the type of the source database end according to the data pull request, send the structured query language SQL of the data source end table structure to the source database end, format the heterogeneous database end into a format corresponding to the data source end table structure at the source database end, and receive the data source end table structure from the source database end; Receiving the data source end table structure from the service gateway; S102: Creating a local temporary table according to the data source end table structure; If the scene is a homogeneous scene; Determine whether the data nodes of the target database and the source database can communicate; If yes, directly obtain a data file of a corresponding type from the source database end according to the data source type indicated in the data pull request; If not, the control service gateway executes a query statement to obtain data according to the type of the source database end, and formats the data into data of a corresponding type; If the scene is a heterogeneous scene; The control service gateway executes a query statement to obtain data according to the type of the source database end, and formats the data into data of a corresponding type; S103: Pull corresponding data from the source database to a local temporary table to complete data processing.
2. A data processing device between database clusters, characterized in that: Applied to the target database end side, the device includes: Receiving module, if the scene is a homogeneous scene; Used to send a data pull request to the service gateway, the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source end table structure to the source database end, and receive the data source end table structure from the source database end; Receiving the data source end table structure from the service gateway; If the scene is a heterogeneous scene: Used to send a data pull request to the service gateway, the data pull request is used to instruct the service gateway to send the structured query language SQL of the data source end table structure to the source database end, and receive the data source end table structure from the source database end; determine the type of the source database end according to the data pull request, send the structured query language SQL of the data source end table structure to the source database end, format the heterogeneous database end into the format corresponding to the data source end table structure at the source database end, and receive the data source end table structure from the source database end; Receiving the data source end table structure from the service gateway; An acquisition module is used to create a local temporary table according to the data source end table structure; If the scene is a homogeneous scene; Determine whether the data nodes of the target database and the source database can communicate; If yes, directly obtain a data file of a corresponding type from the source database end according to the data source type indicated in the data pull request; If not, the control service gateway executes a query statement to obtain data according to the type of the source database end, and formats the data into data of a corresponding type; If the scene is a heterogeneous scene; The control service gateway executes query statements to obtain data according to the type of the source database end, and formats the data into data of the corresponding type; the pulling module is used to pull the corresponding data from the source database end to the local temporary table to complete data processing.
3. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to claim 1 are implemented.
4. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to claim 1 are implemented.
5. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to claim 1 are implemented.
Citation Information
Patent Citations
Database system based on Dblink and transparent gateway and construction using method of database system
CN104484468A
Method for generating relational graph of data sharing between clusters and related device
CN115033639A
Data processing method, computer equipment and readable storage medium
CN115511501A
Construction method and model of multi-source isomorphic database, database system and medium
CN117056305A
Heterogeneous data acquisition method and system based on K8S cluster
CN117311898A
