Database access method, apparatus, device, storage medium, and program product
By introducing a proxy to migrate instance nodes in the public cloud, and forwarding communication between the console node and the private data server, the problems of high communication costs and security risks in the traditional method are solved, achieving lower cost and higher security for database access.
Patent Information
- Application Number
- CN202411749548.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2044-12-02
AI Technical Summary
Traditional methods of communication between cloud databases and private databases require the pre-purchase of elastic public IP addresses, resulting in high communication costs and security risks.
By introducing proxy migration instance nodes in the public cloud, communication between the console node and the private data server is forwarded through the proxy migration instance nodes, avoiding direct communication between the console node and the private data server. Only an elastic public IP address needs to be bound to the proxy migration instance nodes.
It reduces the communication cost between the console node and the private data server, improves data security, and prevents the console node from being directly exposed to the public network.
Smart Images

Figure CN119646076B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a database access method and device, equipment, storage medium and program product. BACKGROUND
[0002] With the development of cloud computing technology, cloud database has become an ideal choice for storing enterprise data. Enterprises can achieve more secure and efficient data management and sharing by migrating data from private databases to cloud databases. Data migration from private databases to cloud databases is usually implemented through console nodes and agent migration instance nodes deployed in public clouds. Before starting a data migration task, the console node usually needs to access the private database in response to a user request, such as obtaining a response result, and thus needs to communicate between the console node and the private data server corresponding to the private database.
[0003] A traditional way of realizing communication between the console node and the private data server is that a cloud service provider pre-purchases elastic public IP addresses and binds the purchased elastic public IP addresses to the console node, so that the console node bound with the elastic public IP addresses can establish a communication connection with the private data server. This way results in high communication cost between the console node and the private data server. SUMMARY
[0004] Therefore, it is necessary to provide a database access method and device, computer equipment, computer readable storage medium and computer program product capable of reducing communication cost in view of 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 the method comprises:
[0006] receiving a database access request, determining a target private data server based on the database access request;
[0007] determining an agent migration instance node corresponding to the target private data server;
[0008] forwarding the database access request to the agent migration instance node, so that the agent migration instance node forwards the database access request to the target private data server;
[0009] receiving a response result forwarded by the agent migration instance node; the response result is returned by the target private data server to the agent migration instance node in response to the database access request;
[0010] returning the response result to a sender of the database access request;
[0011] The control console node and the proxy migration instance node are working nodes for data migration in a public cloud.
[0012] In an embodiment, the determining the proxy migration instance node corresponding to the target private data server comprises:
[0013] obtaining a proxy relationship table;
[0014] If the proxy relationship table exists the 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 an embodiment, the method further comprises:
[0016] If the proxy relationship table does not exist the target migration instance node associated with the target private server, a current migration instance node is obtained;
[0017] The current migration instance node is determined as the proxy migration instance node corresponding to the target private data server.
[0018] In an 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, comprises:
[0019] The database access request is forwarded 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;
[0020] The first communication connection is a communication connection between the control 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. The proxy migration instance node uses an elastic public network IP address in the second communication connection.
[0021] In an embodiment, the first communication connection is associated with a first proxy process and a second proxy process. The first proxy process runs on the control console node, and the second proxy process runs on the proxy migration instance node. A communication protocol between the first proxy process and the second proxy process is a custom protocol.
[0022] In an embodiment, the database access request comprises at least one of a database object obtaining request and a configuration obtaining request, and the response result comprises at least one of a database object and configuration information of the database object.
[0023] In a second aspect, the present application also provides a database access apparatus, the apparatus comprising:
[0024] a request receiving module configured to receive a database access request, and determine a target private data server based on the database access request;
[0025] a proxy node determining module configured to determine a proxy migration instance node corresponding to the target private data server;
[0026] a proxy module configured 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, and receive a response result forwarded by the proxy migration instance node, wherein 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 configured to return the response result to a sender of the database access request;
[0028] wherein the console node and the proxy migration instance node are working nodes for data migration in a public cloud.
[0029] In a third aspect, the present application also provides a computer device comprising 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 also provides a computer readable storage medium, which stores a computer program, and 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 comprising a computer program, and the computer program implements the steps of the above method when executed by a processor.
[0032] The database access method, device, computer device, computer readable storage medium and computer program product, the console node receives the database access request, 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. Through the introduction of the proxy migration instance node, the database access of the console node to the target data server is realized, and a special elastic public network IP address used for direct communication with the private data server does not need to be purchased for the console node, thereby reducing the communication cost between the console node and the private data server. BRIEF DESCRIPTION OF DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the description of the embodiments of the present application or the related art will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other related drawings can be obtained by those skilled in the art without creative labor.
[0034] Figure 1 The application environment diagram of the file storage adjustment method in an embodiment;
[0035] Figure 2 The flowchart of the file storage adjustment method in an embodiment;
[0036] Figure 3 The schematic diagram of the self-defined protocol in an embodiment;
[0037] Figure 4 The flowchart of the file storage adjustment method in another embodiment;
[0038] Figure 5 The schematic diagram of the migration service system in an embodiment;
[0039] Figure 6 The structural block diagram of the file storage adjustment device in an embodiment;
[0040] Figure 7 The internal structure diagram of the computer device in an embodiment. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the 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 by the embodiments of the present application can be applied to the application environment as shown in Figure 1 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 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 executed by the terminal 102, the console node 104 and the proxy migration instance node 106, for example, the console node 104 receives the database access request sent by the terminal 102, determines the target private data server 108 based on the database access request, determines the proxy migration instance node 106 corresponding to the target private data server 108, and 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 the 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 (terminal 102) of the database access request, 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 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things device can be a smart speaker, a smart television, a smart air conditioner, a smart vehicle device, a projection device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The console node 104 and the proxy migration instance node 106 can be cloud servers providing cloud computing services.
[0044] In an exemplary embodiment, as shown in Figure 2 A file storage adjustment method is provided, which is applied to the console node 104 in Figure 1 for example, and includes the following steps S202 to S210. Wherein:
[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 is a request for data retrieval, modification, management, or other forms of interaction with a 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 a private database of an enterprise.
[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 the console node. The console node analyzes the database access request after receiving the database access request, obtains an analysis result, and determines the target private data server to be accessed by the database access request based on the analysis result.
[0048] In an embodiment, the database access request carries server information. The console node extracts the server information from the analysis result and determines the target private data server to be accessed by the database access request based on the server information. The server information can be a server identifier, a domain name, an IP address of the server, or a port number.
[0049] S204, determining a proxy migration instance node corresponding to the target private data server.
[0050] Specifically, after determining the target private data server, the control node can also find 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, 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.
[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 a corresponding database operation in response to the database access request, obtains a processing result, and returns the processing result as a response result to the proxy migration instance node.
[0053] S208, receiving the 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] The console node and the proxy migration instance node are working nodes 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, the console node receives the database access request, 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, receives the response result of the target private data server through the proxy migration instance node, and realizes the database access of the console node to the target data server by introducing the proxy migration instance node. The console node does not need to purchase a special elastic public network IP address for direct communication with the private data server, thereby reducing the communication cost between the console node and the private data server.
[0058] In one embodiment, the process of determining the proxy migration instance node corresponding to the target private data server by the console node includes the following steps: obtaining a proxy relationship table; if the proxy relationship table exists 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] The proxy relationship table is used to store the proxy mapping relationship. The proxy mapping relationship can be a corresponding relationship between the server information of the private data server and the node information of the migration instance node. The server information can be a server identifier, a domain name, or an IP address and a port number of the server. The node information can be a node identifier, or an IP address and a port number of the node.
[0060] Specifically, after determining the target private data server, the console node can obtain the stored proxy relationship table and search for the node information corresponding to the server information in the proxy relationship table. If the node information corresponding 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, the IP address and port number of the target private data server are looked up in the proxy relationship table. If the IP address and port number corresponding 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 automatic lookup process reduces the time for manual configuration and search and improves operation efficiency.
[0063] In one embodiment, the process in which the console node determines the proxy migration instance node corresponding to the target private data server further includes the following steps: if there is no target migration instance node associated with the target private server in the proxy relationship table, a current migration instance node is obtained; and the current migration instance node is determined as the proxy migration instance node corresponding to the target private data server.
[0064] The current migration instance node is created in response to an instance creation operation triggered by a user on a cloud service management page before the database access request is received.
[0065] Specifically, after the console node determines the target private data server, the stored proxy relationship table can be obtained, and the server information of the target private data server is looked up in the proxy relationship table. If the node information corresponding to the server information is found in the proxy relationship table, the node information of the current migration instance node is obtained, a corresponding relationship between the node information of the current migration instance node and the server information of the target private data server is established, the corresponding relationship 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, the IP address and port number of the target private data server are looked up in the proxy relationship table. If the IP address and port number corresponding to the IP address and port number of the server are not found in the proxy relationship table, the IP address and port number of the current migration instance node are obtained, a corresponding relationship 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 is established, the corresponding relationship 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 embodiments, when there is no pre-defined 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 migration instance nodes according to actual needs, resources can be more efficiently utilized, and resource idling or over-investment can be avoided.
[0068] In one embodiment, the process in which the console forwards 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 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] The first communication connection is a communication connection between the console node and the proxy migration instance node, and can be a TCP (Transmission Control Protocol) connection. The second communication connection is a communication connection between the proxy migration instance node and the target private data server, and can be a TCP (Transmission Control Protocol) connection. The proxy migration instance node uses an elastic public IP address in the second communication connection. The elastic public IP address (Elastic IP or EIP) is a function provided in cloud computing services, which allows users to dynamically assign a public IP address to any virtual machine or other cloud resource in the same geographic region.
[0070] It should be noted that, in data migration from a private database to a cloud database, the data migration is usually implemented through a console node and a proxy migration instance node deployed in a public cloud. Before starting the data migration task, the console node usually needs to access the private database in response to a user request, such as obtaining a response result, etc. Therefore, communication between the console node and the private data server corresponding to the private database is required. During data migration, the proxy migration instance node also needs to communicate with the private data server corresponding to the private database. In a traditional scheme, the console node communicates with the private data server by pre-purchasing an elastic public IP address and binding the purchased elastic public IP address to the console node, so that the console node bound with the elastic public IP address can establish a communication connection with the private data server. The migration instance node communicates with the private data server by pre-purchasing an elastic public IP address and binding the purchased elastic public IP address to the migration instance node, so that the migration instance node bound with 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 realize communication between the console node and the private data server, and communication between the migration instance node and the private data server.
[0071] In the scheme provided in the application, only one elastic public IP address needs to be purchased and bound to the proxy migration instance node, so that the second communication connection between the migration instance node and the target private data server can be established based on the elastic public IP address. When the console node needs to communicate with the target private data server, the database access request sent by the console node to the proxy migration instance node through the first communication connection between the console node and the proxy migration instance node can be forwarded by the proxy migration instance node to the target private data server through the second communication connection between the proxy migration instance node and the target private data server, so as to realize the communication between the console node and the target private data server. Therefore, it is not necessary to purchase an elastic public IP address for the console node to directly communicate 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 preset 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, which will cause a security risk to the preset area. The scheme provided in the application does not need to bind the console node to the elastic public IP address, thereby avoiding the direct exposure of the console node to the public network, and improving the data security.
[0072] In one embodiment, the first communication connection is associated with the first proxy process and the second proxy process, the first proxy process runs on the console node, and the second proxy process runs on the proxy migration instance node. The communication protocol between the first proxy process and the second proxy process is a custom protocol.
[0073] The first proxy process can be specifically an Api-Server deployed on the console node, and the second proxy process can be specifically an Api-Bridge deployed on the proxy migration instance node.
[0074] The custom protocol refers to a network communication protocol designed for specific applications or needs. The custom protocol in the embodiment of the application can be specifically a protocol designed for the database access request proxy forwarding scenario, and can specifically include Figure 3The illustrated protocol fields, 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, used to distinguish different request and response messages, the message ID in the embodiment of the application can be a timestamp of the message sending time; the identification of the message length is "Len", with a length of 4 bytes, which can represent the total length of the entire message (including the message ID, message length, request side, response side, data content, etc.), or can only represent the length of the data content; the identification of the request initiator is "ReqId", with a length of 6 bytes, which identifies the unique ID of the request initiator; the identification of the response initiator is "ResId", with a length of 6 bytes, which identifies the unique ID of the response initiator; the identification of the data content is "Data", with a length of any length as required, which can be specified by the Len field in front, and different lengths of data can be flexibly transmitted, which is the actual data part, which can be the data information that needs to be proxy forwarded.
[0075] Specifically, after receiving the database access request, the console node re-encapsulates the database request based on the custom protocol through the Api-Server of the console node, obtains the re-encapsulated database access request, and sends the re-encapsulated 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, and 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, and 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, the first proxy process and the second proxy process are used to run on the console node and the proxy migration instance node respectively, and are connected through the custom communication protocol. The custom protocol can be optimized according to specific application requirements and network environment. Developing and using the custom communication protocol can reduce the dependence on third-party solutions, thereby reducing the cost. Through more effective protocol design, the bandwidth and storage requirements can be reduced, and the infrastructure cost can be reduced.
[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 can be a table, a trigger, an event, or the like, and the configuration information of the database object refers to migration configuration information of the database object, which can be migration configuration information of a target database object in the plurality of database objects.
[0079] For example, the user can trigger a database object acquisition operation on the 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 page. The user can select a target database object that the user wants to migrate 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 for the user to 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 through the proxy migration instance node, and there is no need to purchase a special elastic public network IP address for the console node to directly communicate with the private data server, thereby reducing the cost of communication between the console node and the private data server.
[0081] In one embodiment, as Figure 4 shown, a database access method is also provided. The method is applied to the console node 104 in Figure 1 for example, and 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, determining a 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 a database object forwarded by the proxy migration instance node; the database object is returned by the target private data server to the proxy migration instance node in response to the database object acquisition request.
[0086] S410, returning the database object to the sender of the database access request.
[0087] S412, receive a configuration information acquisition request of a target database object; the target database object is selected by a user from among database objects.
[0088] S414, forward the configuration information acquisition request of the target database object to a proxy migration instance node, so that the proxy migration instance node forwards the configuration information acquisition request of the target database object to a target private data server.
[0089] S416, receive 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 by the target private data server to the proxy migration instance node in response to the acquisition request.
[0090] S418, return the configuration information of the target database object to the sender of the configuration information acquisition request of the target database object.
[0091] The control console node and the proxy migration instance node are working nodes for data migration in the public cloud.
[0092] The application further provides an application scenario applying the above-mentioned database access method, which is implemented by a migration service system as shown in the drawings. Figure 5 The migration service system is deployed in a public cloud, which is divided into a nationwide area, a preset area, and a VPC area, and they are components of multiple resource pools. The nationwide area is shared among the resource pools, and each resource pool corresponds to a preset area and multiple VPC areas. The network between the nationwide area and the preset area or between the preset area and the VPC area in the same resource pool is naturally connected. A control console node is installed in each preset area of a resource pool to manage all data migration instances under the resource pool. A migration instance node is deployed in a corresponding VPC area for each data migration instance to perform data migration operations. An Api-Server process is started on the machine where the control console node is located for network forwarding, and an Api-Bridge process is started on the machine where each data migration instance is located for network forwarding. Figure 5 The migration service system implements the above-mentioned database access method including the following steps:
[0093] 1. The nationwide area front-end page sends an HTTP request to the preset area control console node to request a source database object. The request contains the IP and port information of the source database.
[0094] 2. The control console node acquires the IP and port after the proxy according to the IP and port of the source database:
[0095] (1) By sending a request to the Api-Server, the IP and port after proxying are obtained using the IP and port of the source database. If successful, the IP and port after proxying are returned. If not, the next step is performed.
[0096] (2) According to the ID of the current data migration instance, the IP and port of the machine where the migration instance node is located are obtained.
[0097] (3) Notify the 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. In this stage, the Api-Server establishes a TCP connection with the Api-Bridge and returns the IP and port after proxying. At the same time, the Api-Server listens to port 3900 for the console node. At the same time, the Api-Bridge establishes a TCP long connection with the source database as a client.
[0098] 3. The console node uses the proxying URL to perform 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. The Api-Bridge sends the received data request to the source database.
[0101] 6. The source database sends the query result as a response to the Api-Bridge.
[0102] 7. The Api-Bridge sends the query result as a response to the Api-Server.
[0103] 8. The Api-Server sends the query result as a response to the console node.
[0104] 9. The console node sends the query result as a response to the front end.
[0105] The application also provides an application scenario, which can be a data migration scenario of migrating a self-built database MySQL to a cloud database MySQL RDS. The application scenario applies the above database access method and includes the following steps:
[0106] Step 1) The user binds a public IP for the self-built database MySQL.
[0107] Step 2) The user opens a data transmission service instance, and the console creates a machine as a migration instance node accordingly. The machine is in the same VPC as the cloud database MySQL RDS, and a public network EIP is also 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 pulls up 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 transmission service instance through the page. After filling in the connection information of the source database and the target database, the page displays the database objects of the source database. At this time, the page sends an HTTP request to the console. After receiving the request, the console queries the self-built database of the source database through Api-Server and Api-Bridge to obtain the database objects and returns 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 enters the next step of pre-checking.
[0111] Step 6) The console needs to pre-check the related configurations of the source database. At this time, the console also
[0112] queries the self-built database through Api-Server and Api-Bridge to obtain the database-related configurations.
[0113] Step 7) After the user completes the creation of the migration task, the user starts the migration task. 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 internal network IP.
[0114] Step 8) The console regularly obtains the migration and synchronization progress status from the migration instance node and displays it to the front-end page.
[0115] Step 9) Data migration is complete, and the task is over.
[0116] It should be understood that although each step in the flowchart involved in each embodiment as described above is shown in sequence according to the arrow, these steps are not necessarily executed in the order indicated by the arrow. Unless otherwise specified herein, there is no strict order limitation for the execution of these steps, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or multiple stages, which 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 sequential, but can be alternately executed with at least part of other steps or steps or stages in other steps.
[0117] Based on the same inventive concept, the embodiments of the present application also provide a database access device for implementing the above-mentioned database access method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more database access device embodiments provided below can refer to the limitations of the database access method described above, which will not be repeated here.
[0118] In one exemplary embodiment, as shown in Figure 6 A database access device is provided, comprising: a request receiving module 602, a proxy node determining module 604, a proxy module 606, and a data sending module 608, wherein:
[0119] The request receiving module 602 is configured to receive a database access request, and determine a target private data server based on the database access request;
[0120] The proxy node determining module 604 is configured to determine a proxy migration instance node corresponding to the target private data server;
[0121] The proxy module 606 is configured 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; and the response result is returned by the target private data server to the proxy migration instance node in response to the database access request;
[0122] The data sending module 608 is configured to return the response result to a sender of the database access request;
[0123] The console node and the proxy migration instance node are working nodes for data migration in a public cloud.
[0124] The database access method, device, computer equipment, computer readable storage medium and computer program product, the console node receives the database access request, 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 database access of the target data server by the console node is realized, and a special elastic public network IP address used for direct communication with the private data server does not need to be purchased for the console node, thereby reducing the communication cost between the console node and the private data server.
[0125] In one embodiment, the proxy node determination module 604 is further configured to: obtain a proxy relationship table; and if the target migration instance node associated with the target private server exists in the proxy relationship table, 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 configured to: if the target migration instance node associated with the target private server does not exist in the proxy relationship table, obtain a 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 further configured to: forward 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; wherein the first communication connection is a communication connection between the console node and the proxy migration instance node, 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 uses an elastic public network IP address in the second communication connection.
[0128] In one embodiment, the first communication connection is associated with a first proxy process and a second proxy process, the first proxy process runs on the console node, the second proxy process runs on the proxy migration instance node, and the communication protocol between the first proxy process and the second proxy 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] The modules in the database access apparatus can be implemented by software, hardware, or a combination thereof. The modules can be embedded in or independent of a processor in a computer device in hardware form, or stored in a memory in a computer device in software form, so as to be invoked and executed by a processor to perform operations corresponding to the modules.
[0131] In an example embodiment, a computer device, which can be a server, has an internal structure as shown in Figure 7 The computer device includes a processor, a memory, an input / output interface, and a communication interface. 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. The processor of the computer device is configured 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 running the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store cloud data. The input / output interface of the computer device is configured to exchange information between the processor and external devices. The communication interface of the computer device is configured to communicate with terminals outside through a network connection. The computer program is executed by the processor to implement a database access method.
[0132] Those skilled in the art can understand that Figure 7 The structure shown in the above
[0133] In an example embodiment, a computer device is provided, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0134] In an example embodiment, a computer readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the steps in the above method embodiments.
[0135] In an example embodiment, a computer program product is provided, which includes a computer program. The computer program is executed by a processor to implement the steps in the above method embodiments.
[0136] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant regulations.
[0137] It can be understood by those skilled in the art that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program. 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 above-mentioned embodiments of each method. In the embodiments provided in the present application, any reference to memory, database or other medium 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 storage, 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 but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., without being limited thereto.
[0138] Any technical features in the above embodiments can be combined, and for the sake of brevity, not all possible combinations are described above, however, any combination of these technical features is deemed to be within the scope of the present application.
[0139] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the patent scope of the present application. It should be pointed out that, for ordinary skilled persons in the art, several modifications 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 should be subject to the appended claims.
Claims
1. A database access method, characterized by, The method is applied to a console node, and the method comprises: receiving a database access request, 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 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; the first communication connection is a communication connection between the console node and the proxy migration instance node, 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 uses a flexible public network IP address in the second communication connection; 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 a sender of the database access request; wherein the console node and the proxy migration instance node are working nodes for data migration in a public cloud.
2. The method of claim 1, wherein, The determination of the proxy migration instance node corresponding to the target private data server comprises: obtaining a proxy relationship table; if the target migration instance node associated with the target private data server exists in the proxy relationship table, determining the target migration instance node as the proxy migration instance node corresponding to the target private data server.
3. The method of claim 2, wherein, The method further comprises: if the target migration instance node associated with the target private data server does not exist in the proxy relationship table, obtaining a current migration instance node; determining the current migration instance node as the proxy migration instance node corresponding to the target private data server.
4. The method of claim 1, wherein, The first communication connection is associated with a first proxy process and a second proxy process, the first proxy process runs in the console node, the second proxy process runs in the proxy migration instance node, and the communication protocol between the first proxy process and the second proxy process is a custom protocol.
5. The method according to any one of claims 1 to 4, characterized in that, The database access request comprises at least one of a database object acquisition request and a configuration acquisition request, and the response result comprises at least one of a database object and configuration information of the database object.
6. A database access apparatus characterized by comprising: The apparatus comprises: a request receiving module configured to receive a database access request and determine a target private data server based on the database access request; a proxy node determining module configured to determine a proxy migration instance node corresponding to the target private data server; The agent module is configured 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; 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; the proxy migration instance node uses an elastic public network IP address in the second communication connection; the response result forwarded by the proxy migration instance node is received; the response result is returned by the target private data server to the proxy migration instance node in response to the database access request; The data sending module is configured to return the response result to the sender of the database access request. The console node and the proxy migration instance node are working nodes for data migration in a public cloud.
7. The apparatus of claim 6, wherein, The proxy node determination module is further configured to: obtain an agent relationship table; if the agent relationship table exists a target migration instance node associated with the target private data server, the target migration instance node is determined as the proxy migration instance node corresponding to the target private data server.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, The processor executes the computer program to realize the steps of the method in any one of claims 1 to 5.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the method in any one of claims 1 to 5.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the method in any one of claims 1 to 5. The computer program is executed by the processor to realize the steps of the method in any one of claims 1 to 5.
Citation Information
Patent Citations
Cross-cloud data access method and device under hybrid cloud architecture
CN113452592A