A method, device, equipment and readable storage medium for smoothly upgrading a database

The method enables seamless database version transitions by ensuring synchronization and consistency between databases, reducing data loss and service disruption during upgrades.

CN114185578BActive Publication Date: 2024-12-20CCB FINTECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111554124.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2024-12-20
Estimated Expiration
2041-12-17

AI Technical Summary

Technical Problem

Traditional database upgrade methods require downtime and do not support hot upgrades, leading to potential data loss and service disruptions.

Method used

A method involving real-time replication and synchronization between low-version and high-version databases, with checks for synchronization delay and data consistency, followed by switching services to the high-version database.

Benefits of technology

Ensures smooth database upgrades with minimal data loss and service impact by checking synchronization delay and consistency, allowing for rapid version transitions without downtime.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114185578B_ABST
    Figure CN114185578B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, equipment and readable storage medium for smoothly upgrading a database, which relates to the field of computer technology, and includes obtaining the architecture configuration of a low-version database; initializing a high-version database according to the architecture configuration; establishing a real-time replication and synchronization relationship between the low-version database and the high-version database, and synchronizing data; judging and verifying whether the synchronization between the low-version database and the high-version database is delayed, judging and verifying whether the data between the low-version database and the high-version database are consistent, and if there is no synchronization delay and the data are consistent, closing the replication and synchronization relationship and switching the service to the high-version database. The present application combines the delay with the consistency of the two version databases when switching between the two version databases, so that the external service provided by the database can be unaffected under the premise of quickly and smoothly upgrading the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and readable storage medium for smoothly upgrading a database. Background Art

[0002] The steps for upgrading the traditional MySQL database are as follows:

[0003] 1) Stop the running MySQL database service;

[0004] 2) Install the new version of database software;

[0005] 3) Perform database backup for recovery.

[0006] 4) Start the database and execute the mysql_upgrade command to update the objects in the database to the latest version.

[0007] Hot upgrade cannot be achieved in traditional upgrade. Summary of the invention

[0008] The purpose of the present invention is to provide a method, device, equipment and readable storage medium for smoothly upgrading a database to improve the above problems. In order to achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0009] In the first aspect, the present application provides a method for smoothly upgrading a database, comprising: obtaining the architecture configuration of a low-version database; initializing a high-version database according to the architecture configuration; establishing a real-time replication and synchronization relationship between the low-version database and the high-version database, and synchronizing data; judging and verifying whether the synchronization between the low-version database and the high-version database is delayed, judging and verifying whether the data of the low-version database and the high-version database are consistent. If there is no synchronization delay and the database is consistent, closing the replication and synchronization relationship and switching the service to the high-version database.

[0010] Furthermore, the construction of a real-time replication and synchronization relationship between the low-version database and the high-version database includes: calling the first backup software from the low-version database to obtain backup data, and recording the backup data, wherein the backup data includes a first log file and a backup point file; calling the first backup software to restore the backup data to the high-version database; setting the low-version database as the master database and the high-version database as the slave database, and starting master-slave synchronization; and applying the second log file transmitted from the low-version database to the high-version database.

[0011] Furthermore, the judgment and verification of whether the data of the low version database is consistent with that of the high version database includes: sending a first query command to the high version database, the first query command is used to trigger the high version database to return first query information, the first query information includes reading status information of the high version database and operation information of the high version database, if the reading status information or the operation information is wrong, sending a first display command and restarting to obtain the architectural configuration of the low version database after a first preset time period, the first display command includes a command to control the display to display the abnormal operation of the high version database.

[0012] Furthermore, the judgment and verification of whether the synchronization between the low version database and the high version database is delayed includes: detecting the consistency between the log of the low version database and the log of the high version database; if the logs of the low version database and the high version database are consistent, sending a first control command to the low version database and sending a second query command to the high version database to obtain the second query information returned by the high version database; the first control command is used to trigger the high version database to establish a preset table and enter preset information; the second query command includes a command to query the information in the preset table, and determine whether the second query information is the same as the preset information; if the second query information is not the same as the preset information, sending a second display command and restarting the construction of the real-time replication synchronization relationship between the low version database and the high version database after a first preset time period; the second display command includes a command to control the display to display the failure of master-slave synchronization.

[0013] Furthermore, the detection of the log consistency between the low version database and the high version database includes: sending a third query command to the high version database and sending a fourth query command to the low version database, the third query command is used to trigger the high version database to return third query information, the third query information includes a first preset keyword group corresponding value, the fourth query command is used to trigger the low version database to return fourth query information, the fourth query information includes a second preset keyword corresponding value; determine whether the first preset keyword group corresponding value is the same as the second preset keyword corresponding value, if the third query information is different from the fourth query information, then send a third display command and restart the acquisition of the architecture configuration of the low version database after a first preset time period, the third display command includes a command to control the display to display a master-slave synchronization failure.

[0014] Furthermore, closing the replication synchronization relationship and switching the service to the higher version database includes: backing up the network address of the network card of the server where the lower version database is located to obtain the backup IP information; closing the instance of the lower version database, and closing the network card service of the server where the lower version database is located; binding the backup IP information to the network card of the server where the higher version database is located; and closing the replication synchronization relationship on the higher version database.

[0015] In the second aspect, the present application also provides a smooth upgrade database device, including: an acquisition unit, used to obtain the architecture configuration of a low-version database; an initialization unit, used to initialize a high-version database according to the architecture configuration; a data synchronization unit, used to establish a real-time replication and synchronization relationship between the low-version database and the high-version database, and synchronize data; a first judgment unit, used to judge and verify whether the synchronization between the low-version database and the high-version database is delayed, and judge and verify whether the data of the low-version database and the high-version database are consistent. If there is no delay in synchronization and the data is consistent, the replication and synchronization relationship is closed and the service is switched to the high-version database.

[0016] Furthermore, the data synchronization unit includes: a backup data unit, used to call the first backup software to back up the low version database to obtain backup data, and record the first log file and backup point file of the backup data; a data recovery unit, used to call the first backup software to restore the backup data to the high version database; a master-slave synchronization unit, used to set the low version database as the master database, the high version database as the slave database, and start master-slave synchronization; a log application unit, used to apply the second log file transmitted from the low version database to the high version database.

[0017] Furthermore, the first judgment unit includes: a second judgment unit, used to send a first query command to the high-version database, the first query command is used to trigger the high-version database to return first query information, the first query information includes reading status information of the high-version database and operation information of the high-version database, if the reading status information or the operation information is wrong, then send a first display command and restart obtaining the architecture configuration of the low-version database after a first preset time period, the first display command includes a command to control the display to display the abnormal operation of the high-version database.

[0018] Furthermore, the first judgment unit also includes: a third judgment unit, which is used to detect the consistency of the log of the low version database and the log of the high version database. If the logs of the low version database are consistent with those of the high version database, a first control command is sent to the low version database and a second query command is sent to the high version database to obtain second query information returned by the high version database. The first control command is used to trigger the high version database to establish a preset table and enter preset information. The second query command includes a command to query the information in the preset table to determine whether the second query information is the same as the preset information. If the second query information is not the same as the preset information, a second display command is sent and the real-time replication synchronization relationship between the low version database and the high version database is restarted after a first preset time period. The second display command includes a command to control the display to display the failure of master-slave synchronization.

[0019] Furthermore, the third judgment unit includes: a query unit, used to send a third query command to the high-version database and a fourth query command to the low-version database, the third query command is used to trigger the high-version database to return third query information, the third query information includes a first preset keyword group corresponding value, the fourth query command is used to trigger the low-version database to return fourth query information, the fourth query information includes a second preset keyword corresponding value; a fourth judgment unit, used to determine whether the first preset keyword group corresponding value is the same as the second preset keyword corresponding value, if the third query information is different from the fourth information query information, then send a third display command and restart the acquisition of the architecture configuration of the low-version database after a first preset time period, the third display command includes a command to control the display to display the failure of master-slave synchronization.

[0020] Furthermore, the first judgment unit also includes: an IP backup unit, used to back up the network address of the network card of the server where the low version database is located to obtain backup IP information; a service shutdown unit, used to shut down the instance of the low version database and shut down the network card service of the server where the low version database is located; an IP switching unit, used to bind the backup IP information to the network card of the server where the high version database is located; and a relationship severing unit, used to shut down the replication synchronization relationship on the high version database.

[0021] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.

[0022] In a third aspect, the present application also provides a smooth upgrade database device, including:

[0023] Memory for storing computer programs;

[0024] A processor is used to implement the steps of the method for smoothly upgrading a database when executing the computer program.

[0025] In a fourth aspect, the present application further provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned method based on smooth database upgrade are implemented.

[0026] In a fifth aspect, the present application further provides a computer program product or a computer program, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, it is used to load and execute the steps of the method for smoothly upgrading a database.

[0027] The beneficial effects of the present invention are:

[0028] The present invention checks the synchronization delay between the high version database and the low version database when switching between two versions of the database, so that the two databases will not be missing data due to the short switching time, ensuring the possibility of smoothly upgrading the database. At the same time, when switching between two versions of the database, the consistency of the two versions of the database is checked, combined with the delay, so that the external services provided by the database can be not affected under the premise of quickly and smoothly upgrading the database.

[0029] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by implementing the embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0031] Figure 1 This is a flow chart of a method for smoothly upgrading a database according to an embodiment of the present invention;

[0032] Figure 2 This is a schematic diagram of the structure of a database smooth upgrade device according to an embodiment of the present invention;

[0033] Figure 3 The figure is a schematic diagram of the structure of a database smooth upgrade device described in an embodiment of the present invention. DETAILED DESCRIPTION

[0034] 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, rather than all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0035] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0036] Embodiment 1:

[0037] This embodiment provides a method for smoothly upgrading a database.

[0038] See also Figure 1 , the figure shows that the method includes step S100, step S200, step S300 and step S400.

[0039] S100. Obtain the architecture configuration of the low-version database.

[0040] It should be noted that the architecture configuration involved in this step specifically includes the master-slave or high-availability environment of the low-version database, environment variables, and operating system parameter information of the server where the low-version database is located.

[0041] S200. Initialize a higher version database according to the architecture configuration.

[0042] It is understandable that in this step, the same operation will be performed on the high version database and the server where the high version data is located according to the master-slave or high availability environment, environment variables and operating system parameter information of the server where the low version database is located in the low version database. Keep the high version database and the low version database with the same architecture configuration, that is, if the source database is one master and two slaves, then the new version database will also be one master and two slaves. At the same time, this step also includes initializing the mysql parameter file, wherein the specific initialization step is common knowledge of those skilled in the art, and will not be repeated in this application.

[0043] S300. Build a real-time replication synchronization relationship between the low-version database and the high-version database, and synchronize data.

[0044] S400, determine whether the synchronization between the low version database and the high version database is delayed, and determine whether the data of the low version database and the high version database are consistent. If there is no synchronization delay and the database is consistent, close the replication synchronization relationship and switch the service to the high version database.

[0045] In this method, when switching between two versions of the database, the synchronization delay between the higher version database and the lower version database is checked, so that the two databases will not lose data due to the short switching time, ensuring the possibility of smooth database upgrade. At the same time, when switching between two versions of the database, the consistency of the two versions of the database is checked. The above delay combination ensures that the external services provided by the database will not be affected under the premise of fast and smooth database upgrade.

[0046] In some disclosed embodiments, step S200 includes step S210, step S220, step S230, and step S240.

[0047] S210, calling the first backup software to back up the low version database to obtain backup data, and recording the first log file and the backup point file of the backup data;

[0048] It should be noted that in this application, the first backup software is xtrabackup, the first log file is the binlog file, and the backup point file is the position backup point.

[0049] S220, calling the first backup software to restore the backup data to the higher version database;

[0050] S230, set the low version database as the master database, the high version database as the slave database, and start master-slave synchronization;

[0051] S240. Apply the binlog log from the low version database to the high version database.

[0052] It should be noted that the second log file in this step is also a binlog log, but it is a log after synchronization is enabled.

[0053] In this application, binlog is used to record changes in database table structure and content, and binlog files are used to restore data from high-version databases to low-version databases. At the same time, when backing up with xtrabackup, position backup points are used to speed up the time to restore data from high-version databases and improve the efficiency of version database switching.

[0054] Meanwhile, in some disclosed embodiments, step S400 includes step S410.

[0055] S410. Send a first query command to the high-version database. The first query command is used to trigger the high-version database to return first query information. The first query information includes reading status information and operation information of the high-version database. If the reading status information or the operation information is wrong, send a first display command and restart obtaining the architecture configuration of the low-version database after a first preset time period. The first display command includes a command to control the display to display abnormal operation of the high-version database.

[0056] In this step, the running status of the database is queried in the high-version database, and the running status of the high-version database is verified. For the high-version database that does not meet the expectations, in this application, the high-version data is reconfigured, and the status of the high-version database is checked again. At the same time, the operation and maintenance personnel are prompted by controlling the display of abnormal operation information, and timely manual intervention is carried out to improve the efficiency of error resolution.

[0057] Specifically, in this application, you can show slave status in the high-version database; through the first query command Slave_IO_Running and Slave_SQL_Running, if the return values ​​of these two commands are both yes, if both are yes, it means that the data synchronization between the high-version database and the low-version database is running normally.

[0058] Furthermore, in some disclosed embodiments, step S400 includes step S420.

[0059] S420, detecting the consistency between the log of the low version database and the log of the high version database. If the logs of the low version database are consistent with those of the high version database, sending a first control command to the low version database and sending a second query command to the high version database to obtain the second query information returned by the high version database. The first control command is used to trigger the high version database to establish a preset table and enter the preset information. The second query command includes a command to query the information in the preset table, and determine whether the second query information is the same as the preset information. If the second query information is not the same as the preset information, sending a second display command and restarting to build the real-time replication synchronization relationship between the low version database and the high version database after a first preset time period. The second display command includes a command to control the display to display the failure of master-slave synchronization.

[0060] In this step, by checking the synchronization delay between the high version database and the low version database, the content in the database after the database version is switched can be gradually reduced. Specifically, in this step, a new table can be created on the low version database to check whether it is synchronized in real time in the high version database to further ensure the consistency of the master-slave data. Then check whether the data in the high version database is completely consistent with the data in the low version database. If it is consistent, it indicates that there is no delay in the current master-slave replication, and the switch can be made. At the same time, if it is found that there is a replication delay between the low version database and the high version database, since the data consistency of the two version databases has been checked in the previous step and the high version database is running normally, it may be that there are certain interaction problems between the replication synchronization, so in this method, by trying to rebuild the status of the high version database again, and also by controlling the display to prompt the abnormality of the high version database, thereby prompting the operation and maintenance personnel, timely manual intervention, and improving the efficiency of error resolution.

[0061] Furthermore, in some disclosed embodiments, step S420 includes step S421 and step S422.

[0062] S421, sending a third query command to the higher version database and a fourth query command to the lower version database, the third query command is used to trigger the higher version database to return third query information, the third query information includes the corresponding value of the first preset keyword group, and the fourth query command is used to trigger the lower version database to return fourth query information, the fourth query information includes the corresponding value of the second preset keyword;

[0063] S422. Determine whether the corresponding value of the first preset keyword group is the same as the corresponding value of the second preset keyword. If the values ​​in the third query information and the fourth query information are different, send a third display command and restart obtaining the architecture configuration of the low version database after the first preset time period. The third display command includes a command to control the display to display the failure of master-slave synchronization.

[0064] In order to switch the low version database to the high version database, the data in the two databases are consistent. In the application, the third query command is recorded as the command to check the values ​​of Master_Log_File, Read_Master_Log_Pos and Exec_Master_Log_Pos. That is, the first preset keyword group is Master_Log_File, Read_Master_Log_Pos and Exec_Master_Log_Pos. The fourth query command is to query the second preset keyword master_log_position.

[0065] At the same time, if the low version database and the high version database are found to be inconsistent, the method tries to rebuild the status of the high version database again, and also controls the display to prompt the abnormality of the high version database, thereby prompting the operation and maintenance personnel, timely manual intervention, and improving the efficiency of error resolution. In this application, the high version data is reconfigured, and the status of the high version database is tried again. At the same time, the operation and maintenance personnel are prompted by controlling the display of abnormal operation information, and timely manual intervention is performed to improve the efficiency of error resolution.

[0066] Furthermore, in some disclosed embodiments, step S400 includes step S430 and step S422.

[0067] S430, backing up the network address of the server network card where the low version database is located to obtain backup IP information;

[0068] S440, close the instance of the low-version database, and close the network card service of the server where the low-version database is located;

[0069] S450, bind the backup IP information to the network card of the server where the higher version database is located;

[0070] S460. Close the replication synchronization relationship on the higher version database.

[0071] In this method, through the above steps, the alternation of low-version database to high-version database is realized, and the database upgrade with almost no impact on the business is realized. In order to realize the fast execution of the above script, it can be edited into a shell script for one-time sequential batch execution, and the impact on the business may be only in seconds, and it can be carried out without stopping the business.

[0072] Embodiment 2:

[0073] like Figure 3 As shown, this embodiment provides a device for smoothly upgrading a database, the device comprising:

[0074] Acquisition unit 1, used to acquire the architecture configuration of the low version database;

[0075] Initialization unit 2, used to initialize the high version database according to the architecture configuration;

[0076] The data synchronization unit 3 is used to establish a real-time replication synchronization relationship between the low-version database and the high-version database, and synchronize data;

[0077] The first judgment unit 4 is used to judge whether the synchronization between the low version database and the high version database is delayed, and whether the data between the low version database and the high version database are consistent. If there is no synchronization delay and the data is consistent, the replication synchronization relationship is closed and the service is switched to the high version database.

[0078] In some specific embodiments, the data synchronization unit 3 includes:

[0079] The backup data unit 31 is used to retrieve the first backup software to back up the lower version database to obtain backup data, and record the first log file and backup point file of the backup data;

[0080] The data recovery unit 32 is used to call the first backup software to restore the backup data to the higher version database;

[0081] A master-slave synchronization unit 33 is used to set the low-version database as the master database and the high-version database as the slave database, and start the master-slave synchronization;

[0082] The log application unit 34 is used to apply the second log file transmitted from the low version database to the high version database.

[0083] In some specific embodiments, the first judging unit 4 includes:

[0084] The second judgment unit 41 is used to send a first query command to the high-version database. The first query command is used to trigger the high-version database to return first query information. The first query information includes reading status information and operation information of the high-version database. If the reading status information or the operation information is wrong, a first display command is sent and the architecture configuration of the low-version database is obtained again after a first preset time period. The first display command includes a command to control the display to display abnormal operation of the high-version database.

[0085] In some specific embodiments, the first judging unit 4 further includes:

[0086] The third judgment unit 42 is used to detect the consistency between the log of the low version database and the log of the high version database. If the logs of the low version database are consistent with those of the high version database, a first control command is sent to the low version database and a second query command is sent to the high version database to obtain the second query information returned by the high version database. The first control command is used to trigger the high version database to establish a preset table and enter the preset information. The second query command includes a command to query the information in the preset table, and determine whether the second query information is the same as the preset information. If the second query information is not the same as the preset information, a second display command is sent and the real-time replication synchronization relationship between the low version database and the high version database is restarted after the first preset time period. The second display command includes a command to control the display to display the failure of master-slave synchronization.

[0087] In some specific embodiments, the third determination unit 42 includes:

[0088] A query unit 421 is used to send a third query command to the higher version database and a fourth query command to the lower version database, wherein the third query command is used to trigger the higher version database to return third query information, the third query information includes a value corresponding to the first preset keyword group, and the fourth query command is used to trigger the lower version database to return fourth query information, the fourth query information includes a value corresponding to the second preset keyword;

[0089] The fourth judgment unit 422 is used to determine whether the corresponding value of the first preset keyword group is the same as the corresponding value of the second preset keyword. If the third query information is different from the numerical value in the fourth query information, a third display command is sent and the architectural configuration of the low version database is restarted after the first preset time period. The third display command includes a command to control the display to display the failure of master-slave synchronization.

[0090] In some specific embodiments, the first judging unit 4 further includes:

[0091] The IP backup unit 43 is used to back up the network address of the server network card where the low version database is located to obtain the backup IP information;

[0092] The service closing unit 44 is used to close the instance of the low-version database and close the network card service of the server where the low-version database is located;

[0093] The IP switching unit 45 is used to bind the backup IP information to the network card of the server where the higher version database is located;

[0094] The relationship cutting unit 46 is used to close the replication synchronization relationship on the higher version database.

[0095] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.

[0096] Embodiment 3:

[0097] Corresponding to the above method embodiment, this embodiment further provides a smooth upgrade database device. The smooth upgrade database device described below and the smooth upgrade database method described above can refer to each other.

[0098] Figure 3 FIG. 8 is a block diagram of a smooth upgrade database device 800 according to an exemplary embodiment. Figure 3 As shown, the smooth upgrade database device 800 may include: a processor 801 and a memory 802. The smooth upgrade database device 800 may also include one or more of a multimedia component 803, an I / O interface 804, and a communication component 805.

[0099] The processor 801 is used to control the overall operation of the smooth upgrade database device 800 to complete all or part of the steps in the above-mentioned smooth upgrade database method. The memory 802 is used to store various types of data to support the operation of the smooth upgrade database device 800. These data may include, for example, instructions for any application or method used to operate on the smooth upgrade database device 800, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, which is used to receive external audio signals. The received audio signal may be further stored in the memory 802 or sent through the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the smooth upgrade database device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 805 may include: Wi-Fi module, Bluetooth module, NFC module.

[0100] In an exemplary embodiment, the smooth upgrade database device 800 can be implemented by one or more application specific integrated circuits (Application Specific Integrated Circuit, referred to as ASIC), digital signal processors (Digital Signal Processor, referred to as DSP), digital signal processing devices (Digital Signal Processing Device, referred to as DSPD), programmable logic devices (Programmable Logic Device, referred to as PLD), field programmable gate arrays (Field Programmable Gate Array, referred to as FPGA), controllers, microcontrollers, microprocessors or other electronic components, and is used to execute the above-mentioned smooth upgrade database method.

[0101] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned smooth database upgrade method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions can be executed by the processor 801 of the smooth database upgrade device 800 to complete the above-mentioned smooth database upgrade method.

[0102] Embodiment 4:

[0103] Corresponding to the above method embodiment, this embodiment further provides a readable storage medium. The readable storage medium described below and the method for smoothly upgrading a database described above can refer to each other.

[0104] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for smoothly upgrading a database in the above method embodiment are implemented.

[0105] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.

[0106] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

[0107] Embodiment 5:

[0108] An embodiment of the present application further provides a computer product, which includes a computer program. When the computer program is executed by a processor, the method provided in any optional embodiment of the present application is performed.

[0109] Based on the same principle as the method provided in the embodiment of the present application, the embodiment of the present application further provides a computer program product or computer program, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the smooth database upgrade method provided in any optional embodiment of the present application.

[0110] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for smoothly upgrading a database, characterized in that: include: Get the architecture configuration of the lower version database; Initialize the higher version database according to the architecture configuration; Establishing a real-time replication synchronization relationship between the low-version database and the high-version database, and synchronizing data; The step of constructing a real-time replication synchronization relationship between the low-version database and the high-version database includes: Retrieving the low version database of the first backup software to obtain backup data, and recording the backup data, wherein the backup data includes a first log file and a backup point file; Retrieving the first backup software to restore the backup data to the higher version database; Set the low version database as the master database, the high version database as the slave database, and enable master-slave synchronization; Applying the second log file transmitted from the low version database to the high version database; Determine and verify whether the synchronization between the low version database and the high version database is delayed, and determine and verify whether the data of the low version database and the high version database are consistent. If there is no synchronization delay and the database is consistent, close the replication synchronization relationship and switch the service to the high version database; The determining and verifying whether the data in the low version database is consistent with the data in the high version database includes: Sending a first query command to the high-version database, the first query command is used to trigger the high-version database to return first query information, the first query information includes reading information of the high-version database and operation information of the high-version database, if the reading information or the operation information is wrong, sending a first display command and restarting to obtain the architecture configuration of the low-version database after a first preset time period, the first display command includes a command to control the display to display the abnormal operation of the high-version database; The determining and verifying whether the synchronization between the low version database and the high version database is delayed includes: Detect the consistency of the log of the low version database and the log of the high version database. If the log of the low version database is consistent with that of the high version database, send a first control command to the low version database and send a second query command to the high version database to obtain the second query information returned by the high version database. The first control command is used to trigger the high version database to establish a preset table and enter preset information. The second query command includes a command to query the information in the preset table, and determine whether the second query information is the same as the preset information. If the second query information is not the same as the preset information, send a second display command and restart the construction of the real-time replication synchronization relationship between the low version database and the high version database after a first preset time period. The second display command includes a command to control the display to display the failure of master-slave synchronization.

2. The method for smoothly upgrading a database according to claim 1, characterized in that , the detecting the consistency of the log of the low version database and the log of the high version database includes: Sending a third query command to the high-version database and a fourth query command to the low-version database, wherein the third query command is used to trigger the high-version database to return third query information, wherein the third query information includes a value corresponding to a first preset keyword group, and the fourth query command is used to trigger the low-version database to return fourth query information, wherein the fourth query information includes a value corresponding to a second preset keyword; Determine whether the corresponding value of the first preset keyword group is the same as the corresponding value of the second preset keyword. If the values ​​in the third query information and the fourth query information are different, send a third display command and restart obtaining the architectural configuration of the low version database after a first preset time period. The third display command includes a command to control the display to display the failure of master-slave synchronization.

3. The method for smoothly upgrading a database according to claim 1, characterized in that , the closing of the replication synchronization relationship and switching the service to the higher version database includes: The network address of the network card of the server where the low version database is located is backed up to obtain the backup IP information; Shut down the instance of the low-version database, and shut down the network card service of the server where the low-version database is located; Bind the backup IP information to the network card of the server where the higher version database is located; Close the replication synchronization relationship on the higher version database.

4. A device for smoothly upgrading a database, characterized in that: include: An acquisition unit is used to obtain the architecture configuration of a low-version database; An initialization unit, used to initialize a higher version database according to the architecture configuration; A data synchronization unit, used to establish a real-time replication synchronization relationship between the low-version database and the high-version database, and synchronize data; A first judgment unit is used to judge whether the synchronization between the low version database and the high version database is delayed, and judge whether the data of the low version database and the high version database are consistent. If there is no synchronization delay and the database is consistent, the replication synchronization relationship is closed and the service is switched to the high version database; The data synchronization unit comprises: A backup data unit, used for calling the first backup software to back up the low version database to obtain backup data, and recording the first log file and the backup point file of the backup data; A data recovery unit, used for calling the first backup software to restore the backup data to the higher version database; A master-slave synchronization unit, used to set the low-version database as the master database, the high-version database as the slave database, and start master-slave synchronization; A log application unit, configured to apply the second log file transmitted from the low version database to the high version database; The first judging unit comprises: A second judgment unit is used to send a first query command to the high-version database, the first query command is used to trigger the high-version database to return first query information, the first query information includes reading information of the high-version database and operation information of the high-version database, if the reading information or the operation information is wrong, then send a first display command and restart to obtain the architecture configuration of the low-version database after a first preset time period, the first display command includes a command to control the display to display the abnormal operation of the high-version database; The first judging unit further includes: The third judgment unit is used to detect the consistency between the log of the low version database and the log of the high version database. If the log of the low version database is consistent with that of the high version database, a first control command is sent to the low version database and a second query command is sent to the high version database to obtain the second query information returned by the high version database. The first control command is used to trigger the high version database to establish a preset table and enter preset information. The second query command includes a command to query the information in the preset table to determine whether the second query information is the same as the preset information. If the second query information is not the same as the preset information, a second display command is sent and the real-time replication synchronization relationship between the low version database and the high version database is restarted after a first preset time period. The second display command includes a command to control the display to display the failure of master-slave synchronization.

5. The smooth upgrade database device according to claim 4, characterized in that: The third judgment unit includes: A query unit, configured to send a third query command to the high-version database and a fourth query command to the low-version database, wherein the third query command is configured to trigger the high-version database to return third query information, wherein the third query information includes a value corresponding to a first preset keyword group, and the fourth query command is configured to trigger the low-version database to return fourth query information, wherein the fourth query information includes a value corresponding to a second preset keyword group; The fourth judgment unit is used to judge whether the corresponding value of the first preset keyword group is the same as the corresponding value of the second preset keyword. If the third query information is different from the value in the fourth query information, a third display command is sent and the architectural configuration of the low version database is restarted after a first preset time period. The third display command includes a command to control the display to display the failure of master-slave synchronization.

6. The smooth upgrade database device according to claim 4, characterized in that: The first judging unit further includes: An IP backup unit, used to back up the network address of the network card of the server where the low version database is located to obtain backup IP information; A service closing unit, used to close the instance of the low-version database and close the network card service of the server where the low-version database is located; An IP switching unit, used to bind the backup IP information to the network card of the server where the high version database is located; The relationship cutting unit is used to close the replication synchronization relationship on the high version database.

7. A smooth upgrade database device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for smoothly upgrading a database as claimed in any one of claims 1 to 3 when executing the computer program.

8. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for smoothly upgrading a database as claimed in any one of claims 1 to 3 are implemented.

9. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program is used to load and execute the steps of the method for smoothly upgrading a database as claimed in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Data upgrading method and device based on SaaS and medium

    CN112000349A

  • Data migration method and device

    CN113138975A

  • Method and device for upgrading database

    CN113296804A

  • Database management method and device, electronic equipment and storage medium

    CN113420010A

  • Data replacation technique in database management system

    WO2018093094A1