Data migration method and device, equipment and storage medium
By acquiring and building migration tasks, the migration complexity problem caused by data stickiness and business coupling in traditional data migration is solved, and fast and secure data migration is achieved, reducing migration risks and impacts.
Patent Information
- Application Number
- CN202311516642.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2025-05-16
AI Technical Summary
During the traditional cross-system data migration process, data stickiness is high and business coupling is high, resulting in the risk of data loss and data inconsistency during data migration. It usually requires batch cutting and connection in the data resting state, which is time-consuming and complex.
By obtaining target order data, customer data, account data and user data, a migration task is constructed, and the information is sent to the processing unit for processing in the order of processing, so as to realize the data migration to the target database. Without affecting the normal business management of users, this method processes data in steps and one by one to reduce the amount of migration data and improve migration efficiency.
It realizes data migration quickly and securely without affecting user business processing, reduces the risk of data loss and inconsistency, simplifies the migration process, and improves migration efficiency.
Smart Images

Figure CN120011334A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data storage, and in particular to a data migration method, device, equipment and storage medium. Background Art
[0002] In the traditional cross-system data migration process, business data is closely linked, data stickiness is high, business coupling between data is high, and all business interactions are performed with the same database system. If there is a possibility of data loss in the upper and lower links during cross-database access, data consistency cannot be guaranteed.
[0003] Currently, in order to achieve data migration, batch cutover of data can only be performed when the data is static (i.e., the service is suspended and the business processing during data migration is not supported).
[0004] Therefore, the existing cross-system data migration process has some problems. Summary of the invention
[0005] The present application provides a data migration method, apparatus, device and storage medium to solve problems existing in cross-system data migration.
[0006] In a first aspect, the present application provides a data migration method, comprising:
[0007] Acquire target order data, customer data, account data and user data of the target order data, wherein the target order data is any one of order data for transferring the current business to the target business stored in the target database, order data for establishing a user association relationship with a target user in the target database, and order data for establishing a bill payment relationship with a target account in the target database;
[0008] Building a migration task according to the target order data, the customer data, the account data and the user data of the target order data, wherein the migration task includes a migration task identifier, and processing unit information and processing sequence information of the target order data, the customer data, the account data and the user data corresponding to the migration task identifier;
[0009] According to the migration task identifier, the target order data, customer data, account data and user data in the migration task are sent to the corresponding processing unit for processing according to the processing sequence information, so as to migrate the target order data, customer data, account data and user data to the target database.
[0010] Among them, in this application, obtaining target order data, customer data, account data and user data of the target order data includes:
[0011] Determine the business database, which is used to receive the business data of unprocessed orders;
[0012] Determine target order data based on the business database;
[0013] According to the target order data, the customer data, account data and user data of the target order data are determined.
[0014] Among them, in this application, according to the business database, the target order data is determined, including:
[0015] Determine the unprocessed order business data in the business database and the business type of the unprocessed order business data;
[0016] If the business type of the unprocessed order business data is order data used to transfer the current business to the target business stored in the target database, or order data used to establish a user association relationship with a target user in the target database, or order data used to establish a bill payment relationship with a target account in the target database, the unprocessed order business data will be locked, and the unprocessed order business data after the locking process will be determined as the target order data.
[0017] In this application, after determining the target order data according to the business database, and before constructing the migration task according to the target order data, the customer data, account data and user data of the target order data, the method further includes:
[0018] Determine the current time;
[0019] If the current time is within the preset time range, a step of building a migration task according to the target order data, the customer data of the target order data, the account data, and the user data is executed.
[0020] Among them, in this application, if the current time is within the preset time range, the step of constructing a migration task according to the target order data, the customer data, account data and user data of the target order data is executed, including:
[0021] If the current time is within the preset time range, the target attribute value in the target order data is modified to a migratable target value, and the target attribute value is used to determine whether the unprocessed order business data needs to be migrated;
[0022] According to the target attribute values in the target order data, a step of building a migration task according to the target order data, the customer data of the target order data, the account data, and the user data is performed.
[0023] In this application, a migration task is constructed based on the target order data, the customer data, account data and user data of the target order data, including:
[0024] determining processing unit information and processing sequence information according to the target order data, the customer data, the account data and the user data of the target order data, wherein the processing priority of the target order data in the processing sequence information is higher than the processing priority of the customer data, the account data and the user data of the target order data;
[0025] A migration task is constructed based on the processing unit information, the processing sequence information, the target order data, the customer data of the target order data, the account data, and the user data.
[0026] Among them, in this application, according to the migration task identifier, the target order data, customer data, account data and user data in the migration task are sent to the corresponding processing unit according to the processing sequence information for processing, so as to migrate the target order data, customer data, account data and user data to the target database, including:
[0027] Sending the first transaction information to the master control server, so that the master control server sends the first transaction information to the first processing unit corresponding to the target order data, until the first processing unit migrates the target order data to the target database, and then feeds back first migration completion information to the master control server, where the first transaction information is the transaction information of migrating the target order data in the migration task;
[0028] Receiving first migration completion information fed back by the master control server;
[0029] According to the first migration completion information, adjust the task progress of the target order data in the migration task;
[0030] According to the task progress of the target order data in the migration task, the second transaction information is sent to the master control server, so that the master control server sends the second transaction information to the second processing unit corresponding to the customer data, the third processing unit corresponding to the account data, and the fourth processing unit corresponding to the user data, respectively, until the second processing unit, the third processing unit, and the fourth processing unit migrate the customer data, the account data, and the user data to the target database, and then feedback the second migration completion information to the master control server;
[0031] Receiving second migration completion information fed back by the master control server;
[0032] A completion status of the migration task is determined according to the second migration completion information.
[0033] In this application, according to the migration task identifier, the target order data, customer data, account data and user data in the migration task are sent to the corresponding processing unit according to the processing sequence information for processing, so that the target order data, customer data, account data and user data are migrated to the target database, and the method further includes:
[0034] If a migration error occurs in the target order data in the target database, the step of re-executing, according to the migration task identifier, sending the target order data, customer data, account data, and user data in the migration task to the corresponding processing unit according to the processing sequence information for processing, so as to migrate the target order data, customer data, account data, and user data to the target database;
[0035] If a migration error occurs in the target data in the target database, the target data is re-migrated to the target database according to the migration task identifier, where the target data is customer data, account data or user data.
[0036] In a second aspect, the present application provides a data migration device, including:
[0037] an acquisition module, used to acquire target order data, customer data, account data and user data of the target order data, wherein the target order data is any one of order data for transferring the current business to the target business stored in the target database, order data for establishing a user association relationship with a target user in the target database, and order data for establishing a bill payment relationship with a target account in the target database;
[0038] A construction module, used to construct a migration task according to the target order data, the customer data, the account data and the user data of the target order data, wherein the migration task includes a migration task identifier, and processing unit information and processing sequence information of the target order data, the customer data, the account data and the user data corresponding to the migration task identifier;
[0039] The migration module is used to send the target order data, customer data, account data and user data in the migration task to the corresponding processing unit for processing according to the processing sequence information based on the migration task identifier, so as to migrate the target order data, customer data, account data and user data to the target database.
[0040] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0041] Memory stores computer-executable instructions;
[0042] The processor executes the computer-executable instructions stored in the memory to implement the method in the present application.
[0043] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method of the present application.
[0044] The present application provides a data migration method, apparatus, device and storage medium, which obtains target order data, customer data, account data and user data of the target order data, wherein the target order data is any one of order data for transferring the current business to the target business stored in the target database, order data for establishing a user association relationship with a target user in the target database, and order data for establishing a bill payment relationship with a target account in the target database; constructs a migration task according to the target order data, the customer data, account data and user data of the target order data, the migration task includes a migration task identifier, processing unit information and processing sequence information of the target order data, customer data, account data and user data corresponding to the migration task identifier; according to the migration task identifier, sends the target order data, customer data, account data and user data in the migration task to the corresponding processing unit for processing according to the processing sequence information, so as to migrate the target order data, customer data, account data and user data to the target database. By obtaining the target order data, which is the order data for transferring the current business to the target business stored in the target database, the order data for establishing a user association relationship with the target user in the target database, and any order data for establishing a bill payment relationship with the target account in the target database, the target order data that meets the conditions is screened through conditions, and the data migration process is triggered to migrate the target order data and the user data, customer data, and account data corresponding to the target order data to the target database, so as to achieve the effect that the user is not aware and the data migration has no impact on the user's normal business handling. The target order data, customer data, account data, and user data are sent to the corresponding processing unit for processing according to the processing sequence information, which can better manage the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0046] Figure 1 A flowchart of a data migration method provided in an embodiment of the present application;
[0047] Figure 2 A flowchart of another data migration method provided in an embodiment of the present application;
[0048] Figure 3 A schematic diagram of the structure of a data migration device provided in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0050] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0051] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0052] In the prior art, the traditional migration method migrates a lot of data at one time, so it is necessary to block all business acceptance channels so that users cannot submit order data normally to ensure that the data is in a static state in order to implement migration and failed migration; this migration method is time-consuming, the links are complex, and there is a risk of batch migration failure due to negligence of some details, and it costs a lot of manpower and material resources.
[0053] The present application provides a data migration method, apparatus, device and storage medium. By acquiring target order data, the target order data is order data for transferring the current business to the target business stored in the target database, order data for establishing a user association relationship with the target user in the target database, and any order data for establishing a bill payment relationship with the target account in the target database, and by conditionally screening the target order data that meets the conditions, a data migration process is triggered to migrate the target order data and the user data, customer data and account data corresponding to the target order data to the target database. The migration data in one migration task is small, so the entire migration time is very fast, and the normal business handling of the user is not affected, so that the user is not aware and the data migration has no effect on the normal business handling of the user. A migration task is constructed based on the target order data, the customer data, account data and user data of the target order data, and the migration task includes a migration task identifier, and processing unit information and processing sequence information of the target order data, customer data, account data and user data corresponding to the migration task identifier; based on the migration task identifier, the target order data, customer data, account data and user data in the migration task are sent to the corresponding processing unit for processing according to the processing sequence information, so as to migrate the target order data, customer data, account data and user data to the target database. By processing the corresponding data through the processing unit, the migration data can be better managed, and when the migration fails, the data that failed to migrate can be quickly located.
[0054] The execution subject of the method for data migration provided in the embodiment of the present application can be a server. Among them, the server can be any server. This embodiment does not impose any special restrictions on the implementation method of the execution subject, as long as the execution subject can obtain the target order data, the customer data of the target order data, the account data and the user data, wherein the target order data is used to transfer the current business to the target business stored in the target database, the order data used to establish a user association relationship with the target user in the target database, and the order data used to establish a bill payment relationship with the target account in the target database. Any one of the data; according to the target order data, the customer data, the account data and the user data of the target order data, a migration task is constructed, and the migration task includes a migration task identifier, and the processing unit information and processing sequence information of the target order data, the customer data, the account data and the user data corresponding to the migration task identifier; according to the migration task identifier, the target order data, the customer data, the account data and the user data in the migration task are sent to the corresponding processing unit for processing according to the processing sequence information, so as to migrate the target order data, the customer data, the account data and the user data to the target database.
[0055] The database is a warehouse that organizes, stores and manages data according to data structure. It is a collection of large amounts of data that is stored in a computer for a long time, organized, shareable and uniformly managed.
[0056] Figure 1 A flow chart of a data migration method provided in an embodiment of the present application. Figure 1 As shown, the execution subject of the method can be a server or other servers, and this embodiment is not particularly limited here. Figure 1 As shown, the method includes:
[0057] S101. Obtain target order data, customer data, account data and user data of the target order data, wherein the target order data is any one of order data for transferring the current business to the target business stored in the target database, order data for establishing a user association relationship with a target user in the target database, and order data for establishing a bill payment relationship with a target account in the target database.
[0058] Among them, the target order data is the order data currently submitted by the user and meets the migration conditions; the account corresponding to the target data order cannot have more than the target number of users, and the target number can be fifteen; the users corresponding to the target order data do not have no discount after the migration is completed, for example: the users corresponding to the target order data use the group-wide group purchase package discount, then the data migration will result in the user group purchase package discount message; the target order data can be one or more; when there are multiple new order data submitted at the same time, there are multiple target order data.
[0059] Order data can be used to order products for users, confirm users' payment accounts, and change the association between users.
[0060] Customer data refers to the data of individuals, enterprises or other groups that use products and services provided by operators (including third-party partners). Customers also include potential customers. A customer may have one or more users. Customer can be individual A or enterprise B.
[0061] User data is the data of an instance formed by a customer subscribing to an operator's product, including subscription information, resource usage, etc. The user can be a phone card.
[0062] Account data refers to the payment entity data of customers using mobile services. The account can be a bank card or credit card.
[0063] Transferring the current business to the order data of the target business stored in the target database means that the order data is used to replace the storage product in the current database used by the user with the storage product in the target database. For example, the user is currently using the product sold by the current database Oracle (such as 4G-related products), and replaces it with the product sold by drds (such as 5G-related products).
[0064] The order data that establishes a user association relationship with the target user in the target database refers to the order data used to establish a target relationship between user A in the current database and user B in the target database. For example, user A is phone card A in the current database oracle, and user B is phone card B in the target database drds. If phone card A needs to be changed into a secondary card of phone card B, user B is migrated from oracle to drds.
[0065] The order data used to establish a bill payment relationship with the target account in the target database refers to the order used to establish a payment relationship between the user in the current database and the account in the target database. For example, account A's data is in the target database drds, and user B's data is in the current database oracle. At this time, account A needs to pay for user B's consumption, so user B is migrated from oracle to drds.
[0066] The target database is a database that receives the target order data, the customer data of the target order data, the account data and the user data. The target database can be drds or mysql. The target database is different from the original database of the target order data.
[0067] In the embodiment of the present application, obtaining target order data, customer data, account data and user data of the target order data includes:
[0068] Determine the business database, which is used to receive the business data of unprocessed orders;
[0069] Determine target order data based on the business database;
[0070] According to the target order data, the customer data, account data and user data of the target order data are determined.
[0071] The business database is the target database, which is used to receive the migrated data. It can be drds, mysql or any other database.
[0072] Unprocessed order business data refers to the order data submitted by the user that needs to be processed.
[0073] Among them, in the embodiment of the present application, determining the target order data according to the business database includes:
[0074] Determine the unprocessed order business data in the business database and the business type of the unprocessed order business data;
[0075] If the business type of the unprocessed order business data is order data used to transfer the current business to the target business stored in the target database, or order data used to establish a user association relationship with a target user in the target database, or order data used to establish a bill payment relationship with a target account in the target database, the unprocessed order business data will be locked, and the unprocessed order business data after the locking process will be determined as the target order data.
[0076] Among them, the order locking process is to prevent the order data from being polluted during the migration process. After the order is locked, no new order data submitted by users corresponding to the target order data will be accepted; but because the amount of data to be migrated for each migration task is small, it only includes multiple target order data submitted at the same time or one target order data. Therefore, it takes at most a few minutes to complete the migration task. Therefore, the order locking time is short and has almost no impact on users' submission of new orders.
[0077] When a user submits new order data, the business type of the order data is determined, and based on the business type, it is determined whether the new order data needs to be migrated to the target database.
[0078] In the embodiment of the present application, after determining the target order data according to the business database, and before constructing the migration task according to the target order data, the customer data, account data and user data of the target order data, the method further includes:
[0079] Determine the current time;
[0080] If the current time is within the preset time range, a step of building a migration task according to the target order data, the customer data of the target order data, the account data, and the user data is executed.
[0081] The preset time range can be any time preset by the user, for example, the time except the two days at the beginning and the two days at the end of each month. Reconciliation operations are required within the two days at the beginning and the end of the month when data migration cannot be performed.
[0082] If the current time is within the preset time range, the formal migration process will be started; otherwise, the formal migration process will be started only when the current time is within the preset time range.
[0083] S102. Construct a migration task according to the target order data, the customer data, the account data and the user data of the target order data, wherein the migration task includes a migration task identifier, and processing unit information and processing sequence information of the target order data, the customer data, the account data and the user data corresponding to the migration task identifier.
[0084] The migration task identifier is unique and can be a sequence of 16 random digits.
[0085] Among them, in the embodiment of the present application, if the current time is within the preset time range, the step of constructing a migration task according to the target order data, the customer data, the account data and the user data of the target order data is executed, including:
[0086] If the current time is within the preset time range, the target attribute value in the target order data is modified to a migratable target value, and the target attribute value is used to determine whether the unprocessed order business data needs to be migrated;
[0087] According to the target attribute values in the target order data, a step of building a migration task according to the target order data, the customer data of the target order data, the account data, and the user data is performed.
[0088] Among them, the target attribute value is preset by the user, which can be the target data value A, and the migratable target value can be A1. By identifying whether the target attribute value A in the order data is the migratable value A1, the order data whose target attribute value A is the migratable value A1 is migrated.
[0089] In the embodiment of the present application, a migration task is constructed according to the target order data, the customer data, the account data and the user data of the target order data, including:
[0090] determining processing unit information and processing sequence information according to the target order data, the customer data, the account data and the user data of the target order data, wherein the processing priority of the target order data in the processing sequence information is higher than the processing priority of the customer data, the account data and the user data of the target order data;
[0091] A migration task is constructed based on the processing unit information, the processing sequence information, the target order data, the customer data of the target order data, the account data, and the user data.
[0092] The processing order information is to migrate the target order data first, and then migrate the account data, user data, and customer data. The account data, user data, and customer data can be started to migrate at the same time, or they can be migrated in any order.
[0093] The order data is migrated first because the order data contains customer data information, account data information, and user data information. During the migration, the customer data information, account data information, and user data information need to be found through the customer data information, account data information, and user data information in the target order data. The business type of the target order data is determined first, and the migration process is started only if the business type meets the migration conditions. Therefore, the target order data is migrated first.
[0094] S103. According to the migration task identifier, the target order data, customer data, account data and user data in the migration task are sent to the corresponding processing unit for processing according to the processing sequence information, so as to migrate the target order data, customer data, account data and user data to the target database.
[0095] In the embodiment of the present application, according to the migration task identifier, the target order data, customer data, account data and user data in the migration task are sent to the corresponding processing unit for processing according to the processing sequence information, so as to migrate the target order data, customer data, account data and user data to the target database, including:
[0096] Sending the first transaction information to the master control server, so that the master control server sends the first transaction information to the first processing unit corresponding to the target order data, until the first processing unit migrates the target order data to the target database, and then feeds back first migration completion information to the master control server, where the first transaction information is the transaction information of migrating the target order data in the migration task;
[0097] Receiving first migration completion information fed back by the master control server;
[0098] According to the first migration completion information, adjust the task progress of the target order data in the migration task;
[0099] According to the task progress of the target order data in the migration task, the second transaction information is sent to the master control server, so that the master control server sends the second transaction information to the second processing unit corresponding to the customer data, the third processing unit corresponding to the account data, and the fourth processing unit corresponding to the user data, respectively, until the second processing unit, the third processing unit, and the fourth processing unit migrate the customer data, the account data, and the user data to the target database, and then feedback the second migration completion information to the master control server;
[0100] Receiving second migration completion information fed back by the master control server;
[0101] A completion status of the migration task is determined according to the second migration completion information.
[0102] The first processing unit may be a target order data migration sub-department, which is used to execute a migration task of migrating the target order data to the target database.
[0103] The second processing unit may be an account data migration sub-department, configured to execute a migration task of migrating the account data to a target database.
[0104] The third processing unit may be a user data migration sub-department, configured to execute a migration task of migrating user data to a target database.
[0105] The fourth processing unit may be a customer data migration sub-department, configured to execute a migration task of migrating customer data to a target database.
[0106] After receiving the first transaction information, the general control service sends the first transaction information to the target order data migration sub-department; after receiving the first transaction message, the target order data migration sub-department identifies the target order data, and then migrates the target order data from the current database to the target database; after the migration of the target order data is completed, the second transaction information is sent to the general control service; after receiving the second transaction information from the target order data migration sub-department, the general control service sends the second transaction information to the customer data migration sub-department, the account data migration sub-department, and the user data migration sub-department; the customer data, account data, and user data corresponding to the target order data are obtained according to the target order data, and then the customer data migration sub-department migrates the customer data to the target database, the account data migration sub-department migrates the account data to the target database, and the user data migration sub-department migrates the user data to the target database.
[0107] In the embodiment of the present application, according to the migration task identifier, the target order data, customer data, account data and user data in the migration task are sent to the corresponding processing unit according to the processing sequence information for processing, so that the target order data, customer data, account data and user data are migrated to the target database, and the method further includes:
[0108] If a migration error occurs in the target order data in the target database, the step of re-executing, according to the migration task identifier, sending the target order data, customer data, account data, and user data in the migration task to the corresponding processing unit according to the processing sequence information for processing, so as to migrate the target order data, customer data, account data, and user data to the target database;
[0109] If a migration error occurs in the target data in the target database, the target data is re-migrated to the target database according to the migration task identifier, where the target data is customer data, account data or user data.
[0110] Among them, failure to migrate target order data will also lead to failure to migrate customer data, user data, and account data.
[0111] Failure in migrating any of customer data, user data, or account data will not affect other data.
[0112] The operation and maintenance personnel check whether the corresponding migration task is successfully migrated according to the task identifiers of each migration task; if the migration of the target order data fails, the migration system will re-migrate the target order data, customer data, user data, and account data in response to the operation of the operation and maintenance personnel; if the migration of the target order data is successful, and there is migration failure data in the customer data, user data, and account data, then the migration system only needs to migrate the corresponding failed data in response to the operation of the operation and maintenance personnel.
[0113] A data migration method provided in an embodiment of the present application obtains target order data newly submitted by a user and meeting migration conditions, and then migrates the target order data and user data, customer data, and customer data corresponding to the target order data. The migration process is initiated only when the order data newly submitted by the user meets the migration conditions. This method can achieve multiple migrations of a small amount of data, thereby enabling data migration without affecting the normal business processing of the user.
[0114] Figure 2 A flow chart of another data migration method provided in an embodiment of the present application. Figure 2 As shown, the execution subject of the method can be a server or other servers, and this embodiment is not particularly limited here. Figure 2 As shown, the method includes:
[0115] S201. Determine pre-migration data according to migration conditions and order data.
[0116] Among them, the order data is the latest order data submitted by the user, and does not include historical order data.
[0117] The method for determining pre-migration data based on migration conditions and order data is as follows:
[0118] According to the latest order submitted by the user, it is determined whether the latest submitted order is an order that meets the migration condition.
[0119] The pre-migration data includes order data and customer data, account data, and user data corresponding to the order data.
[0120] Customer refers to an individual, enterprise or other group that uses products and services provided by an operator (including third-party partners). Customers also include potential customers. A customer may have one or more users. Customer can be individual A or enterprise B.
[0121] A user is an instance formed by a customer subscribing to an operator's product, including subscription information, resource usage, etc. A user can be a phone card.
[0122] An account refers to the payment entity for a customer's use of mobile services. An account can be a bank card or credit card.
[0123] The orders that meet the migration conditions are:
[0124] The order is used to replace the product in the current database used by the user with the product in the target database. For example, the user is currently using the product sold by the current database Oracle (such as 4G-related products), and replace it with the product sold by drds (such as 5G-related products).
[0125] The order is used to establish a target relationship between user A in the current database and user B in the target database. For example, user A is phone card A in the current database Oracle, and user B is phone card B in the target database Drds. If you need to change phone card A to the secondary card of phone card B, then migrate user B from Oracle to Drds.
[0126] Orders are used to establish payment relationships between users in the current database and accounts in the target database. For example, account A's data is in the target database drds, and user B's data is in the current database oracle. If account A needs to pay for user B's consumption, user B will be migrated from oracle to drds.
[0127] S202: Get the current date and determine whether the current date is within the migration date.
[0128] Among them, the dates that do not meet the migration requirements are manually preset, which can be the last two or three days of the month and the first three days of the month. Data migration can be performed on other dates of each month.
[0129] S203: If the relocation date is within the period, the order data is marked.
[0130] Among them, the method of marking the order data is: changing specific attributes in the order to specific values.
[0131] S204: Create a new cutover flow (i.e., a migration task).
[0132] Among them, the cutover flow includes a unique identifier of the cutover flow; a cutover flow includes multiple migration subtasks; a migration subtask corresponds to a migration subdepartment migrating corresponding data; a migration subtask has a migration subtask status; during the entire migration process, a cutover flow will only be generated in this step, and the migration subtask status in the cutover flow will be added according to the actual situation of the corresponding migration subdepartment executing the migration subtask.
[0133] S205: Lock the order data and send the first transaction information to the general control service.
[0134] Among them, the purpose of locking the order is to prevent users from submitting new orders during migration to prevent data pollution. The first transaction information is generated through the cutover flow.
[0135] S206: After receiving the first transaction information, the general control service sends the first transaction information to the order data migration sub-department.
[0136] S207 . After receiving the first transaction message, the order data migration sub-department identifies the marked order data and then migrates the marked order data from the current database to the target database.
[0137] The current database can be oracle and the target database can be drds.
[0138] S208. After the order data migration is completed, the corresponding order data migration completion status is added to the cutover flow, and then the second transaction information is sent to the general control service.
[0139] The second transaction information here is obtained according to the cutover flow of the newly added corresponding order data migration completion status.
[0140] S209: Migrate user data, customer data, and account data from the current database to the target database.
[0141] Among them, the method for migrating user data, customer data, and account data from the current database to the target database is:
[0142] After receiving the second transaction information of the order data migration sub-department, the general control service sends the second transaction information to the customer data migration sub-department, the account data migration sub-department, and the user data migration sub-department; obtains the customer data, account data, and user data corresponding to the order data based on the order data, and then the customer data migration sub-department migrates the customer data to the target database, the account data migration sub-department migrates the account data to the target database, and the user data migration sub-department migrates the user data to the target database; the migration sub-department completes the migration of the corresponding data, and adds the migration completion status of the corresponding migration sub-task to the cutover flow.
[0143] S210: When all pre-migration data are migrated, the migration sub-department that last completes the migration sub-task sends the third transaction information to the master control service, so that the master control service unlocks the order data.
[0144] The last migration sub-department may be any one of the customer data migration sub-department, the account data migration sub-department, and the user data migration sub-department, and the third transaction information is generated according to the latest cutover flow.
[0145] S211. If data migration fails, the operation and maintenance personnel will re-migrate the failed data according to the cutover flow.
[0146] Among them, the operation and maintenance personnel re-migrate the failed data according to the cutover flow:
[0147] The operation and maintenance personnel determine which specific migration sub-department has an error in migration data based on each cutover flow identifier, and then directly start the process of re-migrating the failed migration data through the migration system. Then, the migration system responds to the operation of the operation and maintenance personnel to migrate the failed migration data to the target database; the failed migration data can be any one or more of the order data and the customer data, account data, and user data corresponding to the order data; the failure of order data will affect the subsequent migration of customer data, account data, and user data; the failure of customer data, account data, and user data migration will not affect the migration of other data.
[0148] Another data migration method provided in the embodiment of the present application can be broken down into parts and is committed to achieving lightweight and imperceptible migration purposes, breaking the traditional batch cutover of static data mode and effectively reducing the pressure of batch migration data.
[0149] Figure 3 This is a diagram showing an example of the structure of a data migration device provided in an embodiment of the present application. Figure 3 As shown, the data migration device 30 includes: an acquisition module 301, a construction module 302, and a migration module 303. Among them:
[0150] An acquisition module 301 is used to acquire target order data, customer data, account data and user data of the target order data, wherein the target order data is any one of order data for transferring the current business to the target business stored in the target database, order data for establishing a user association relationship with a target user in the target database, and order data for establishing a bill payment relationship with a target account in the target database;
[0151] A construction module 302 is used to construct a migration task according to the target order data, the customer data, account data and user data of the target order data, wherein the migration task includes a migration task identifier, processing unit information and processing sequence information of the target order data, customer data, account data and user data corresponding to the migration task identifier;
[0152] The migration module 303 is used to send the target order data, customer data, account data and user data in the migration task to the corresponding processing unit for processing according to the processing sequence information based on the migration task identifier, so as to migrate the target order data, customer data, account data and user data to the target database.
[0153] In the embodiment of the present application, the acquisition module 301 may also be specifically used for:
[0154] Determine the business database, which is used to receive the business data of unprocessed orders;
[0155] Determine target order data based on the business database;
[0156] According to the target order data, the customer data, account data and user data of the target order data are determined.
[0157] In the embodiment of the present application, the acquisition module 301 may also be specifically used for:
[0158] Determine the unprocessed order business data in the business database and the business type of the unprocessed order business data;
[0159] If the business type of the unprocessed order business data is order data used to transfer the current business to the target business stored in the target database, or order data used to establish a user association relationship with a target user in the target database, or order data used to establish a bill payment relationship with a target account in the target database, the unprocessed order business data will be locked, and the unprocessed order business data after the locking process will be determined as the target order data.
[0160] In the embodiment of the present application, the construction module 301 may also be specifically used for:
[0161] Determine the current time;
[0162] If the current time is within the preset time range, a step of building a migration task according to the target order data, the customer data of the target order data, the account data, and the user data is executed.
[0163] In the embodiment of the present application, the construction module 302 may also be specifically used for:
[0164] If the current time is within the preset time range, the target attribute value in the target order data is modified to a migratable target value, and the target attribute value is used to determine whether the unprocessed order business data needs to be migrated;
[0165] According to the target attribute values in the target order data, a step of building a migration task according to the target order data, the customer data of the target order data, the account data, and the user data is performed.
[0166] In the embodiment of the present application, the construction module 302 may also be specifically used for:
[0167] determining processing unit information and processing sequence information according to the target order data, the customer data, the account data and the user data of the target order data, wherein the processing priority of the target order data in the processing sequence information is higher than the processing priority of the customer data, the account data and the user data of the target order data;
[0168] A migration task is constructed based on the processing unit information, the processing sequence information, the target order data, the customer data of the target order data, the account data, and the user data.
[0169] In the embodiment of the present application, the migration module 303 may also be specifically used for:
[0170] Sending the first transaction information to the master control server, so that the master control server sends the first transaction information to the first processing unit corresponding to the target order data, until the first processing unit migrates the target order data to the target database, and then feeds back first migration completion information to the master control server, where the first transaction information is the transaction information of migrating the target order data in the migration task;
[0171] Receiving first migration completion information fed back by the master control server;
[0172] According to the first migration completion information, adjust the task progress of the target order data in the migration task;
[0173] According to the task progress of the target order data in the migration task, the second transaction information is sent to the master control server, so that the master control server sends the second transaction information to the second processing unit corresponding to the customer data, the third processing unit corresponding to the account data, and the fourth processing unit corresponding to the user data, respectively, until the second processing unit, the third processing unit, and the fourth processing unit migrate the customer data, the account data, and the user data to the target database, and then feedback the second migration completion information to the master control server;
[0174] Receiving second migration completion information fed back by the master control server;
[0175] A completion status of the migration task is determined according to the second migration completion information.
[0176] In the embodiment of the present application, the migration module 303 may also be specifically used for:
[0177] If a migration error occurs in the target order data in the target database, the step of re-executing, according to the migration task identifier, sending the target order data, customer data, account data, and user data in the migration task to the corresponding processing unit according to the processing sequence information for processing, so as to migrate the target order data, customer data, account data, and user data to the target database;
[0178] If a migration error occurs in the target data in the target database, the target data is re-migrated to the target database according to the migration task identifier, where the target data is customer data, account data or user data.
[0179] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, the electronic device 40 includes:
[0180] The electronic device 40 may include a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a communication component 403 and other components. The processor 401 , the memory 402 and the communication component 403 are connected via a bus 404 .
[0181] In a specific implementation process, at least one processor 401 executes the computer execution instructions stored in the memory 402, so that at least one processor 401 executes the above data migration method.
[0182] The specific implementation process of the processor 401 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0183] In the above Figure 4In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0184] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk storage.
[0185] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0186] In some embodiments, a computer program product is also proposed, including a computer program or instructions, which implement the steps in any of the above-mentioned data migration methods when executed by a processor.
[0187] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0188] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0189] To this end, an embodiment of the present application provides a computer-readable storage medium, in which multiple instructions are stored. The instructions can be loaded by a processor to execute the steps in any data migration method provided in the embodiment of the present application.
[0190] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0191] According to one aspect of the present application, a computer program product or a computer program is provided. The computer program product or the computer program comprises computer instructions stored in a computer-readable storage medium.
[0192] Since the instructions stored in the storage medium can execute the steps in any data migration method provided in the embodiments of the present application, the beneficial effects that can be achieved by any data migration method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0193] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0194] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A data migration method, characterized in that: The method comprises: Acquire target order data, customer data, account data and user data of the target order data, wherein the target order data is any one of order data for transferring the current business to the target business stored in the target database, order data for establishing a user association relationship with a target user in the target database, and order data for establishing a bill payment relationship with a target account in the target database; constructing a migration task according to the target order data, the customer data, the account data and the user data of the target order data, wherein the migration task includes a migration task identifier, and processing unit information and processing sequence information of the target order data, the customer data, the account data and the user data corresponding to the migration task identifier; According to the migration task identifier, the target order data, customer data, account data and user data in the migration task are sent to the corresponding processing unit for processing according to the processing sequence information, so as to migrate the target order data, customer data, account data and user data to the target database.
2. The method according to claim 1, characterized in that: The obtaining of target order data, customer data, account data and user data of the target order data includes: Determine a business database, wherein the business database is used to receive unprocessed order business data; Determining the target order data according to the business database; The customer data, account data and user data of the target order data are determined according to the target order data.
3. The method according to claim 2, characterized in that The step of determining the target order data according to the business database includes: Determining unprocessed order business data in the business database and the business type of the unprocessed order business data; If the business type of the unprocessed order business data is order data for transferring the current business to the target business stored in the target database, or order data for establishing a user association relationship with a target user in the target database, or order data for establishing a bill payment relationship with a target account in the target database, the unprocessed order business data is locked, and the unprocessed order business data after the locking process is determined as the target order data.
4. The method according to claim 1, characterized in that: After determining the target order data according to the business database, and before constructing a migration task according to the target order data, the customer data, account data and user data of the target order data, the method further includes: Determine the current time; If the current time is within a preset time range, a step of constructing a migration task according to the target order data, the customer data, the account data and the user data of the target order data is executed.
5. The method according to claim 4, characterized in that If the current time is within the preset time range, executing the step of constructing a migration task according to the target order data, the customer data, account data and user data of the target order data, includes: If the current time is within the preset time range, modifying the target attribute value in the target order data to a migratable target value, wherein the target attribute value is used to determine whether the unprocessed order business data needs to be migrated; According to the target attribute value in the target order data, a step of constructing a migration task according to the target order data, the customer data, the account data and the user data of the target order data is performed.
6. The method according to claim 1, characterized in that The step of constructing a migration task according to the target order data, the customer data, the account data and the user data of the target order data includes: determining processing unit information and processing sequence information according to the target order data, the customer data, the account data and the user data of the target order data, wherein the processing priority of the target order data in the processing sequence information is higher than the processing priority of the customer data, the account data and the user data of the target order data; A migration task is constructed according to the processing unit information, the processing sequence information, the target order data, the customer data, the account data and the user data of the target order data.
7. The method according to claim 1, characterized in that The step of sending the target order data, customer data, account data, and user data in the migration task to corresponding processing units for processing according to the processing sequence information according to the migration task identifier, so as to migrate the target order data, the customer data, the account data, and the user data to the target database includes: Sending first transaction information to a master control server, so that the master control server sends the first transaction information to a first processing unit corresponding to the target order data, until the first processing unit migrates the target order data to the target database, and then feeds back first migration completion information to the master control server, where the first transaction information is transaction information for migrating the target order data in the migration task; Receiving the first migration completion information fed back by the master control server; adjusting the task progress of the target order data in the migration task according to the first migration completion information; According to the task progress of the target order data in the migration task, the second transaction information is sent to the master control server, so that the master control server sends the second transaction information to the second processing unit corresponding to the customer data, the third processing unit corresponding to the account data, and the fourth processing unit corresponding to the user data, respectively, until the second processing unit, the third processing unit, and the fourth processing unit migrate the customer data, the account data, and the user data to the target database, and then feedback second migration completion information to the master control server; receiving the second migration completion information fed back by the master control server; A completion status of the migration task is determined according to the second migration completion information.
8. The method according to claim 1, characterized in that: After the target order data, customer data, account data and user data in the migration task are sent to corresponding processing units according to the processing sequence information for processing according to the migration task identifier, so as to migrate the target order data, customer data, account data and user data to the target database, the method further includes: If a migration error occurs in the target order data in the target database, re-execute the step of sending the target order data, customer data, account data and user data in the migration task to the corresponding processing unit according to the processing sequence information for processing according to the migration task identifier, so as to migrate the target order data, the customer data, the account data and the user data to the target database; If a migration error occurs in the target data in the target database, the target data is re-migrated to the target database according to the migration task identifier, where the target data is the customer data, the account data or the user data.
9. A data migration device, characterized in that: include: an acquisition module, used to acquire target order data, customer data, account data and user data of the target order data, wherein the target order data is any one of order data for transferring a current business to a target business stored in a target database, order data for establishing a user association relationship with a target user in the target database, and order data for establishing a bill payment relationship with a target account in the target database; a construction module, configured to construct a migration task according to the target order data, the customer data, the account data and the user data of the target order data, wherein the migration task includes a migration task identifier, and processing unit information and processing sequence information of the target order data, the customer data, the account data and the user data corresponding to the migration task identifier; A migration module is used to send the target order data, customer data, account data and user data in the migration task to the corresponding processing unit for processing according to the processing sequence information based on the migration task identifier, so as to migrate the target order data, customer data, account data and user data to the target database.
10. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.
Citation Information
Cited By
Business system migration method and computing device
CN121029724A