CN114185578A - Method, device and equipment for smoothly upgrading database and readable storage medium - Google Patents

Method, device and equipment for smoothly upgrading database and readable storage medium Download PDF

Info

Publication number
CN114185578A
CN114185578A CN202111554124.0A CN202111554124A CN114185578A CN 114185578 A CN114185578 A CN 114185578A CN 202111554124 A CN202111554124 A CN 202111554124A CN 114185578 A CN114185578 A CN 114185578A
Authority
CN
China
Prior art keywords
version database
database
version
low
command
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111554124.0A
Other languages
Chinese (zh)
Inventor
李斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202111554124.0A priority Critical patent/CN114185578A/en
Publication of CN114185578A publication Critical patent/CN114185578A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a device, equipment and a readable storage medium for smoothly upgrading a database, which relate to the technical field of computers and comprise the steps of obtaining the architecture configuration of a low-version database; initializing a high-version database according to architecture configuration; constructing a real-time copying and synchronizing relationship between the low-version database and the high-version database, and synchronizing data; whether the synchronization of the low-version database and the high-version database is delayed or not is judged, whether the data of the low-version database and the high-version database are consistent or not is judged, if the synchronization is not delayed and the data are consistent, the synchronous relation is closed and the service is switched to the high-version database, the consistency of the two version databases is checked when the two version databases are switched, the two version databases are combined with the delay, and the external service supply of the databases is not influenced on the premise that the databases are rapidly and smoothly upgraded.

Description

Method, device and equipment for smoothly upgrading database and readable storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device and equipment for smoothly upgrading a database and a readable storage medium.
Background
The steps of the traditional mysql database upgrading scheme are as follows:
1) suspending the running mysql database service;
2) installing new version database software;
3) a database backup is performed for recovery.
4) And starting the database, executing a mysql _ upgrade command, and updating the object in the database to the latest version.
The traditional upgrading can not realize hot upgrading.
Disclosure of Invention
The invention aims to provide a method, a device and equipment for smoothly upgrading a database and a readable storage medium, so as to improve the problems. In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
in a first aspect, the present application provides a method for smoothly upgrading a database, including: obtaining the architecture configuration of a low version database; initializing a high-version database according to the architecture configuration; constructing a real-time copy synchronization relationship between the low-version database and the high-version database, and synchronizing data; judging whether synchronization of the low version database and the high version database is delayed or not, judging whether data of the low version database and the high version database are consistent or not, if synchronization is not delayed and the databases are consistent, closing a copy synchronization relation and switching service to the high version database.
Further, the constructing a real-time replication synchronization relationship between the low version database and the high version database includes: calling the low-version database of the first backup software to obtain backup data, and recording the backup data, wherein the backup data comprises 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 a master database, setting the high version database as a slave database, and starting master-slave synchronization; and applying the second log file transmitted from the low-version database to the high-version database.
Further, the judging and checking whether the data of the low version database and the data of the high version database have consistency includes: and sending a first query command to the high-version database, wherein the first query command is used for triggering the high-version database to return first query information, the first query information comprises reading condition information of the high-version database and running information of the high-version database, if the reading condition information or the running information is wrong, sending a first display command and restarting to acquire the architecture configuration of the low-version database after a first preset time period, and the first display command comprises a command for controlling a display to display abnormal running of the high-version database.
Further, the determining whether synchronization between the low version database and the high version database is delayed includes: detecting the consistency of the logs of the low-version database and the logs of the high-version database, if the logs of the low-version database and the logs of the high-version database are consistent, sending a first control command to the low-version database and a second query command to the high-version database, acquiring second query information returned by the high-version database, wherein the first control command is used for triggering the high-version database to establish a preset table and key in preset information, the second query command comprises a command for querying information in the preset table, judging 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 establish a 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 comprises a command for controlling the display to display a master-slave synchronization failure.
Further, the detecting consistency of the logs of the low-version database and the logs 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 for triggering the high-version database to return third query information, the third query information comprises a first preset keyword group corresponding value, the fourth query command is used for triggering the low-version database to return fourth query information, and the fourth query information comprises a second preset keyword group corresponding value; and judging whether the corresponding value of the first preset keyword group is the same as that of the second preset keyword group, if so, sending a third display command and restarting to acquire the architecture configuration of the low-version database after a first preset time period, wherein the third display command comprises a command for controlling a display to display master-slave synchronization failure.
Further, the closing the replication synchronization relationship and switching service to the high version database includes: backing up the network address of the network card of the server where the low version database is located to obtain backup IP information; closing the instance of the low version database, and closing the network card service of the server where the low version database is located; binding the backup IP information to a network card of a server where the high-version database is located; closing a replication synchronization relationship on the high version database.
In a second aspect, the present application further provides a smooth upgrade database apparatus, including: the acquisition unit is used for acquiring the architecture configuration of the low-version database; the initialization unit is used for initializing a high-version database according to the architecture configuration; the data synchronization unit is used for constructing a real-time copying synchronization relation between the low-version database and the high-version database and synchronizing data; the first judging unit is used for judging whether synchronization of the low version database and the high version database is verified or not, judging whether data of the low version database and the high version database are verified to be consistent or not, and if synchronization is not delayed and data are consistent, closing a copy synchronization relation and switching service to the high version database.
Further, the data synchronization unit includes: the backup data unit is used for calling first backup software to backup the low-version database to obtain backup data and recording a first log file and a backup point file of the backup data; the data recovery unit is used for calling the first backup software to recover the backup data to the high-version database; the master-slave synchronization unit is used for setting the low-version database as a master database, setting the high-version database as a slave database and starting master-slave synchronization; and the log application unit is used for applying the second log file transmitted from the low-version database to the high-version database.
Further, the first judgment unit includes: the second judging unit is configured to send a first query command to the high-version database, where the first query command is used to trigger the high-version database to return first query information, where the first query information includes reading condition information of the high-version database and operation information of the high-version database, and if the reading condition information or the operation information is an error, send a first display command and resume obtaining of the architecture configuration of the low-version database after a first preset time period, where the first display command includes a command for controlling a display to display that the high-version database is abnormally operated.
Further, the first judgment unit further includes: a third determining unit, configured to detect consistency between logs of the low-version database and logs 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 if the logs of the low-version database and the logs of the high-version database are consistent, obtain second query information returned by the high-version database, where 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 for querying information in the preset table, determine whether the second query information is the same as the preset information, and if the second query information is not the same as the preset information, send a second display command and restart to establish a 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 comprises a command for controlling the display to display a master-slave synchronization failure.
Further, the third judgment unit includes: the query unit is used for sending a third query command to the high-version database and sending a fourth query command to the low-version database, wherein the third query command is used for triggering the high-version database to return third query information, the third query information comprises a first preset key word group corresponding value, the fourth query command is used for triggering the low-version database to return fourth query information, and the fourth query information comprises a second preset key word group corresponding value; and the fourth judging unit is used for judging whether the corresponding value of the first preset keyword group is the same as that of the second preset keyword group, if the numerical values in the third query information are different from those in the fourth query information, sending a third display command, and restarting to acquire the architecture configuration of the low-version database after a first preset time period, wherein the third display command comprises a command for controlling a display to display master-slave synchronization failure.
Further, the first judgment unit further includes: the IP backup unit is used for backing up the network address of the network card of the server where the low-version database is located to obtain backup IP information; the service closing unit is used for closing the instance of the low-version database and closing the network card service of the server where the low-version database is located; the IP switching unit is used for binding the backup IP information to the network card of the server where the high-version database is located; and the relation cutting-off unit is used for closing the copy synchronization relation on the high-version database.
It should be noted that, regarding the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated herein.
In a third aspect, the present application further provides a smooth upgrade database device, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of the smooth upgrading database method when the computer program is executed.
In a fourth aspect, the present application further provides a readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the smooth-upgrade-based database method described above.
In a fifth aspect, the present application further provides a computer program product or a computer program, the computer program product comprising a computer program for loading and executing the steps of the smooth upgrade database method as described.
The invention has the beneficial effects that:
according to the method and the device, when the databases of the two versions are switched, the synchronous delay condition between the database of the high version and the database of the low version is checked, so that the two databases cannot be lost due to the photo data in a short switching time, and the possibility of smoothly upgrading the databases is ensured. Meanwhile, when the two version databases are switched, the consistency of the two version databases is checked, and the consistency is combined with the delay, so that the externally provided service of the databases can not be influenced on the premise of rapidly and smoothly upgrading the databases.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a schematic flow chart illustrating a method for smoothly upgrading a database according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a smooth upgrade database apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a smooth upgrade database device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, 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 with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Example 1:
the embodiment provides a method for smoothly upgrading a database.
Referring to fig. 1, it is shown that the method includes step S100, step S200, step S300 and step S400.
S100, obtaining the architecture configuration of the low-version database.
It should be noted that the architecture configuration involved in this step specifically includes a master-slave or high-availability environment of the low-version database, an environment variable, and operating system parameter information of a server where the low-version database is located.
S200, initializing a high-version database according to architecture configuration.
It can be understood that, in this step, the same operation is to be performed on the server where the high-version database and the high-version database are located according to the master-slave or high-availability environment in the low-version database, the environment variable, and the operating system parameter information of the server where the low-version database is located. The high-version database and the low-version database are kept to have the same architecture configuration, that is, if the source database is a master and two slaves, the new-version database will also be a master and two slaves. Meanwhile, the initialization step further includes initializing a mysql parameter file, wherein the specific initialization step is common knowledge of those skilled in the art, and is not described in detail in this application.
S300, establishing a real-time copying and synchronizing relationship between the low-version database and the high-version database, and synchronizing data.
S400, judging whether synchronization of the low version database and the high version database is delayed or not, judging whether data of the low version database and the high version database are consistent or not, if synchronization is not delayed and the databases are consistent, closing a copy synchronization relation and switching service to the high version database.
In the method, when the databases of the two versions are switched, the synchronous delay condition between the database of the high version and the database of the low version is checked, so that the two databases cannot be lost due to the photo data in short switching time, and the possibility of smoothly upgrading the databases is ensured. Meanwhile, when the two version databases are switched, the consistency of the two version databases is checked, and the delay is combined, so that the externally provided service of the databases is not influenced on the premise of rapidly and smoothly upgrading the databases.
In some disclosed embodiments, step S200 includes step S210, step S220, step S230, and step S240.
S210, calling first backup software to backup a low-version database to obtain backup data, and recording a first log file and a backup point file of the backup data;
in the present application, the first backup software is xtrabackup, the first log file is a binlog file, and the backup point file is a position backup point.
S220, calling first backup software to restore the backup data to a high-version database;
s230, setting the low version database as a master database and the high version database as a slave database, and starting master-slave synchronization;
and S240, applying the binlog log transmitted from the low-version database to the high-version database.
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 turned on.
According to the method and the device, the change of the database table structure and the change of the content are recorded by using the binlog, and the data recovery of the high-version data to the low-version database is realized through the binlog file. Meanwhile, when the xtrabackup backup is carried out, the time for restoring the data of the high-version database is accelerated through the position backup point, and the switching efficiency of the version database is improved.
Meanwhile, in some disclosed embodiments, step S400 includes step S410.
S410, sending a first query command to the high-version database, wherein the first query command is used for triggering the high-version database to return first query information, the first query information comprises reading condition information of the high-version database and running information of the high-version database, if the reading condition information or the running information is wrong, sending a first display command, and restarting to acquire architecture configuration of the low-version database after a first preset time period, and the first display command comprises a command for controlling a display to display abnormal running of the high-version database.
In this step, inquire the running state of database in the high version database to verify the running state of high version database, to the high version database that is not conform to expectation, through reconfiguration high version data in this application, and try again to inspect the state of high version database, simultaneously, also show the information suggestion fortune dimension personnel that operate unusually through control, timely manual intervention promotes wrong solution efficiency.
In particular, the present application may be in a show slow status in a high-version database; if the return values of the two commands are yes, the high version database and the low version database are data synchronization and normally run if the return values of the two commands are yes.
Also, in some disclosed embodiments, step S400 includes step S420.
S420, detecting the consistency of the logs of the low-version database and the logs of the high-version database, if the logs of the low-version database and the logs of the high-version database are consistent, sending a first control command to the low version database and a second query command to the high version database, acquiring second query information returned by the high version database, wherein the first control command is used for triggering the high version database to establish a preset table and typing in the preset information, the second query command comprises a command for querying information in the preset table, judging 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, and sending a second display command and restarting to construct a real-time copy synchronization relationship between the low-version database and the high-version database after a first preset time period, wherein the second display command comprises a command for controlling a display to display master-slave synchronization failure.
In this step, through the synchronization delay condition between the high-version database and the low-version database, the content in the database after the database versions are switched can be gradually faulted, and specifically, in this step, whether synchronization is performed or not is checked in real time on the high-version database by creating a new table on the low-version database, so that the master-slave data consistency is further ensured. And then checking whether the data of the high-version database is completely consistent with the data in the low-version database, and if the data of the high-version database is consistent with the data in the low-version database, indicating that the current master-slave copy has no time delay, switching. If the copying delay exists between the low-version database and the high-version database, the consistency of the data of the two version databases and the normal operation of the high-version database are checked in the previous step, and a certain interaction problem possibly exists between the copying synchronization, so that the state of the high-version database is rebuilt by trying again in the method, and meanwhile, the abnormity of the high-version database is prompted by controlling the display, so that operation and maintenance personnel are prompted, manual intervention is timely performed, and the error solving efficiency is improved.
Also, in some disclosed embodiments, step S420 includes step S421 and step S422.
S421, 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 for triggering the high-version database to return third query information, the third query information comprises a first preset keyword group corresponding value, the fourth query command is used for triggering the low-version database to return fourth query information, and the fourth query information comprises a second preset keyword group corresponding value;
and S422, judging whether the corresponding value of the first preset keyword group is the same as that of the second preset keyword group, if the numerical values in the third query information and the fourth query information are different, sending a third display command, and restarting to acquire the architecture configuration of the low-version database after the first preset time period, wherein the third display command comprises a command for controlling the display to display master-slave synchronization failure.
In order to switch the low version database to the high version database, the data in both databases is made consistent. In the application, the third query command is recorded as a value command to view Master _ Log _ File, Read _ Master _ Log _ Pos, and Exec _ Master _ Log _ Pos. Namely, the first preset key phrases are Master _ Log _ File, Read _ Master _ Log _ Pos and Exec _ Master _ Log _ Pos. The fourth query command is to query a second preset keyword master _ log _ position.
Meanwhile, if the low-version database and the high-version database are found to be only inconsistent, the state of the high-version database is rebuilt by trying again in the method, and meanwhile, the abnormity of the high-version database is prompted by controlling the display, so that operation and maintenance personnel are prompted, manual intervention is timely performed, and the error solving efficiency is improved. Through reconfiguring the high version data in the application, the state of the high version database is tried to be checked again, meanwhile, the operation and maintenance personnel are prompted through controlling and displaying abnormal operation information, manual intervention is timely performed, and the error solving efficiency is improved.
Also, in some disclosed embodiments, step S400 includes step S430, step S422.
S430, backing up the network address of the network card of the server where the low version database is located to obtain backup IP information;
s440, closing the instance of the low version database, and closing the network card service of the server where the low version database is located;
s450, binding the backup IP information to a network card of a server where the high version database is located;
and S460, closing the copy synchronization relation on the high-version database.
In order to realize the quick execution of the script, the method can be edited into the shell script to execute in batch in one time in sequence, the influence on the service can only be in the second level, and the method can be completely carried out under the condition that the service is not stopped.
Example 2:
as shown in fig. 3, the present embodiment provides a smooth upgrade database apparatus, including:
the acquisition unit 1 is used for acquiring the architecture configuration of the low-version database;
the initialization unit 2 is used for initializing the high-version database according to the architecture configuration;
the data synchronization unit 3 is used for constructing a real-time copy synchronization relationship between the low-version database and the high-version database and synchronizing data;
and the first judging unit 4 is configured to judge whether synchronization between the verification low-version database and the verification high-version database is delayed, judge whether data of the verification low-version database and the verification high-version database has consistency, and close the copy synchronization relationship and switch service to the high-version database if synchronization is not delayed and data has consistency.
In some specific embodiments, the data synchronization unit 3 includes:
the backup data unit 31 is used for calling the first backup software to backup the low-version database to obtain backup data, and recording a first log file and a backup point file of the backup data;
a data recovery unit 32, configured to invoke first backup software to recover backup data to a high-version database;
a master-slave synchronization unit 33, configured to set the low-version database as a master library and the high-version database as a slave library, and start master-slave synchronization;
and a log application unit 34 for applying the second log file transmitted from the low version database to the high version database.
In some specific embodiments, the first judging unit 4 includes:
the second determining unit 41 is configured to send a first query command to the high-version database, where the first query command is used to trigger the high-version database to return first query information, where the first query information includes reading condition information of the high-version database and running information of the high-version database, and if the reading condition information or the running information is an error, send a first display command and restart to acquire the architecture configuration of the low-version database after a first preset time period, where the first display command includes a command for controlling the display to display that the high-version database runs abnormally.
In some specific embodiments, the first determining unit 4 further includes:
a third judging unit 42, configured to detect consistency between the logs of the low version database and the logs of the high version database, and if the logs of the low version database and the logs of the high version database are consistent, sending a first control command to the low version database and a second query command to the high version database, acquiring second query information returned by the high version database, wherein the first control command is used for triggering the high version database to establish a preset table and typing in the preset information, the second query command comprises a command for querying information in the preset table, judging 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, and sending a second display command and restarting to construct a real-time copy synchronization relationship between the low-version database and the high-version database after a first preset time period, wherein the second display command comprises a command for controlling a display to display master-slave synchronization failure.
In some specific embodiments, the third determining unit 42 includes:
the query unit 421 is configured to send a third query command to the high-version database and a fourth query command to the low-version database, where the third query command is used to trigger the high-version database to return third query information, the third query information includes a value corresponding to a first preset keyword group, the fourth query command is used to trigger the low-version database to return fourth query information, and the fourth query information includes a value corresponding to a second preset keyword group;
a fourth determining unit 422, configured to determine whether the corresponding value of the first preset keyword group is the same as the corresponding value of the second preset keyword group, and if the numerical values in the third query information and the fourth query information are different, send a third display command, and resume obtaining the architecture configuration of the low-version database after the first preset time period, where the third display command includes a command for controlling the display to display a master-slave synchronization failure.
In some specific embodiments, the first determining unit 4 further includes:
the IP backup unit 43 is configured to backup a network address of a network card of a server where the low-version database is located to obtain backup IP information;
the service closing unit 44 is configured to close an instance of the low-version database and close a network card service of a server where the low-version database is located;
the IP switching unit 45 is used for binding the backup IP information to the network card of the server where the high version database is located;
a relation cutting unit 46 for closing the copy synchronization relation on the high version database.
It should be noted that, regarding the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated herein.
Example 3:
corresponding to the above method embodiment, the present embodiment further provides a smooth upgrade database device, and a smooth upgrade database device described below and a smooth upgrade database method described above may be referred to correspondingly.
FIG. 3 is a block diagram illustrating a smooth-upgrade database device 800 according to an exemplary embodiment. As shown in fig. 3, the smooth upgrade database device 800 may include: a processor 801, 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 communications component 805.
The processor 801 is configured to control the overall operation of the smooth upgrade database device 800, so as to complete all or part of the steps in the smooth upgrade database method. The memory 802 is used to store various types of data to support operation at the smooth upgrade database device 800, which may include, for example, instructions for any application or method operating on the smooth upgrade database device 800, as well as application related data, such as contact data, transceived messages, pictures, audio, video, and so forth. The Memory 802 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The multimedia components 803 may include screen and audio components. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 802 or transmitted through the communication component 805. The audio assembly 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, such as a keyboard, mouse, 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 that the corresponding communication component 805 may include: Wi-Fi module, bluetooth module, NFC module.
In an exemplary embodiment, the smooth-upgrade database apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described smooth-upgrade database method.
In another exemplary embodiment, a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the smooth upgrade database method described above is also provided. For example, the computer readable storage medium may be the memory 802 described above that includes program instructions executable by the processor 801 of the smooth upgrade database device 800 to perform the smooth upgrade database method described above.
Example 4:
corresponding to the above method embodiment, a readable storage medium is also provided in this embodiment, and a readable storage medium described below and a smooth upgrade database method described above may be referred to correspondingly.
A readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the smooth upgrade database method of the above-described method embodiments.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Example 5:
embodiments of the present application also provide a computer product comprising a computer program that, when executed by a processor, performs the method provided in any of the alternative embodiments of the present application.
Based on the same principle as the method provided by the embodiment of the present application, the embodiment of the present application also provides a computer program product or a 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 to cause the computer device to execute the smooth upgrade database method provided in any one of the optional embodiments of the present application.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (15)

1. 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;
constructing a real-time copy synchronization relationship between the low-version database and the high-version database, and synchronizing data;
judging whether synchronization of the low version database and the high version database is delayed or not, judging whether data of the low version database and the high version database are consistent or not, if synchronization is not delayed and the databases are consistent, closing a copy synchronization relation and switching service to the high version database.
2. The smooth upgrade database method according to claim 1, wherein said building a real-time replication synchronization relationship between the low version database and the high version database comprises:
calling the low-version database of the first backup software to obtain backup data, and recording the backup data, wherein the backup data comprises 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 a master database, setting the high version database as a slave database, and starting master-slave synchronization;
and applying the second log file transmitted from the low-version database to the high-version database.
3. The smooth upgrade database method according to claim 1, wherein the determining whether the data of the low version database and the data of the high version database have consistency comprises:
and sending a first query command to the high-version database, wherein the first query command is used for triggering the high-version database to return first query information, the first query information comprises reading condition information of the high-version database and running information of the high-version database, if the reading condition information or the running information is wrong, sending a first display command and restarting to acquire the architecture configuration of the low-version database after a first preset time period, and the first display command comprises a command for controlling a display to display abnormal running of the high-version database.
4. The smooth upgrade database method according to claim 1, wherein the determining whether the synchronization of the low version database and the high version database is delayed comprises:
detecting the consistency of the logs of the low-version database and the logs of the high-version database, if the logs of the low-version database and the logs of the high-version database are consistent, sending a first control command to the low-version database and a second query command to the high-version database, acquiring second query information returned by the high-version database, wherein the first control command is used for triggering the high-version database to establish a preset table and key in preset information, the second query command comprises a command for querying information in the preset table, judging 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 establish a 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 comprises a command for controlling the display to display a master-slave synchronization failure.
5. The smooth upgrade database method according to claim 4, wherein the detecting consistency of the logs of the low version database and the logs of the high version database comprises:
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 for triggering the high-version database to return third query information, the third query information comprises a first preset keyword group corresponding value, the fourth query command is used for triggering the low-version database to return fourth query information, and the fourth query information comprises a second preset keyword group corresponding value;
and judging whether the corresponding value of the first preset keyword group is the same as that of the second preset keyword group, if so, sending a third display command and restarting to acquire the architecture configuration of the low-version database after a first preset time period, wherein the third display command comprises a command for controlling a display to display master-slave synchronization failure.
6. The smooth upgrade database method of claim 1, wherein said closing a replication synchronization relationship and switching service to the high version database comprises:
backing up the network address of the network card of the server where the low version database is located to obtain backup IP information;
closing the instance of the low version database, and closing the network card service of the server where the low version database is located;
binding the backup IP information to a network card of a server where the high-version database is located;
closing a replication synchronization relationship on the high version database.
7. A smooth-upgrade database apparatus, comprising:
the acquisition unit is used for acquiring the architecture configuration of the low-version database;
the initialization unit is used for initializing a high-version database according to the architecture configuration;
the data synchronization unit is used for constructing a real-time copying synchronization relation between the low-version database and the high-version database and synchronizing data;
the first judging unit is used for judging whether synchronization of the low version database and the high version database is verified or not, judging whether data of the low version database and the high version database are verified to be consistent or not, and if synchronization is not delayed and the databases are consistent, closing a copy synchronization relation and switching service to the high version database.
8. The smooth upgrade database device according to claim 7, wherein the data synchronization unit comprises:
the backup data unit is used for calling first backup software to backup the low-version database to obtain backup data and recording a first log file and a backup point file of the backup data;
the data recovery unit is used for calling the first backup software to recover the backup data to the high-version database;
the master-slave synchronization unit is used for setting the low-version database as a master database, setting the high-version database as a slave database and starting master-slave synchronization;
and the log application unit is used for applying the second log file transmitted from the low-version database to the high-version database.
9. The smooth upgrade database device according to claim 7, wherein the first determination unit includes:
the second judging unit is configured to send a first query command to the high-version database, where the first query command is used to trigger the high-version database to return first query information, where the first query information includes reading condition information of the high-version database and operation information of the high-version database, and if the reading condition information or the operation information is an error, send a first display command and resume obtaining of the architecture configuration of the low-version database after a first preset time period, where the first display command includes a command for controlling a display to display that the high-version database is abnormally operated.
10. The smooth upgrade database device according to claim 7, wherein the first determination unit further comprises:
a third determining unit, configured to detect consistency between logs of the low-version database and logs 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 if the logs of the low-version database and the logs of the high-version database are consistent, obtain second query information returned by the high-version database, where 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 for querying information in the preset table, determine whether the second query information is the same as the preset information, and if the second query information is not the same as the preset information, send a second display command and restart to establish a 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 comprises a command for controlling the display to display a master-slave synchronization failure.
11. The smooth upgrade database device according to claim 10, wherein the third determination unit comprises:
the query unit is used for sending a third query command to the high-version database and sending a fourth query command to the low-version database, wherein the third query command is used for triggering the high-version database to return third query information, the third query information comprises a first preset key word group corresponding value, the fourth query command is used for triggering the low-version database to return fourth query information, and the fourth query information comprises a second preset key word group corresponding value;
and the fourth judging unit is used for judging whether the corresponding value of the first preset keyword group is the same as that of the second preset keyword group, if the numerical values in the third query information are different from those in the fourth query information, sending a third display command, and restarting to acquire the architecture configuration of the low-version database after a first preset time period, wherein the third display command comprises a command for controlling a display to display master-slave synchronization failure.
12. The smooth upgrade database device according to claim 7, wherein the first determination unit further comprises:
the IP backup unit is used for backing up the network address of the network card of the server where the low-version database is located to obtain backup IP information;
the service closing unit is used for closing the instance of the low-version database and closing the network card service of the server where the low-version database is located;
the IP switching unit is used for binding the backup IP information to the network card of the server where the high-version database is located;
a relation cutting unit, configured to close a copy synchronization relation on the high-version database;
it should be noted that, regarding the apparatus in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated herein.
13. A smooth-upgrade database device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the smooth upgrade database method according to any one of claims 1 to 6 when executing the computer program.
14. A readable storage medium, characterized by: the readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the smooth upgrade database method according to any one of claims 1 to 6.
15. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, is adapted to load and carry out the steps of the smooth upgrade database method according to any one of claims 1 to 6.
CN202111554124.0A 2021-12-17 2021-12-17 Method, device and equipment for smoothly upgrading database and readable storage medium Pending CN114185578A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111554124.0A CN114185578A (en) 2021-12-17 2021-12-17 Method, device and equipment for smoothly upgrading database and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111554124.0A CN114185578A (en) 2021-12-17 2021-12-17 Method, device and equipment for smoothly upgrading database and readable storage medium

Publications (1)

Publication Number Publication Date
CN114185578A true CN114185578A (en) 2022-03-15

Family

ID=80544384

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111554124.0A Pending CN114185578A (en) 2021-12-17 2021-12-17 Method, device and equipment for smoothly upgrading database and readable storage medium

Country Status (1)

Country Link
CN (1) CN114185578A (en)

Similar Documents

Publication Publication Date Title
CN107171833B (en) Method for realizing batch upgrading of BMC and BIOS of server through BMC
CN106951345B (en) Consistency test method and device for disk data of virtual machine
CN105468717B (en) Database operation method and device
US10048978B2 (en) Apparatus and method for identifying a virtual machine having changeable settings
CN111694612A (en) Configuration checking method, device, computer system and storage medium
CN102567047A (en) Fast computer startup
CN110633101A (en) Program code management method, device and equipment and readable storage medium
CN102193841B (en) Backup method and device of Subversion configuration database
CN110209525B (en) Operating system restoration method and device
CN112925555A (en) Model management method, device, equipment and storage medium
TWI764454B (en) Firmware corruption recovery
CN103995717A (en) Method for upgrading software in embedded device
CN116149713B (en) Program upgrading method and device for all-level equipment under tree-type heterogeneous network
CN109634782B (en) Method and device for detecting system robustness, storage medium and terminal
CN114185578A (en) Method, device and equipment for smoothly upgrading database and readable storage medium
CN111782236A (en) System software upgrading method and device, storage medium and all-in-one machine equipment
CN114153480A (en) Code synchronization method, component publishing method, device thereof and computer storage medium
JP7492839B2 (en) Configuration management device, configuration management method, and configuration management program
CN113918162A (en) Front-end code automatic checking method based on centralized management mode
CN114610516A (en) Application program repairing method and device, computer equipment and storage medium
CN114490570A (en) Production data synchronization method and device, data synchronization system and server
CN114153503A (en) BIOS control method, device and medium
KR101420026B1 (en) A method, apparatus and computer program for loading files during a boot-up process
US8918630B1 (en) System, apparatus, and method for initiating a reboot of a personal computer system by pressing a button on an attached storage device and causing the operating system on the attached storage device to be booted
US20210132934A1 (en) Cluster deployment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination