Migration method, system, server and storage medium of database

By inserting a proxy service point and modifying its target address during the database migration process, the backend service interruption caused by database migration was resolved, achieving seamless migration and business continuity, and reducing the risk of downtime.

CN114116671BActive Publication Date: 2025-11-21SHENZHEN TCL NEW-TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111426243.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-25
Publication Date
2025-11-21
Estimated Expiration
2041-11-25

AI Technical Summary

Technical Problem

Migrating existing databases requires interrupting backend services, leading to prolonged downtime and uncontrollable risks, especially in environments with large data volumes or multiple services.

Method used

By inserting a proxy service point between the backend application and the database, and modifying the target address of the proxy service point to achieve database migration, the strong association between the application and the database is avoided. Different access methods are used to configure the proxy service point to adapt to different environments.

Benefits of technology

It enables uninterrupted application data writing during database migration, minimizing business downtime losses and improving the flexibility and applicability of the migration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114116671B_ABST
    Figure CN114116671B_ABST
Patent Text Reader

Abstract

The application discloses a database migration method, system, server and storage medium, and the method comprises the following steps: in response to a data migration instruction, a target address is acquired; configuration information of a proxy service point is modified according to the target address; the proxy service point is controlled to run according to the modified configuration information, and business data of an application is written into a target database corresponding to the target address; and the connection between the application and the database is guided to the proxy service point through the proxy service point, so that the strong association between the application and the database is broken, the migration of the database is completed only by modifying the proxy target address of the proxy service point, the business of the application does not need to be interrupted, and the loss caused by interrupting the application is reduced to the maximum extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and specifically to a database migration method, system, server, and storage medium. Background Technology

[0002] When existing databases undergo changes, business systems often need to be shut down to support these changes. This is especially true when a database needs to be migrated, requiring backend services to be shut down to interrupt the writing of new data, migrate the data from the old database to a new database instance, modify the database connection configuration of the backend services, and then restart the backend services to complete the database migration. However, when the database contains tens or hundreds of gigabytes of data or dozens of backend services are using the same database simultaneously, the downtime for database migration can often exceed several hours, and the risks associated with the migration are often uncontrollable. Summary of the Invention

[0003] This invention provides a database migration method, system, server, and storage medium to solve the problem of needing to interrupt (restart) backend services after the database migration process.

[0004] On one hand, embodiments of this application provide a database migration method, the method comprising:

[0005] Respond to the data migration command and obtain the target address;

[0006] Modify the configuration information of the proxy service point according to the target address;

[0007] The proxy service point is controlled to run according to the modified configuration information, and the application's business data is written into the target database corresponding to the target address.

[0008] In some embodiments of this application, before obtaining the target address in response to the data migration instruction, the method includes:

[0009] Obtain the access method between the database and the application;

[0010] Configure the proxy service point according to the access method described above;

[0011] Control the proxy service point to connect to the application through the access method.

[0012] In some embodiments of this application, configuring the proxy service point according to the access method includes:

[0013] If the access method is the first access method, then obtain the port address of the database and the modified port address;

[0014] Set the modified port address as the proxy target address of the proxy service point, and set the port address as the proxy port address of the proxy service point;

[0015] Restart the proxy service point to complete its configuration.

[0016] In some embodiments of this application, configuring the proxy service point according to the access method includes:

[0017] If the access method is the second access method, then obtain the initial domain name address of the database;

[0018] Set the initial domain name address as the proxy target address of the proxy service point;

[0019] Control the start of the proxy service point and complete the configuration of the proxy service point.

[0020] Send the proxy domain name address of the proxy service point to the application.

[0021] In some embodiments of this application, after controlling the proxy service point to connect to the application via the access method, the method includes:

[0022] Receive the access request initiated by the application;

[0023] Access the database according to the access request and perform data processing;

[0024] Based on the data processing results, an access feedback is sent to the application.

[0025] In some embodiments of this application, before obtaining the target address in response to a data migration instruction, the method includes:

[0026] Respond to data synchronization commands and obtain the amount of data in the database;

[0027] If the data volume is greater than a preset data volume threshold, a request to establish a database slave node is issued, the target address of the database slave node is obtained, the data synchronization instruction is modified according to the target address, and the modified data synchronization instruction is sent to the database.

[0028] If the amount of data is less than or equal to a preset data amount threshold, then the data synchronization instruction is sent to the database;

[0029] If the data synchronization of the database is completed, a data migration request is issued.

[0030] In some embodiments of this application, modifying the configuration information of the proxy service point according to the target address includes:

[0031] Set the target address as the new proxy target address for the proxy service point;

[0032] The step of controlling the proxy service point to run according to the modified configuration information and writing the application's business data into the target database corresponding to the target address includes:

[0033] Access the new proxy target address and connect to the target database corresponding to the target address;

[0034] In response to the application's access request, the business data sent by the application is written to the target database.

[0035] On the other hand, embodiments of this application provide a database migration system, the database migration system comprising:

[0036] Agent service points, databases, target databases, and applications;

[0037] The proxy service points are connected to the database and the application, respectively.

[0038] The proxy service point is used to respond to data migration instructions and obtain the target address;

[0039] The proxy service point is used to modify the configuration information of the proxy service point according to the target address;

[0040] The proxy service point is used to control the proxy service point to run according to the modified configuration information, disconnect from the database, establish a connection with the target database, and write the application's business data into the target database corresponding to the target address.

[0041] On the other hand, embodiments of this application provide a server, including a memory and a processor; the memory stores an application program, and the processor is used to run the application program in the memory to perform operations in the database migration method.

[0042] On the other hand, embodiments of this application provide a storage medium storing a plurality of instructions adapted for loading by a processor to execute the steps in the database migration method.

[0043] This invention responds to a data migration command, obtains a target address, modifies the configuration information of a proxy service point based on the target address, controls the proxy service point to operate according to the modified configuration information, and writes the application's business data into the target database corresponding to the target address. Through the proxy service point, the connection between the application and the database is redirected to the proxy service point, eliminating the strong association between the application and the database. Database migration is completed simply by modifying the proxy target address of the proxy service point, without interrupting the application's business operations, thus minimizing the business losses caused by application interruption. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a schematic diagram of an embodiment of the LAMP / LNMP-based application architecture provided in this application.

[0046] Figure 2 This is a schematic diagram of another embodiment of the LAMP / LNMP-based application architecture provided in this application.

[0047] Figure 3 This is a schematic flowchart of an embodiment of the database migration method provided in this application.

[0048] Figure 4 This is a schematic flowchart of an embodiment of the database migration method provided in this application, which involves inserting a proxy service point;

[0049] Figure 5 This is a schematic flowchart of an embodiment of the database migration method provided in this application, which configures a proxy service point;

[0050] Figure 6 This is a flowchart illustrating another embodiment of the database migration method provided in this application, specifically the configuration of a proxy service point.

[0051] Figure 7 This is a schematic diagram of a data interaction process based on a proxy service point in the database migration method provided in this application embodiment;

[0052] Figure 8 This is a schematic flowchart of an embodiment of the data synchronization in the database migration method provided in this application;

[0053] Figure 9 This is a schematic diagram of another embodiment of the LAMP / LNMP-based application architecture provided in this application.

[0054] Figure 10 A schematic diagram illustrating an application scenario of the database migration method provided in this application embodiment;

[0055] Figure 11 This is a schematic diagram showing the database migration method provided in this application after the database migration is completed;

[0056] Figure 12 This is a schematic diagram of an embodiment of the database migration system provided in this application.

[0057] Figure 13 This is a schematic diagram of the structure of an embodiment of the agent service point provided in this application;

[0058] Figure 14 This is a schematic diagram of an embodiment of the server provided in this application. Detailed Implementation

[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0060] This invention provides a database migration method, apparatus, server, and storage medium. According to an embodiment of the database migration method provided in this application, it should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0061] In some embodiments of this application, the database migration method refers to data migration on a LAMP / LNMP-based application architecture. This LAMP / LNMP-based application architecture involves deploying Apache / Nginx + PHP (Java / Python) + MySQL on a Linux server. Apache / Nginx middleware serves as the front-end traffic entry point and front-end service entry point, while services implemented in dynamic languages ​​such as PHP / Java serve as back-end services. Data is persisted in MySQL. The front-end and back-end services of a LAMP / LNMP-based website / application architecture have excellent scalability; as business grows, nodes can be added horizontally to achieve expansion. For example,... Figure 1 As shown, Figure 1This is a schematic diagram of an embodiment of the LAMP / LNMP-based application architecture provided in this application. The LAMP / LNMP-based application architecture shown includes a backend application 101, a master database 102, and a slave database 103. The backend application 101 connects to both the master database 102 and the slave database 103, and is used to access the master database 102 for data writing and to access the slave database 103 for data reading. The master database 102 connects to the slave database and, based on the access from the backend application 101, stores the data written by the backend application 101 and synchronizes the written data to the slave database 103. The slave database 103 receives data sent by the master database 102 for data synchronization and responds to the access from the backend application 101, returning access feedback to enable the backend application 101 to read data. The master database 102 connects to the slave database through a Mixed BinLog format. In some embodiments of this application, such as... Figure 1 In the LAMP / LNMP-based application architecture shown, to avoid interrupting data writing to the backend application 101 during data migration, proxy services are inserted between the backend application 101 and the master database 102 and the slave database 103, respectively. Figure 2 As shown, Figure 2 This is a schematic diagram of another embodiment of the LAMP / LNMP-based application architecture provided in this application. The LAMP / LNMP-based application architecture shown is... Figure 1 The LAMP / LNMP-based application architecture shown also includes a first proxy service 201 and a second proxy service. The first proxy service 201 connects to the backend application 101 at one end, to the master database 102 at the other, and to the slave database 103 at the third end. It receives access requests from the backend application 101, writes data sent by the backend application 101 to the master database 102, and synchronizes the data to the slave database 103. The second proxy service connects to the backend application 101 at one end and to the slave database 103 at the other. It responds to access requests from the backend application 101, accesses the slave database 103 to process data according to the requests, and sends the processing results back to the backend application 101 as feedback. In some embodiments of this application, during data migration, only the target addresses of the first proxy service 201 and the second proxy service 202 are modified, allowing them to connect to new databases respectively, thus achieving data migration based on the LAMP / LNMP application architecture.

[0062] In this embodiment, proxy services are inserted between the backend application 101 and the main database 102 and the slave database 103, respectively, to eliminate the strong association between the backend application 101 and the database. Data migration based on the LAMP / LNMP application architecture is achieved by only modifying the target address of the proxy service, avoiding interruption of data writing of the backend application 101 and minimizing the loss of business caused by business downtime.

[0063] In some embodiments of this application, the method for data migration in a LAMP / LNMP-based application architecture is as follows: Figure 3 As shown, Figure 3 This is a schematic flowchart of an embodiment of the database migration method provided in this application. The database migration method shown is applied to a proxy service point, where the proxy service point refers to... Figure 2 The first proxy service 201 in the diagram illustrates a database migration method comprising steps 301 to 303:

[0064] Step 301: Respond to the data migration instruction and obtain the target address.

[0065] The target address refers to the address of the target database in the data migration process, where the target database refers to the new database to be migrated into during the data migration.

[0066] In some embodiments of this application, the data migration instruction can be sent by the database; it can also be sent by a backend server, where the backend server can be a third-party server connected to the proxy service point for monitoring the running status of the LAMP / LNMP-based application architecture; or it can be generated by the proxy service point itself, for example, the proxy service point generates the data migration instruction through its instruction module. Responding to a data migration instruction can be understood as: responding to a data migration instruction sent by the database and obtaining the target address in the data migration instruction; responding to a data migration instruction sent by the backend server and obtaining the target address in the data migration instruction; and responding to a data migration instruction issued by the instruction module in the proxy service point and obtaining the target address in the data migration instruction.

[0067] In some embodiments of this application, obtaining the target address can be achieved by accessing a database, for example, by responding to a data migration instruction, accessing the database, and querying the data transmission direction in the database to obtain the target address; it can also be achieved by obtaining the target address in the data migration instruction, for example, by responding to a data migration instruction, parsing the data migration instruction, reading the address field in the data migration instruction, and using that address field as the target address; or it can be achieved by obtaining the target address sent by the backend server, for example, by responding to a data migration instruction, accessing the backend server, sending an address query request, and obtaining the target address returned by the backend server based on the address query request.

[0068] In some embodiments of this application, obtaining the target address may also involve obtaining the target address based on the input of the proxy service point. For example, in response to a data migration instruction, an address configuration page is output, and the address information input on the address configuration page is obtained as the target address.

[0069] Step 302: Modify the configuration information of the proxy service point according to the target address.

[0070] The configuration information refers to the target address of the proxy service point.

[0071] In some embodiments of this application, step 302 includes: obtaining the domain name / hostname of the target database based on the target address; resolving the domain name / hostname of the target database to the proxy service point to modify the configuration information; and updating the proxy target address to the target address, so that the proxy service point can access the target database through the new proxy target address and establish a connection with the target database. Here, the initial domain name / hostname refers to the original database's domain name / hostname.

[0072] In some embodiments of this application, step 302 may further include obtaining the port address of the target database based on the target address, modifying the initial port address in the proxy target address to a new port address, and updating the proxy target address to the target address, so that the proxy service point can access the target database through the new proxy target address and establish a connection with the target database. Here, the initial port address refers to the port address on which the original database provides services externally.

[0073] Step 303: Control the proxy service point to run according to the modified configuration information and write the application's business data into the target database corresponding to the target address.

[0074] Application refers to Figure 1 and Figure 2 Backend application 101.

[0075] In some embodiments of this application, step 303 includes: restarting the control proxy service point, controlling the control proxy service point to run according to the new proxy target address, accessing the new proxy target address, and connecting to the target database corresponding to the target address; responding to the application's access request and writing the business data sent by the application into the target database.

[0076] This application embodiment uses a proxy service point to eliminate the strong association between the application and the database. The database migration is completed by simply modifying the proxy target address of the proxy service point, without interrupting the application data writing, thus minimizing the loss of business caused by application interruption.

[0077] In some embodiments of this application, in order to avoid interrupting application data writing during database migration, proxy service points are inserted between the application and the database before step 301 to eliminate the strong association between the application and the database. Specifically, as follows: Figure 4 As shown, Figure 4 This is a schematic flowchart of an embodiment of the database migration method provided in this application, which includes steps 401 to 403:

[0078] Step 401: Obtain the access method between the database and the application.

[0079] Access methods include fixed IP access and URL access. Fixed IP access refers to the application connecting to the database via an IP address, where the application accesses the database to write and read data. Alternatively, the application connects to the database using its domain name / hostname, and accesses the database to write and read data by resolving the domain name / hostname.

[0080] In some embodiments of this application, obtaining the access method between the database and the application can be done by accessing a backend server to obtain the access method between the database and the application, or by outputting a configuration page, obtaining configuration information input on the configuration page, and then obtaining the access method between the database and the application from the configuration information. The configuration information may include, but is not limited to, the target address of the target database, the access method between the database and the application, and the address of the database, all input by the operations and maintenance personnel based on the configuration page.

[0081] Step 402: Configure the proxy service point according to the access method and port address.

[0082] In some embodiments of this application, when the access method is fixed IP access, the proxy service point can be configured based on the port address of the database obtained. Specifically, for example... Figure 5 As shown, Figure 5 This is a schematic flowchart of an embodiment of the database migration method provided in this application, illustrating the configuration of a proxy service point, which includes steps 501 to 503:

[0083] Step 501: If the access method is the first access method, then obtain the database port address and the modified port address.

[0084] In some embodiments of this application, the first access method refers to access via a fixed IP address.

[0085] In some embodiments of this application, if the access method is the first access method, in order for the proxy service point to connect with the database and the application, the proxy service point needs to be set up on the same server as the database. Since the application and the database connect through the port address on which the database provides services externally, the exposed port of the proxy service point needs to be set to the port address on which the database provides services externally, so that the proxy service point can connect with the application. However, since the proxy service point and the database are deployed on the same server, to avoid address conflicts caused by port address occupancy, the port address of the database on the server needs to be modified. For example, if the port address on which the database provides services externally is 3306, the database port address needs to be changed to 3307.

[0086] In some embodiments of this application, the method for obtaining the database port address and the modified port address is similar to the method for obtaining the access method in step 401, and will not be described again here.

[0087] Step 502: Set the modified port address as the proxy target address of the proxy service point, and set the port address as the proxy port address of the proxy service point.

[0088] A proxy port address refers to the port exposed by the proxy service point, used to connect with nodes for data interaction. Nodes include, but are not limited to, servers, applications, and terminals, with terminals including mobile terminals, virtual terminals, and fixed terminals. In some embodiments of this application, the proxy port address is used to connect with… Figure 1 and Figure 2 The backend application 101 connects to the network for data interaction.

[0089] In some embodiments of this application, the modified port address is set as the proxy target address of the proxy service point. The proxy service point connects to the database deployed on the same server through the proxy target address, and the port address on which the database provides services to the outside world is set as the proxy port address of the proxy service point. For example, when the port address on which the database provides services to the outside world is 3306 and the modified port address is 3307, the proxy target address of the proxy service point is set to 3307, the proxy service point connects to the database deployed on the same server through 3307, and the modified port address 3307 is set as the proxy port address of the proxy service point.

[0090] Step 503: Restart the proxy service point to complete the configuration of the proxy service point.

[0091] In some embodiments of this application, the proxy service point is restarted, and the proxy service point connects to the database according to the proxy target address to complete the configuration of the proxy service point.

[0092] In this embodiment of the application, when data interaction between the database and the application is performed via a fixed IP access method, the proxy service point and the database are deployed on the same server. By modifying the port address of the database on the server and using the port address of the database that provides services to the outside world as the port exposed by the proxy service point, the proxy service point is connected to the database, which facilitates the management of the proxy service point.

[0093] In some embodiments of this application, when the access method is URL access, the database domain name / hostname can be resolved to a proxy service point, and the proxy service point can be configured, specifically, as follows: Figure 6 As shown, Figure 6 This is a flowchart illustrating another embodiment of the database migration method provided in this application, where configuring a proxy service point includes steps 601 to 604:

[0094] Step 601: If the access method is the second access method, then obtain the initial domain name address of the database.

[0095] In some embodiments of this application, the second access method refers to URL access.

[0096] The initial domain name address of the database can be the domain name address of the server where the database is located, such as the domain name address of a cloud server, or it can be the hostname of the server where the database is located. The database can be deployed on a local server or a cloud server.

[0097] In some embodiments of this application, the method for obtaining the initial domain name address of the database may be to receive the initial domain name address of the database sent by the backend server, or to output a configuration page and obtain the domain name address input on the configuration page as the initial domain name address of the database.

[0098] In some embodiments of this application, if the access method is the second access method, the proxy service point can be deployed on a third-party server, which can be a local server or a cloud server.

[0099] Step 602: Set the initial domain name address as the proxy target address of the proxy service point.

[0100] Step 603: Start the proxy service point and complete the configuration of the proxy service point.

[0101] In some embodiments of this application, the proxy service point is started, the proxy service point resolves the proxy target address, accesses the database and establishes a database connection, and completes the configuration of the proxy service point.

[0102] Step 604: Send the proxy domain name address of the proxy service point to the application.

[0103] In some embodiments of this application, sending the proxy domain name address of the proxy service point to the application may involve accessing a database, obtaining the network address of the application connected to the database, resolving the network address, connecting to the application, and sending the proxy domain name address of the proxy service point to the application. Alternatively, sending the proxy domain name address of the proxy service point to the application may involve encapsulating the proxy domain name address of the proxy service point and the access request to generate an access command, accessing the database, and sending the access command to the database so that the database parses the access command and sends the proxy domain name address of the proxy service point and the access request in the access command to the application.

[0104] In this embodiment of the application, when data interaction occurs between the database and the application via URL access, the domain name address of the database is resolved to the proxy service point, and the proxy service point is connected to the database. This simplifies the connection method between the proxy service point and the database and improves the efficiency of the database migration method.

[0105] Step 403: Control the proxy service point to connect to the application via access method.

[0106] In some embodiments of this application, there are multiple ways to control the proxy service point to connect to the application via access methods, including, for example:

[0107] (1) When the access method is a fixed IP access method, the proxy service point restarts and receives the application's connection request through the proxy port address exposed by the proxy service point; it responds to the connection request by sending response information to the application through the proxy port address; if the application receives feedback information based on the response information again through the proxy port address within a preset time period, a connection is established with the application; if the application does not receive feedback information based on the response information again through the proxy port address within the preset time period, it waits for the application to send a connection request.

[0108] (2) When the access method is URL access, the proxy service point restarts, receives the connection request sent by the application through the communication interface, and establishes a connection with the application.

[0109] It should be noted that the above-mentioned method of connecting the proxy service point to the application is only an illustrative example, and the embodiments of this application do not limit the method of connecting the proxy service point to the application.

[0110] In some embodiments of this application, to ensure the data security of the application architecture, when a proxy service connects to the application via an access method, it performs security verification on the application. If the security verification passes, a connection is established with the application; if the security verification fails, the connection is refused. Specifically, this includes: receiving a connection request from the application; parsing the connection request; obtaining a verification code from the connection request; accessing a database to obtain a preset verification code; comparing the verification code with the preset verification code; if the verification code matches the preset verification code, the security verification is deemed successful; if the verification code does not match the preset verification code, the security verification is deemed unsuccessful.

[0111] In some embodiments of this application, when the access method is a fixed IP access method, when configuring a proxy service point, if the database restarts, the connection between the database and the application is broken. When the application detects the disconnection, it automatically seeks the address configured in the application and connects to the target port address corresponding to the configured address, thereby establishing a connection between the application and the proxy service point corresponding to that target port address. The configured address refers to the address set in the application for connecting to the database. For example, if the database's external service port address is 3306 and the modified port address is 3307, the proxy service point exposes a proxy port address of 3307. Upon restarting the proxy service point and the database, since the modified port address is 3307, while the target port address configured in the application remains 3306, the connection between the database and the application is broken. The application automatically seeks the address configured in the application and connects to the target port address 3306, thus establishing a connection with the proxy service point corresponding to that target port address 3306.

[0112] In some embodiments of this application, when the access method is a URL access method, when the application receives the access request from the proxy service point and the proxy domain name address, it modifies the configuration address according to the proxy domain name address, parses the modified configuration address, and establishes a connection with the proxy service point.

[0113] According to the embodiments of this application, the proxy target address of the proxy service point is configured according to the access method between the database and the application, and the proxy service point is inserted between the application and the database respectively to get rid of the strong association between the application and the database; and different configuration methods are provided according to different access methods to improve the applicability and flexibility of the database migration method.

[0114] In some embodiments of this application, such as Figure 2 As shown, after inserting proxy service points between the application and the database, the application and the database interact with each other through the proxy service points, specifically as follows: Figure 7 As shown, Figure 7This is a flowchart illustrating data interaction based on a proxy service point in the database migration method provided in this application embodiment. The method for data interaction based on a proxy service point includes steps 701 to 703:

[0115] Step 701: Receive the access request initiated by the application.

[0116] In some embodiments of this application, the access request includes a data write request and a data read request.

[0117] Step 702: Access the database according to the access request and perform data processing.

[0118] Data processing includes data reading and data writing.

[0119] In some embodiments of this application, the database includes a master database 102 and a slave database 103.

[0120] In some embodiments of this application, when the access request is a data write request, step 702 may be to receive the business data to be written sent by the application according to the data write request initiated by the application, access the main database 102, write the business data to be written into the main database 102, and access the slave database 103 to synchronize the business data to be written into the slave database 103.

[0121] In some embodiments of this application, when the access request is a data read request, step 702 may be to parse the data read request initiated by the application to obtain the target data identifier, access the database 103, query the database 103 according to the target data identifier, and read the target read data corresponding to the target data identifier.

[0122] Step 703: Based on the data processing results, send access feedback to the application.

[0123] In some embodiments of this application, access feedback includes write completion and data read results.

[0124] In some embodiments of this application, when the access request is a data write request, step 703 may be to detect whether the data write is complete. If the data write is complete, a write completion message is sent to the application. If the data write is not complete, the received business data is continued to be written to the main database 102 and the slave database 103.

[0125] In some embodiments of this application, when the access request is a data read request, step 703 may be to send the read target data to the application.

[0126] In some embodiments of this application, when the access request is a data reading request, step 703 may further include querying the database 103 according to the target data identifier to determine whether there is target reading data corresponding to the target data identifier in the database. If there is target reading data corresponding to the target data identifier, the target reading data is read and sent to the application. If there is no target reading data corresponding to the target data identifier, a prompt message indicating that the data does not exist is sent to the application.

[0127] In this embodiment of the application, after inserting proxy service points between the application and the database, the application and the database interact with each other through the proxy service points, thus breaking the strong association between the backend application 101 and the database, which facilitates the application's data writing without interruption during subsequent database migration.

[0128] In some embodiments of this application, after inserting proxy service points between the application and the database, a data synchronization instruction can be sent to the database so that the database can synchronize data according to the data synchronization instruction.

[0129] In some embodiments of this application, after inserting proxy service points between the application and the database, the proxy service points respond to data synchronization instructions, control the database to perform data synchronization, and issue a database migration request when data synchronization is complete, thereby migrating the database. Specifically, as shown in... Figure 8 As shown, Figure 8 This is a schematic flowchart of an embodiment of the database migration method provided in this application, showing the data synchronization method including steps 801 to 804:

[0130] Step 801: Respond to the data synchronization command and obtain the amount of data in the database.

[0131] In some embodiments of this application, a data synchronization instruction is used to instruct a database to synchronize business data in the database to a new database.

[0132] In some embodiments of this application, the data synchronization command may be sent by a backend server. Specifically, after inserting a proxy service point between the application and the database, the backend server checks whether the communication between the application and the proxy service point is normal, and also checks whether the communication between the database and the proxy service point is normal. If the communication between the application and the proxy service point is normal, and the communication between the database and the proxy service point is normal, a data synchronization command is sent to the proxy service point. If the communication between the application and the proxy service point is abnormal, and / or the communication between the database and the proxy service point is abnormal, a preset time is waited, and the communication between the application and the proxy service point, and the communication between the database and the proxy service point, is checked again to see if they have been restored. If the communication between the application and the proxy service point is restored, and the communication between the database and the proxy service point is restored, a data synchronization command is sent to the proxy service point. If the communication between the application and the proxy service point is not restored, and / or the communication between the database and the proxy service point is not restored, a reconfiguration command is sent to the proxy service point, and the proxy service point responds to the reconfiguration command to re-establish a connection with the database and the application.

[0133] In some embodiments of this application, the data synchronization instruction can also be generated by the proxy service point. Specifically, after inserting the proxy service point between the application and the database, it is detected whether the communication between the application and the database is normal. If the communication between the application and the database is normal, the control instruction module generates the data synchronization instruction. If the communication between the application and the database is abnormal, and / or the communication between the database is abnormal, the proxy service point is controlled to re-establish the connection with the database and the application.

[0134] In some embodiments of this application, obtaining the amount of data in the database can be achieved by accessing the database, obtaining the number of data bytes in the database as the amount of data, comparing the number of data bytes with a preset byte count threshold, and determining that the amount of data is greater than the preset byte count threshold if the number of data bytes is greater than the preset byte count threshold; or determining that the amount of data is less than or equal to the preset byte count threshold if the number of data bytes is less than or equal to the preset byte count threshold.

[0135] Step 802: If the data volume is greater than the preset data volume threshold, a request to establish a database slave node is issued, the target address of the database slave node is obtained, the data synchronization instruction is modified according to the target address, and the modified data synchronization instruction is sent to the database.

[0136] In some embodiments of this application, if the data volume exceeds a preset data volume threshold, it indicates that the application architecture is a large-scale architecture and the amount of data that needs to be synchronized in the database is relatively large. To avoid additional burden on the database during data synchronization, a database slave node is added as an intermediate node, such as... Figure 9 As shown, Figure 9This is a schematic diagram of another embodiment of the LAMP / LNMP-based application architecture provided in this application. The LAMP / LNMP-based application architecture shown contains... Figure 2 Based on the LAMP / LNMP-based application architecture, a database slave node 901 is added.

[0137] In some embodiments of this application, if the data volume is greater than a preset data volume threshold, a request to establish a database slave node is issued to add a database slave node to the application architecture. After the database slave node is deployed, the target address of the database slave node is obtained, the data synchronization address in the data synchronization instruction is modified to the target address, the data synchronization instruction is modified, and the modified data synchronization instruction is sent to the database so that the database executes the modified data synchronization instruction and transmits the database's business data to the database slave node corresponding to the target address.

[0138] Step 803: If the data volume is less than or equal to the preset data volume threshold, a data synchronization command is sent to the database.

[0139] In some embodiments of this application, when sending a data synchronization command or a modified data synchronization command to the database to control the database to perform data synchronization, a data migration service is initiated. This data migration service migrates business data from the database to the target database corresponding to the target address, or migrates business data from the node to the target database corresponding to the target address. The data migration service includes DTS (Data Transmission Service) or DMS (Database Migration Service).

[0140] In some embodiments of this application, when the data migration is completed, the database sends a data synchronization completion flag to the proxy service point. The proxy service point checks whether it has received the data synchronization completion flag. If it has received the data synchronization completion flag, it determines that the database data synchronization is complete. If it has not received the data synchronization completion flag, it continues to wait and receives access requests initiated by the application.

[0141] In some embodiments of this application, the proxy service point detects the progress of the data migration service, and when the data migration service is detected to be complete, it is determined that the data synchronization of the database is complete.

[0142] Step 804: If the database data synchronization is complete, a database migration request is issued.

[0143] In some embodiments of this application, if the data synchronization of the database is completed, issuing a data migration request may involve sending a database migration request to the backend server to receive a database migration instruction sent by the backend server based on the database migration request.

[0144] In some embodiments of this application, if the database data synchronization is completed, issuing a data migration request may also involve sending a database migration request to the instruction module of the proxy service point, and the instruction module of the proxy service point issuing a database migration instruction based on the database migration request.

[0145] In some embodiments of this application, it can also be determined whether to issue a request to establish a database slave node by querying the number of applications, specifically including steps a1 to a4:

[0146] Step a1: Respond to the data synchronization command and obtain the number of connected applications.

[0147] Step a2: Compare the number of applications with the preset application number threshold.

[0148] Step a3: If the number of applications is greater than or equal to the preset application number threshold, a request to establish a database slave node is issued, the target address of the database slave node is obtained, the data synchronization instruction is modified according to the target address, and the modified data synchronization instruction is sent to the database.

[0149] Step a4: If the number of applications is less than the preset application number threshold, a data synchronization command is sent to the database.

[0150] In this embodiment, after inserting proxy service points between the application and the database, the proxy service points respond to data synchronization commands, control the database to perform data synchronization, and before data synchronization, detect the application architecture type and design different data synchronization schemes for different application architecture types, thereby improving the diversity and flexibility of data synchronization in the database migration method and reducing the burden on the database.

[0151] In some embodiments of this application, to better illustrate the database migration method provided in the embodiments of this application, an application scenario of the database migration method is provided, exemplarily taking Data Migration Service (DTS) as an example, such as... Figure 10 As shown, Figure 10 This application provides an example of an application scenario for the database migration method. The scenario depicted can be a cross-WAN, cross-cloud migration from a traditional database to a public cloud SaaS service (RDS). In this scenario, a proxy service point connects the database and the application, reducing the strong association between the application and the database. A database slave node 901 connected to the database is added as a data source for data synchronization. Business data from the database is transferred to the database slave node 901. The database slave node is then migrated to the target database 1001 via the DTS service. After data synchronization is complete, the proxy target address of the proxy service point is modified to connect the proxy service point to the target database 1001. Figure 11 As shown, Figure 11 This is a schematic diagram showing the database migration method provided in this application after the database migration is completed. Figure 11 In this process, the application connects to the target database 1001 through a proxy service point.

[0152] In this embodiment, proxy services are inserted between the backend application 101 and the main database 102 and the slave database 103, respectively, to eliminate the strong association between the backend application 101 and the database. Data migration based on the LAMP / LNMP application architecture is achieved by only modifying the target address of the proxy service, avoiding interruption of data writing of the backend application 101 and minimizing the loss of business caused by business downtime.

[0153] To better implement the database migration method provided in the embodiments of this application, a database migration system is provided based on the database migration method, such as... Figure 12 As shown, Figure 12 This is a schematic diagram of an embodiment of the database migration system provided in this application. The database migration system shown includes:

[0154] Agent service point 1202, database 1203, target database 1001, and application 1201;

[0155] The proxy service point 1202 is connected to the database 1203 and the application 1201 respectively;

[0156] Agent service point 1202 is used to respond to data migration instructions and obtain the target address in the data migration instructions;

[0157] Proxy service point 1202 is used to modify the configuration information of proxy service point 1202 according to the target address;

[0158] The proxy service point 1202 is used to control the proxy service point 1202 to run according to the modified configuration information, disconnect from the database 1203, establish a connection with the target database 1001, and write the application's business data into the target database corresponding to the target address.

[0159] In some embodiments of this application, such as Figure 13 As shown, Figure 13 This is a schematic diagram of an embodiment of the proxy service point provided in this application. The proxy service point 1202 shown includes:

[0160] Module 1301 is used to obtain the access method between the database and the application.

[0161] Configuration module 1302 is used to configure the proxy service point according to the access method;

[0162] The communication module 1303 is used to control the proxy service point to connect to the application via access.

[0163] In some embodiments of this application, the configuration module 1302 includes:

[0164] The port acquisition unit is used to acquire the database port address and the modified port address if the access method is the first access method.

[0165] The address modification unit is used to set the modified port address as the proxy target address of the proxy service point and the port address as the proxy port address of the proxy service point.

[0166] The configuration unit is used to control the restart of the proxy service point and complete the configuration of the proxy service point.

[0167] In some embodiments of this application, the configuration module 1302 further includes:

[0168] The address acquisition unit is used to obtain the initial domain name address of the database if the access method is the second access method.

[0169] The address modification unit is used to set the initial domain name address to the proxy target address of the proxy service point;

[0170] The configuration unit is used to control the startup of the proxy service point and complete the configuration of the proxy service point.

[0171] The sending unit is used to send the proxy domain name address of the proxy service point to the application.

[0172] In some embodiments of this application, the proxy service point 1202 further includes:

[0173] The processing module 1304 is used to receive access requests initiated by the application; access the database according to the access requests and perform data processing; and send access feedback to the application based on the data processing results.

[0174] In some embodiments of this application, the proxy service point 1202 further includes:

[0175] The instruction module 1305 is used to respond to data synchronization instructions and obtain the amount of data in the database. If the amount of data is greater than a preset data volume threshold, it sends a request to establish a database slave node, obtains the target address of the database slave node, modifies the data synchronization instruction according to the target address, and sends the modified data synchronization instruction to the database. If the amount of data is less than or equal to the preset data volume threshold, it sends a data synchronization instruction to the database. If the database data synchronization is completed, it sends a data migration request.

[0176] In some embodiments of this application, the communication module 1303 of the proxy service point 1202 is further configured to set the target address as the new proxy target address of the proxy service point; access the new proxy target address and connect to the target database corresponding to the target address; respond to the application's access request and write the business data sent by the application into the target database.

[0177] This application embodiment uses a proxy service point to eliminate the strong association between the application and the database. The database migration is completed by simply modifying the proxy target address of the proxy service point, without interrupting the application data writing, thus minimizing the loss of business caused by application interruption.

[0178] This invention also provides a server, such as... Figure 13 As shown, it illustrates a schematic diagram of the server structure involved in an embodiment of the present invention, specifically:

[0179] The server may include components such as a processor 1301 with one or more processing cores, a memory 1302 with one or more computer-readable storage media, a power supply 1303, and an input unit 1304. Those skilled in the art will understand that... Figure 13 The server architecture shown does not constitute a limitation on the server and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. Wherein:

[0180] Processor 1301 is the control center of the server, connecting various parts of the server through various interfaces and lines. It performs various server functions and processes data by running or executing software programs and / or modules stored in memory 1302, and by calling data stored in memory 1302, thereby providing overall monitoring of the server. Optionally, processor 1301 may include one or more processing cores; preferably, processor 1301 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into processor 1301.

[0181] The memory 1302 can be used to store software programs and modules. The processor 1301 executes various functional applications and data processing by running the software programs and modules stored in the memory 1302. The memory 1302 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 1302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 1302 may also include a memory controller to provide the processor 1301 with access to the memory 1302.

[0182] The server also includes a power supply 1303 that supplies power to the various components. Preferably, the power supply 1303 can be logically connected to the processor 1301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 1303 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0183] The server may also include an input unit 1304, which can be used to receive input numeric or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.

[0184] Although not shown, the server may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 1301 in the server loads the executable files corresponding to the processes of one or more applications into the memory 1302 according to the following instructions, and the processor 1301 runs the applications stored in the memory 1302 to realize various functions, as follows:

[0185] Respond to the data migration command and obtain the target address in the data migration command;

[0186] Modify the configuration information of the proxy service point according to the target address;

[0187] The control agent service point runs according to the modified configuration information and writes the application's business data into the target database corresponding to the target address.

[0188] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0189] To this end, embodiments of the present invention provide a storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the database migration methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps:

[0190] Respond to the data migration command and obtain the target address in the data migration command;

[0191] Modify the configuration information of the proxy service point according to the target address;

[0192] The control agent service point runs according to the modified configuration information and writes the application's business data into the target database corresponding to the target address.

[0193] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.

[0194] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0195] Since the instructions stored in the storage medium can execute the steps in any of the database migration methods provided in the embodiments of the present invention, the beneficial effects that any of the database migration methods provided in the embodiments of the present invention can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.

[0196] The foregoing has provided a detailed description of a database migration method, system, server, and storage medium provided by embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A database migration method, characterized in that, Applied to agent service points, the method includes: Respond to the data migration command and obtain the target address; Modify the configuration information of the proxy service point according to the target address; The proxy service point is controlled to run according to the modified configuration information, and the application's business data is written into the target database corresponding to the target address. Before obtaining the target address in the response data migration instruction, the method includes: Obtain the access method between the database and the application; Configure the proxy service point according to the access method described above; Control the proxy service point to connect to the application and database through the access method; Before obtaining the target address in the response data migration instruction, the method includes: Respond to data synchronization commands and obtain the amount of data in the database; If the data volume is greater than a preset data volume threshold, a request to establish a database slave node is issued, the target address of the database slave node is obtained, the data synchronization instruction is modified according to the target address, and the modified data synchronization instruction is sent to the database. If the amount of data is less than or equal to a preset data amount threshold, then the data synchronization instruction is sent to the database; If the data synchronization of the database is completed, a data migration request is issued.

2. The database migration method as described in claim 1, characterized in that, The configuration of the proxy service point according to the access method includes: If the access method is the first access method, then obtain the port address of the database and the modified port address; Set the modified port address as the proxy target address of the proxy service point, and set the port address as the proxy port address of the proxy service point; Restart the proxy service point to complete its configuration.

3. The database migration method as described in claim 1, characterized in that, The configuration of the proxy service point according to the access method includes: If the access method is the second access method, then obtain the initial domain name address of the database; Set the initial domain name address as the proxy target address of the proxy service point; Control the proxy service point to start and complete the configuration of the proxy service point; Send the proxy domain name address of the proxy service point to the application.

4. The database migration method as described in claim 1, characterized in that, After the proxy service point is controlled to connect to the application and database through the access method, the method includes: Receive the access request initiated by the application; Access the database according to the access request and perform data processing; Based on the data processing results, an access feedback is sent to the application.

5. The database migration method according to any one of claims 1 to 4, characterized in that, The step of modifying the configuration information of the proxy service point according to the target address includes: Set the target address as the new proxy target address for the proxy service point; The step of controlling the proxy service point to run according to the modified configuration information and writing the application's business data into the target database corresponding to the target address includes: Access the new proxy target address and connect to the target database corresponding to the target address; In response to the application's access request, the business data sent by the application is written to the target database.

6. A database migration system, characterized in that, The database migration system includes: Agent service points, databases, target databases, and applications; The proxy service points are connected to the database and the application, respectively. The proxy service point is used to respond to data migration instructions and obtain the target address; The proxy service point is used to modify the configuration information of the proxy service point according to the target address; The proxy service point is used to run the configuration information, disconnect from the database, establish a connection with the target database, and write the application's business data into the target database corresponding to the target address. The agency service points include: The acquisition module is used to obtain the access method between the database and the application; The configuration module is used to configure the proxy service point according to the access method; The communication module is used to control the proxy service point to connect to the application and database through the access method; The instruction module is used to respond to data synchronization instructions and obtain the amount of data in the database. If the amount of data is greater than the preset data volume threshold, it sends a request to establish a database slave node, obtains the target address of the database slave node, modifies the data synchronization instruction according to the target address, and sends the modified data synchronization instruction to the database. If the amount of data is less than or equal to the preset data volume threshold, it sends a data synchronization instruction to the database. If the database data synchronization is complete, it sends a data migration request.

7. A server, characterized in that, It includes a memory and a processor; the memory stores an application program, and the processor runs the application program within the memory to perform the operations in the database migration method according to any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the database migration method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • A database migration method and device

    CN105528368A

  • Monitoring method and device for client side server system

    CN107436831A