Consistency verification method and device for data synchronization from MySQL database to Kafka message queue, computer equipment and readable storage medium
Real-time dynamic comparison or static data comparison is used between the MySQL database and the Kafka message queue through the configuration file to verify data consistency, which solves the problem that existing technology cannot achieve automatic data comparison and improves the efficiency of data consistency verification. and accuracy.
Patent Information
- Application Number
- CN202410885852.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing MySQL database and Kafka message queue data synchronization technology cannot realize automatic data comparison based on heterogeneous data content, resulting in the inability to meet the high requirements for data content accuracy and completeness in application scenarios with strict data consistency requirements.
Through the configuration file, real-time dynamic comparison or static data comparison of stopped databases is used to obtain the number of data items and specified column summation information in the MySQL database and Kafka message queue, verify the consistency of the data, and provide consistency comparison results and Exception notification.
It improves the efficiency and accuracy of data consistency verification, reduces the complexity and error rate of manual operations, and provides a more reliable technical solution for the fields of data processing and messaging.
Smart Images

Figure CN118779351A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a consistency verification method, device, computer equipment and readable storage medium for data synchronization from a MySQL database to a Kafka message queue. Background Art
[0002] In the field of data processing and messaging, data synchronization between MySQL database, a representative of relational databases, and Kafka, a message queue, is a crucial technology. However, due to the essential differences in the data structures of the two, namely the relational characteristics of MySQL and the message queue characteristics of Kafka, the existing technical solutions can only provide dynamic number comparison during data synchronization, but cannot achieve automatic data comparison based on heterogeneous data content. This limitation is particularly prominent in application scenarios with strict requirements on data consistency, because relying solely on dynamic data number comparison cannot meet the high requirements for data content accuracy and integrity. Summary of the invention
[0003] The object of the present invention is to provide a consistency verification method, device, computer equipment and readable storage medium for data synchronization from a MySQL database to a Kafka message queue.
[0004] In a first aspect, an embodiment of the present invention provides a consistency verification method for data synchronization from a MySQL database to a Kafka message queue, comprising:
[0005] Through the configuration file, the consistency verification of the synchronized data between the MySQL database and the Kafka message queue is completed based on real-time dynamic comparison or static data comparison of the stopped database.
[0006] In a possible implementation, completing the consistency verification of the synchronized data between the MySQL database and the Kafka message queue based on real-time dynamic comparison through the configuration file includes:
[0007] Execute the scheduled task to obtain the number of data items and the sum of specified columns in the MySQL database and the Kafka message queue determined based on the configuration file to verify the consistency of the data.
[0008] In a possible implementation, the obtaining the number of data items and the sum of specified columns in the MySQL database and the Kafka message queue determined based on the configuration file includes:
[0009] In the MySQL database, the table name and designated columns and other parameters in the configuration file are used to count the number of data items in the synchronization table and the sum information of the designated columns through SQL statements.
[0010] In a possible implementation, the obtaining the number of data items and the sum of specified columns in the MySQL database and the Kafka message queue determined based on the configuration file includes:
[0011] In the Kafka message queue, the table name and designated columns and other parameters in the configuration file are used to receive and count the number of synchronization table data items and the sum information of the designated columns from the MySQL database through the program loop logic setting.
[0012] In a possible implementation, the consistency verification of the synchronized data between the MySQL database and the Kafka message queue is completed based on the static data comparison of the stopped database through the configuration file, including:
[0013] Stop the MySQL database and synchronization program to reach a static state;
[0014] In the static state, a data comparison is performed between the MySQL database and the Kafka message queue to verify the consistency of the data.
[0015] In a possible implementation manner, the configuration file includes a time interval and comparison accuracy for data synchronization.
[0016] In a possible implementation, the method further includes:
[0017] In response to a user inputting configuration parameters in a preset user interface, obtaining consistency comparison results and abnormality notifications;
[0018] The consistency comparison result and the abnormality notification are displayed on the preset user interface.
[0019] In a second aspect, an embodiment of the present invention provides a consistency verification device for synchronizing data from a MySQL database to a Kafka message queue, including:
[0020] The verification module is used to complete the consistency verification of the synchronized data between the MySQL database and the Kafka message queue based on the configuration file, real-time dynamic comparison or static data comparison of the stopped database.
[0021] In a third aspect, an embodiment of the present invention provides a computer device, comprising a processor and a non-volatile memory storing computer instructions, wherein when the computer instructions are executed by the processor, the computer device executes the method described in at least one possible implementation of the first aspect.
[0022] In a fourth aspect, an embodiment of the present invention provides a readable storage medium, wherein the readable storage medium includes a computer program, and when the computer program is executed, the computer device where the readable storage medium is located is controlled to execute the method described in at least one possible implementation manner of the first aspect.
[0023] Compared with the prior art, the beneficial effects provided by the present invention include: adopting a consistency verification method, device, computer equipment and readable storage medium for data synchronization from MySQL database to Kafka message queue disclosed in the present invention, and flexibly selecting two methods based on real-time dynamic comparison or static data comparison of the stopped database through the configuration file to complete the consistency verification of the synchronized data between the MySQL database and the Kafka message queue. Such a design improves the verification efficiency and accuracy of data consistency, reduces the complexity and error rate of manual operations, and provides a more reliable technical solution for the field of data processing and message transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can also be obtained based on these drawings without creative work.
[0025] Figure 1 A schematic diagram of the steps of a consistency verification method for synchronizing data from a MySQL database to a Kafka message queue provided by an embodiment of the present invention;
[0026] Figure 2 An interactive schematic diagram of consistency verification for data synchronization from a MySQL database to a Kafka message queue provided by an embodiment of the present invention;
[0027] Figure 3 A schematic block diagram of the structure of a consistency verification device for synchronizing data from a MySQL database to a Kafka message queue provided by an embodiment of the present invention;
[0028] Figure 4 A schematic block diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0030] The specific implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings.
[0031] In order to solve the technical problems in the aforementioned background technology, Figure 1 A flow chart of a method for consistency verification of data synchronization from a MySQL database to a Kafka message queue provided in an embodiment of the present disclosure is provided. The method for consistency verification of data synchronization from a MySQL database to a Kafka message queue is introduced in detail below.
[0032] Step S201, through the configuration file, based on real-time dynamic comparison or static data comparison of the database, complete the consistency verification of the synchronized data between the MySQL database and the Kafka message queue.
[0033] In the embodiment of the present invention, illustratively, the server administrator sets parameters such as the MySQL database table name to be synchronized, designated columns, and other configuration information such as the time interval for data synchronization and comparison accuracy in the configuration file.
[0034] The configuration file is saved in the specified directory of the server for subsequent consistency verification program to read and use.
[0035] In a data platform processing system, the MySQL database records the user's transaction information in real time, and this information needs to be synchronized to the Kafka message queue for consumption by other services.
[0036] The automated program on the server periodically reads the configuration file to obtain the table name and specified columns that need to be synchronized. Then, the program uses SQL statements to count the number of data items in the data table in the MySQL database and the sum of the specified columns (such as transaction amounts). At the same time, the program also performs the same statistics on the transaction data synchronized in the Kafka message queue. Finally, the program compares the statistical results of the two. If they are consistent, the data synchronization is considered consistent; if they are inconsistent, an exception notification is triggered.
[0037] On the system financial settlement day, precise consistency verification of transaction data in the MySQL database and Kafka message queue is required to ensure the accuracy of financial data.
[0038] Before the financial settlement date, the server administrator stops the write operation and synchronization program of the MySQL database by executing the script. Then, the administrator runs the consistency verification program, which reads the table name and specified columns in the configuration file and performs a comprehensive comparison of the data in the static MySQL database and the Kafka message queue. After the comparison is completed, the program outputs the comparison results. If the data is consistent, the verification is passed; if it is inconsistent, the detailed information of the inconsistency is output for the administrator to analyze and handle.
[0039] Through the above steps, the server can effectively complete the consistency verification of data synchronization from MySQL database to Kafka message queue, ensuring the accuracy and reliability of the data.
[0040] In the embodiment of the present invention, the aforementioned step S201 can be implemented through the following example execution.
[0041] Execute the scheduled task to obtain the number of data items and the sum of specified columns in the MySQL database and the Kafka message queue determined based on the configuration file to verify the consistency of the data.
[0042] In the embodiment of the present invention, for example, in the processing system of the data platform, the server needs to ensure in real time that the transaction information in the MySQL database is consistent with the transaction information in the Kafka message queue. To this end, the server administrator sets a scheduled task and configures the corresponding parameters.
[0043] Setting of scheduled tasks:
[0044] The server administrator sets a scheduled task with a customizable time using a cron job or other scheduled task scheduling tools.
[0045] The scheduled task points to a script or program that is responsible for executing the consistency verification logic.
[0046] Reading of configuration files:
[0047] When the scheduled task is triggered, the program on the server will read the previously set configuration file.
[0048] The configuration file contains the MySQL database table name that needs to be synchronized (such as "orders"), the specified column (such as "order_amount" for the amount), and the relevant configuration information of the Kafka message queue (such as topic name, partition, etc.).
[0049] Get the number of data items and the sum of specified columns:
[0050] The program uses the table name and specified column information in the configuration file to query the "orders" table in the MySQL database through SQL statements, and counts the number of data items and the total amount of the "order_amount" column.
[0051] At the same time, the program obtains transaction data synchronized with the "orders" table through the Kafka message queue, and performs statistics on the number of identical data items and the sum of specified columns.
[0052] Verification of data consistency:
[0053] The program compares the number of data items and the sum of specified columns obtained from the MySQL database and the Kafka message queue.
[0054] If the data of the two are completely consistent, the program records the verification result and can continue to execute other tasks.
[0055] If the data is inconsistent, the program triggers an exception notification and sends an alert email or message to the server administrator so that the data synchronization problem can be handled in a timely manner.
[0056] Through the above steps, the server can execute scheduled tasks in real time and automatically complete the consistency verification of synchronized data between the MySQL database and the Kafka message queue according to the parameter settings in the configuration file. This ensures the accuracy and reliability of data in the data platform processing system.
[0057] In an embodiment of the present invention, the aforementioned step of obtaining the number of data items and the sum information of the specified columns in the MySQL database and the Kafka message queue determined based on the configuration file can be implemented through the following example.
[0058] In the MySQL database, the table name and designated columns and other parameters in the configuration file are used to count the number of data items in the synchronization table and the sum information of the designated columns through SQL statements.
[0059] In the embodiment of the present invention, for example, in the processing system of the data platform, the server needs to ensure in real time that the transaction information in the MySQL database is consistent with the transaction information in the Kafka message queue. To this end, the server administrator has set up a scheduled task and configured the corresponding parameters.
[0060] Reading of configuration files:
[0061] When the scheduled task is triggered, the program on the server will read the previously set configuration file.
[0062] The configuration file contains parameters such as the MySQL database table name that needs to be synchronized (such as "orders"), the specified column (such as "order_amount" for the amount), etc.
[0063] Connect to MySQL database:
[0064] The program uses the database connection information in the configuration file (such as database address, port, user name, password, etc.) to connect to the MySQL database.
[0065] Execute SQL statements:
[0066] The program constructs an SQL statement based on the table name and specified column parameters in the configuration file to count the number of data entries in the "orders" table and the total amount of the "order_amount" column.
[0067] For example, the SQL statement may be as follows: "SELECT COUNT(*) AS total_count, SUM(order_amount) AS total_amount FROM orders;".
[0068] Get statistical results:
[0069] The program executes SQL statements and obtains statistical results returned by the MySQL database.
[0070] The statistical results include the number of data items in the "orders" table and the sum of the "order_amount" column.
[0071] Processing statistical results:
[0072] The program saves the obtained statistical results in memory or writes them to log files for subsequent comparison with the data in the Kafka message queue.
[0073] Through the above steps, the server can use the parameters in the configuration file in the MySQL database to count the number of data in the synchronization table and the sum of the specified columns through SQL statements. This is an important step in obtaining MySQL database data during real-time dynamic comparison, which provides a basis for subsequent data consistency verification.
[0074] In an embodiment of the present invention, the aforementioned step of obtaining the number of data items and the sum of specified columns in the MySQL database and the Kafka message queue determined based on the configuration file can be implemented through the following example.
[0075] In the Kafka message queue, the table name and designated columns and other parameters in the configuration file are used to receive and count the number of synchronization table data items and the sum information of the designated columns from the MySQL database through the program loop logic setting.
[0076] In the embodiment of the present invention, for example, in the processing system of the data platform, the server needs to ensure in real time that the transaction information in the MySQL database is consistent with the transaction information in the Kafka message queue. To this end, the server administrator has set up a scheduled task and configured the corresponding parameters.
[0077] Reading of configuration files:
[0078] When the scheduled task is triggered, the program on the server will read the previously set configuration file.
[0079] The configuration file contains the MySQL database table name that needs to be synchronized (such as "orders"), the specified column (such as "order_amount" for the amount), and the relevant configuration information of the Kafka message queue (such as topic name, partition, etc.).
[0080] Connect to the Kafka message queue:
[0081] The program uses the Kafka connection information in the configuration file (such as Kafka cluster address, port, consumer group ID, etc.) to connect to the Kafka message queue.
[0082] Set up the program loop logic:
[0083] The program enters a loop logic that continues to run until the scheduled task ends or a stop signal is received.
[0084] In the loop, the program will continuously receive transaction data from the Kafka message queue.
[0085] Receive and count synchronization table data:
[0086] The program parses the received Kafka message according to the table name and specified column parameters in the configuration file and extracts the data corresponding to the "orders" table in the MySQL database.
[0087] The program counts these data and calculates the number of data items and the sum of the "order_amount" column.
[0088] Processing statistical results:
[0089] The program saves the obtained statistical results in memory or writes them to log files for subsequent comparison with the data in the MySQL database.
[0090] Through the above steps, the server can use the parameters in the configuration file in the Kafka message queue to receive and count the number of synchronized table data and the sum of specified columns from the MySQL database through the program loop logic. This is an important step in obtaining Kafka message queue data during real-time dynamic comparison, which provides a basis for subsequent data consistency verification.
[0091] In an embodiment of the present invention, the consistency verification of the synchronized data between the MySQL database and the Kafka message queue is completed based on the static data comparison of the stopped database through the configuration file, including:
[0092] Stop the MySQL database and synchronization program to reach a static state;
[0093] In the static state, a data comparison is performed between the MySQL database and the Kafka message queue to verify the consistency of the data.
[0094] In the embodiment of the present invention, for example, on the financial settlement date, the server needs to ensure that the transaction information in the MySQL database is completely consistent with the transaction information in the Kafka message queue in order to perform accurate financial settlement. To this end, the server administrator decides to perform static data comparison.
[0095] Stop the MySQL database and synchronization program:
[0096] The server administrator stops the MySQL database service by executing a specific script or command to ensure that no new data is written during the comparison process.
[0097] At the same time, the administrator also stops the synchronization program to prevent new data from being synchronized from the MySQL database to the Kafka message queue during the comparison process.
[0098] To reach a static state:
[0099] After stopping the MySQL database and the synchronization program, the system reaches a static state, where the data in the MySQL database and the Kafka message queue are fixed and do not change.
[0100] Perform data comparison:
[0101] The comparison program on the server starts to execute. The program reads the parameters in the configuration file, including the MySQL database table name to be compared (such as "orders"), the specified column (such as "order_amount" for the amount), and the relevant configuration information of the Kafka message queue (such as topic name, partition, etc.).
[0102] The comparison program first connects to the MySQL database, queries all the data in the "orders" table through SQL statements, and calculates the number of data items and the sum of the "order_amount" column.
[0103] Next, the comparison program connects to the Kafka message queue, obtains the transaction data synchronized with the "orders" table, and performs statistics on the number of identical data items and the sum of specified columns.
[0104] Finally, the comparison program compares the data obtained from the MySQL database and the Kafka message queue. If the data of the two are exactly the same, the result of the comparison is recorded; if the data is inconsistent, an exception notification is triggered and an alert is sent to the server administrator.
[0105] Through the above steps, the server can complete the consistency verification of the synchronized data between the MySQL database and the Kafka message queue in a static state. This ensures the accuracy and reliability of the financial settlement date information.
[0106] In the embodiment of the present invention, the configuration file includes the time interval and comparison accuracy of data synchronization.
[0107] In the embodiment of the present invention, the time interval for data synchronization is exemplarily:
[0108] Configuration file content: In the configuration file, the data synchronization interval is set to "every 5 minutes".
[0109] Actual scenario: In the processing system of the data platform, in order to update the data status in real time, the server needs to regularly synchronize transaction data from the MySQL database to the Kafka message queue. According to the settings in the configuration file, the synchronization program will be executed every 5 minutes to pull the latest transaction data from the MySQL database and push it to the Kafka message queue.
[0110] Comparison precision: Configuration file content: In the configuration file, the comparison precision is set to "two decimal places".
[0111] Actual scenario: On the financial settlement day, the server needs to perform static data comparison to verify whether the transaction amounts in the MySQL database and the Kafka message queue are consistent. According to the settings in the configuration file, the comparison program will compare the transaction amounts in the two data sources and ensure that they are completely consistent in terms of "two decimal places". If the comparison result meets this accuracy requirement, the result of the comparison passing will be recorded; otherwise, an exception notification will be triggered so that the server administrator can deal with the data inconsistency problem in a timely manner.
[0112] Through the above steps and scenario examples, we can see the importance of the two parameters of data synchronization time interval and comparison accuracy in the configuration file in practical applications. They ensure the timeliness of data synchronization and the accuracy of data comparison, thereby ensuring the normal operation of the data platform processing system and financial settlement date.
[0113] In the embodiments of the present invention, the following implementation modes are also provided.
[0114] In response to a user inputting configuration parameters in a preset user interface, obtaining consistency comparison results and abnormality notifications;
[0115] The consistency comparison result and the abnormality notification are displayed on the preset user interface.
[0116] In the embodiment of the present invention, illustratively, in response to a user inputting configuration parameters in a preset user interface:
[0117] Pre-configured user interface: Data platform administrators access a dedicated web interface to configure the platform.
[0118] Enter configuration parameters: The administrator fills in the data synchronization interval as "every 10 minutes" and the comparison accuracy as "three decimal places" on the web interface, and selects the MySQL database table and Kafka message queue topic that need to be synchronized and compared.
[0119] Server response: After receiving these configuration parameters, the server saves them in the configuration file and prepares to perform data synchronization and consistency comparison based on these parameters.
[0120] Obtain consistency comparison results and exception notifications: Execute comparison: The server synchronizes data from the MySQL database to the Kafka message queue every 10 minutes according to the parameters set by the user, and performs static data comparison at the preset time point.
[0121] Comparison results and exception notifications: During the comparison process, the server found that there was a slight difference in the fourth decimal place in the synchronized data, which triggered an exception notification. At the same time, the server also recorded the consistency results of each comparison.
[0122] Display consistency comparison results and exception notifications to the preset user interface: Display results: The server updates the consistency results of each comparison and the triggered exception notifications in real time on the administrator's web interface.
[0123] Administrator review: By accessing the web interface, the administrator can clearly see the results of each data comparison, including successful comparisons and abnormal comparisons. For abnormal comparisons, the administrator can also view detailed abnormal information for timely processing.
[0124] Through the above steps and scenario examples, we can see how the server responds to the user's operation in the preset user interface, obtains consistency comparison results and exception notifications, and displays this information to the user. This provides great convenience for users, allowing them to easily monitor and manage the data consistency verification process.
[0125] In order to more clearly describe the solution provided by the embodiment of the present application, please refer to Figure 2 , Figure 2 An interactive schematic diagram of consistency verification of data synchronization from a MySQL database to a Kafka message queue provided in an embodiment of the present invention.
[0126] For the scenario of data synchronization from MySQL database to Kafka message queue, data consistency verification is performed by verifying the number of synchronized data table data and summing statistical information based on the specified column in the data table (the specified column is an integer / floating point data type field).
[0127] For the source MySQL database, statistics on the number of data in the synchronization table and the sum of the specified columns (the specified columns are integer / floating point data type fields) are completed through configuration files and SQL statements. By configuring parameters such as the table name and the specified columns (the specified columns are integer / floating point data type fields) in the configuration file, the comparison module automatically outputs the number of data in the synchronization table and the sum of the specified columns during program execution according to the configuration file.
[0128] For the Kafka message queue, it is responsible for receiving the data information output from the source MySQL database after extraction, conversion, transmission and other operations. Statistics on the number of data items in the synchronization table and the sum of the specified columns (the specified columns are integer / floating point data type fields) on the Kafka message queue side are completed through the configuration file and program loop logic settings. By configuring parameters such as the table name and the specified column (the specified column is an integer / floating point data type field) in the configuration file, the Kafka data receiving program module sets the loop processing logic during execution. The Kafka data receiving program module automatically completes the statistics of the number of data items in the synchronization table and the sum of the specified column fields according to the configuration file, and outputs them regularly.
[0129] There are two data comparison modes. One is real-time dynamic comparison, which is for scenarios where the database cannot be stopped; the other is static data comparison with the database stopped, which meets application scenarios with high requirements for data accuracy. This data comparison mode can stop the database and synchronization program as required, and complete the data comparison through the set comparison conditions.
[0130] Please refer to Figure 3 , Figure 3 A consistency verification device 110 for synchronizing data from a MySQL database to a Kafka message queue provided in an embodiment of the present invention includes:
[0131] The verification module 1101 is used to complete the consistency verification of the synchronized data between the MySQL database and the Kafka message queue based on the real-time dynamic comparison or the static data comparison of the stopped database through the configuration file.
[0132] It should be noted that the implementation principle of the aforementioned consistency verification device 110 for data synchronization from MySQL database to Kafka message queue can refer to the implementation principle of the aforementioned consistency verification method for data synchronization from MySQL database to Kafka message queue, which will not be repeated here. It should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be fully implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the consistency verification device 110 for data synchronization from MySQL database to Kafka message queue can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the consistency verification device 110 for data synchronization from MySQL database to Kafka message queue. The implementation of other modules is similar. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in a processor element or an instruction in software form.
[0133] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA), etc. For another example, when a module above is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0134] The embodiment of the present invention provides a computer device 100, which includes a processor and a non-volatile memory storing computer instructions. When the computer instructions are executed by the processor, the computer device 100 executes the aforementioned consistency verification device 110 for MySQL database to Kafka message queue data synchronization. Figure 4 As shown, Figure 4 The computer device 100 provided in the embodiment of the present invention is a structural block diagram. The computer device 100 includes a consistency verification device 110 for MySQL database to Kafka message queue data synchronization, a memory 111, a processor 112 and a communication unit 113.
[0135] In order to realize the transmission or interaction of data, the memory 111, the processor 112 and the communication unit 113 are electrically connected to each other directly or indirectly. For example, the electrical connection between these elements can be realized through one or more communication buses or signal lines. The consistency verification device 110 for MySQL database to Kafka message queue data synchronization includes at least one software function module that can be stored in the memory 111 in the form of software or firmware or solidified in the operating system (OS) of the computer device 100. The processor 112 is used to execute the consistency verification device 110 for MySQL database to Kafka message queue data synchronization stored in the memory 111, such as the software function modules and computer programs included in the consistency verification device 110 for MySQL database to Kafka message queue data synchronization.
[0136] An embodiment of the present invention provides a readable storage medium, which includes a computer program. When the computer program is running, it controls the computer device where the readable storage medium is located to execute the aforementioned consistency verification device 110 for MySQL database to Kafka message queue data synchronization.
[0137] For illustrative purposes, the foregoing description is made with reference to specific embodiments. However, the above illustrative discussion is not intended to be exhaustive or to limit the present disclosure to the precise form disclosed. Numerous modifications and variations are possible in accordance with the above teachings. These embodiments are selected and described in order to best illustrate the principles of the present disclosure and its practical application, so that those skilled in the art can best utilize the present disclosure and utilize various embodiments with different modifications to suit the intended specific application.
Claims
1. A consistency verification method for data synchronization from a MySQL database to a Kafka message queue, characterized in that: include: Through the configuration file, the consistency verification of the synchronized data between the MySQL database and the Kafka message queue is completed based on real-time dynamic comparison or static data comparison of the stopped database.
2. The method according to claim 1, characterized in that The consistency verification of the synchronized data between the MySQL database and the Kafka message queue is completed based on real-time dynamic comparison through the configuration file, including: Execute the scheduled task to obtain the number of data items and the sum of specified columns in the MySQL database and the Kafka message queue determined based on the configuration file to verify the consistency of the data.
3. The method according to claim 2, characterized in that The obtaining of the number of data items and the sum of the specified columns in the MySQL database and the Kafka message queue determined based on the configuration file includes: In the MySQL database, the table name and designated columns and other parameters in the configuration file are used to count the number of data items in the synchronization table and the sum information of the designated columns through SQL statements.
4. The method according to claim 2, characterized in that: The obtaining of the number of data items and the sum of the specified columns in the MySQL database and the Kafka message queue determined based on the configuration file includes: In the Kafka message queue, the table name and designated columns and other parameters in the configuration file are used to receive and count the number of synchronization table data items and the sum information of the designated columns from the MySQL database through the program loop logic setting.
5. The method according to claim 1, characterized in that The consistency verification of the synchronized data between the MySQL database and the Kafka message queue is completed through the configuration file based on the static data comparison of the stopped database, including: Stop the MySQL database and synchronization program to reach a static state; In the static state, a data comparison is performed between the MySQL database and the Kafka message queue to verify the consistency of the data.
6. The method according to claim 1, characterized in that The configuration file includes the time interval and comparison accuracy of data synchronization.
7. The method according to claim 1, characterized in that The method further comprises: In response to a user inputting configuration parameters in a preset user interface, obtaining consistency comparison results and abnormality notifications; The consistency comparison result and the abnormality notification are displayed on the preset user interface.
8. A consistency verification device for MySQL database to Kafka message queue data synchronization, characterized in that: include: The verification module is used to complete the consistency verification of the synchronized data between the MySQL database and the Kafka message queue based on the configuration file, real-time dynamic comparison or static data comparison of the stopped database.
9. A computer device, characterized in that: The computer device comprises a processor and a non-volatile memory storing computer instructions. When the computer instructions are executed by the processor, the computer device executes the method according to any one of claims 1 to 7.
10. A readable storage medium, characterized in that: The readable storage medium includes a computer program, and when the computer program is executed, the computer device where the readable storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Data conversion synchronization method and device for heterogeneous database and storage medium
CN110222117A
Multi-source heterogeneous structured data synchronization method
CN111506556A
Adaptive synchronization and difference identification method, device and equipment for multiple data sources
CN115827777A
Online migration method for mysql database instance of cloud platform
CN116841984A
Data synchronization method and apparatus, computer device and storage medium
WO2021027363A1
