Database migration method and device, computer equipment and readable storage medium
The database migration method driven by artificial intelligence models solves the problems of long database migration time and data inconsistency, and realizes efficient and lossless database migration and traffic switching, reducing the risk of business interruption.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-26
- Publication Date
- 2026-04-10
AI Technical Summary
Existing database migration methods suffer from problems such as long processing time, reliance on manual experience, data inconsistency, and high risk of traffic switching, and lack a unified migration, detection, and switching framework.
Artificial intelligence models are used for semantic parsing and matching to generate data mapping rules. Combined with transaction consistency control and performance prediction, full data is imported in parallel and incremental data is synchronized in real time. Lossless switching is achieved through the optimal traffic switching window.
Reduce manual intervention, improve migration accuracy and efficiency, reduce the risk of business interruption, and achieve hot database migration and lossless traffic switching.
Smart Images

Figure CN121833652A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database operation and maintenance technology, and in particular to a database migration method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] Against the backdrop of innovation in information technology applications, the current database ecosystem remains imperfect due to the involvement of multiple operating systems, database vendors, and security strategies, lacking a unified framework for migration, detection, and switching.
[0003] Traditional heterogeneous database migration methods typically involve exporting the logical structure of the source database, manually converting it into a format compatible with the target database, and combining this with incremental log synchronization to achieve data consistency. However, due to significant syntactic differences and complex rules between the target and source databases, the logical migration process is time-consuming, highly dependent on human experience, and lacks intelligent prediction and automated optimization mechanisms.
[0004] To improve upon this traditional approach, a strategy combining full and incremental data migration is proposed. This involves first migrating the full set of foundational data, then using Change Data Capture (CDC) technology to synchronize incremental changes in real time, completing the business handover within a short switching window. While this method effectively ensures business continuity, the differences in transaction models across heterogeneous databases can lead to brief data inconsistencies during incremental synchronization, and rollback operations are complex. Furthermore, a method utilizing artificial intelligence (AI) models to automatically generate syntax transformation rules is proposed. Although this reduces human intervention, the process of generating syntax transformation rules using AI models is opaque and has limited versatility.
[0005] Furthermore, after completing the full data migration and synchronizing incremental data, a traffic switch is typically required. The traditional process for seamless traffic switchover involves assessing the compatibility between the source and target database systems, developing a phased migration plan, implementing a canary release according to the plan, and simultaneously monitoring and optimizing to ultimately achieve a seamless traffic switchover. However, due to the difficulty in intelligently determining the optimal switchover timing, in high-concurrency environments, traffic switchover may lead to some request failures or duplicate submissions, and performance fluctuations after data migration are difficult to predict and cannot be intervened in advance.
[0006] Therefore, how to drive database hot migration and lossless traffic switching based on AI large models, and build a unified migration, detection, and switching framework, has become an urgent problem to be solved. Summary of the Invention
[0007] Therefore, it is necessary to provide a database migration method, device, computer equipment, computer-readable storage medium, and computer program product that can drive database hot migration and lossless traffic switching with AI large models, thereby constructing a unified migration, detection, and switching framework to address the above-mentioned technical problems.
[0008] Firstly, this application provides a database migration method, including:
[0009] Deploy the data collection process and log capture device in the source database;
[0010] An artificial intelligence model is used to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules; based on the data mapping rules, a migration script is generated.
[0011] Acquire the full data from the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, obtain the incremental data during the parallel import of the full data into the target database based on the log stream, and update the target database with the incremental data;
[0012] Artificial intelligence models are used to predict the performance metrics of the target database under different loads; based on the performance metrics, the optimal traffic switching window is calculated.
[0013] Update routing rules in the optimal traffic switching window; based on the routing rules, switch traffic from the source database to the target database; traffic from the source database refers to access requests from business applications.
[0014] In one embodiment, an artificial intelligence model is used to perform semantic parsing and matching of objects in the source database and the target database to generate data mapping rules, including:
[0015] An artificial intelligence model is used to perform semantic parsing on objects in the source and target databases to obtain the syntactic differences between the source and target databases;
[0016] Artificial intelligence models are used to analyze grammatical differences, and semantic matching of objects in the source and target databases is performed using artificial intelligence models to generate data mapping rules.
[0017] In one embodiment, the method further includes:
[0018] Obtain the transaction consistency controller;
[0019] A transaction consistency controller is used to perform repeatable read and consistency verification on at least one transaction corresponding to full data and incremental data through a distributed snapshot version control algorithm.
[0020] For transactions that fail verification, an artificial intelligence delay compensation algorithm is used to schedule the execution strategy of the data corresponding to the transaction; based on the execution strategy, the data is updated to the target database.
[0021] In one embodiment, an artificial intelligence model is used to predict the performance metrics of the target database under different loads, including:
[0022] Artificial intelligence models are used to analyze historical business traffic, system access patterns, and abnormal peak fluctuations to obtain historical switching data;
[0023] Based on historical switching data, predict the performance metrics of the target database under different loads.
[0024] In one embodiment, updating routing rules within the optimal traffic switching window includes:
[0025] Confirm whether the access request for at least one transaction corresponding to the incremental data arrives within the traffic switching window;
[0026] For access service requests that arrive within the traffic switching window, a preset component is used to route the traffic corresponding to the access service request to the target database;
[0027] For access service requests created before the traffic switching window begins, connection pooling and transaction caching technologies are used to keep the routing of traffic corresponding to the created access service requests to the source database unchanged until the transaction corresponding to the created access service requests is completed in the source database.
[0028] In one embodiment, switching traffic from the source database to the target database based on the routing rules includes:
[0029] Based on the routing rules, traffic from the source database is switched to the target database in N steps; wherein, during the i-th switch, the current migration transaction of the source database is determined; and the traffic corresponding to the current migration transaction is switched to the target database.
[0030] Connect the source and target databases through the application layer; use an artificial intelligence monitoring system to simultaneously monitor the performance metrics of both the source and target databases; based on the performance metrics, confirm whether any anomalies occur during the traffic switching process;
[0031] If this occurs, the traffic switching will be terminated, and the traffic of the current migration transaction that is switching to the target database will be rolled back to the source database through the application layer.
[0032] If this does not occur, continue executing the steps to switch the traffic corresponding to the current migration transaction to the target database and subsequent steps until all traffic to the source database has been switched.
[0033] Secondly, this application also provides a database migration apparatus, comprising:
[0034] The deployment module is used to deploy the collection process and log capturer in the source database;
[0035] The generation module is used to perform semantic parsing and matching of objects in the source database and the target database using an artificial intelligence model to generate data mapping rules; based on the data mapping rules, migration scripts are generated.
[0036] The migration module is used to acquire the full data of the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, acquire incremental data based on the log stream during the parallel import of the full data into the target database, and update the target database with the incremental data.
[0037] The calculation module is used to predict the performance indicators of the target database under different loads using artificial intelligence models; based on the performance indicators, it calculates the optimal traffic switching window.
[0038] The switching module is used to update routing rules in the optimal traffic switching window; based on the routing rules, it switches traffic from the source database to the target database; traffic from the source database refers to access requests from business applications.
[0039] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0040] Deploy the data collection process and log capture device in the source database;
[0041] An artificial intelligence model is used to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules; based on the data mapping rules, a migration script is generated.
[0042] Acquire the full data from the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, obtain the incremental data during the parallel import of the full data into the target database based on the log stream, and update the target database with the incremental data;
[0043] Artificial intelligence models are used to predict the performance metrics of the target database under different loads; based on the performance metrics, the optimal traffic switching window is calculated.
[0044] Update routing rules in the optimal traffic switching window; based on the routing rules, switch traffic from the source database to the target database; traffic from the source database refers to access requests from business applications.
[0045] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0046] Deploy the data collection process and log capture device in the source database;
[0047] An artificial intelligence model is used to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules; based on the data mapping rules, a migration script is generated.
[0048] Acquire the full data from the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, obtain the incremental data during the parallel import of the full data into the target database based on the log stream, and update the target database with the incremental data;
[0049] Artificial intelligence models are used to predict the performance metrics of the target database under different loads; based on the performance metrics, the optimal traffic switching window is calculated.
[0050] Update routing rules in the optimal traffic switching window; based on the routing rules, switch traffic from the source database to the target database; traffic from the source database refers to access requests from business applications.
[0051] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0052] Deploy the data collection process and log capture device in the source database;
[0053] An artificial intelligence model is used to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules; based on the data mapping rules, a migration script is generated.
[0054] Acquire the full data from the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, obtain the incremental data during the parallel import of the full data into the target database based on the log stream, and update the target database with the incremental data;
[0055] Artificial intelligence models are used to predict the performance metrics of the target database under different loads; based on the performance metrics, the optimal traffic switching window is calculated.
[0056] Update routing rules in the optimal traffic switching window; based on the routing rules, switch traffic from the source database to the target database; traffic from the source database refers to access requests from business applications.
[0057] The aforementioned database migration method, apparatus, computer equipment, computer-readable storage medium, and computer program product deploy a collection process and a log capturer in the source database; employ an artificial intelligence model to perform semantic parsing and matching of objects in the source and target databases, generating data mapping rules; generate a migration script based on the data mapping rules; acquire all data from the source database collected by the collection process; run the migration script to import all data into the target database in parallel; use the log capturer to monitor the real-time log stream of the source database, acquire incremental data during the parallel import of all data into the target database based on the log stream, and update the target database with the incremental data; employ an artificial intelligence model to predict the performance indicators of the target database under different loads; calculate the optimal traffic switching window based on the performance indicators; update the routing rules within the optimal traffic switching window; and switch the traffic from the source database to the target database based on the routing rules; where traffic from the source database refers to access requests from business programs. By utilizing an artificial intelligence model to achieve hot database migration and lossless traffic switching, manual intervention during the hot database migration process can be reduced, improving the accuracy and efficiency of the migration, while minimizing the risk of business interruption during the traffic switching process. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1 This is a diagram illustrating the application environment of a database migration method in one embodiment.
[0060] Figure 2 This is a flowchart illustrating a database migration method in one embodiment;
[0061] Figure 3 This is a schematic diagram illustrating the specific process of database hot migration in one embodiment;
[0062] Figure 4 This is a schematic diagram illustrating the specific process of lossless database traffic switching in one embodiment;
[0063] Figure 5 This is a flowchart illustrating a database migration method in another embodiment;
[0064] Figure 6 This is a structural block diagram of a database migration device in one embodiment;
[0065] Figure 7This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0066] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0067] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0068] The database migration method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. Specifically, terminal 102 or server 104 completes a database migration method, which includes: deploying a collection process and a log capturer in the source database; using an artificial intelligence model to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules; generating a migration script based on the data mapping rules; acquiring the full amount of data collected by the collection process from the source database; running the migration script to import the full amount of data into the target database in parallel; using the log capturer to listen to the real-time log stream of the source database, acquiring incremental data during the parallel import of the full amount of data into the target database based on the log stream, and updating the target database with the incremental data; using an artificial intelligence model to predict the performance indicators of the target database under different loads; calculating the optimal traffic switching window based on the performance indicators; updating the routing rules within the optimal traffic switching window; and switching the traffic from the source database to the target database based on the routing rules. The traffic from the source database refers to access requests from business programs.
[0069] Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, drones, low-altitude aircraft, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, and projection equipment. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted displays. Head-mounted displays can be virtual reality (VR) devices, augmented reality (AR) devices, and smart glasses. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0070] In one exemplary embodiment, such as Figure 2 As shown, a database migration method is provided, which can be applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps 202 to 210. Wherein:
[0071] Step 202: Deploy the collection process and log capturer in the source database.
[0072] The data collection process is a lightweight collection agent, an independently running background process or service used to capture the structure, data, and log information of the source database. It supports multiple database types and has data anonymization and compression functions. The log capturer is used to monitor changes in the source database logs in real time through change data capture technology; it supports adaptive parsing of log formats across databases; the log capturer integrates an AI anomaly detection model to automatically identify abnormal database commands. Database commands include Data Definition Language (DDL) for defining and managing database structure and schema, and Data Manipulation Language (DML) for manipulating the data itself within the database.
[0073] Optionally, the data collection process and log capture device can be deployed at the source end of the source database. The source end of the source database refers to the operating system environment where the source database server resides.
[0074] Step 204: Use an artificial intelligence model to perform semantic parsing and matching of objects in the source database and the target database to generate data mapping rules; based on the data mapping rules, generate migration scripts.
[0075] In this system, the source database is the database containing the original data being read; the target database is the database into which new data is being written. The source and target databases belong to different database types. A data mapping rule is a set of instructions that define how to transform and place each data fragment from the source database into its corresponding location in the target database. Migration scripts are automatically generated code that can be directly executed by the database. The artificial intelligence model is a big data model (LLM). Objects include DDL, stored procedures, and triggers.
[0076] Optionally, leveraging the semantic understanding capabilities of the big data model, semantic parsing and matching are performed on objects such as DDL, stored procedures, and triggers in the source and target databases to generate data mapping rules. These data mapping rules can be stored in a migration rule base for later use. The artificial intelligence model then automatically generates migration scripts based on these data mapping rules.
[0077] Step 206: Obtain the full data of the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, obtain the incremental data during the parallel import of the full data into the target database based on the log stream, and update the target database with the incremental data.
[0078] The full dataset includes the source database's structure, indexes, and static data. The incremental data consists of the log stream generated during the parallel import of the full dataset into the target database.
[0079] For example, the data collection process collects the structure, data, and log information of the source database, performs data anonymization and compression on the collected data, and generates full data. The log capture device listens for changes in the source database logs, treats the detected log changes as change events, encapsulates them in a structured manner, and obtains a unified change event stream, i.e., the log stream.
[0080] For example, the entire dataset is divided into multiple logical blocks; multiple processes running migration scripts are started, each process handling one logical block; an artificial intelligence model evaluates network bandwidth and system load in real time, and based on the evaluation results, the migration scripts for multiple logical blocks are run in batches until all the data is imported into the target database; a log catcher is used to listen to the real-time log stream of the source database, and incremental data is obtained based on the log stream during the parallel import of the entire dataset into the target database, and the incremental data is updated to the target database; the artificial intelligence model automatically adjusts the tablespaces, index strategies, and connection pool parameters in the target database to ensure performance optimization after migration.
[0081] Step 208: Use an artificial intelligence model to predict the performance indicators of the target database under different loads; based on the performance indicators, calculate the optimal traffic switching window.
[0082] The optimal traffic switching window refers to the optimal time period for traffic switching after comprehensively considering factors such as business load, connection pool status, cache hit rate, and network latency; it is usually during off-peak hours. Performance metrics include response time and queries per second (QPS) trends. QPS indicates how many requests or queries the database can process per second.
[0083] For example, an artificial intelligence model is used to analyze historical business traffic, system access patterns, and abnormal peak fluctuations; based on the analysis results, the performance indicators response time and QPS change trends of the target database under different loads are predicted; based on the prediction results, the next optimal traffic switching time point is predicted; based on the optimal traffic switching time point, the optimal traffic switching window is calculated.
[0084] Step 210: Update the routing rules in the optimal traffic switching window; based on the routing rules, switch the traffic from the source database to the target database; the traffic from the source database refers to access requests from the business application.
[0085] Routing rules are rules that control the path of application access requests from the source database to the target database. Traffic to the source database consists of a set of database manipulation languages used by the business applications to access their services.
[0086] In the aforementioned database migration method, a data acquisition process and a log capture device are deployed in the source database. An artificial intelligence model is used to perform semantic parsing and matching of objects in the source and target databases, generating data mapping rules. Based on these rules, a migration script is generated. The entire dataset from the source database collected by the acquisition process is acquired. The migration script is run to import the entire dataset into the target database in parallel. The log capture device monitors the real-time log stream from the source database, and incremental data is acquired during the parallel import of the entire dataset into the target database. This incremental data is then updated in the target database. An artificial intelligence model is used to predict the performance metrics of the target database under different loads. Based on these performance metrics, the optimal traffic switching window is calculated. Routing rules are updated within the optimal traffic switching window. Based on the routing rules, traffic from the source database is switched to the target database. Traffic from the source database refers to access requests from business applications. By utilizing an artificial intelligence model to achieve hot database migration and lossless traffic switching, manual intervention during the hot database migration process can be reduced, improving the accuracy and efficiency of the migration, while minimizing the risk of business interruption during traffic switching.
[0087] In one embodiment, an artificial intelligence model is used to perform semantic parsing and matching of objects in the source database and the target database to generate data mapping rules. This includes: using an artificial intelligence model to perform semantic parsing of objects in the source database and the target database to obtain syntactic differences between the source database and the target database; using an artificial intelligence model to analyze the syntactic differences; and using an artificial intelligence model to perform semantic matching of objects in the source database and the target database to generate data mapping rules.
[0088] For example, an abstract syntax tree parsing technique based on an artificial intelligence model is used to perform semantic parsing on objects in the source and target databases. The semantics of the objects in the source and target databases are compared to identify syntactic differences. An artificial intelligence model is then used to analyze these syntactic differences, and after semantic matching of the objects in the source and target databases using the artificial intelligence model, data mapping rules are generated and stored in a migration rule base. Finally, a self-learning rule generation technique based on an artificial intelligence model is used to call the migration rule base and optimize the data mapping rules based on historical migration experience. This self-learning rule generation technique is used to improve conversion accuracy.
[0089] In this embodiment, by employing an artificial intelligence model to perform deep semantic analysis and precise matching of objects in the source database and the target database, accurate and efficient data mapping rules are generated. This avoids the need for manual conversion of source database data into a format compatible with the target database, reducing manual costs. Furthermore, self-learning rule generation technology can be used to continuously optimize the data mapping rules based on historical migration experience, thereby improving the accuracy and efficiency of the conversion.
[0090] In one embodiment, the method further includes: obtaining a transaction consistency controller; using the transaction consistency controller to perform repeatable read and consistency verification on at least one transaction corresponding to the full data and incremental data through a distributed snapshot version control algorithm; for transactions that fail verification, using an artificial intelligence latency compensation algorithm to schedule the execution strategy of the data corresponding to the transaction; and updating the data to the target database based on the execution strategy.
[0091] Among them, the transaction consistency controller is used to perform parallel verification of multiple transaction groups to ensure data consistency before and after traffic switching; the distributed snapshot version control algorithm is an algorithm used in distributed systems to capture globally consistent state and manage state versions; and the artificial intelligence latency compensation algorithm is used to solve the problem of performance degradation or instability caused by computation, communication, or control latency.
[0092] For example, the transaction consistency controller performs parallel verification on at least one transaction corresponding to the full data and incremental data through a distributed snapshot version control algorithm. When a transaction passes verification, it indicates that these transactions have passed the consistency check and their execution has not conflicted with other transactions.
[0093] Furthermore, when a transaction fails verification, it indicates that these transactions cannot pass the consistency check under the current distributed snapshot version. This may be due to latency caused by network, computation, or resource contention in a distributed environment, resulting in the transaction obtaining an outdated data version or executing at the wrong time. Therefore, the transaction consistency controller uses an artificial intelligence latency compensation algorithm to predict a new execution time or method. This new execution time or method is then used as the execution strategy for the data corresponding to these transactions. Based on the execution strategy, the transaction consistency controller updates the data corresponding to these transactions to the target database at the new execution time or method.
[0094] Optionally, artificial intelligence models can be used to predict long transactions or deadlock scenarios that may exist in transactions corresponding to incremental data and full data, and a transaction consistency controller can be used to resolve them in advance.
[0095] In this embodiment, the transaction consistency controller performs repeatable read and consistency verification on transactions to ensure data consistency before and after traffic switching. This effectively guarantees the accuracy and reliability of data migration and improves the stability and security of the entire database migration process. Data consistency before and after migration is the basis for subsequent traffic switching.
[0096] In one embodiment, using an artificial intelligence model to predict the performance indicators of a target database under different loads includes: using an artificial intelligence model to analyze historical business traffic, system access patterns, and abnormal peak fluctuations to obtain historical switching data; and based on the historical switching data, predicting the performance indicators of the target database under different loads.
[0097] In this embodiment, by using an artificial intelligence model to deeply analyze multi-dimensional data such as historical business traffic, system access patterns, and abnormal peak fluctuations, comprehensive and accurate historical switching data is obtained to predict the performance indicators of the target database under different loads. This provides solid data support for the subsequent calculation of the optimal traffic switching window, and the error of the optimal traffic switching window can be basically controlled within ±2 minutes.
[0098] In one embodiment, updating routing rules within the optimal traffic switching window includes: confirming whether access service requests for at least one transaction corresponding to incremental data arrive within the traffic switching window; for access service requests arriving within the traffic switching window, using a preset component to route the traffic corresponding to the access service request to the target database; for access service requests created before the start of the traffic switching window, maintaining the route of the traffic corresponding to the created access service request to the source database unchanged through connection pool reuse and transaction caching technology, until the transaction corresponding to the created access service request is completed in the source database.
[0099] Connection pooling refers to maintaining a pre-established set of database connections between the application and the database. When the application needs to perform database operations, it obtains an idle connection from this pool, and returns the connection to the pool after use, instead of actually closing it, so that it can be reused for subsequent requests. Transaction caching technology refers to caching the context, state, and metadata of transactions to ensure transaction continuity and data consistency during database switches. Applications typically interact with the database through connection pools, which manage multiple database connections. The application obtains a connection from the pool and returns it after use.
[0100] Optionally, the default component can be a routing component that can control traffic, such as Nginx, Open Resty, or API Gateway. During the switchover process, the default component can quickly update the routing rules, directing new business access requests to the target database.
[0101] For example, it is confirmed whether the access service request corresponding to at least one transaction of incremental data arrives within the traffic switching window; for the access service request arriving within the traffic switching window, a preset component is used to route the traffic corresponding to the access service request to the target database; for the access service request created before the start of the traffic switching window, the routing of the traffic corresponding to the created access service request to the source database is kept unchanged through connection pool reuse and transaction caching technology until the transaction corresponding to the created access service request is completed in the source database.
[0102] In this embodiment, by confirming the arrival status of the access service requests corresponding to the incremental data transactions within the traffic switching window, and by using preset components to update the routing of new service access requests and maintain the routing of old service access requests, the routing of service access requests is ensured to be accurate during the traffic switching process. This avoids data inconsistency or service interruption caused by routing errors, thereby ensuring the continuity and stability of services during the database migration process and achieving lossless traffic switching.
[0103] In one embodiment, switching traffic from the source database to the target database based on the routing rules includes: switching traffic from the source database to the target database N times based on the routing rules; wherein, during the i-th switching process, the current migration transaction of the source database is determined; the traffic corresponding to the current migration transaction is controlled to switch to the target database; the source database and the target database are connected through the application layer; an artificial intelligence monitoring system is used to simultaneously monitor the performance indicators of the source database and the target database; based on the performance indicators, it is confirmed whether any abnormal phenomena occur during the traffic switching process; if so, the traffic switching is terminated, and the traffic of the current migration transaction switched to the target database is rolled back to the source database through the application layer; if not, the steps of controlling the traffic corresponding to the current migration transaction to switch to the target database and subsequent steps continue until all traffic to the source database is switched.
[0104] For example, an artificial intelligence model is used to predict traffic switching results based on routing rules, generating a canary switchover plan; where N is determined based on the canary switchover plan; 1≤i≤N, and i is an integer. Canary switchover is a gradual system change strategy, referring to dividing the traffic switching process from the source database to the target database into multiple batches and executing them step by step, rather than switching all at once. The transaction volume of the current migration transaction in each switchover is also determined based on the canary switchover plan. Performance metrics for the source and target databases include response latency, transaction success rate, etc. An artificial intelligence monitoring system is used to collect performance metrics during the switchover process in real time, such as TPS, RT, and failure rate, and input them into the AI model for anomaly detection. The AI model can automatically identify potential risks based on performance metrics and intervene in optimization in advance.
[0105] Optionally, the source database and the target database can be connected through the application layer to enable dual-track operation.
[0106] For example, based on the routing rules, an artificial intelligence model is used to predict the traffic switching result; based on the traffic switching result, a gray-scale switching plan is obtained; based on the gray-scale switching plan, the traffic of the source database is switched to the target database in N steps; wherein, during the i-th switching process, the current migration transaction of the source database is determined; the traffic corresponding to the current migration transaction is controlled to switch to the target database; the source database and the target database are connected through the application layer; an artificial intelligence monitoring system is used to simultaneously monitor the performance indicators of the source database and the target database; these indicators are input into the AI model for anomaly detection to confirm whether any abnormal phenomena occur during the traffic switching process; if any abnormal phenomena occur, the traffic switching is terminated, and the traffic of the current migration transaction switched to the target database is rolled back to the source database through the application layer; if no abnormal phenomena occur, the i+1-th switching and subsequent steps are continued until all traffic of the source database is switched.
[0107] In this embodiment, traffic switching is achieved through a gray-scale switching plan based on routing rules, and the traffic switching process is monitored in real time. When an anomaly is detected, self-healing rollback can be performed. This supports millisecond-level lossless traffic switching while ensuring the continuity and stability of services during the switching process, and guarantees the security and reliability of the entire database migration process. Moreover, its self-healing rollback operation is simple, realizing the full automation and traceability of the traffic switching process.
[0108] Next reference Figure 5 The database migration method of this application will be illustrated by a specific embodiment.
[0109] Database migration methods include hot database migration and traffic switching processes.
[0110] refer to Figure 3 This section introduces the process of hot database migration.
[0111] On the source database side, a collection process is deployed to collect all data, while a log capturer is used to capture incremental data.
[0112] An AI model is used to compare objects in the source and target databases to obtain data mapping rules. Based on these rules, the full dataset is imported in parallel, and incremental data is synchronized into the target database.
[0113] After migrating the data, a transaction consistency controller is acquired to ensure data consistency before and after the migration. The migrated data is then validated in parallel. If data fails validation, an intelligent latency compensation algorithm adjusts the execution strategy. This ultimately achieves hot database migration. After the AI model predicts performance metrics, an optimal switching window is obtained, and a lossless traffic switch is performed within this window.
[0114] refer to Figure 4 This section describes the process of lossless traffic switching.
[0115] After the data is migrated to the target database, the business logic is not yet migrated. Therefore, it is necessary to migrate the business logic to the target database for execution without affecting the business. At this point, the source and target databases are connected through the application layer, entering a dual-track operation phase. After the AI model performs traffic prediction, a canary rollout plan is obtained.
[0116] Implement a canary rollout plan to switch traffic, for example, initially switching 5% of business requests to the new database; simultaneously monitor response and error rates; gradually expand to 100%, where the business requests migrated each time may not be the same. If latency increases or error rates become abnormal, the traffic switchout can be automatically terminated and traffic automatically rolled back to the source database.
[0117] The switching process employs a strategy of controlling traffic routing, which can utilize routing components such as Nginx, OpenResty, or API Gateway to complete route connection redirection in milliseconds; combined with connection pool reuse and transaction caching technologies, it achieves connectionless switching without interruption.
[0118] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0119] Based on the same inventive concept, this application also provides a database migration apparatus for implementing the database migration method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more database migration apparatus embodiments provided below can be found in the limitations of the database migration method described above, and will not be repeated here.
[0120] In one exemplary embodiment, such as Figure 6 As shown, a database migration apparatus 600 is provided, including: a deployment module 602, a generation module 604, a migration module 606, a calculation module 608, and a switching module 610, wherein:
[0121] Deployment module 602 is used to deploy the acquisition process and log capturer in the source database.
[0122] The generation module 604 is used to perform semantic parsing and matching of objects in the source database and the target database using an artificial intelligence model to generate data mapping rules; based on the data mapping rules, a migration script is generated.
[0123] The migration module 606 is used to acquire the full data of the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, acquire incremental data based on the log stream during the parallel import of the full data into the target database, and update the target database with the incremental data.
[0124] The calculation module 608 is used to predict the performance indicators of the target database under different loads using an artificial intelligence model; based on the performance indicators, it calculates the optimal traffic switching window.
[0125] The switching module 610 is used to update routing rules in the optimal traffic switching window; based on the routing rules, it switches the traffic from the source database to the target database; the traffic from the source database refers to access service requests from the business program.
[0126] In one embodiment, the generation module is further configured to use an artificial intelligence model to perform semantic parsing on objects in the source database and the target database to obtain syntactic differences between the source database and the target database; use an artificial intelligence model to analyze syntactic differences; use an artificial intelligence model to perform semantic matching on objects in the source database and the target database to generate data mapping rules.
[0127] In one embodiment, the database migration apparatus further includes a verification module, which is used to obtain a transaction consistency controller; use the transaction consistency controller to perform repeatable read and consistency verification on at least one transaction corresponding to the full data and incremental data through a distributed snapshot version control algorithm; for transactions that fail verification, use an artificial intelligence latency compensation algorithm to schedule the execution strategy of the data corresponding to the transaction; and update the data to the target database based on the execution strategy.
[0128] In one embodiment, the computing module is also used to analyze historical business traffic, system access patterns, and abnormal peak fluctuations using an artificial intelligence model to obtain historical switching data; based on the historical switching data, it predicts the performance indicators of the target database under different loads.
[0129] In one embodiment, the switching module is further configured to confirm whether the access service request of at least one transaction corresponding to the incremental data arrives within the traffic switching window; for the access service request arriving within the traffic switching window, a preset component is used to route the traffic corresponding to the access service request to the target database; for the access service request created before the start of the traffic switching window, the routing of the traffic corresponding to the created access service request to the source database is kept unchanged through connection pool reuse and transaction caching technology until the transaction corresponding to the created access service request is completed in the source database.
[0130] In one embodiment, the switching module is further configured to switch the traffic from the source database to the target database in N steps based on the routing rules; wherein, during the i-th switching process, the current migration transaction of the source database is determined; the traffic corresponding to the current migration transaction is switched to the target database; the source database and the target database are connected through the application layer; an artificial intelligence monitoring system is used to simultaneously monitor the performance indicators of the source database and the target database; based on the performance indicators, it is confirmed whether any abnormal phenomena occur during the traffic switching process; if so, the traffic switching is terminated, and the traffic of the current migration transaction switched to the target database is rolled back to the source database through the application layer; if not, the steps of controlling the traffic corresponding to the current migration transaction to switch to the target database and subsequent steps continue to be executed until all traffic of the source database is switched.
[0131] Each module in the aforementioned database migration device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0132] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores both full and incremental data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a database migration method.
[0133] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0134] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0135] Deploy the data collection process and log capture device in the source database;
[0136] An artificial intelligence model is used to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules; based on the data mapping rules, a migration script is generated.
[0137] Acquire the full data from the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, obtain the incremental data during the parallel import of the full data into the target database based on the log stream, and update the target database with the incremental data;
[0138] Artificial intelligence models are used to predict the performance metrics of the target database under different loads; based on the performance metrics, the optimal traffic switching window is calculated.
[0139] Update routing rules in the optimal traffic switching window; based on the routing rules, switch traffic from the source database to the target database; traffic from the source database refers to access requests from business applications.
[0140] In one embodiment, when the processor executes the computer program, it further performs the following steps: using an artificial intelligence model to perform semantic parsing on objects in the source database and the target database to obtain syntactic differences between the source database and the target database; using an artificial intelligence model to analyze the syntactic differences; using an artificial intelligence model to perform semantic matching on objects in the source database and the target database to generate data mapping rules.
[0141] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining a transaction consistency controller; using the transaction consistency controller and a distributed snapshot version control algorithm, performing repeatable read and consistency verification on at least one transaction corresponding to the full data and incremental data; for transactions that fail verification, using an artificial intelligence latency compensation algorithm to schedule the execution strategy of the data corresponding to the transaction; and updating the data to the target database based on the execution strategy.
[0142] In one embodiment, when the processor executes the computer program, it also performs the following steps: using an artificial intelligence model to analyze historical business traffic, system access patterns, and abnormal peak fluctuations to obtain historical switching data; and based on the historical switching data, predicting the performance indicators of the target database under different loads.
[0143] In one embodiment, when the processor executes the computer program, it further performs the following steps: confirming whether the access service request of at least one transaction corresponding to the incremental data arrives within the traffic switching window; for the access service request arriving within the traffic switching window, using a preset component to route the traffic corresponding to the access service request to the target database; for the access service request created before the start of the traffic switching window, using connection pool reuse and transaction caching technology to keep the route of the traffic corresponding to the created access service request pointing to the source database unchanged, until the transaction corresponding to the created access service request is completed in the source database.
[0144] In one embodiment, when the processor executes the computer program, it further implements the following steps: based on the routing rules, the traffic of the source database is switched to the target database in N steps; wherein, during the i-th switch, the current migration transaction of the source database is determined; the traffic corresponding to the current migration transaction is switched to the target database; the source database and the target database are connected through the application layer; an artificial intelligence monitoring system is used to simultaneously monitor the performance indicators of the source database and the target database; based on the performance indicators, it is confirmed whether any abnormal phenomena occur during the traffic switching process; if so, the traffic switching is terminated, and the traffic of the current migration transaction switched to the target database is rolled back to the source database through the application layer; if not, the steps of controlling the traffic corresponding to the current migration transaction to switch to the target database and subsequent steps continue to be executed until all the traffic of the source database is switched.
[0145] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0146] Deploy the data collection process and log capture device in the source database;
[0147] An artificial intelligence model is used to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules; based on the data mapping rules, a migration script is generated.
[0148] Acquire the full data from the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, obtain the incremental data during the parallel import of the full data into the target database based on the log stream, and update the target database with the incremental data;
[0149] Artificial intelligence models are used to predict the performance metrics of the target database under different loads; based on the performance metrics, the optimal traffic switching window is calculated.
[0150] Update routing rules in the optimal traffic switching window; based on the routing rules, switch traffic from the source database to the target database; traffic from the source database refers to access requests from business applications.
[0151] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: using an artificial intelligence model to perform semantic parsing on objects in the source database and the target database to obtain syntactic differences between the source database and the target database; using an artificial intelligence model to analyze the syntactic differences; using an artificial intelligence model to perform semantic matching on objects in the source database and the target database to generate data mapping rules.
[0152] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: obtaining a transaction consistency controller; using the transaction consistency controller and a distributed snapshot version control algorithm, performing repeatable read and consistency verification on at least one transaction corresponding to the full data and incremental data; for transactions that fail verification, using an artificial intelligence latency compensation algorithm to schedule the execution strategy of the data corresponding to the transaction; and updating the data to the target database based on the execution strategy.
[0153] In one embodiment, when the computer program is executed by the processor, it also performs the following steps: using an artificial intelligence model to analyze historical business traffic, system access patterns, and abnormal peak fluctuations to obtain historical switching data; and based on the historical switching data, predicting the performance indicators of the target database under different loads.
[0154] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: confirming whether the access service request of at least one transaction corresponding to the incremental data arrives within the traffic switching window; for the access service request arriving within the traffic switching window, using a preset component to route the traffic corresponding to the access service request to the target database; for the access service request created before the start of the traffic switching window, using connection pool reuse and transaction caching technology to keep the route of the traffic corresponding to the created access service request pointing to the source database unchanged, until the transaction corresponding to the created access service request is completed in the source database.
[0155] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: based on the routing rules, the traffic of the source database is switched to the target database in N steps; wherein, during the i-th switch, the current migration transaction of the source database is determined; the traffic corresponding to the current migration transaction is switched to the target database; the source database and the target database are connected through the application layer; an artificial intelligence monitoring system is used to simultaneously monitor the performance indicators of the source database and the target database; based on the performance indicators, it is confirmed whether any abnormal phenomena occur during the traffic switching process; if so, the traffic switching is terminated, and the traffic of the current migration transaction switched to the target database is rolled back to the source database through the application layer; if not, the steps of controlling the traffic corresponding to the current migration transaction to switch to the target database and subsequent steps continue to be executed until all the traffic of the source database is switched.
[0156] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0157] Deploy the data collection process and log capture device in the source database;
[0158] An artificial intelligence model is used to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules; based on the data mapping rules, a migration script is generated.
[0159] Acquire the full data from the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capturer to listen to the real-time log stream of the source database, obtain the incremental data during the parallel import of the full data into the target database based on the log stream, and update the target database with the incremental data;
[0160] Artificial intelligence models are used to predict the performance metrics of the target database under different loads; based on the performance metrics, the optimal traffic switching window is calculated.
[0161] Update routing rules in the optimal traffic switching window; based on the routing rules, switch traffic from the source database to the target database; traffic from the source database refers to access requests from business applications.
[0162] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: using an artificial intelligence model to perform semantic parsing on objects in the source database and the target database to obtain syntactic differences between the source database and the target database; using an artificial intelligence model to analyze the syntactic differences; using an artificial intelligence model to perform semantic matching on objects in the source database and the target database to generate data mapping rules.
[0163] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: obtaining a transaction consistency controller; using the transaction consistency controller and a distributed snapshot version control algorithm, performing repeatable read and consistency verification on at least one transaction corresponding to the full data and incremental data; for transactions that fail verification, using an artificial intelligence latency compensation algorithm to schedule the execution strategy of the data corresponding to the transaction; and updating the data to the target database based on the execution strategy.
[0164] In one embodiment, when the computer program is executed by the processor, it also performs the following steps: using an artificial intelligence model to analyze historical business traffic, system access patterns, and abnormal peak fluctuations to obtain historical switching data; and based on the historical switching data, predicting the performance indicators of the target database under different loads.
[0165] In one embodiment, when the computer program is executed by the processor, it further performs the following steps: confirming whether the access service request of at least one transaction corresponding to the incremental data arrives within the traffic switching window; for the access service request arriving within the traffic switching window, using a preset component to route the traffic corresponding to the access service request to the target database; for the access service request created before the start of the traffic switching window, using connection pool reuse and transaction caching technology to keep the route of the traffic corresponding to the created access service request pointing to the source database unchanged, until the transaction corresponding to the created access service request is completed in the source database.
[0166] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: based on the routing rules, the traffic of the source database is switched to the target database in N steps; wherein, during the i-th switch, the current migration transaction of the source database is determined; the traffic corresponding to the current migration transaction is switched to the target database; the source database and the target database are connected through the application layer; an artificial intelligence monitoring system is used to simultaneously monitor the performance indicators of the source database and the target database; based on the performance indicators, it is confirmed whether any abnormal phenomena occur during the traffic switching process; if so, the traffic switching is terminated, and the traffic of the current migration transaction switched to the target database is rolled back to the source database through the application layer; if not, the steps of controlling the traffic corresponding to the current migration transaction to switch to the target database and subsequent steps continue to be executed until all the traffic of the source database is switched.
[0167] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0168] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0169] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 application.
[0170] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A database migration method, characterized in that, The method includes: Deploy the data collection process and log capture device in the source database; An artificial intelligence model is used to perform semantic parsing and matching of objects in the source database and the target database to generate data mapping rules; based on the data mapping rules, a migration script is generated. The process acquires all data from the source database collected by the acquisition process; runs the migration script to import the all data into the target database in parallel; uses the log capturer to listen to the real-time log stream of the source database, acquires incremental data during the parallel import of the all data into the target database based on the log stream, and updates the target database with the incremental data. The artificial intelligence model is used to predict the performance indicators of the target database under different loads; based on the performance indicators, the optimal traffic switching window is calculated. Update the routing rules in the optimal traffic switching window; based on the routing rules, switch the traffic of the source database to the target database; the traffic of the source database refers to access service requests from the business program.
2. The method according to claim 1, characterized in that, The step of using an artificial intelligence model to perform semantic parsing and matching of objects in the source and target databases to generate data mapping rules includes: An artificial intelligence model is used to perform semantic parsing on objects in the source database and the target database to obtain the syntactic differences between the source database and the target database; The artificial intelligence model is used to analyze the grammatical differences, and semantic matching of objects in the source database and the target database is performed using the artificial intelligence model to generate data mapping rules.
3. The method according to claim 1, characterized in that, The method further includes: Obtain the transaction consistency controller; The transaction consistency controller uses a distributed snapshot version control algorithm to perform repeatable read and consistency verification on at least one transaction corresponding to the full data and the incremental data. For transactions that fail verification, an artificial intelligence delay compensation algorithm is used to schedule the execution strategy of the data corresponding to the transaction; based on the execution strategy, the data is updated to the target database.
4. The method according to claim 1, characterized in that, The step of using the artificial intelligence model to predict the performance metrics of the target database under different loads includes: The aforementioned artificial intelligence model is used to analyze historical business traffic, system access patterns, and abnormal peak fluctuations to obtain historical switching data; Based on the historical switching data, predict the performance metrics of the target database under different loads.
5. The method according to claim 1, characterized in that, Updating routing rules within the optimal traffic switching window includes: Confirm whether the access service request for at least one transaction corresponding to the incremental data arrives within the traffic switching window; For access service requests arriving within the traffic switching window, a preset component is used to route the traffic corresponding to the access service request to the target database; For access service requests created before the start of the traffic switching window, the routing of the traffic corresponding to the created access service request is kept to the source database by connection pool reuse and transaction caching technology, until the transaction corresponding to the created access service request is completed in the source database.
6. The method according to claim 1, characterized in that, The step of switching traffic from the source database to the target database based on the routing rules includes: Based on the routing rules, the traffic from the source database is switched to the target database N times; During the i-th switch, the current migration transaction of the source database is determined; and the traffic corresponding to the current migration transaction is switched to the target database. The source database and the target database are connected through the application layer; an artificial intelligence monitoring system is used to simultaneously monitor the performance metrics of the source database and the target database; based on the performance metrics, it is confirmed whether any abnormal phenomena occur during the traffic switching process; If this occurs, the traffic switching is terminated, and the traffic of the current migration transaction that has switched to the target database is rolled back to the source database through the application layer; If this does not occur, continue executing the steps to switch the traffic corresponding to the current migration transaction to the target database and subsequent steps until all traffic to the source database has been switched.
7. A database migration device, characterized in that, The device includes: The deployment module is used to deploy the collection process and log capturer in the source database; The generation module is used to perform semantic parsing and matching of objects in the source database and the target database using an artificial intelligence model to generate data mapping rules; and to generate migration scripts based on the data mapping rules. The migration module is used to acquire the full data of the source database collected by the acquisition process; run the migration script to import the full data into the target database in parallel; use the log capture device to listen to the real-time log stream of the source database, acquire incremental data based on the log stream during the parallel import of the full data into the target database, and update the target database with the incremental data. The calculation module is used to predict the performance indicators of the target database under different loads using the artificial intelligence model; and to calculate the optimal traffic switching window based on the performance indicators. The switching module is used to update routing rules in the optimal traffic switching window; and based on the routing rules, switch the traffic of the source database to the target database; the traffic of the source database refers to access service requests from the business program.
8. 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, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.