Database migration processing method and device and computer equipment
By using half of the directory structure and mapping relationships in the migration resource package in the database migration processing, the target migration execution file is quickly obtained and database migration processing is carried out, which solves the problem of low database migration processing efficiency in the existing technology, and realizes efficient and accurate database migration processing.
Patent Information
- Application Number
- CN202411865209.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-11
AI Technical Summary
In the prior art, database migration processing efficiency is low, resulting in low migration processing efficiency during microservice upgrades or testing.
By responding to the migration instruction of the pending database, the migration resource package corresponding to the pending database is determined based on the database migration attribute information carried in the migration instruction. The migration resource package includes a mapping relationship between half a directory structure and different migration execution files, quickly obtain the target migration execution file, and migrate the to-process database based on the target migration execution file.
This method can speed up the database migration processing, improve the efficiency of database migration processing, reduce the workload of operation and maintenance personnel, and greatly improve the accuracy and speed of database migration processing.
Smart Images

Figure CN119807132A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a database migration processing method, device and computer equipment. Background Art
[0002] With the development of cloud-native technologies, more and more companies are beginning to adopt microservice architecture to build and deploy applications, splitting applications into a set of microservices, each of which has specific business functions.
[0003] In actual applications, each microservice is supported by a variety of different databases when it is running. In order to ensure the security and stability of each microservice, it is necessary to regularly upgrade or test each microservice. During the upgrade or testing of each microservice, the database associated with each microservice is mainly migrated.
[0004] However, in the related art, there is a problem of low efficiency in database migration processing during the process of performing database migration processing. Summary of the invention
[0005] Based on this, it is necessary to provide a database migration processing method, device and computer equipment to address the above technical problems, which can improve the efficiency of database migration processing during the process of database migration processing.
[0006] In a first aspect, an embodiment of the present application provides a database migration processing method, the method comprising:
[0007] In response to the migration instruction of the database to be processed, a migration resource package corresponding to the database to be processed is determined according to the database migration attribute information carried in the migration instruction; the migration resource package includes a mapping relationship between a semi-quantum directory structure and different migration execution files;
[0008] Determine target information from the semi-quantity directory structure of the migration resource package according to the database migration attribute information, and obtain the target migration execution file from each migration execution file according to the target information and the mapping relationship;
[0009] Based on the target migration execution file and database migration attribute information, the database to be processed is migrated.
[0010] The technical solution in the embodiment of the present application responds to the migration instruction of the database to be processed, determines the migration resource package corresponding to the database to be processed according to the database migration attribute information carried in the migration instruction, the migration resource package includes the mapping relationship between the semi-quantitative directory structure and different migration execution files, determines the target information from the semi-quantitative directory structure of the migration resource package according to the database migration attribute information, obtains the target migration execution file from each migration execution file according to the target information and the mapping relationship, and performs migration processing on the database to be processed based on the target migration execution file and the database migration attribute information; the above method is based on the mapping relationship between the pre-constructed semi-quantitative directory structure and different migration execution files, and can quickly obtain the target migration execution file required for the migration processing of the database to be processed. On this basis, the database to be processed can be migrated based on the target migration execution file, which can speed up the database migration processing and improve the efficiency of the database migration processing. In addition, the process does not require manual participation, and can avoid the errors of repeated processing and omitted processing caused by manual processing. It can not only improve the accuracy of the database migration processing, but also greatly improve the speed of the database migration processing. In addition, it can also reduce the workload of operation and maintenance personnel and speed up the migration progress of the database.
[0011] In one embodiment, the database migration attribute information includes a database identifier; determining a migration resource package corresponding to the database to be processed according to the database migration attribute information carried in the migration instruction includes:
[0012] Find the database identifier corresponding to the database to be processed in the pre-built full directory structure;
[0013] Get the microservice ID corresponding to the database ID from the full directory structure;
[0014] Get the migration resource package corresponding to the database to be processed according to the microservice identifier.
[0015] The technical solution in the embodiment of the present application searches for the database identifier corresponding to the database to be processed in the pre-built full directory structure, obtains the microservice identifier corresponding to the database identifier from the full directory structure, and obtains the migration resource package corresponding to the database to be processed according to the microservice identifier; the above method can quickly search for the microservice identifier from the pre-built full directory structure, and accelerate the acquisition of the migration resource package corresponding to the database to be processed based on the microservice identifier, which simplifies the acquisition process of the migration resource package corresponding to the database to be processed and reduces the complexity of the acquisition process.
[0016] In one embodiment, the method further comprises:
[0017] Check whether the database to be processed exists;
[0018] If it exists, execute the step of obtaining the microservice identifier corresponding to the database identifier from the full directory structure;
[0019] If it does not exist, create the database to be processed and execute the step of obtaining the microservice identifier corresponding to the database identifier from the full directory structure.
[0020] The technical solution in the embodiment of the present application can detect whether the database to be processed exists before entering the substantive steps of the database migration processing process, which can avoid wasting time, improve the effectiveness of the processing process, and ensure the normal execution of the database migration processing flow.
[0021] In one embodiment, obtaining a migration resource package corresponding to a database to be processed according to a microservice identifier includes:
[0022] Search processing is performed according to the correspondence between different migration resource package identifiers and different service identifiers and the microservice identifier, and the migration resource package of the database to be processed is determined according to the migration resource package identifier corresponding to the service identifier matching the microservice identifier in the correspondence.
[0023] The technical solution in the embodiment of the present application can quickly determine the migration resource package of the database to be processed according to the pre-built corresponding relationship, thereby improving the efficiency of obtaining the migration resource package of the database to be processed.
[0024] In one embodiment, the database migration attribute information includes a migration version identifier and a migration type, and the semi-quantitative directory structure includes associations between different version identifiers and different migration types; determining target information from the semi-quantitative directory structure of the migration resource package according to the database migration attribute information includes:
[0025] Search each version ID for a target version ID that matches the migration version ID;
[0026] According to the association relationship and the target version identifier, at least one candidate migration type associated with the target version identifier is acquired, and a target migration type matching the migration type is acquired from each candidate migration type;
[0027] The target version ID and the target migration type are determined as the target information.
[0028] The technical solution in the embodiment of the present application searches for a target version identifier that matches the migration version identifier in each version identifier, obtains at least one candidate migration type associated with the target version identifier based on the association relationship and the target version identifier, and obtains a target migration type that matches the migration type from each candidate migration type, and then determines the target version identifier and the target migration type as the target information; the above method can determine the target information from the semi-quantitative directory structure of the migration resource package by searching, and the process does not require the participation of complex algorithms, and the processing process is relatively simple, thereby speeding up the determination of the target information and improving the efficiency of determining the target information; in addition, the migration resource package in the above method may include all migration execution files under different versions, so that in the subsequent maintenance of the database to be processed, no additional operations are required, and traceability can be achieved through the migration resource package, thereby improving the traceability of the data to be processed and reducing the time cost of maintenance.
[0029] In one embodiment, the target information includes a target version identifier and a target migration type; obtaining the target migration execution file from each migration execution file according to the target information and the mapping relationship includes:
[0030] The target migration type corresponding to the target version identifier is searched in the mapping relationship, and the migration execution file corresponding to the target migration type in the mapping relationship is determined as the target migration execution file.
[0031] The technical solution in the embodiment of the present application searches for the target migration type corresponding to the target version identifier in the mapping relationship, and determines the migration execution file corresponding to the target migration type in the mapping relationship as the target migration execution file; the above method can quickly obtain the target migration execution file based on the pre-built mapping relationship, thereby improving the efficiency of obtaining the target migration execution file required for migration processing of the database to be processed.
[0032] In one embodiment, the database migration attribute information includes a migration version identifier; and the method further includes:
[0033] Get the current version ID of the database to be processed;
[0034] If the current version identifier is different from the migration version identifier, a step of determining target information from a semi-quantitative directory structure of the migration resource package according to the database migration attribute information is performed.
[0035] The technical solution in the embodiment of the present application obtains the current version identifier of the database to be processed, and when the current version identifier is different from the migration version identifier, executes the step of determining the target information from the semi-quantitative directory structure of the migration resource package according to the database migration attribute information; the above can ensure that the database to be processed is in the target state, that is, the migration version identifier and the migration type, and before executing the specific process of database migration processing, verify whether it is necessary to execute the specific process. If necessary, execute the specific implementation process. If it is not necessary, it can save the process of executing the specific implementation process, end the database migration processing in advance, speed up the database migration processing, reduce the time required for the database migration processing, and also avoid the problem of database status error caused by repeated execution of the database migration processing.
[0036] In one embodiment, the database migration attribute information includes database configuration information; based on the target migration execution file and the database migration attribute information, performing migration processing on the database to be processed includes:
[0037] According to the database configuration information, determine the storage node where the database to be processed is located;
[0038] A plurality of different operation instructions in the target migration execution file are sequentially sent to the storage node, instructing the storage node to perform migration processing on the pending database.
[0039] The technical solution in the embodiment of the present application determines the storage node where the database to be processed is located according to the database configuration information, and sends multiple different operation instructions in the target migration execution file to the storage node in sequence, instructing the storage node to migrate the database to be processed; the above method can correctly send multiple different operation instructions in the target migration execution file to the corresponding storage node in sequence, avoiding node sending errors, which can improve the correctness of database migration.
[0040] In a second aspect, an embodiment of the present application provides a database migration processing device, the device comprising:
[0041] A first determination module is used to respond to the migration instruction of the database to be processed and determine the migration resource package corresponding to the database to be processed according to the database migration attribute information carried in the migration instruction; the migration resource package includes a mapping relationship between a semi-quantum directory structure and different migration execution files;
[0042] A first acquisition module is used to determine target information from a semi-quantitative directory structure of a migration resource package according to database migration attribute information, and to acquire a target migration execution file from each migration execution file according to the target information and a mapping relationship;
[0043] The migration processing module is used to perform migration processing on the database to be processed based on the target migration execution file and database migration attribute information.
[0044] In a third aspect, an embodiment of the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method of any one of the embodiments of the first aspect when executing the computer program.
[0045] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method of any embodiment in the above-mentioned first aspect are implemented.
[0046] In a fifth aspect, an embodiment of the present application further provides a computer program product, the computer program product comprising a computer program, which, when executed by a processor, implements the steps of the method of any embodiment of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 An application environment diagram of a database migration processing method in an embodiment;
[0048] Figure 2 A schematic diagram of a process flow of a database migration processing method in one embodiment;
[0049] Figure 3 A schematic diagram of a flow chart of a database migration processing method in another embodiment;
[0050] Figure 4 This is a structural diagram of a full directory structure in an embodiment;
[0051] Figure 5 A schematic diagram of a flow chart of a database migration processing method in another embodiment;
[0052] Figure 6 A schematic diagram of a flow chart of a database migration processing method in another embodiment;
[0053] Figure 7 A schematic diagram of a flow chart of a database migration processing method in another embodiment;
[0054] Figure 8 A schematic diagram of a flow chart of a database migration processing method in another embodiment;
[0055] Fig. 9 A schematic diagram of a flow chart of a database migration processing method in another embodiment;
[0056] Fig.10 is a structural block diagram of a database migration processing device in one embodiment;
[0057] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0059] In the field of cloud computing, more and more companies are beginning to adopt microservice architecture to build and deploy applications, splitting applications into a group of microservices, each of which has specific business functions. In actual applications, each microservice is provided with necessary data support through a variety of different databases when it is running. In order to ensure the security and stability of each microservice, it is necessary to upgrade or test each microservice regularly. During the upgrade or testing of each microservice, the database associated with each microservice is mainly migrated. In the related art, a manual method is mainly used to migrate at least one database associated with the microservice to be upgraded or tested based on the migration execution file. However, in the process of migrating the database in the related art, there is a problem of low efficiency in database migration processing. Based on this, the embodiment of the present application provides a database migration processing method, which can improve the efficiency of database migration processing during the process of migrating the database.
[0060] The database migration processing method provided in the embodiment of the present application can be applied to Figure 1 The application environment diagram shown. The application environment includes a database migration processing system, which may include a computer device, at least one storage device where multiple databases associated with different microservices are located, and a data center. Among them, the computer device and each storage device and data center can be connected by communication, and the communication method can be Wi-Fi, mobile network or Bluetooth connection, etc. Optionally, the computer device can be a personal computer, desktop computer, laptop computer, smart phone, smart watch and other electronic devices with data processing functions, and the above storage device can be but is not limited to a computer device or database system with storage function, wherein, Figure 1 The following example is illustrated by taking three storage nodes (including storage node 1, storage node 2 and storage node 3) as an example. The following embodiment takes a computer device as the execution subject of the database migration processing method to introduce the specific process of the database migration processing method.
[0061] like Figure 2 FIG. 1 is a flow chart of a database migration processing method provided in an embodiment of the present application. The method can be implemented by the following steps:
[0062] S100: In response to a migration instruction of a pending database, a migration resource package corresponding to the pending database is determined according to database migration attribute information carried in the migration instruction, wherein the migration resource package includes a mapping relationship between a semi-quantum directory structure and different migration execution files.
[0063] Among them, during the upgrade or testing of any microservice, at least one corresponding database associated with the microservice needs to be migrated. In practical applications, these databases can be referred to as corresponding databases to be processed. In the embodiment of the present application, a database to be processed is taken as an example for explanation.
[0064] Specifically, the computer device can receive a migration instruction of any pending database associated with a microservice input by a user through voice, gesture, button, knob, etc., and respond to the migration instruction, perform analysis and processing, extraction and other operations on the information carried in the migration instruction, obtain the database migration attribute information carried in the migration instruction, and then determine the migration resource package corresponding to the pending database according to the database migration attribute information carried in the migration instruction.
[0065] In one embodiment, the computer device may send the database migration attribute information carried in the migration instruction to each storage device, and the corresponding storage device in each storage device may respond to the database migration attribute information and then feedback the migration resource package corresponding to the database to be processed.
[0066] In another embodiment, the computer device can analyze and process the database migration attribute information carried in the migration instruction, determine the corresponding storage device, and send a request to obtain the migration resource package corresponding to the database to be processed to the corresponding storage device, instructing the corresponding storage device to feedback the migration resource package corresponding to the database to be processed.
[0067] Correspondingly, the computer device may receive the migration resource package corresponding to the database to be processed sent by the corresponding storage device.
[0068] In an embodiment of the present application, the migration resource package corresponding to the database to be processed includes a mapping relationship between a semi-quantity directory structure and different migration execution files; the semi-quantity directory structure can be a directory structure constructed by relevant information of the migration of the database to be processed, and the migration execution file can include multiple relevant instructions for migration processing.
[0069] It should be noted here that the above-mentioned migration instructions can be upgrade instructions (including creation of storage structure instructions, addition of data instructions, modification of data instructions, deletion of data instructions, etc.), rollback instructions (including deletion of storage structure, modification of data instructions, deletion of data instructions, etc.). In an embodiment of the present application, the type of migration instruction corresponds to the type directory of migration processing.
[0070] S200: Determine target information from a semi-quantitative directory structure of a migration resource package according to database migration attribute information, and obtain a target migration execution file from each migration execution file according to the target information and a mapping relationship.
[0071] It should be noted that the semi-quantity directory structure may include multiple levels, and the target information may be any information in the innermost level of the multiple levels. Optionally, the target migration execution file may be any one of the migration execution files.
[0072] In one implementation, the computer device may pre-train an algorithm model, and then input the database migration attribute information and the migration resource package into the algorithm model, and the algorithm model outputs the target information determined from the semi-quantitative directory structure of the migration resource package. In another implementation, the computer device may also perform keyword extraction processing, comparison processing, and / or matching processing on the database migration attribute information and the hierarchical information in the semi-quantitative directory structure of the migration resource package layer by layer to determine the target information from the semi-quantitative directory structure of the migration resource package.
[0073] At the same time, the computer device may perform keyword extraction processing, comparison processing and / or matching processing according to the target information and the mapping relationship, and obtain the target migration execution file from each migration execution file according to the processing result.
[0074] S300: Perform migration processing on the database to be processed based on the target migration execution file and database migration attribute information.
[0075] Specifically, the computer device can determine the identifier of the storage device where the database to be processed is located based on the database migration attribute information, and then send the target migration execution file to the corresponding storage device based on the identifier of the storage device, instructing the storage device to migrate the database to be processed based on the target migration execution file.
[0076] Migrating the database to be processed refers to the process of converting the database to be processed from one state to another state, which may be creating a new table in the database to be processed, updating the structure of the original table, updating the data in the original table, deleting an original table, creating an index, etc.
[0077] The technical solution in the embodiment of the present application responds to the migration instruction of the database to be processed, determines the migration resource package corresponding to the database to be processed according to the database migration attribute information carried in the migration instruction, the migration resource package includes the mapping relationship between the semi-quantitative directory structure and different migration execution files, determines the target information from the semi-quantitative directory structure of the migration resource package according to the database migration attribute information, obtains the target migration execution file from each migration execution file according to the target information and the mapping relationship, and performs migration processing on the database to be processed based on the target migration execution file and the database migration attribute information; the above method is based on the mapping relationship between the pre-constructed semi-quantitative directory structure and different migration execution files, and can quickly obtain the target migration execution file required for the migration processing of the database to be processed. On this basis, the database to be processed can be migrated based on the target migration execution file, which can speed up the database migration processing and improve the efficiency of the database migration processing. In addition, the process does not require manual participation, and can avoid the errors of repeated processing and omitted processing caused by manual processing. It can not only improve the accuracy of the database migration processing, but also greatly improve the speed of the database migration processing. In addition, it can also reduce the workload of operation and maintenance personnel and speed up the migration progress of the database.
[0078] The following is an explanation of the process of determining the migration resource package corresponding to the database to be processed according to the database migration attribute information carried in the migration instruction. In one embodiment, the database migration attribute information includes a database identifier; Figure 3 As shown, the step of determining the migration resource package corresponding to the database to be processed according to the database migration attribute information carried in the migration instruction in the above S100 can be implemented by the following steps:
[0079] S110. Searching for a database identifier corresponding to the database to be processed in the pre-built full directory structure.
[0080] In practical applications, a full directory structure can be pre-built, which is built based on the semi-directory structure in the migration resource package, that is, the full directory structure includes the semi-directory structure. It should be noted here that the first level in the full directory structure is the database identification layer, which may include multiple different database identifications. In an embodiment of the present application, the above database identification can be understood as the database name.
[0081] Among them, the computer device can pre-train an algorithm model, and then input the full directory structure and the database identifier corresponding to the database to be processed into the algorithm model. The algorithm model searches for the database identifier corresponding to the database to be processed in the full directory structure, that is, searches for the database identifier that matches the database identifier corresponding to the database to be processed in the full directory structure.
[0082] In addition, the computer device may also use a matching algorithm to match each information in the full directory structure with the database corresponding to the database to be processed, and search for the database identifier corresponding to the database to be processed in the full directory structure based on the matching result.
[0083] Optionally, the above matching algorithm may be at least one of a string matching algorithm, a pattern matching algorithm, a fuzzy matching algorithm, an exact matching algorithm, and the like.
[0084] S120. Obtain a microservice identifier corresponding to the database identifier from the full directory structure.
[0085] Specifically, the computer device can pre-train an algorithm model, and then input the full directory structure and the identifier of the database to be processed into the algorithm model, and the algorithm model obtains the microservice identifier corresponding to the database identifier from the full directory structure.
[0086] At the same time, the computer device can use a matching algorithm to match the information in the full directory structure with the database identifier, and obtain the microservice identifier corresponding to the database identifier from the full directory structure based on the matching result.
[0087] Optionally, the above-mentioned microservice identifier can be understood as the microservice name; wherein, the second level within the full directory structure is the microservice identification layer, which may include different microservice identifiers; in an embodiment of the present application, the full directory structure may include the correspondence between different database identifiers, different microservice identifiers, different version identifiers and different migration types.
[0088] like Figure 4 The following is a diagram of the full directory structure. Figure 4 The first level in the code includes two database identifiers, each of which includes the microservice identifiers associated with it in the second level, and each microservice identifier includes
[0089] S130. Obtain a migration resource package corresponding to the database to be processed according to the microservice identifier.
[0090] In actual applications, the corresponding relationship between different microservice identifiers and different migration resource packages can be stored on each storage device. Specifically, the computer device can send the microservice identifier to the data center, instructing the data center to obtain the migration resource package corresponding to the microservice identifier from the resource warehouse, that is, the migration resource package corresponding to the database to be processed. Correspondingly, the computer device can receive the migration resource package corresponding to the database to be processed sent by the data center.
[0091] It should be noted that the original migration resource package stored in the resource warehouse can be understood as a resource compression package, and the migration resource package can be understood as the file after the data center decompresses the original migration resource package. Among them, the data center can automatically maintain the database to be processed through the Jenkins tool.
[0092] The following is an explanation of the process of obtaining the migration resource package corresponding to the database to be processed according to the microservice identifier. In one embodiment, the step in S130 may include: performing search processing according to the correspondence between different migration resource package identifiers and different service identifiers and the microservice identifier, and determining the migration resource package of the database to be processed according to the migration resource package identifier corresponding to the service identifier that matches the microservice identifier in the correspondence.
[0093] Specifically, the computer device can search for a service identifier that matches the microservice identifier in the correspondence between different migration resource package identifiers and different service identifiers, and determine the migration resource package of the database to be processed based on the migration resource package identifier corresponding to the service identifier that matches the microservice identifier in the correspondence, that is, determine the migration resource package corresponding to the found migration resource package identifier as the migration resource package of the database to be processed.
[0094] The technical solution in the embodiment of the present application can quickly determine the migration resource package of the database to be processed according to the pre-built corresponding relationship, thereby improving the efficiency of obtaining the migration resource package of the database to be processed.
[0095] The technical solution in the embodiment of the present application searches for the database identifier corresponding to the database to be processed in the pre-built full directory structure, obtains the microservice identifier corresponding to the database identifier from the full directory structure, and obtains the migration resource package corresponding to the database to be processed according to the microservice identifier; the above method can quickly search for the microservice identifier from the pre-built full directory structure, and accelerate the acquisition of the migration resource package corresponding to the database to be processed based on the microservice identifier, which simplifies the acquisition process of the migration resource package corresponding to the database to be processed and reduces the complexity of the acquisition process.
[0096] In one embodiment, before executing the step in S120 above, Figure 5 As shown, the above method may also include:
[0097] S121. Detect whether the database to be processed exists.
[0098] Specifically, the computer device may send the database identifier of the pending database to each storage device to detect whether the pending database exists. When the computer device receives a feedback message sent by any storage device, it determines that the pending database exists, otherwise, it determines that the pending database does not exist.
[0099] In addition, the computer device may output a detection instruction of whether the database to be processed exists, instructing the user to input information of whether the database to be processed exists, so as to complete the detection of whether the database to be processed exists.
[0100] S122. If it exists, execute the step of obtaining the microservice identifier corresponding to the database identifier from the full directory structure.
[0101] Among them, if the database to be processed exists, the step of obtaining the microservice identifier corresponding to the database identifier from the full directory structure can be executed.
[0102] S123. If it does not exist, create a database to be processed, and execute the step of obtaining the microservice identifier corresponding to the database identifier from the full directory structure.
[0103] If the database to be processed does not exist, you can first create the database to be processed, and then execute the step of obtaining the microservice identifier corresponding to the database identifier from the full directory structure.
[0104] It should be noted here that if the database to be processed exists, it indicates that the database to be processed is any version of the database after the initial version; if the database to be processed does not exist, it indicates that the database to be processed did not exist before the current moment, or the database to be processed was suddenly lost before the current moment.
[0105] The technical solution in the embodiment of the present application can detect whether the database to be processed exists before entering the substantive steps of the database migration processing process, which can avoid wasting time, improve the effectiveness of the processing process, and ensure the normal execution of the database migration processing flow.
[0106] The following is an explanation of the process of determining the target information from the semi-quantitative directory structure of the migration resource package according to the database migration attribute information. In one embodiment, the database migration attribute information includes a migration version identifier and a migration type, and the semi-quantitative directory structure includes associations between different version identifiers and different migration types; Figure 6 As shown, the step of determining the target information from the semi-quantity directory structure of the migration resource package according to the database migration attribute information in the above S200 can be implemented in the following manner:
[0107] S210: Search among the version identifiers for a target version identifier that matches the migration version identifier.
[0108] Specifically, the computer device may use a matching algorithm to match each version identifier in the semi-quantity directory structure with the migration version identifier, and search for a version identifier that matches the migration version identifier among each version identifier as the target version identifier.
[0109] In addition, the computer device may pre-train a matching model, and then input the semi-quantity directory structure and the migration version identifier into the matching model, and the matching model searches for a target version identifier that matches the migration version identifier in each version identifier and outputs the target version identifier. Optionally, the matching model may be implemented by at least one of a convolutional neural network model, a fully connected neural network model, a long short-term memory neural network model, a recurrent neural network model, a residual neural network model, and the like.
[0110] The version identifier may be a version number, and different version numbers are arranged in order of size in the semi-quantity directory structure; the migration type is a category of migration processing. In an embodiment of the present application, the migration resource package may include mapping relationships between different version identifiers, different migration types, and different migration execution files. Different version identifiers and different migration types may be named with different Arabic serial numbers.
[0111] S220: Acquire at least one candidate migration type associated with the target version identifier according to the association relationship and the target version identifier, and acquire a target migration type matching the migration type from each candidate migration type.
[0112] In practical applications, the computer device may obtain at least one migration type corresponding to the target version identifier in the association relationship as a candidate migration type, and match each candidate migration type with the migration type to obtain a target migration type matching the migration type from each candidate migration type.
[0113] It should be noted here that the above-mentioned target migration type can be any information in the innermost level in the semi-quantity directory structure, that is, the innermost level in the semi-quantity directory structure is the migration type layer.
[0114] S230: Determine the target version identifier and the target migration type as target information.
[0115] In an embodiment of the present application, the computer device may determine the target version identifier and the target migration type as the target information.
[0116] The technical solution in the embodiment of the present application searches for a target version identifier that matches the migration version identifier in each version identifier, obtains at least one candidate migration type associated with the target version identifier based on the association relationship and the target version identifier, and obtains a target migration type that matches the migration type from each candidate migration type, and then determines the target version identifier and the target migration type as the target information; the above method can determine the target information from the semi-quantitative directory structure of the migration resource package by searching, and the process does not require the participation of complex algorithms, and the processing process is relatively simple, thereby speeding up the determination of the target information and improving the efficiency of determining the target information; in addition, the migration resource package in the above method may include all migration execution files under different versions, so that in the subsequent maintenance of the database to be processed, no additional operations are required, and traceability can be achieved through the migration resource package, thereby improving the traceability of the data to be processed and reducing the time cost of maintenance.
[0117] The process of obtaining the target migration execution file from each migration execution file according to the target information and the mapping relationship is described below. In one embodiment, the target information includes a target version identifier and a target migration type; the step of obtaining the target migration execution file from each migration execution file according to the target information and the mapping relationship in S200 may include: searching the mapping relationship for the target migration type corresponding to the target version identifier, and determining the migration execution file corresponding to the target migration type in the mapping relationship as the target migration execution file.
[0118] Specifically, the computer device can search for a version identifier that matches the target version identifier in the mapping relationship, obtain the target migration type corresponding to the version identifier that matches the target version identifier in the mapping relationship, and determine the migration execution file corresponding to the target migration type in the mapping relationship as the target migration execution file.
[0119] It should be noted here that there may be multiple migration types corresponding to the version identifier that matches the target version identifier in the mapping relationship, and the target migration type is one of them.
[0120] The technical solution in the embodiment of the present application searches for the target migration type corresponding to the target version identifier in the mapping relationship, and determines the migration execution file corresponding to the target migration type in the mapping relationship as the target migration execution file; the above method can quickly obtain the target migration execution file based on the pre-built mapping relationship, thereby improving the efficiency of obtaining the target migration execution file required for migration processing of the database to be processed.
[0121] In practical applications, in order to improve the effectiveness and speed of database migration processing, it is possible to first verify whether the migration requirements are consistent with the current state of the database to be processed, and determine the execution status of the database migration process based on the verification results. The following is an explanation of the verification process. In one embodiment, the above-mentioned database migration attribute information includes a migration version identifier; before executing the steps in S200 above, such as Figure 7 As shown, the above method may further include the following steps:
[0122] S400: Obtain the current version identifier of the database to be processed.
[0123] Specifically, the computer device may send a version identification acquisition request to the storage device where the database to be processed is located, instructing the storage device to feedback the current version identification of the database to be processed, so as to acquire the current version identification of the database to be processed.
[0124] In addition, the computer device may output a request for obtaining the version identifier of the database to be processed, instructing the user to input the current version identifier of the database to be processed.
[0125] S500: If the current version identifier is different from the migration version identifier, a step of determining target information from a semi-quantitative directory structure of the migration resource package according to database migration attribute information is performed.
[0126] Among them, when the current version identifier of the database to be processed is different from the migration version identifier, continue to execute the step of determining the target information from the semi-directory structure of the migration resource package according to the database migration attribute information; when the current version identifier of the database to be processed is the same as the migration version identifier, end the database migration processing flow.
[0127] The technical solution in the embodiment of the present application obtains the current version identifier of the database to be processed, and when the current version identifier is different from the migration version identifier, executes the step of determining the target information from the semi-quantitative directory structure of the migration resource package according to the database migration attribute information; the above can ensure that the database to be processed is in the target state, that is, the migration version identifier and the migration type, and before executing the specific process of database migration processing, verify whether it is necessary to execute the specific process. If necessary, execute the specific implementation process. If it is not necessary, it can save the process of executing the specific implementation process, end the database migration processing in advance, speed up the database migration processing, reduce the time required for the database migration processing, and also avoid the problem of database status error caused by repeated execution of the database migration processing.
[0128] The following is an explanation of the process of performing migration processing on the database to be processed based on the target migration execution file and the database migration attribute information. In one embodiment, the database migration attribute information includes database configuration information; Figure 8 As shown, the steps in the above S300 can be implemented in the following manner:
[0129] S310: Determine the storage node where the database to be processed is located according to the database configuration information.
[0130] Specifically, the computer device may use a keyword extraction method to extract keywords from the database configuration information, and then determine the storage node where the database to be processed is located according to the extraction result. Optionally, the keyword extraction method may include at least one of a clustering algorithm, a topic model algorithm, a word frequency-inverse document frequency method, a fast automatic keyword extraction method, and the like.
[0131] In addition, the computer device can search for database configuration information in the migration instruction based on the association relationship between different database configuration information and different storage node identifiers, and then determine the storage node corresponding to the storage node identifier that matches the database configuration information found in the association relationship as the storage node where the database to be processed is located.
[0132] S320 , sending multiple different operation instructions in the target migration execution file to the storage node in sequence, instructing the storage node to perform migration processing on the pending database.
[0133] Furthermore, a plurality of different operation instructions in the target migration execution file may be sent to the storage node in sequence, instructing the storage node to perform migration processing on the database to be processed.
[0134] In actual applications, after each data migration process is completed, the results of the data migration process and the process information of the data migration process can be stored in a record table for subsequent traceability when managing the corresponding database; the results of the data migration process can include the status of whether the data migration process is successful or not, the start and end time of the data migration process, and other information; the process information of the data migration process can include the database identifier, microservice identifier, version identifier and migration type of the data migration process, as well as the response result, response time and other information of each operation instruction in the data migration process.
[0135] Among them, the language types corresponding to the above-mentioned different operation instructions can be Python, Shell, batch processing and the like, but in the embodiment of the present application, the SQL type is taken as an example for explanation.
[0136] The technical solution in the embodiment of the present application determines the storage node where the database to be processed is located according to the database configuration information, and sends multiple different operation instructions in the target migration execution file to the storage node in sequence, instructing the storage node to migrate the database to be processed; the above method can correctly send multiple different operation instructions in the target migration execution file to the corresponding storage node in sequence, avoiding node sending errors, which can improve the correctness of database migration.
[0137] In one embodiment, the present application also provides a database migration processing method, which is applied to a computer device, such as Fig. 9 As shown, the method includes the following processes:
[0138] S11, in response to the migration instruction of the database to be processed, searching for a database identifier corresponding to the database to be processed in the pre-built full directory structure;
[0139] S12, detecting whether the database to be processed exists;
[0140] S13. If it exists, obtain the microservice identifier corresponding to the database identifier from the full directory structure;
[0141] S14. If it does not exist, create a database to be processed, and obtain the microservice identifier corresponding to the database identifier from the full directory structure;
[0142] S15, searching and processing are performed according to the correspondence between different migration resource package identifiers and different service identifiers and the microservice identifier, and the migration resource package of the database to be processed is determined according to the migration resource package identifier corresponding to the service identifier matching the microservice identifier in the correspondence; the migration resource package includes the mapping relationship between the semi-quantity directory structure and different migration execution files;
[0143] S16, obtaining the current version identifier of the database to be processed;
[0144] S17. If the current version identifier is different from the migration version identifier, searching for a target version identifier that matches the migration version identifier among the version identifiers;
[0145] S18: acquiring at least one candidate migration type associated with the target version identifier according to the association relationship and the target version identifier, and acquiring a target migration type matching the migration type from each candidate migration type;
[0146] S19, determining the target version identifier and the target migration type as target information;
[0147] S20: searching the mapping relationship for a target migration type corresponding to the target version identifier, and determining the migration execution file corresponding to the target migration type in the mapping relationship as the target migration execution file;
[0148] S21. Determine the storage node where the database to be processed is located according to the database configuration information;
[0149] S22. Send multiple different operation instructions in the target migration execution file to the storage node in sequence, instructing the storage node to perform migration processing on the pending database.
[0150] The execution process of the above S11 to S22 may be specifically referred to the description of the above embodiment, and the implementation principle and technical effect thereof are similar and will not be described in detail here.
[0151] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0152] Based on the same inventive concept, the embodiment of the present application also provides a database migration processing device for implementing the database migration processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more database migration processing device embodiments provided below can refer to the limitations on the database migration processing method above, and will not be repeated here.
[0153] In one embodiment, Fig.10 This is a schematic diagram of the structure of a database migration processing device in one embodiment of the present application. The database migration processing device provided in the embodiment of the present application can be applied to any slave node in the database migration processing system that stores backup data in the logical disk of the master node. Fig.10 As shown, the database migration processing device of the embodiment of the present application may include: a first determination module 11, a first acquisition module 12 and a migration processing module 13, wherein:
[0154] The first determination module 11 is used to respond to the migration instruction of the database to be processed and determine the migration resource package corresponding to the database to be processed according to the database migration attribute information carried in the migration instruction; the migration resource package includes the mapping relationship between the semi-quantity directory structure and different migration execution files;
[0155] A first acquisition module 12 is used to determine target information from a semi-quantitative directory structure of a migration resource package according to database migration attribute information, and to acquire a target migration execution file from each migration execution file according to the target information and a mapping relationship;
[0156] The migration processing module 13 is used to perform migration processing on the database to be processed based on the target migration execution file and the database migration attribute information.
[0157] The database migration processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned database migration processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0158] In one embodiment, the database migration attribute information includes a database identifier; the first determination module 11 includes: a search unit, a first acquisition unit, and a second acquisition unit, wherein:
[0159] A search unit, used to search for a database identifier corresponding to the database to be processed in a pre-built full directory structure;
[0160] A first acquisition unit is used to acquire a microservice identifier corresponding to the database identifier from the full directory structure;
[0161] The second acquisition unit is used to acquire a migration resource package corresponding to the database to be processed according to the microservice identifier.
[0162] The database migration processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned database migration processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0163] In one embodiment, the first determination module 11 further includes: a detection unit, a first determination unit, and a second determination unit, wherein:
[0164] A detection unit, used for detecting whether the database to be processed exists;
[0165] A first determining unit is used to execute a step of acquiring a microservice identifier corresponding to the database identifier from the full directory structure when the result of the detecting unit is existence;
[0166] The second determination unit is used to create a database to be processed when the result of the detection unit is that the database does not exist, and execute the step of obtaining a microservice identifier corresponding to the database identifier from the full directory structure.
[0167] The database migration processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned database migration processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0168] In one embodiment, the second acquisition unit is specifically used for:
[0169] Search processing is performed according to the correspondence between different migration resource package identifiers and different service identifiers and the microservice identifier, and the migration resource package of the database to be processed is determined according to the migration resource package identifier corresponding to the service identifier matching the microservice identifier in the correspondence.
[0170] The database migration processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned database migration processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0171] In one embodiment, the database migration attribute information includes a migration version identifier and a migration type, and the semi-quantity directory structure includes associations between different version identifiers and different migration types; the database migration processing device includes: a search module, a second acquisition module and a second determination module, wherein:
[0172] A search module, used to search for a target version identifier matching the migration version identifier among various version identifiers;
[0173] A second acquisition module is used to acquire at least one candidate migration type associated with the target version identifier according to the association relationship and the target version identifier, and acquire a target migration type matching the migration type from each candidate migration type;
[0174] The second determining module is used to determine the target version identifier and the target migration type as the target information.
[0175] The database migration processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned database migration processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0176] In one embodiment, the target information includes a target version identifier and a target migration type; the migration processing module 13 is specifically used to:
[0177] The target migration type corresponding to the target version identifier is searched in the mapping relationship, and the migration execution file corresponding to the target migration type in the mapping relationship is determined as the target migration execution file.
[0178] The database migration processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned database migration processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0179] In one embodiment, the database migration attribute information includes a migration version identifier; the database migration processing device further includes: a version identifier acquisition module and a third determination module, wherein:
[0180] A version identification acquisition module is used to obtain the current version identification of the database to be processed;
[0181] The third determination module is used to execute the step of determining the target information from the semi-quantity directory structure of the migration resource package according to the database migration attribute information when the current version identifier is different from the migration version identifier.
[0182] The database migration processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned database migration processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0183] In one embodiment, the database migration attribute information includes database configuration information; the migration processing module 13 includes: a fourth determination module and a sending module, wherein:
[0184] A fourth determination module is used to determine the storage node where the database to be processed is located according to the database configuration information;
[0185] The sending module is used to send multiple different operation instructions in the target migration execution file to the storage node in sequence, instructing the storage node to perform migration processing on the database to be processed.
[0186] The database migration processing device provided in the embodiment of the present application can be used to execute the technical solution in the above-mentioned database migration processing method embodiment of the present application. Its implementation principle and technical effect are similar and will not be repeated here.
[0187] For the specific definition of the database migration processing device, please refer to the definition of the database migration processing method above, which will not be repeated here. Each module in the above-mentioned database migration processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0188] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.11As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide processing power. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store migration resource packages and a full directory structure. The network interface of the computer device is used to communicate with an external endpoint through a network connection. When the computer program is executed by the processor, a database migration processing method is implemented.
[0189] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0190] In one embodiment, a computer device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the technical solution in the above-mentioned database migration processing method embodiment of the present application is implemented. The implementation principle and technical effect are similar and will not be repeated here.
[0191] In one embodiment, a computer-readable storage medium is also provided, on which a computer program is stored. When the computer program is executed by a processor, the technical solution of the above-mentioned database migration processing method of the present application is implemented. The implementation principle and technical effect are similar and will not be repeated here.
[0192] In one embodiment, a computer program product is also provided, including a computer program. When the computer program is executed by a processor, the technical solution of the above-mentioned database migration processing method of the present application is implemented. The implementation principle and technical effect are similar and will not be repeated here.
[0193] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0194] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0195] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A database migration processing method, characterized in that: The method comprises: In response to a migration instruction of a database to be processed, a migration resource package corresponding to the database to be processed is determined according to database migration attribute information carried in the migration instruction; the migration resource package includes a mapping relationship between a semi-quantum directory structure and different migration execution files; Determining target information from a semi-quantitative directory structure of the migration resource package according to the database migration attribute information, and acquiring a target migration execution file from each of the migration execution files according to the target information and the mapping relationship; Based on the target migration execution file and the database migration attribute information, migration processing is performed on the database to be processed.
2. The method according to claim 1, characterized in that: The database migration attribute information includes a database identifier; the step of determining a migration resource package corresponding to the database to be processed according to the database migration attribute information carried in the migration instruction includes: Searching for a database identifier corresponding to the database to be processed in a pre-built full directory structure; Obtaining a microservice identifier corresponding to the database identifier from the full directory structure; According to the microservice identifier, a migration resource package corresponding to the database to be processed is obtained.
3. The method according to claim 2, characterized in that The method further comprises: Detecting whether the database to be processed exists; If it exists, the step of obtaining the microservice identifier corresponding to the database identifier from the full directory structure is performed; If it does not exist, create the database to be processed, and execute the step of obtaining the microservice identifier corresponding to the database identifier from the full directory structure.
4. The method according to claim 2, characterized in that: The step of obtaining a migration resource package corresponding to the database to be processed according to the microservice identifier includes: Search processing is performed according to the correspondence between different migration resource package identifiers and different service identifiers and the microservice identifier, and the migration resource package of the to-be-processed database is determined according to the migration resource package identifier corresponding to the service identifier matching the microservice identifier in the correspondence.
5. The method according to any one of claims 1 to 4, characterized in that The database migration attribute information includes a migration version identifier and a migration type, and the semi-quantity directory structure includes associations between different version identifiers and different migration types; The step of determining target information from a semi-quantitative directory structure of the migration resource package according to the database migration attribute information includes: Searching for a target version identifier that matches the migration version identifier among the version identifiers; According to the association relationship and the target version identifier, acquiring at least one candidate migration type associated with the target version identifier, and acquiring a target migration type matching the migration type from each of the candidate migration types; The target version identifier and the target migration type are determined as the target information.
6. The method according to any one of claims 1 to 4, characterized in that The target information includes the target version identifier and the target migration type; The acquiring a target migration execution file from each migration execution file according to the target information and the mapping relationship includes: The target migration type corresponding to the target version identifier is searched in the mapping relationship, and the migration execution file corresponding to the target migration type in the mapping relationship is determined as the target migration execution file.
7. The method according to any one of claims 1 to 4, characterized in that The database migration attribute information includes a migration version identifier; the method further includes: Obtaining the current version identifier of the database to be processed; If the current version identifier is different from the migration version identifier, the step of determining target information from the semi-quantitative directory structure of the migration resource package according to the database migration attribute information is performed.
8. The method according to any one of claims 1 to 4, characterized in that The database migration attribute information includes database configuration information; performing migration processing on the database to be processed based on the target migration execution file and the database migration attribute information includes: Determine the storage node where the database to be processed is located according to the database configuration information; Sending a plurality of different operation instructions in the target migration execution file to the storage node in sequence, instructing the storage node to perform migration processing on the database to be processed.
9. A database migration processing device, characterized in that: The device comprises: A first determination module is used to respond to a migration instruction of a database to be processed and determine a migration resource package corresponding to the database to be processed according to database migration attribute information carried in the migration instruction; the migration resource package includes a mapping relationship between a semi-quantum directory structure and different migration execution files; A first acquisition module, configured to determine target information from a semi-quantitative directory structure of the migration resource package according to the database migration attribute information, and acquire a target migration execution file from each of the migration execution files according to the target information and the mapping relationship; The migration processing module is used to perform migration processing on the database to be processed based on the target migration execution file and the database migration attribute information.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.