Read-write request routing method and device, medium and program product
By controlling the device to determine the target server according to the migration switch status, it realizes continuous routing of read and write requests during the data migration process, solving the business interruption problem caused by data migration in the prior art, and improving user experience and migration efficiency.
Patent Information
- Application Number
- CN202411078470.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-13
AI Technical Summary
During the migration of existing data, routing read and write requests need to be suspended, resulting in business interruption.
By controlling the device to determine the target server from the first server and the second server according to the status of the migration switch, and route the read and write requests to the target server, thereby continuing to route read and write requests during the data migration process, reducing service interruptions.
There is no need to pause read and write request routing during data migration, reducing business interruptions, improving user experience and reducing migration costs.
Smart Images

Figure CN119135588A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of data migration. More specifically, the embodiments of the present disclosure relate to a read / write request routing method, device, medium, and program product. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the present disclosure. No description herein is admitted to be prior art by virtue of its inclusion in this section.
[0003] With the rapid development of information technology, the generation, storage and processing of data are becoming more and more important. In order to improve the efficiency of data processing and meet the demand for real-time data storage, the server storing data is generally replaced or additional servers are added, which requires data migration.
[0004] In the related art, the handling of business is usually accompanied by routing read and write requests to the server. In the process of migrating data from the old server to the new server, the routing of read and write requests to the old server or the new server is suspended. After the migration is completed, the read and write requests are routed to the new server, and the new server processes the read and write requests.
[0005] In summary, the existing data migration process requires suspending routing read and write requests, which will cause business interruption. Summary of the invention
[0006] The present invention provides a read / write request routing method, device, medium and program product to solve the problem that the routing of read / write requests needs to be suspended during the existing data migration process, which may cause business interruption.
[0007] In a first aspect of the embodiments of the present disclosure, a read / write request routing method is provided, which is applied to a control device, and the method includes:
[0008] Receive read and write requests;
[0009] Determine a target server from a first server and a second server according to a state of a migration switch, wherein the migration switch includes at least one of a migration task start switch, a full migration completion switch, a new data routing switch, and a rollback switch, wherein the first server is a server from which data is migrated out, and the second server is a server to which data is migrated in;
[0010] The read and write requests are routed to the target server.
[0011] In one embodiment of the present disclosure, the migration task start switch, the full migration completion switch, the new data routing switch and the rollback switch are in a closed state before data migration;
[0012] The migration task start switch is in an on state after the data migration starts;
[0013] The full migration completion switch is turned on after the data migration is completed;
[0014] The newly added data routing switch is in an open state after the control device receives the newly added data routing modification request;
[0015] The rollback switch is in an open state after the control device receives a rollback request.
[0016] In another embodiment of the present disclosure, determining the target server from the first server and the second server according to the state of the migration switch includes:
[0017] Determine whether the migration task start switch is in an off state;
[0018] If the migration task start switch is in an off state, the first server is used as a target server.
[0019] In yet another embodiment of the present disclosure, the method further includes:
[0020] If the migration task start switch is in the on state, determining whether the full migration completion switch is in the on state;
[0021] If the full migration completion switch is in the on state, the second server is used as the target server.
[0022] In yet another embodiment of the present disclosure, the method further includes:
[0023] If the full migration completion switch is in the off state, determining whether the rollback switch is in the on state;
[0024] If the rollback switch is in the on state, the first server is used as the target server.
[0025] In yet another embodiment of the present disclosure, the read / write request includes a data identifier, and the method further includes:
[0026] If the rollback switch is in the off state, sending a data status acquisition request to the first server, wherein the data status acquisition request includes the data identifier;
[0027] receiving a data status sent by the first server, the data status including a first identifier indicating whether data corresponding to the data identifier exists;
[0028] A target server is determined from the first server and the second server according to the data state and the state of the migration switch.
[0029] In yet another embodiment of the present disclosure, determining the target server from the first server and the second server according to the data state and the state of the migration switch includes:
[0030] Determining, according to the first identifier, whether data corresponding to the data identifier exists;
[0031] If the data corresponding to the data identifier does not exist, the target server is determined according to the state of the newly added data routing switch.
[0032] In yet another embodiment of the present disclosure, determining the target server according to the state of the newly added data routing switch includes:
[0033] If the newly added data routing switch is in the on state, the second server is used as the target server;
[0034] If the newly added data routing switch is in a closed state, the first server is used as the target server.
[0035] In yet another embodiment of the present disclosure, if the first identifier indicates that the data corresponding to the data identifier exists, the data status further includes: a second identifier indicating whether the data corresponding to the data identifier is locked, and a third identifier indicating whether the data corresponding to the data identifier is marked with a migrated identifier, and the method further includes:
[0036] If the data corresponding to the data identifier exists, judging whether the data corresponding to the data identifier has been migrated according to the third identifier;
[0037] If the data migration corresponding to the data identifier is completed, the second server is used as the target server.
[0038] In yet another embodiment of the present disclosure, the method further includes:
[0039] If the data corresponding to the data identifier has not been migrated, determining whether the data corresponding to the data identifier is in the process of being migrated according to the second identifier;
[0040] If the data corresponding to the data identifier is in the process of being migrated, the second server is used as the target server;
[0041] If the data corresponding to the data identifier is not in the migration process, the first server is used as the target server.
[0042] In yet another embodiment of the present disclosure, the method further includes:
[0043] When receiving the migration instruction, sending the migration instruction to the first server and turning on the migration task start switch;
[0044] When receiving a new data route modification request, turning on the new data route switch;
[0045] When a rollback request is received, the rollback switch is turned on;
[0046] When the migration completion message sent by the first server is received, the full migration completion switch is turned on.
[0047] In a second aspect of the embodiments of the present disclosure, a read / write request routing method is provided, which is applied to a first server, and the method includes:
[0048] receiving a data status acquisition request sent by a control device, wherein the data status acquisition request includes a data identifier;
[0049] Determine a data status according to the data identifier, wherein the data status includes a first identifier indicating whether data corresponding to the data identifier exists;
[0050] The data status is sent to the control device.
[0051] In one embodiment of the present disclosure, determining the data state according to the data identifier includes:
[0052] generating a first identifier indicating whether the data corresponding to the data identifier exists according to whether the data corresponding to the data identifier exists in the first server;
[0053] The data status is generated according to the first identifier.
[0054] In another embodiment of the present disclosure, the method further includes:
[0055] If the first identifier indicates that the data corresponding to the data identifier exists, a second identifier indicating whether the data corresponding to the data identifier is locked is generated according to whether the data corresponding to the data identifier is locked, and the data corresponding to the data identifier is locked during the data migration process;
[0056] According to whether the data corresponding to the data identifier is marked with a migration identifier, a third identifier is generated to indicate whether the data corresponding to the data identifier is marked with a migration identifier; the data corresponding to the data identifier is marked with a migration identifier after the data is migrated;
[0057] The second identifier and the third identifier are added to the data state.
[0058] In yet another embodiment of the present disclosure, the method further includes:
[0059] receiving a migration instruction sent by the control device;
[0060] According to the preset screening strategy and heterogeneous strategy, the original data in the database is processed to obtain the target data;
[0061] Using a preset sending strategy, sequentially sending migration requests to the second server, the migration requests including the sub-data in the target data;
[0062] Locking the sub-data;
[0063] When receiving the sub-data migration completion message sent by the second server, unlocking the sub-data and marking the sub-data with a migration completed flag;
[0064] When all sub-data in the target data are marked with migrated flags, a migration completion message is sent to the control device.
[0065] In yet another embodiment of the present disclosure, the method further includes:
[0066] receiving a data synchronization instruction sent by the second server, where the data synchronization instruction is an instruction generated by the second server according to the write request when the received read-write request is a write request;
[0067] The data in the database is synchronized according to the data synchronization instruction.
[0068] In yet another embodiment of the present disclosure, the method further includes:
[0069] For each first data marked as migrated, obtaining, from the second server according to the identifier of the first data, second data corresponding to the identifier of the first data;
[0070] If the first data is different from the second data, a data inconsistency prompt message is output.
[0071] In a third aspect of the embodiments of the present disclosure, a read / write request routing device is provided, comprising:
[0072] A receiving module, used for receiving read and write requests;
[0073] a processing module, configured to determine a target server from a first server and a second server according to a state of a migration switch, wherein the migration switch includes at least one of a migration task start switch, a full migration completion switch, a new data routing switch, and a rollback switch, wherein the first server is a server from which data is migrated out, and the second server is a server from which data is migrated in;
[0074] A sending module is used to route the read and write requests to the target server.
[0075] In a fourth aspect of the embodiments of the present disclosure, a read / write request routing device is provided, comprising:
[0076] A receiving module, used for receiving a data status acquisition request sent by a control device, wherein the data status acquisition request includes a data identifier;
[0077] A processing module, configured to determine a data state according to the data identifier, wherein the data state includes a first identifier indicating whether data corresponding to the data identifier exists;
[0078] A sending module is used to send the data status to the control device.
[0079] In a fifth aspect of the embodiments of the present disclosure, there is provided a computing device, comprising:
[0080] at least one processor; and a memory communicatively coupled to the at least one processor;
[0081] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the computing device to perform the read and write request routing method as described in any one of the first aspect or the second aspect.
[0082] In a sixth aspect of the embodiments of the present disclosure, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the read / write request routing method described in any one of the first aspect or the second aspect is implemented.
[0083] In a seventh aspect of the embodiments of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, is used to implement the read and write request routing method described in any one of the first aspect or the second aspect.
[0084] According to the read / write request routing method, device, medium and program product of the disclosed embodiment, after receiving the read / write request, the control device determines the target server from the first server and the second server according to the state of the migration switch, the first server is the server for data migration out, and the second server is the server for data migration in. Then the read / write request is routed to the target server. This solution determines the target server by the state of the migration switch, and then routes the read / write request to the target server, which can realize the routing of read / write requests during the data migration process and reduce the occurrence of business interruption. BRIEF DESCRIPTION OF THE DRAWINGS
[0085] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0086] Figure 1 The following schematically shows an application scenario diagram provided according to an embodiment of the present disclosure;
[0087] Figure 2a The flowchart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Figure 1 ;
[0088] Figure 2b A schematic diagram of data comparison before and after isomerization provided according to an embodiment of the present disclosure is schematically shown;
[0089] Figure 3 Schematically showing a flow chart 2 of a read / write request routing method provided according to an embodiment of the present disclosure;
[0090] Figure 4 The flowchart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Figure 3 ;
[0091] Figure 5a The flowchart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Figure 4 ;
[0092] Figure 5b A schematic diagram schematically shows a comparison of a target server before and after data migration according to an embodiment of the present disclosure;
[0093] Figure 6 Schematically shows a flowchart of a read / write request routing method provided according to an embodiment of the present disclosure;
[0094] Figure 7 The flowchart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Figure 6 ;
[0095] Figure 8 The structure diagram of a computer-readable storage medium provided according to an embodiment of the present disclosure is schematically shown;
[0096] Fig. 9 The structure of the read / write request routing device provided according to an embodiment of the present disclosure is schematically shown. Figure 1 ;
[0097] Fig.10A second structural diagram schematically shows a read / write request routing device provided according to an embodiment of the present disclosure;
[0098] Fig.11 The schematic diagram shows a structure of a computing device provided according to an embodiment of the present disclosure.
[0099] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0100] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0101] Those skilled in the art will appreciate that the embodiments of the present disclosure may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0102] According to an embodiment of the present disclosure, a read / write request routing method, apparatus, device, medium and program product are proposed.
[0103] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0104] In addition, any number of elements in the drawings is for illustration and not limitation, and any naming is only for distinction and does not have any limiting meaning.
[0105] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure. SUMMARY OF THE INVENTION
[0107] In order to meet the demand for fast data processing, it is necessary to replace the server storing data, add servers, etc., which requires data migration. At the same time, the handling of business is usually accompanied by routing read and write requests to the server. In the process of migrating data from the old server to the new server, the routing of read and write requests to the old server or the new server is suspended. Only after the migration is completed will the read and write requests be routed to the new server, and the new server will handle the read and write requests. In this way, read and write requests cannot be routed during the data migration process, resulting in business interruption.
[0108] The inventors have found that in order to realize the routing of read and write requests during the data migration process, the routing process can be completed by the control device. For the process of migrating the data of the first server to the second server, a migration switch is provided in the control device, and the migration switch includes at least one of a migration task start switch, a full migration completion switch, a new data routing switch, and a rollback switch. The control device can adjust the state of the migration switch according to the data migration situation, and then after receiving the read and write request, according to the state of the migration switch, determine the target server from the first server and the second server, and then route the read and write request to the target server, thereby realizing the routing of read and write requests during the data migration process and reducing the occurrence of business interruptions.
[0109] After introducing the basic principles of the present disclosure, various non-limiting embodiments of the present disclosure are described in detail below.
[0110] Application Scenario Overview
[0111] First reference Figure 1 As shown, Figure 1 The following schematically shows an application scenario diagram provided according to an embodiment of the present disclosure, such as Figure 1 As shown, the application scenario includes a control device 101, a first server 102 and a second server 103, the first server 102 is a server for data migration out, and the second server is a server for data migration in.
[0112] The migration task start switch and the full migration completion switch in the control device 101 are in a closed state before data migration.
[0113] When the control device 101 receives a read / write request before data migration, since the migration task start switch is in the off state, the first server 102 is used as the target server and the read / write request is routed to the first server 102 .
[0114] When receiving the migration instruction, the control device 101 sends the migration instruction to the first server 102 and turns on the migration task start switch.
[0115] After receiving the migration instruction, the first server 102 sends the sub-data to the second server 103 and locks the sent sub-data. After receiving and storing the sub-data, the second server 103 sends a sub-data migration completion message to the first server 102. After receiving the sub-data migration completion message, the first server 102 removes the lock on the sub-data and marks the sub-data with a migration mark; in addition, after determining that all sub-data have been marked with a migration mark, the first server 102 sends a migration completion message to the control device 101. When the control device 101 receives the migration completion message, it turns the full migration completion switch on.
[0116] When the control device 101 receives a read / write request during the data migration process, since the migration task start switch is in the on state, the full migration completion switch is in the off state, and the rollback switch is in the off state, a data status acquisition request is sent to the first server 102. After the first server 102 sends the data status to the control device 101, the control device 101 determines that the data corresponding to the read / write request exists in the first server 102 according to the data status, and determines that the data migration is completed, so the second server 103 is used as the target server and the read / write request is routed to the second server 103.
[0117] When the control device 101 receives a read / write request after data migration, since the migration task start switch is on and the full migration completion switch is on, the second server 103 is used as the target server and the read / write request is routed to the second server 103 .
[0118] It should be noted that Figure 1 This is only a schematic diagram of an application scenario provided by the embodiment of the present application. Figure 1 The actual form of the various devices included in the Figure 1 The interaction mode between devices is limited, and in the specific application of the solution, it can be set according to actual needs.
[0119] Exemplary Methods
[0120] Combine the following Figure 1 For application scenarios, refer to Figure 2a-Figure 7 To describe a method for routing read and write requests according to an exemplary embodiment of the present disclosure. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present disclosure, and the embodiments of the present disclosure are not limited in this regard. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0121] refer to Figure 2a , Figure 2a The flowchart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Figure 1 The embodiment of the present application describes the interaction between the control device, the first server, and the second server to implement the data migration process and adjust the state of the migration switch. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 2a As shown, the read-write request routing method specifically includes the following steps:
[0122] S201: When the control device receives the migration instruction, it sends the migration instruction to the first server and turns on the migration task start switch.
[0123] When data migration is required, the staff uses the terminal device to send a migration instruction to the control device to start the data migration process.
[0124] In this step, when the control device receives the migration instruction, it sends the migration instruction to the first server so that the first server can subsequently migrate data to the second server. In order to realize the routing of read and write requests during the data migration process, it is also necessary to turn on the migration task start switch, that is, the migration task start switch is in the on state after the data migration starts.
[0125] It should be noted that a migration switch is provided in the control device, and the migration switch includes at least one of a migration task start switch, a full migration completion switch, a new data routing switch and a rollback switch. The migration task start switch, the full migration completion switch, the new data routing switch and the rollback switch are in a closed state before data migration.
[0126] It should be noted that the control device and the first server may be the same device or different devices.
[0127] S202: When the control device receives the new data route modification request, it turns on the new data route switch.
[0128] In this step, after the control device receives the migration instruction, since some read and write requests are for new data, the staff can also set which server the new data should be stored in. If you want to store it in the second server, you need to use the terminal device to send a new data route modification request to the control device. When the control device receives the new data route modification request, it turns on the new data route switch.
[0129] If you want to store it in the first server, you do not need to send a new data routing modification request to the control device.
[0130] S203: When the control device receives the rollback request, it turns on the rollback switch.
[0131] In this step, after the control device receives the migration instruction, if the staff finds that the data migration is abnormal and data rollback is required, the staff uses the terminal device to send a rollback request to the control device. When the control device receives the rollback request, it turns the rollback switch on.
[0132] S204: After receiving the migration instruction sent by the control device, the first server processes the original data in the database according to the preset screening strategy and heterogeneous strategy to obtain target data.
[0133] In this step, after the control device sends the migration instruction to the first server, the first server can receive the migration instruction and then perform the data migration process. First, according to the preset screening strategy and heterogeneous strategy, the original data in the database is processed to obtain the target data.
[0134] The original data in the database includes multiple sub-data, each of which includes a data identifier, multiple field names, and a field value corresponding to each field name. The screening strategy can be to extract the sub-data whose data identifier belongs to a preset identifier range, or to extract the sub-data including the preset field name, or to extract the sub-data including the preset field name and the field value corresponding to the preset field name belongs to the preset field value range. The embodiment of the present application does not limit the screening strategy, which can be determined according to the actual situation.
[0135] After filtering the original data according to the filtering strategy to obtain the filtered data, it is necessary to use the heterogeneous strategy to heterogeneously obtain the target data. The target data includes sub-data, and each sub-data is a piece of data. This is because the units, data structures, and formats of the data stored in the first server and the second server are different, so heterogeneity is required. ETL (Extract-Transform-Load) tools can be used for heterogeneity.
[0136] Exemplary, reference Figure 2b , Figure 2b A schematic diagram of data comparison before and after heterogeneity according to an embodiment of the present disclosure is shown schematically. Figure 2b As shown, the data identification remains unchanged before and after heterogeneity. The field value of field 1 before heterogeneity is 500, and the field value of field 1 after heterogeneity is 5; the field value of field 2 before heterogeneity is 30, and the field value of field 2 after heterogeneity is 0.3; because the first server and the second server store data in different units, the size of the field values is different, and heterogeneity is required.
[0137] S205: The first server uses a preset sending strategy to send migration requests to the second server in sequence, and locks the sub-data in the migration requests.
[0138] In this step, after the first server determines the target data, in order to meet the requirements of whitelist testing, grayscale switching, and improving migration efficiency, it can use a preset sending strategy to send migration requests to the second server in sequence. The migration request includes the sub-data in the target data. At the same time, in order to ensure data consistency and to determine which server the read and write request should be routed to, the sub-data in the migration request is locked.
[0139] It should be noted that the preset strategy may be: grouping the data identifiers of the sub-data in the target data after hashing the modulo, and including a group of sub-data in each migration request sent. The preset strategy may also be: dividing the sub-data in the target data into a preset number of groups, and including a group of sub-data in each migration request sent. The preset strategy may also be: determining the sub-data corresponding to each preset identification list in the target data based on multiple preset identification lists, dividing the sub-data corresponding to each preset identification list into a group, and including a group of sub-data in each migration request sent. The embodiment of the present application does not limit the preset strategy, and it can be determined according to actual conditions.
[0140] It should be noted that locking the sub-data in the migration request means that when data is migrated, the sub-data will be copied, one copy of the sub-data will be retained in the first server, another copy of the sub-data will be put into the migration request, and the sub-data retained in the first server will be locked.
[0141] S206: After receiving the migration request sent by the first server, the second server stores the sub-data therein and sends a sub-data migration completion message to the first server.
[0142] In this step, after the first server sends a migration request to the second server, the second server receives the migration request and stores the sub-data therein. In order for the first server to modify the status of the sub-data later, the second server sends a sub-data migration completion message to the first server.
[0143] S207: When the first server receives the sub-data migration completion message sent by the second server, it removes the lock on the sub-data and marks the sub-data with a migration completed flag.
[0144] In this step, after the second server sends a sub-data migration completion message to the first server, the first server can receive the sub-data migration completion message, remove the lock on the sub-data, and mark the sub-data with a migration flag in order to determine which server the read and write request should be routed to.
[0145] S208: When all sub-data in the target data are marked with migrated flags, the first server sends a migration completion message to the control device.
[0146] In this step, the first server also monitors whether all sub-data in the target data are marked with migrated flags, and sends a migration completion message to the control device when it is detected that all sub-data in the target data are marked with migrated flags.
[0147] S209: When the control device receives the migration completion message sent by the first server, it turns on the full migration completion switch.
[0148] In this step, after the first server control device sends the migration completion message, the control device can receive the migration completion message. In order to determine which server the read and write requests should be routed to, the full migration completion switch is placed in the on state, that is, the full migration completion switch is in the on state after the data migration is completed.
[0149] It should be noted that after the control device turns on the full migration completion switch, if the control device receives a read / write request, the read / write request is directly sent to the second server.
[0150] The read / write request routing method provided in this embodiment provides a judgment basis for read / write request routing by controlling the device to adjust the state of the migration switch according to the received request or message during the data migration process. There is no need to manually supervise the data migration process, which reduces the migration cost. In addition, by setting a heterogeneous strategy, the data is not wrong in the second server. By setting different sending strategies, whitelist testing, grayscale switching, and improving migration efficiency can be achieved.
[0151] refer to Figure 3 , Figure 3 Schematic diagram 2 of the flow chart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Based on the above embodiment, the embodiment of the present application describes the situation where the control device performs read / write request routing. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 3 As shown, the read-write request routing method specifically includes the following steps:
[0152] S301: receiving a read / write request.
[0153] The control device completes the routing of the read and write requests. When the data in the server needs to be read and written, the read and write device sends a read and write request to the control device.
[0154] It should be noted that the reading and writing device can be a computer, a server, a terminal device, etc. The embodiment of the present application does not limit the reading and writing device and can be determined according to actual conditions.
[0155] In this step, after the read-write device sends a read-write request to the control device, the control device can receive the read-write request.
[0156] It should be noted that a read / write request is a read request or a write request, and a write request is a request indicating the addition of new data or a request indicating the modification of data. A read request is used to read data in a server, and a write request is used to add new data or modify data in a server.
[0157] S302: Determine a target server from the first server and the second server according to the state of the migration switch.
[0158] In this step, after receiving the read / write request, the control device determines the target server from the first server and the second server according to the state of the migration switch.
[0159] The migration switch includes at least one of a migration task start switch, a full migration completion switch, a new data routing switch, and a rollback switch. The first server is a server from which data is migrated out, and the second server is a server from which data is migrated in.
[0160] The control switch first determines whether the migration task start switch is in the off state. If the migration task start switch is in the off state, it means that the migration process is not in progress and the data is all in the first server, so the first server is used as the target server.
[0161] If the migration task start switch is on, it means that the migration is not in progress or the migration has been completed, then it is determined whether the full migration completion switch is on. If the full migration completion switch is on, it means that the migration has been completed, and the second server is used as the target server.
[0162] If the full migration completion switch is off, it means that the migration is currently in progress. Then determine whether the rollback switch is on to determine whether there is any abnormality in the data migration.
[0163] If the rollback switch is turned on, it means that an exception occurs in the data migration and the read and write requests need to be routed to the first server, and the first server is used as the target server.
[0164] If the rollback switch is in the off state, it is necessary to interact with the first server to determine the state of the data corresponding to the read / write request, and determine the target server from the first server and the second server according to the state of the data and the state of the migration switch.
[0165] S303: Routing the read and write requests to the target server.
[0166] In this step, after the control device determines the target server, it routes the read and write requests to the target server, and the target server subsequently processes the read and write requests.
[0167] The read / write request routing method provided in this embodiment determines the target server from the first server and the second server according to the state of the migration switch after receiving the read / write request by the control device, wherein the first server is the server from which the data is migrated out, and the second server is the server from which the data is migrated in. Then the read / write request is routed to the target server. This solution determines the target server by the state of the migration switch, and then routes the read / write request to the target server, which can realize routing of the read / write request during the data migration process, reduce the occurrence of service interruption, and improve the user experience.
[0168] refer to Figure 4 , Figure 4 The flowchart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Figure 3 Based on the above embodiments, the present application embodiment describes the situation where the control device interacts with the first server to obtain the data status when the rollback switch is in the off state, and then determines the target server according to the data status and the state of the migration switch. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 4 As shown, the read-write request routing method specifically includes the following steps:
[0169] S401: The control device sends a data status acquisition request to the first server.
[0170] In this step, when the control device determines that the migration task start switch is in the on state, the full migration completion switch is in the off state, and the rollback switch is in the off state, it needs to determine the target server based on the data status and other migration switches, and first send a data status acquisition request to the first server. The data status acquisition request includes a data identifier, and the data identifier in the data status acquisition request is the data identifier in the read and write request.
[0171] S402: After receiving the data status acquisition request sent by the control device, the first server determines the data status according to the data identifier.
[0172] In this step, after the control device sends a data status acquisition request to the first server, the first server can receive the data status acquisition request and then determine the data status according to the data identifier. The data status includes a first identifier indicating whether the data corresponding to the data identifier exists.
[0173] The first server generates a first identifier indicating whether the data corresponding to the data identifier exists according to whether the first server has data corresponding to the data identifier. If the sub-data corresponding to the data identifier exists in the target data, the first identifier is generated indicating that the data corresponding to the data identifier exists. If the sub-data corresponding to the data identifier does not exist in the target data, the first identifier is generated indicating that the data corresponding to the data identifier does not exist.
[0174] Then, a data state is generated according to the first identifier.
[0175] It should be noted that if the first identifier indicates that the data corresponding to the data identifier exists, a second identifier indicating whether the data corresponding to the data identifier is locked is generated based on whether the data corresponding to the data identifier is locked, and the data corresponding to the data identifier will be locked during the data migration process; the data corresponding to the data identifier refers to: the sub-data corresponding to the data identifier in the target data.
[0176] According to whether the data corresponding to the data identifier is marked with a migration identifier, a third identifier is generated to indicate whether the data corresponding to the data identifier is marked with a migration identifier; the data corresponding to the data identifier is marked with a migration identifier after the data is migrated;
[0177] Add the second and third identifiers to the data state.
[0178] S403: The first server sends the data status to the control device.
[0179] In this step, after obtaining the data status, the first server sends the data status to the control device so that the control device can subsequently determine the target server.
[0180] S404: After receiving the data status sent by the first server, the control device determines a target server from the first server and the second server according to the data status and the state of the migration switch.
[0181] In this step, after the first server sends the data status to the control device, the control device can receive the data status and then determine the target server from the first server and the second server according to the data status and the state of the migration switch.
[0182] The control device determines whether the data corresponding to the data identifier exists based on the first identifier; if the data corresponding to the data identifier does not exist, it means that the read / write request is a write request and a request indicating new data, and then the target server is determined based on the state of the new data routing switch.
[0183] If the new data routing switch is in the on state, it means that the staff has set the request for indicating the new data to be sent to the second server, and the second server is used as the target server;
[0184] If the new data routing switch is in the off state, it means that the staff has set the request for indicating the new data to be sent to the first server, and the first server is used as the target server.
[0185] It should be noted that when the new data routing switch is in the off state, the control device will route the read and write requests to the first server. The first server will add new data based on the read and write requests, and then determine whether the new data needs to be migrated based on the screening strategy. If migration is required, the new data will be added to the target data.
[0186] If the data corresponding to the data identifier exists, in this case, the data status also includes: a second identifier indicating whether the data corresponding to the data identifier is locked, and a third identifier indicating whether the data corresponding to the data identifier is marked with a migrated identifier. According to the third identifier, it is determined whether the data corresponding to the data identifier has been migrated. The third identifier indicates that the data corresponding to the data identifier is marked with a migrated identifier, indicating that the migration of the data corresponding to the data identifier has been completed. The third identifier indicates that the data corresponding to the data identifier is not marked with a migrated identifier, indicating that the data corresponding to the data identifier has not been migrated.
[0187] If the data migration corresponding to the data identifier is completed, the second server is used as the target server.
[0188] If the data corresponding to the data identifier has not been migrated, determine whether the data corresponding to the data identifier is in the migration process based on the second identifier. The second identifier indicates that the data corresponding to the data identifier is locked, indicating that the data corresponding to the data identifier is in the migration process. The second identifier indicates that the data corresponding to the data identifier is not locked, indicating that the data corresponding to the data identifier is not in the migration process.
[0189] If the data corresponding to the data identifier is not in the migration process, it means that the data has not been migrated yet, and the first server is used as the target server.
[0190] If the data corresponding to the data identifier is in the process of migration, the second server is used as the target server. In this case, the control device needs to send a monitoring request to the first server, and the monitoring request includes the data identifier. The first server monitors whether the data corresponding to the data identifier is marked with a migration identifier based on the data identifier. When the first server detects that the data corresponding to the data identifier is marked with a migration identifier, the first server sends a routing request to the control device, and the routing request includes the data identifier. After receiving the routing request, the control device routes the read and write request including the data identifier to the second server.
[0191] The read / write request routing method provided in this embodiment controls the device to interact with the first server to obtain the data status when the migration task start switch is turned on, the full migration completion switch is turned off, and the rollback switch is turned off, and then determines the target server according to the data status and the status of the newly added data routing switch. This ensures that the read / write requests are routed during the data migration process and reduces the occurrence of business interruptions.
[0192] refer to Figure 5a , Figure 5a The flowchart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Figure 4 Based on the above embodiments, the present application embodiment describes the situation where the control device determines the target server according to the state of the migration switch and the data state. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 5a As shown, the read-write request routing method specifically includes the following steps:
[0193] S501: receiving a read / write request.
[0194] S502: Determine whether the migration task startup switch is in the off state; if the migration task startup switch is in the off state, execute step S509; if the migration task startup switch is in the on state, execute step S503.
[0195] S503: Determine whether the full migration completion switch is in the on state; if the full migration completion switch is in the on state, execute step S510; if the full migration completion switch is in the off state, execute step S504.
[0196] S504: Determine whether the rollback switch is in the on state; if the rollback switch is in the on state, execute step S509; if the rollback switch is in the off state, execute step S505.
[0197] S505: Determine whether the data corresponding to the data identifier exists; if the data corresponding to the data identifier does not exist, execute step S506; if the data corresponding to the data identifier exists, execute step S507.
[0198] S506: Determine whether the newly added data routing switch is in the on state; if the newly added data routing switch is in the on state, execute step S510; if the newly added data routing switch is in the off state, execute step S509.
[0199] S507: Determine whether the data corresponding to the data identifier has been migrated; if the data corresponding to the data identifier has been migrated, execute step S510; if the data corresponding to the data identifier has not been migrated, execute step S508.
[0200] S508: Determine whether the data corresponding to the data identifier is in the process of migration; if the data corresponding to the data identifier is in the process of migration, execute step S510; if the data corresponding to the data identifier is not in the process of migration, execute step S509.
[0201] S509: Use the first server as the target server.
[0202] S510: Use the second server as the target server.
[0203] It should be noted that the implementation process of this embodiment is similar to the implementation process of step S302 and step S401 to step S404 in the above embodiment, and will not be described in detail here.
[0204] Exemplary, reference Figure 5b , Figure 5b A schematic diagram schematically shows a comparison of the target server before and after data migration according to an embodiment of the present disclosure, as shown in FIG. Figure 5b As shown, before data migration, the migration task start switch is in the off state, and the first server is used as the target server. During data migration, the migration task start switch is in the on state, and the full migration completion switch is in the off state. The control device determines the target server from the first server and the second server according to the status of the newly added data routing switch and the rollback switch, as well as the data status. After data migration, the migration task start switch is in the on state, the full migration completion switch is in the on state, and the second server is used as the target server.
[0205] The read / write request routing method provided in this embodiment determines the target server according to the state of the migration switch and the data state, thereby ensuring the routing of read / write requests during the data migration process and reducing the occurrence of service interruptions.
[0206] refer to Figure 6 , Figure 6 Schematic diagram 5 of the flow chart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Based on the above embodiment, the embodiment of the present application describes the situation where the second server interacts with the first server to achieve data synchronization. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 6 As shown, the read-write request routing method specifically includes the following steps:
[0207] S601: When the second server receives the write request, it sends a data synchronization instruction to the first server.
[0208] In order to reduce the risk of data loss and ensure data consistency between the first server and the second server, data synchronization is required. When the second server receives a read / write request routed by the control device, if the read / write request is a write request, data synchronization is required.
[0209] In this step, when the second server receives the write request, it sends a data synchronization instruction to the first server. The data synchronization instruction is an instruction generated according to the write request. The data synchronization instruction includes the data identifier in the write request. The data synchronization instruction may be the write request.
[0210] It should be noted that the second server may send the data synchronization instruction to the first server through a message middleware.
[0211] S602: After receiving the data synchronization instruction sent by the second server, the first server synchronizes the data in the database according to the data synchronization instruction.
[0212] In this step, after the second server sends a data synchronization instruction to the first server, the first server can receive the data synchronization instruction and then synchronize the data in the database according to the data synchronization instruction.
[0213] If the first server stores data corresponding to the data identifier, it means that the data needs to be modified, and the data is modified according to the data synchronization instruction. If the first server does not store data corresponding to the data identifier, it means that new data needs to be added, and the data is added according to the data synchronization instruction.
[0214] The read-write request routing method provided in this embodiment sends a data synchronization instruction to the first server when the second server receives a write request. The first server synchronizes the data, thereby reducing the risk of data loss, ensuring the consistency of data between the first server and the second server, and improving data rollback efficiency.
[0215] refer to Figure 7 , Figure 7 The flowchart of the read / write request routing method provided according to an embodiment of the present disclosure is schematically shown. Figure 6 Based on the above embodiments, the present application embodiment describes the situation where the first server performs data consistency verification. The method in this embodiment can be implemented by software, hardware, or a combination of software and hardware. Figure 7 As shown, the read-write request routing method specifically includes the following steps:
[0216] S701: For each first data marked as migrated, according to the identifier of the first data, obtain from a second server the second data corresponding to the identifier of the first data.
[0217] In this step, in order to ensure the correctness of the rollback and verify the data consistency between the first server and the second server, the first server obtains the second data corresponding to the identifier of each first data marked as migrated from the second server according to the identifier of the first data.
[0218] A consistency check request may be sent to the second server, the consistency check request including the identifier of the first data. The second server searches for the corresponding second data according to the identifier included in the consistency check request and sends the data to the first server.
[0219] S702: If the first data is different from the second data, output a data inconsistency prompt message.
[0220] In this step, after the first server obtains the second data corresponding to the identifier of the first data, it determines whether the first data and the second data are the same. It is necessary to heterogeneously structure the first data according to the heterogeneous strategy, and then determine whether the heterogeneous first data and the second data are the same. If the two are not the same, it means that the data are inconsistent, and a data inconsistency prompt message is output, which may include the identifier of the first data.
[0221] It should be noted that the first server will also record logs during the data migration process for subsequent backtracking, and will also record in real time the proportion of data marked with the migration identifier in the target data, and the data identifier and quantity of the data marked with the migration identifier.
[0222] The read / write request routing method provided in this embodiment improves the stability of data migration by performing data consistency check on the first data marked as migrated and outputting a data inconsistency prompt message when the data is inconsistent.
[0223] Exemplary Media
[0224] After introducing the method of the exemplary embodiment of the present disclosure, next, refer to Figure 8 The storage medium according to the exemplary embodiment of the present disclosure is described. Figure 8 The schematic diagram shows the structure of a computer-readable storage medium provided according to an embodiment of the present disclosure.
[0225] refer to Figure 8 As shown, the storage medium 80 stores a program product for implementing the above method according to an embodiment of the present disclosure, which can be a portable compact disk read-only memory (CD-ROM) and includes program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto.
[0226] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0227] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable signal medium may also be any readable medium other than a readable storage medium.
[0228] Program code for performing the disclosed operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN).
[0229] Exemplary Devices
[0230] After introducing the medium of the exemplary embodiment of the present disclosure, next, reference is made to Fig. 9 The read / write request routing device according to the exemplary embodiment of the present disclosure is described. Fig. 9 The structure of the read / write request routing device provided according to an embodiment of the present disclosure is schematically shown. Figure 1 , used to implement a method for controlling a device in any of the above method embodiments, the implementation principle and technical effect are similar and will not be repeated here.
[0231] like Fig. 9 As shown, the read / write request routing device 90 includes:
[0232] Receiving module 91, used for receiving read and write requests;
[0233] The processing module 92 is used to determine the target server from the first server and the second server according to the state of the migration switch, wherein the migration switch includes at least one of a migration task start switch, a full migration completion switch, a new data routing switch, and a rollback switch, wherein the first server is a server from which data is migrated out, and the second server is a server to which data is migrated in;
[0234] The sending module 93 is used to route the read and write request to the target server.
[0235] In one embodiment of the present disclosure, the migration task start switch, the full migration completion switch, the new data routing switch and the rollback switch are in a closed state before data migration;
[0236] The migration task start switch is in an on state after the data migration starts;
[0237] The full migration completion switch is turned on after the data migration is completed;
[0238] The newly added data routing switch is in an open state after the control device receives the newly added data routing modification request;
[0239] The rollback switch is in an open state after the control device receives a rollback request.
[0240] In one embodiment of the present disclosure, when the processing module 92 is used to determine the target server from the first server and the second server according to the state of the migration switch, it is specifically used to:
[0241] Determine whether the migration task start switch is in an off state;
[0242] If the migration task start switch is in an off state, the first server is used as a target server.
[0243] In one embodiment of the present disclosure, the processing module 92 is further configured to:
[0244] If the migration task start switch is in the on state, determining whether the full migration completion switch is in the on state;
[0245] If the full migration completion switch is in the on state, the second server is used as the target server.
[0246] In one embodiment of the present disclosure, the processing module 92 is further configured to:
[0247] If the full migration completion switch is in the off state, determining whether the rollback switch is in the on state;
[0248] If the rollback switch is in the on state, the first server is used as the target server.
[0249] In one embodiment of the present disclosure, the read / write request includes a data identifier, and the processing module 92 is further configured to:
[0250] If the rollback switch is in the off state, sending a data status acquisition request to the first server, wherein the data status acquisition request includes the data identifier;
[0251] receiving a data status sent by the first server, the data status including a first identifier indicating whether data corresponding to the data identifier exists;
[0252] A target server is determined from the first server and the second server according to the data state and the state of the migration switch.
[0253] In one embodiment of the present disclosure, when the processing module 92 is used to determine the target server from the first server and the second server according to the data state and the state of the migration switch, it is specifically used to:
[0254] Determining, according to the first identifier, whether data corresponding to the data identifier exists;
[0255] If the data corresponding to the data identifier does not exist, the target server is determined according to the state of the newly added data routing switch.
[0256] In one embodiment of the present disclosure, when the processing module 92 is used to determine the target server according to the state of the newly added data routing switch, it is specifically used to:
[0257] If the newly added data routing switch is in the on state, the second server is used as the target server;
[0258] If the newly added data routing switch is in a closed state, the first server is used as the target server.
[0259] In one embodiment of the present disclosure, if the first identifier indicates that the data corresponding to the data identifier exists, the data status further includes: a second identifier indicating whether the data corresponding to the data identifier is locked, and a third identifier indicating whether the data corresponding to the data identifier is marked with a migration identifier, and the processing module 92 is further specifically used to:
[0260] If the data corresponding to the data identifier exists, judging whether the data corresponding to the data identifier has been migrated according to the third identifier;
[0261] If the data migration corresponding to the data identifier is completed, the second server is used as the target server.
[0262] In one embodiment of the present disclosure, the processing module 92 is further configured to:
[0263] If the data corresponding to the data identifier has not been migrated, determining whether the data corresponding to the data identifier is in the process of being migrated according to the second identifier;
[0264] If the data corresponding to the data identifier is in the process of being migrated, the second server is used as the target server;
[0265] If the data corresponding to the data identifier is not in the migration process, the first server is used as the target server.
[0266] In one embodiment of the present disclosure, the receiving module 91 is further configured to receive a migration instruction.
[0267] In one embodiment of the present disclosure, the sending module 93 is further configured to send the migration instruction to the first server.
[0268] In one embodiment of the present disclosure, the processing module 92 is further configured to turn on the migration task start switch.
[0269] In one embodiment of the present disclosure, the processing module 92 is further configured to, upon receiving a new data route modification request through the receiving module 91 , place the new data route switch in an on state.
[0270] In one embodiment of the present disclosure, the processing module 92 is further configured to turn on the rollback switch when a rollback request is received through the receiving module 91 .
[0271] In one embodiment of the present disclosure, the processing module 92 is further configured to turn on the full migration completion switch when receiving a migration completion message sent by the first server through the receiving module 91 .
[0272] The read / write request routing device provided in this embodiment can implement the technical solution of the control device in the above method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0273] refer to Fig.10 The read / write request routing device according to the exemplary embodiment of the present disclosure is described. Fig.10 A second structural diagram of a read / write request routing device provided according to an embodiment of the present disclosure is schematically shown, which is used to implement the method of the first server in any of the above method embodiments. Its implementation principle and technical effect are similar and will not be repeated here.
[0274] like Fig.10 As shown, the read / write request routing device 1000 includes:
[0275] A receiving module 1001 is used to receive a data status acquisition request sent by a control device, where the data status acquisition request includes a data identifier;
[0276] A processing module 1002 is used to determine a data state according to the data identifier, where the data state includes a first identifier indicating whether the data corresponding to the data identifier exists;
[0277] The sending module 1003 is used to send the data status to the control device.
[0278] In one embodiment of the present disclosure, when determining the data state according to the data identifier, the processing module 1002 is specifically configured to:
[0279] generating a first identifier indicating whether the data corresponding to the data identifier exists according to whether the data corresponding to the data identifier exists in the first server;
[0280] The data status is generated according to the first identifier.
[0281] In one embodiment of the present disclosure, the processing module 1002 is further configured to:
[0282] If the first identifier indicates that the data corresponding to the data identifier exists, a second identifier indicating whether the data corresponding to the data identifier is locked is generated according to whether the data corresponding to the data identifier is locked, and the data corresponding to the data identifier is locked during the data migration process;
[0283] According to whether the data corresponding to the data identifier is marked with a migration identifier, a third identifier is generated to indicate whether the data corresponding to the data identifier is marked with a migration identifier; the data corresponding to the data identifier is marked with a migration identifier after the data is migrated;
[0284] The second identifier and the third identifier are added to the data state.
[0285] In one embodiment of the present disclosure, the receiving module 1001 is further configured to receive a migration instruction sent by the control device;
[0286] In one embodiment of the present disclosure, the processing module 1002 is further used to process the original data in the database according to the preset screening strategy and heterogeneous strategy to obtain the target data;
[0287] In an embodiment of the present disclosure, the sending module 1003 is further configured to use a preset sending strategy to sequentially send migration requests to the second server, wherein the migration requests include the sub-data in the target data.
[0288] In one embodiment of the present disclosure, the processing module 1002 is further configured to:
[0289] Locking the sub-data;
[0290] When receiving the sub-data migration completion message sent by the second server through the receiving module 1001, the sub-data is unlocked and a migration completed flag is marked on the sub-data;
[0291] In one embodiment of the present disclosure, the sending module 1003 is further configured to send a migration completion message to the control device when all sub-data in the target data are marked with a migrated flag.
[0292] In one embodiment of the present disclosure, the receiving module 1001 is further used to receive a data synchronization instruction sent by the second server, where the data synchronization instruction is an instruction generated by the second server according to the write request when the received read / write request is a write request;
[0293] In one embodiment of the present disclosure, the processing module 1002 is further configured to perform synchronization processing on the data in the database according to the data synchronization instruction.
[0294] In one embodiment of the present disclosure, the processing module 1002 is further configured to:
[0295] For each first data marked as migrated, obtaining, from the second server according to the identifier of the first data, second data corresponding to the identifier of the first data;
[0296] If the first data is different from the second data, a data inconsistency prompt message is output.
[0297] The read / write request routing device provided in this embodiment can implement the technical solution of the first server in the above method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0298] Exemplary Computing Devices
[0299] After introducing the method, medium and apparatus of the exemplary embodiments of the present disclosure, next, reference is made to Fig.11 The computing device according to the exemplary embodiment of the present disclosure is described. Fig.11 The schematic diagram shows a structure of a computing device provided according to an embodiment of the present disclosure.
[0300] Fig.11 The computing device 1100 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0301] like Fig.11As shown, the computing device 1100 is in the form of a general computing device. The components of the computing device 1100 may include, but are not limited to: at least one processing unit 1101, at least one storage unit 1102, and a bus 1103 connecting different system components (including the processing unit 1101 and the storage unit 1102). Among them, at least one storage unit 1102 stores computer-executable instructions; at least one processing unit 1101 includes a processor, and the processor executes the computer-executable instructions to implement the method described above.
[0302] The bus 1103 includes a data bus, a control bus, and an address bus.
[0303] The storage unit 1102 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 11021 and / or a cache memory 11022 , and may further include a readable medium in the form of a non-volatile memory, such as a read-only memory (ROM) 11023 .
[0304] The storage unit 1102 may also include a program / utility 11025 having a set (at least one) of program modules 11024, such program modules 11024 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0305] The computing device 1100 may also communicate with one or more external devices 1104 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 1105. Furthermore, the computing device 1100 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1106. Fig.11 As shown, the network adapter 1106 communicates with other modules of the computing device 1100 via the bus 1103. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the computing device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0306] The computing device is used to execute the technical solution of the control device or the first server in any of the aforementioned method embodiments, and its implementation principle and technical effect are similar and will not be repeated here.
[0307] It should be noted that although several units / modules or sub-units / modules of the read / write request routing device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided to be embodied by multiple units / modules.
[0308] In addition, although the operations of the disclosed method are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0309] Although the spirit and principle of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A read / write request routing method, characterized in that: Applied to a control device, the method comprises: Receive read and write requests; Determine a target server from a first server and a second server according to a state of a migration switch, wherein the migration switch includes at least one of a migration task start switch, a full migration completion switch, a new data routing switch, and a rollback switch, wherein the first server is a server from which data is migrated out, and the second server is a server to which data is migrated in; The read and write requests are routed to the target server.
2. The method according to claim 1, characterized in that The migration task start switch, the full migration completion switch, the new data routing switch and the rollback switch are in a closed state before data migration; The migration task start switch is in an on state after the data migration starts; The full migration completion switch is turned on after the data migration is completed; The newly added data routing switch is in an open state after the control device receives the newly added data routing modification request; The rollback switch is in an open state after the control device receives a rollback request.
3. The method according to claim 2, characterized in that The step of determining a target server from the first server and the second server according to the state of the migration switch includes: Determine whether the migration task start switch is in an off state; If the migration task start switch is in an off state, the first server is used as a target server.
4. The method according to claim 3, characterized in that The method further comprises: If the migration task start switch is in the on state, determining whether the full migration completion switch is in the on state; If the full migration completion switch is in the on state, the second server is used as the target server.
5. The method according to claim 4, characterized in that The method further comprises: If the full migration completion switch is in the off state, determining whether the rollback switch is in the on state; If the rollback switch is in the on state, the first server is used as the target server.
6. The method according to claim 5, characterized in that The read / write request includes a data identifier, and the method further includes: If the rollback switch is in the off state, sending a data status acquisition request to the first server, wherein the data status acquisition request includes the data identifier; receiving a data status sent by the first server, the data status including a first identifier indicating whether data corresponding to the data identifier exists; A target server is determined from the first server and the second server according to the data state and the state of the migration switch.
7. A read-write request routing method, characterized in that: Applied to a first server, the method comprises: receiving a data status acquisition request sent by a control device, wherein the data status acquisition request includes a data identifier; Determine a data status according to the data identifier, wherein the data status includes a first identifier indicating whether data corresponding to the data identifier exists; The data status is sent to the control device.
8. A computing device, characterized in that include: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the computing device to perform the read / write request routing method as described in any one of claims 1 to 6 or claim 7.
9. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements any one of claims 1 to 6, or the read / write request routing method described in claim 7.
10. A computer program product, characterized in that It comprises a computer program, which is used to implement any one of claims 1 to 6 or the read-write request routing method described in claim 7 when executed by a processor.
