Database access method and device, equipment, storage medium and program product

By introducing proxy migration instance nodes during cloud database migration, the console node forwards database access requests to proxy nodes, solving the problem of high communication costs in traditional methods and achieving lower cost and higher security database access.

CN119646076AActive Publication Date: 2025-03-18CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
CN202411749548.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-03-18
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

In traditional methods, cloud service providers need to purchase an elastic public IP address for each console node and migrating instance node, resulting in higher communication costs between the console node and the private data server.

Method used

By introducing a proxy migration instance node, the console node forwards the database access request to the proxy migration instance node, and the proxy migration instance node forwards the request to the target private data server, realizing the database access of the console node to the target data server, avoiding the need for the console node to communicate directly with the private data server.

Benefits of technology

Reduces the cost of communication between the console node and the private data server, and eliminates the need to purchase elastic public IP addresses specifically for direct communication with the private data server for the console node, while improving data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646076A_ABST
    Figure CN119646076A_ABST
Patent Text Reader

Abstract

The invention relates to a database access method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: receiving a database access request, and determining a target private data server based on the database access request; determining a proxy migration instance node corresponding to the target private data server; forwarding the database access request to a proxy migration instance node, so that the proxy migration instance node forwards the database access request to a target private data server; receiving a response result forwarded by the proxy migration instance node; the response result is returned to the proxy migration instance node by the target private data server in response to the database access request; returning a response result to a sender of the database access request; wherein the console node and the proxy migration instance node are working nodes for data migration in the public cloud. By adopting the method, the cost of communication between the console node and the private data server can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a database access method, device, equipment, storage medium and program product. Background Art

[0002] With the development of cloud computing technology, cloud databases have become an ideal choice for storing enterprise data. Enterprises are migrating data from private databases to cloud databases to achieve more secure and efficient data management and sharing. The data migration from private databases to cloud databases is usually implemented through console nodes and proxy migration instance nodes deployed in the public cloud. Before starting the data migration task, the console node usually needs to respond to user requests to access the private database, such as obtaining response results, etc. Therefore, communication is required between the console node and the private data server corresponding to the private database.

[0003] The traditional way to achieve communication between the console node and the private data server is that the cloud service provider purchases an elastic public IP address in advance and binds the purchased elastic public IP address to the console node, so that the console node bound to the elastic public IP address can establish a communication connection with the private data server. This method results in a high cost for communication between the console node and the private data server. Summary of the invention

[0004] Based on this, it is necessary to provide a database access method, apparatus, computer equipment, computer-readable storage medium and computer program product that can reduce communication costs in response to the above technical problems.

[0005] In a first aspect, the present application provides a database access method, which is applied to a console node and includes:

[0006] receiving a database access request, and determining a target private data server based on the database access request;

[0007] Determine the proxy migration instance node corresponding to the target private data server;

[0008] forwarding the database access request to the proxy migration instance node, so that the proxy migration instance node forwards the database access request to the target private data server;

[0009] receiving a response result forwarded by the proxy migration instance node; the response result is returned by the target private data server to the proxy migration instance node in response to the database access request;

[0010] Returning the response result to the sender of the database access request;

[0011] The console node and the proxy migration instance node are working nodes used for data migration in the public cloud.

[0012] In one embodiment, determining the proxy migration instance node corresponding to the target private data server includes:

[0013] Get the proxy relationship table;

[0014] If the proxy relationship table contains a target migration instance node associated with the target private server, the target migration instance node is determined as the proxy migration instance node corresponding to the target private data server.

[0015] In one embodiment, the method further comprises:

[0016] If the target migration instance node associated with the target private server does not exist in the proxy relationship table, obtaining the current migration instance node;

[0017] The current migration instance node is determined as the proxy migration instance node corresponding to the target private data server.

[0018] In one embodiment, the forwarding the database access request to the proxy migration instance node so that the proxy migration instance node forwards the database access request to the target private data server includes:

[0019] forwarding the database access request to the proxy migration instance node through the first communication connection, so that the proxy migration instance node forwards the database access request to the target private data server through the second communication connection;

[0020] Among them, the first communication connection is the communication connection between the console node and the agent migration instance node, the second communication connection is the communication connection between the agent migration instance node and the target private data server, and the agent migration instance node in the second communication connection uses an elastic public IP address.

[0021] In one embodiment, the first communication connection is associated with a first agent process and a second agent process, the first agent process runs on a console node, the second agent process runs on an agent migration instance node, and the communication protocol between the first agent process and the second agent process is a custom protocol.

[0022] In one embodiment, the database access request includes at least one of a database object acquisition request and a configuration acquisition request, and the response result includes at least one of a database object and configuration information of the database object.

[0023] In a second aspect, the present application further provides a database access device, the device comprising:

[0024] A request receiving module, used to receive a database access request and determine a target private data server based on the database access request;

[0025] An agent node determination module, used to determine the agent migration instance node corresponding to the target private data server;

[0026] The proxy module is used to forward the database access request to the proxy migration instance node, so that the proxy migration instance node forwards the database access request to the target private data server; receive a response result forwarded by the proxy migration instance node; the response result is returned by the target private data server to the proxy migration instance node in response to the database access request;

[0027] A data sending module, used for returning the response result to the sender of the database access request;

[0028] The console node and the proxy migration instance node are working nodes used for data migration in the public cloud.

[0029] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method 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, wherein the computer program implements the steps of the above method when executed by a processor.

[0031] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.

[0032] In the above-mentioned database access method, apparatus, computer equipment, computer-readable storage medium and computer program product, upon receiving a database access request, the console node determines the target private data server based on the database access request, determines the proxy migration instance node corresponding to the target private data server, forwards the database access request to the target private data server through the proxy migration instance node, and receives the response result of the target private data server through the proxy migration instance node. By introducing the proxy migration instance node, the console node realizes database access to the target data server, and there is no need to purchase an elastic public network IP address specifically for the console node to communicate directly with the private data server, thereby reducing the cost of communication between the console node and the private data server. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A diagram of an application environment of a file storage adjustment method in an embodiment;

[0035] Figure 2 A schematic diagram of a flow chart of a file storage adjustment method in one embodiment;

[0036] Figure 3 A schematic diagram of a custom protocol in one embodiment;

[0037] Figure 4 A schematic diagram of a flow chart of a file storage adjustment method in another embodiment;

[0038] Figure 5 A schematic diagram of a migration service system in one embodiment;

[0039] Figure 6 A structural block diagram of a file storage adjustment device in one embodiment;

[0040] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0041] 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.

[0042] The database access method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the console node 104 through the network, the console node 104 communicates with the proxy migration instance node 106 through the network, the proxy migration instance node 106 communicates with the target private data server 108 through the network, the data storage system 1062 can be a database corresponding to the storage proxy migration instance node 106, the data storage system 1082 can be a database corresponding to the target private data server 108, and the data storage system 1062 can be placed on the cloud. The above-mentioned database access method can be interactively executed through the terminal 102, the console node 104 and the proxy migration instance node 106. For example, the console node 104 receives a database access request sent by the terminal 102, determines the target private data server 108 based on the database access request, and determines the proxy migration instance node 106 corresponding to the target private data server 108, forwards the database access request to the proxy migration instance node 106, so that the proxy migration instance node 106 forwards the database access request to the target private data server 108; receives a response result forwarded by the proxy migration instance node 106; the response result is returned by the target private data server 108 to the proxy migration instance node 106 in response to the database access request; and returns the response result to the sender of the database access request (terminal 102), wherein the console node 104 and the proxy migration instance node 106 are working nodes for data migration in the public cloud.

[0043] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The console node 104 and the proxy migration instance node 106 may be cloud servers that provide cloud computing services.

[0044] In an exemplary embodiment, Figure 2 As shown, a file storage adjustment method is provided, which is applied to Figure 1 The console node 104 in the example is used for illustration, and the following steps S202 to S210 are included. Among them:

[0045] S202, receiving a database access request, and determining a target private data server based on the database access request.

[0046] The database access request refers to a request for data retrieval, modification, management or other forms of interaction with the database corresponding to the target private data server, and can be at least one of a site query request, a database object acquisition request and a configuration acquisition request. The target private data server can be a server corresponding to the enterprise's private database.

[0047] Specifically, a cloud service management page is displayed on the terminal. The terminal generates a database access request in response to a database access operation triggered by a user on the cloud service management page, and sends the generated database access request to a console node. After receiving the database access request, the console node parses the database access request to obtain a parsing result, and determines the target private data server to be accessed by the database access request based on the parsing result.

[0048] In one embodiment, the database access request carries server information, the console node extracts the server information from the parsing result, and determines the target private data server to be accessed by the database access request based on the server information. The server information may be a server identifier, a domain name, or an IP address and a port number of the server.

[0049] S204: Determine the proxy migration instance node corresponding to the target private data server.

[0050] Specifically, after determining the target private data server, the control node may also search for the proxy migration instance node corresponding to the target private data server in the established proxy mapping relationship based on the server information of the target private data server.

[0051] S206: Forward the database access request to the proxy migration instance node, so that the proxy migration instance node forwards the database access request to the target private data server.

[0052] Specifically, after determining the proxy migration instance node corresponding to the target private data server, the control node can forward the database access request sent by the terminal to the proxy migration instance node. After receiving the database access request, the proxy migration instance node forwards the database access request to the target private data server. After receiving the database access request, the target private data server performs corresponding database operations in response to the database access request, obtains processing results, and returns the processing results to the proxy migration instance node as a response result.

[0053] S208, receiving a response result forwarded by the proxy migration instance node; the response result is returned by the target private data server to the proxy migration instance node in response to the database access request.

[0054] S210: Return the response result to the sender of the database access request.

[0055] Among them, the console node and the proxy migration instance node are working nodes used for data migration in the public cloud.

[0056] Specifically, after receiving the response result returned by the target private data server in response to the database access request, the proxy migration instance node forwards the response result to the console node. After receiving the response result, the console node forwards the response result to the original request initiator, such as a terminal. After receiving the response result, the terminal can display the response result so that the user can further trigger operations related to data migration based on the displayed response result.

[0057] In the above database access method, after receiving a database access request, the console node determines the target private data server based on the database access request, determines the proxy migration instance node corresponding to the target private data server, forwards the database access request to the target private data server through the proxy migration instance node, and receives the response result of the target private data server through the proxy migration instance node. By introducing the proxy migration instance node, the console node can access the database of the target data server without purchasing an elastic public IP address specifically for the console node to communicate directly with the private data server, thereby reducing the cost of communication between the console node and the private data server.

[0058] In one embodiment, the process of the console node determining the proxy migration instance node corresponding to the target private data server includes the following steps: obtaining a proxy relationship table; if the proxy relationship table contains a target migration instance node associated with the target private server, determining the target migration instance node as the proxy migration instance node corresponding to the target private data server.

[0059] Among them, the proxy relationship table is used to store the proxy mapping relationship. The proxy mapping relationship can be the correspondence between the server information of the private data server and the node information of the migration instance node. The server information can be the server ID, domain name, or the IP address and port number of the server. The node information can be the node ID, or the IP address and port number of the node.

[0060] Specifically, after the console node determines the target private data server, it can obtain the stored proxy relationship table and search in the proxy relationship table according to the server information of the target private data server. If node information that corresponds to the server information is found in the proxy relationship table, the target migration instance node corresponding to the node information is determined as the proxy migration instance node corresponding to the target private data server.

[0061] For example, a search is performed in the proxy relationship table based on the IP address and port number of the target private data server. If an IP address and port number that correspond to the IP address and port number of the server are found in the proxy relationship table, the target migration instance node corresponding to the found IP address and port number is determined as the proxy migration instance node corresponding to the target private data server.

[0062] In the above embodiment, the console node can quickly determine which migration instance node is associated with a specific private data server by using the proxy relationship table. This automated search process reduces the time for manual configuration and searching, and improves operational efficiency.

[0063] In one embodiment, the process of the console node determining the proxy migration instance node corresponding to the target private data server also includes the following steps: if the target migration instance node associated with the target private server does not exist in the proxy relationship table, obtaining the current migration instance node; determining the current migration instance node as the proxy migration instance node corresponding to the target private data server.

[0064] The current migration instance node is created before receiving the database access request in response to an instance creation operation triggered by a user on the cloud service management page.

[0065] Specifically, after the console node determines the target private data server, it can obtain the stored proxy relationship table and search in the proxy relationship table according to the server information of the target private data server. If node information that corresponds to the server information is found in the proxy relationship table, the node information of the current migration instance node is obtained, and a correspondence is established between the node information of the current migration instance node and the server information of the target private data server. The correspondence is stored in the proxy relationship table, and the current migration instance node is determined as the proxy migration instance node corresponding to the target private data server.

[0066] For example, a search is performed in the proxy relationship table based on the IP address and port number of the target private data server. If an IP address and port number that corresponds to the IP address and port number of the server is not found in the proxy relationship table, the IP address and port number of the current migration instance node are obtained, and a correspondence is established between the IP address and port number of the current migration instance node and the IP address and port number of the target private data server. The correspondence is stored in the proxy relationship table, and the current migration instance node is determined as the proxy migration instance node corresponding to the target private data server.

[0067] In the above embodiment, when there is no predefined mapping in the proxy relationship table, the console node ensures the continuity of the service by dynamically selecting an available migration instance node, and by dynamically allocating the migration instance node according to actual needs, resources can be used more efficiently to avoid idle resources or over-investment.

[0068] In one embodiment, the process in which the console forwards a database access request to the proxy migration instance node so that the proxy migration instance node forwards the database access request to the target private data server includes the following steps: forwarding the database access request to the proxy migration instance node through a first communication connection so that the proxy migration instance node forwards the database access request to the target private data server through a second communication connection.

[0069] Among them, the first communication connection is the communication connection between the console node and the agent migration instance node, which can be specifically a TCP (Transmission Control Protocol) connection. The second communication connection is the communication connection between the agent migration instance node and the target private data server, which can be specifically a TCP (Transmission Control Protocol) connection. In the second communication connection, the agent migration instance node uses an elastic public IP address. The elastic public IP address (Elastic IP or EIP) is a function provided in cloud computing services that allows users to dynamically assign public IP addresses to any virtual machine or other cloud resources in the same geographical area.

[0070] It should be noted that the data migration from a private database to a cloud database is usually implemented through a console node and an agent migration instance node deployed in a public cloud. Before starting the data migration task, the console node usually needs to respond to user requests to access the private database, such as obtaining response results, etc. Therefore, the console node needs to communicate with the private data server corresponding to the private database. When performing data migration, the agent migration instance node also needs to communicate with the private data server corresponding to the private database. In the traditional solution, the way to achieve communication between the console node and the private data server is that the cloud service provider pre-purchases an elastic public network IP address and sends the purchased The purchased elastic public IP address is bound to the console node, so that the console node bound to the elastic public IP address can establish a communication connection with the private data server. The way to achieve communication between the migration instance node and the private data server is that the cloud service provider purchases an elastic public IP address in advance and binds the purchased elastic public IP address to the migration instance node, so that the migration instance node bound to the elastic public IP address can establish a communication connection with the private data server. In this way, the cloud service provider needs to purchase two different elastic public IP addresses to achieve communication between the console node and the private data server, and to achieve communication between the migration instance node and the private data server.

[0071] In the solution provided by the present application, it is only necessary to purchase one elastic public IP address and bind it to the proxy migration instance node, so that a second communication connection can be established between the migration instance node and the target private data server based on the elastic public IP address. When the console node needs to communicate with the target private data server, the console node only needs to send the database access request to the proxy migration instance node through the first communication connection between the console node and the proxy migration instance node, and the proxy migration instance node can forward the database access request to the target private data server through the second communication connection between the console node and the target private data server, thereby realizing communication between the console node and the target private data server. There is no need to purchase an elastic public IP address specifically for the console node to communicate directly with the private data server, thereby reducing the cost of communication between the console node and the private data server. In addition, the console node is usually deployed in the pre-set area of ​​the public cloud. If the console node is bound to the elastic public IP address, the console node will be directly exposed to the public network, thereby causing security risks to the pre-set area. The solution provided by the present application does not need to bind the console node to the elastic public IP address, thereby avoiding exposing the console node directly to the public network, thereby improving data security.

[0072] In one embodiment, the first communication connection associates a first agent process and a second agent process, the first agent process runs on a console node, the second agent process runs on an agent migration instance node, and the communication protocol between the first agent process and the second agent process is a custom protocol.

[0073] The first proxy process may specifically be an Api-Server deployed on a console node, and the second proxy process may specifically be an Api-Bridge deployed on a proxy migration instance node.

[0074] A custom protocol refers to a network communication protocol designed for a specific application or requirement. The custom protocol in the embodiment of the present application can be a protocol designed for a database access request proxy forwarding scenario, which can include Figure 3The protocol fields shown, such as message ID, message length, request initiator, response initiator, data content, etc., wherein the message ID is identified as "MessageId" with a length of 8 bytes, which uniquely identifies the ID of each communication message and is used to distinguish different request and response messages. The message ID in the embodiment of the present application can specifically be a timestamp of the message sending time; the message length is identified as "Len" with a length of 4 bytes. This field can represent the total length of the entire message (including fields such as message ID, message length, requester, responder, data content, etc.), or it can only represent the length of the data content; the request initiator is identified as "ReqId" with a length of 6 bytes, which identifies the unique ID of the request initiator; the response initiator is identified as "ResId" with a length of 6 bytes, which identifies the unique ID of the response initiator; the data content is identified as "Data", and the length can be any length that meets the requirements. Its length can be specifically specified by the previous Len field, and data of different lengths can be flexibly transmitted. It is the actual data part, and specifically can be data information that needs to be forwarded by a proxy.

[0075] Specifically, after receiving the database access request, the console node repackages the database request based on the custom protocol through the Api-Server of the console node to obtain the repackaged database access request, and sends the repackaged database access request to the Api-Bridge of the proxy migration instance node through the first communication connection corresponding to the Api-Server. The Api-Bridge forwards the received database access request to the target private data server. The target private data server sends the query result obtained by the database query as a response result to the Api-Bridge. The Api-Bridge sends the response result to the Api-Server. The Api-Server sends the response result to the console node. The console node sends the response result to the terminal.

[0076] In the above embodiment, by using the first agent process and the second agent process to run on the console node and the agent migration instance node respectively, and connecting through a custom communication protocol, the custom protocol can be optimized according to specific application requirements and network environment. The development and use of custom communication protocols can reduce dependence on third-party solutions, thereby reducing costs. Through more efficient protocol design, bandwidth and storage requirements can be reduced, thereby reducing infrastructure costs.

[0077] In one embodiment, the database access request includes at least one of a database object acquisition request and a configuration acquisition request, and the response result includes at least one of a database object and configuration information of the database object.

[0078] The database object may specifically be a table, a trigger, an event, etc., and the configuration information of the database object refers to the migration configuration information of the database object, and may specifically be the migration configuration information of a target database object among multiple database objects.

[0079] For example, a user can trigger a database object acquisition operation on a cloud service management page. The terminal generates a database object acquisition request in response to the database object acquisition operation and sends the database object acquisition request to the console node. After receiving the database object returned by the console node, the database object can be displayed on the cloud service management side. The user can select the target database object to be migrated from the displayed database objects and trigger a configuration information acquisition operation for the target database object. The terminal generates a configuration information acquisition request for the target database object in response to the configuration information acquisition operation for the target database object and sends the configuration information acquisition request to the console node. After receiving the configuration information returned by the console node, the configuration information can be displayed so that the user can check and review the migration configuration of the target database object.

[0080] In the above embodiment, the console node can respond to various database access requests by proxying the migration instance node, without the need to purchase an elastic public IP address specifically for the console node to communicate directly with the private data server, thereby reducing the cost of communication between the console node and the private data server.

[0081] In one embodiment, Figure 4 As shown, a database access method is also provided, which is applied to Figure 1 Taking the console node 104 in the example as an example, the method includes the following steps:

[0082] S402, receiving a database object acquisition request, and determining a target private data server based on the database object acquisition request.

[0083] S404: Determine the proxy migration instance node corresponding to the target private data server.

[0084] S406: forwarding the database object acquisition request to the proxy migration instance node, so that the proxy migration instance node forwards the database object acquisition request to the target private data server.

[0085] S408, receiving the database object forwarded by the proxy migration instance node; the database object is returned to the proxy migration instance node by the target private data server in response to the database object acquisition request.

[0086] S410: Return the database object to the sender of the database access request.

[0087] S412, receiving a configuration information acquisition request of a target database object; the target database object is the database object selected by the user.

[0088] S414: forward the configuration information acquisition request of the target database object to the proxy migration instance node, so that the proxy migration instance node forwards the configuration information acquisition request of the target database object to the target private data server.

[0089] S416, receiving the configuration information of the target database object forwarded by the proxy migration instance node; the configuration information of the target database object is returned to the proxy migration instance node by the target private data server in response to the acquisition request.

[0090] S418: Return the configuration information of the target database object to the sender of the request for obtaining the configuration information of the target database object.

[0091] Among them, the console node and the proxy migration instance node are working nodes used for data migration in the public cloud.

[0092] The present application also provides an application scenario, which applies the above database access method. The database access method is Figure 5 The migration service system shown is implemented and deployed in a public cloud. The public cloud is divided into national zone, pre-configured zone and VPC zone, which are components of multiple resource pools. The national zone is shared among resource pools, and each resource pool corresponds to a pre-configured zone and multiple VPC zones. Whether it is between the national zone and the pre-configured zone, or between the pre-configured zone and the VPC zone in the same resource pool, the networks between them are naturally connected; A console node will be installed in the pre-configured zone of each resource pool to manage all data migration instances under the resource pool. Each data migration instance will deploy a migration instance node in the corresponding VPC zone for data migration operations; The machine where the console node is located will start an Api-Server process for network forwarding, and the machine where each data migration instance is located will start an Api-Bridge process, also for network forwarding. As shown Figure 5 As shown, the migration service system implements the above database access method including the following steps:

[0093] 1. The national front-end page sends an HTTP request to the console node in the provisioning area to obtain the source database object. The request contains the IP and port information of the source database.

[0094] 2. The console node obtains the IP and port of the proxy based on the IP and port of the source database:

[0095] (1) Send a request to the Api-Server and use the source database's IP and port to obtain the proxy's IP and port. If the IP and port are obtained successfully, the proxy's IP and port are returned. If not, proceed to the next step.

[0096] (2) Based on the ID of the current data migration instance, obtain the IP and port of the machine where the migration instance node is located.

[0097] (3) Inform Api-Server to bind the IP and port of the machine where the migration instance node is located with the IP and port of the source database. At this stage, Api-Server establishes a TCP connection with Api-Bridge and returns the proxied IP and port. At the same time, Api-Server listens to port 3900 for use by the console node. At the same time, Api-Bridge, as a client, establishes a TCP persistent connection with the source database.

[0098] 3. The console node uses the proxied URL to execute a JDBC query.

[0099] 4. The Api-Server receives the data sent by the console node and sends the data to the corresponding Api-Bridge through the Sock5 protocol.

[0100] 5. Api-Bridge sends the received data request to the source database.

[0101] 6. The source database sends the query result as a response to Api-Bridge.

[0102] 7. Api-Bridge sends the query result as a response to Api-Server.

[0103] 8. Api-Server sends the query result as a response to the console node.

[0104] 9. The console node sends the query results as a response to the front end.

[0105] The present application also provides an application scenario, which can be a data migration scenario of migrating a database MySQL to a cloud database MySQL RDS. The application scenario uses the above database access method and includes the following steps:

[0106] Step 1) The user binds a public IP to the self-built MySQL database.

[0107] Step 2) The user activates a data transfer service instance. The console will create a machine as the migration instance node. The machine and the cloud database MySQL RDS are in the same VPC. At the same time, a public network EIP is bound to the migration instance node to ensure that the migration instance node and the self-built database MySQL network are connected.

[0108] Step 3) The console starts the Api-Bridge process of the migration instance node machine through SSH.

[0109] Step 4) The user configures the data migration task in the specified data transfer service instance through the page. After filling in the connection information of the source and target libraries, the page will display the database objects of the source library. At this time, the page sends an HTTP request to the console. After receiving the request, the console entrusts the migration instance node to query the self-built database of the source library through Api-Server and Api-Bridge to obtain the database objects and return them to the front end.

[0110] Step 5) The user selects the database objects (tables, triggers, events, etc.) that need to be migrated on the page and proceeds to the next step of pre-check.

[0111] Step 6) The console needs to pre-check the relevant configuration of the source library.

[0112] Through Api-Server and Api-Bridge, the migration instance node is delegated to query the self-built database to obtain database-related configurations.

[0113] Step 7) After the user completes the creation of the migration task, the migration task is started. At this time, the console notifies the migration instance node to start data migration. The migration instance node extracts data through the self-built database EIP and writes it to the target database MySQL RDS through the intranet IP.

[0114] Step 8) The console periodically obtains the progress status of migration and synchronization from the migration instance node and displays it on the front-end page.

[0115] Step 9) Data migration is complete and the task is completed.

[0116] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned 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 does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can 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 to be 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.

[0117] Based on the same inventive concept, the embodiment of the present application also provides a database access device for implementing the database access method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more database access device embodiments provided below can refer to the limitations on the database access method above, and will not be repeated here.

[0118] In an exemplary embodiment, Figure 6 As shown, a database access device is provided, including: a request receiving module 602, a proxy node determining module 604, a proxy module 606 and a data sending module 608, wherein:

[0119] A request receiving module 602, configured to receive a database access request and determine a target private data server based on the database access request;

[0120] The proxy node determination module 604 is used to determine the proxy migration instance node corresponding to the target private data server;

[0121] The proxy module 606 is used to forward the database access request to the proxy migration instance node, so that the proxy migration instance node forwards the database access request to the target private data server; receive the response result forwarded by the proxy migration instance node; the response result is returned to the proxy migration instance node by the target private data server in response to the database access request;

[0122] The data sending module 608 is used to return the response result to the sender of the database access request;

[0123] Among them, the console node and the proxy migration instance node are working nodes used for data migration in the public cloud.

[0124] In the above-mentioned database access method, apparatus, computer equipment, computer-readable storage medium and computer program product, upon receiving a database access request, the console node determines the target private data server based on the database access request, determines the proxy migration instance node corresponding to the target private data server, forwards the database access request to the target private data server through the proxy migration instance node, and receives the response result of the target private data server through the proxy migration instance node. By introducing the proxy migration instance node, the console node realizes database access to the target data server, and there is no need to purchase an elastic public network IP address specifically for the console node to communicate directly with the private data server, thereby reducing the cost of communication between the console node and the private data server.

[0125] In one embodiment, the proxy node determination module 604 is further used to: obtain a proxy relationship table; if the proxy relationship table contains a target migration instance node associated with the target private server, determine the target migration instance node as the proxy migration instance node corresponding to the target private data server.

[0126] In one embodiment, the proxy node determination module 604 is further used to: if there is no target migration instance node associated with the target private server in the proxy relationship table, obtain the current migration instance node; and determine the current migration instance node as the proxy migration instance node corresponding to the target private data server.

[0127] In one embodiment, the proxy module 606 is also used to: forward the database access request to the proxy migration instance node through a first communication connection, so that the proxy migration instance node forwards the database access request to the target private data server through a second communication connection; wherein the first communication connection is a communication connection between the console node and the proxy migration instance node, and the second communication connection is a communication connection between the proxy migration instance node and the target private data server, and the proxy migration instance node in the second communication connection uses an elastic public IP address.

[0128] In one embodiment, the first communication connection associates a first agent process and a second agent process, the first agent process runs on a console node, the second agent process runs on an agent migration instance node, and the communication protocol between the first agent process and the second agent process is a custom protocol.

[0129] In one embodiment, the database access request includes at least one of a database object acquisition request and a configuration acquisition request, and the response result includes at least one of a database object and configuration information of the database object.

[0130] Each module in the above-mentioned database access device 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 the operations corresponding to each module.

[0131] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. 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 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 cloud data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication 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 database access method is implemented.

[0132] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part 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. The specific 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.

[0133] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0134] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0135] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0137] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method 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 the present application can include at least one of non-volatile memory 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), magnetic 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, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0138] The technical features of the above embodiments may be combined arbitrarily. 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 application.

[0139] 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 database access method, characterized in that: The method is applied to a console node, and the method comprises: receiving a database access request, and determining a target private data server based on the database access request; Determine the proxy migration instance node corresponding to the target private data server; forwarding the database access request to the proxy migration instance node, so that the proxy migration instance node forwards the database access request to the target private data server; receiving a response result forwarded by the proxy migration instance node; the response result is returned by the target private data server to the proxy migration instance node in response to the database access request; Returning the response result to the sender of the database access request; The console node and the proxy migration instance node are working nodes used for data migration in the public cloud.

2. The method according to claim 1, characterized in that The determining the proxy migration instance node corresponding to the target private data server includes: Get the proxy relationship table; If the proxy relationship table contains a target migration instance node associated with the target private server, the target migration instance node is determined as the proxy migration instance node corresponding to the target private data server.

3. The method according to claim 2, characterized in that The method further comprises: If the target migration instance node associated with the target private server does not exist in the proxy relationship table, obtaining the current migration instance node; The current migration instance node is determined as the proxy migration instance node corresponding to the target private data server.

4. The method according to claim 1, characterized in that: The step of forwarding the database access request to the proxy migration instance node so that the proxy migration instance node forwards the database access request to the target private data server includes: forwarding the database access request to the proxy migration instance node through the first communication connection, so that the proxy migration instance node forwards the database access request to the target private data server through the second communication connection; Among them, the first communication connection is the communication connection between the console node and the agent migration instance node, the second communication connection is the communication connection between the agent migration instance node and the target private data server, and the agent migration instance node in the second communication connection uses an elastic public IP address.

5. The method according to claim 4, characterized in that The first communication connection is associated with a first agent process and a second agent process, the first agent process runs on a console node, the second agent process runs on an agent migration instance node, and the communication protocol between the first agent process and the second agent process is a custom protocol.

6. The method according to any one of claims 1 to 5, characterized in that The database access request includes at least one of a database object acquisition request and a configuration acquisition request, and the response result includes at least one of a database object and configuration information of a database object.

7. A database access device, characterized in that: The device comprises: A request receiving module, used to receive a database access request and determine a target private data server based on the database access request; An agent node determination module, used to determine the agent migration instance node corresponding to the target private data server; The proxy module is used to forward the database access request to the proxy migration instance node, so that the proxy migration instance node forwards the database access request to the target private data server; receive a response result forwarded by the proxy migration instance node; the response result is returned by the target private data server to the proxy migration instance node in response to the database access request; A data sending module, used for returning the response result to the sender of the database access request; The console node and the proxy migration instance node are working nodes used for data migration in the public cloud.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. 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 any one of claims 1 to 6 are implemented.

10. 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 any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method for realizing cluster sharing type public cloud load balancing

    CN111638957A

  • Node autonomous method, system and device of node cluster and electronic equipment

    CN112035215A

  • PaaS service data processing method and device, equipment and storage medium

    CN112243036A

  • Database migration method and device, equipment and medium

    CN112256676A

  • Cross-cloud data access method and device under hybrid cloud architecture

    CN113452592A

Cited By

  • Cross-resource-pool cloud database access method and device and computer equipment

    CN121585734A