CN113590257B - Container-based database disaster tolerance method, system, device and medium - Google Patents
Container-based database disaster tolerance method, system, device and medium Download PDFInfo
- Publication number
- CN113590257B CN113590257B CN202110682096.4A CN202110682096A CN113590257B CN 113590257 B CN113590257 B CN 113590257B CN 202110682096 A CN202110682096 A CN 202110682096A CN 113590257 B CN113590257 B CN 113590257B
- Authority
- CN
- China
- Prior art keywords
- time
- periods
- reading
- container
- writing
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 41
- 230000004044 response Effects 0.000 claims abstract description 21
- 238000011084 recovery Methods 0.000 claims description 25
- 238000004590 computer program Methods 0.000 claims description 7
- 238000010586 diagram Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 6
- 238000012544 monitoring process Methods 0.000 description 6
- 230000007935 neutral effect Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 3
- 230000008447 perception Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000001960 triggered effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
- G06F11/1464—Management of the backup or restore process for networked environments
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45591—Monitoring or debugging support
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a container-based database disaster tolerance method, a system, equipment and a storage medium, wherein the method comprises the following steps: creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times of the container per second at preset time intervals; dividing the total recording time into a plurality of preset periods, further dividing the periods into a plurality of time periods with the first time duration, and judging whether the reading and writing times per second in each time period exceed the reading and writing threshold value; in response to the fact that the number of times of reading and writing per second in a time period exceeds the reading and writing threshold value, recording the time period as an effective drop point; and determining whether the backup condition is met or not based on the number of times of reading and writing per second of the current time and the number of the time periods to which the current time belongs in all preset periods and recorded as the number of effective drop points, and backing up the container in response to the backup condition being met. The invention changes the deployment mode of the current webpage application and the database into the deployment mode of the container, has lower cost and more intelligence compared with the prior mode, and recovers the user data to the maximum extent.
Description
Technical Field
The present invention relates to the field of databases, and more particularly, to a container-based database disaster recovery method, system, computer device, and readable medium.
Background
Databases are basically inevitable basic components for application level development. In web (web) applications, the importance of databases as a centralized repository is even more self-evident. The database is not completely reliable, except for the defects of the database, external influences are larger, such as power failure, the database files are damaged and cannot be repaired at a high probability in the scenes, once the database files are damaged or lost, the database files are very troublesome to recover, not only are the consumption of manpower and material resources but also the influence on user services, and once a virtual machine is influenced, the user services are interrupted, and the influence and the loss are immeasurable. And if not fully recovered, the business system will become unusable, possibly facing the brute force of the user data, and the risk will increase significantly.
A common processing method is to establish a database cluster, and reduce the problem that a database cannot be recovered due to a single point of failure by dispersing data, but the complexity of the technology always brings maintenance complexity, and adds other uncontrollable points, thereby affecting the overall stability.
Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method, a system, a computer device, and a computer-readable storage medium for container-based database disaster recovery, in which the present web application and the deployment mode of a database are changed into a container deployment mode, and a container technology is used to implement backup of the database, which belongs to out-of-band backup, and an internal system is completely unaware; the monitoring is integrated, the database pressure is analyzed more intelligently, backup is carried out in a neutral period, and the service is ensured not to be interrupted to the maximum extent; the scheme which is lighter and more intelligent for medium and small scenes is provided, and the complexity and the dimension difficulty of the clustering scheme are reduced.
Based on the above object, an aspect of the embodiments of the present invention provides a container-based database disaster recovery method, including the following steps: creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times of the container per second at preset time intervals; dividing the total recording time into a plurality of preset periods, further dividing the periods into a plurality of time periods with the first time duration, and judging whether the reading and writing times per second in each time period exceed the reading and writing threshold value; in response to the fact that the number of times of reading and writing per second in a time period exceeds the reading and writing threshold value, recording the time period as an effective drop point; and determining whether the backup condition is met or not based on the number of times of reading and writing per second of the current time and the number of the time periods to which the current time belongs in all preset periods and recorded as the number of effective drop points, and backing up the container in response to the backup condition being met.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: judging whether the read-write times per second in a second time nearest to the current moment exceed the read-write threshold value, wherein the second time is one fourth of the first time; and responding to the time that the reading and writing times per second do not exceed the reading and writing threshold value in the second time nearest to the current time, and determining that the current time does not meet the backup condition.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: responding to the fact that the reading and writing times per second in the second time nearest to the current time exceed the reading and writing threshold, and judging whether the number of time periods to which the current time belongs in all preset periods is recorded as the number of effective falling points exceeds the effective falling point threshold or not; and determining that the current time meets the backup condition in response to the fact that the number of the time periods, to which the current time belongs, recorded as effective drop points in all the preset periods exceeds the effective drop point threshold.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: adjusting the size of the effective drop point threshold based on the size of the current backup space.
In some embodiments, said resizing the effective drop point threshold based on the size of the current backup space comprises: judging whether the current backup space is smaller than a space threshold value; and if the current backup space is smaller than the space threshold, increasing the effective drop point threshold.
In some embodiments, the backing up the container comprises: and naming the backed-up file based on the current time.
In some embodiments, the method further comprises: judging whether the time difference between the current time and the latest backup time exceeds a third time or not; and responding to the fact that the time difference between the current time and the last backup time exceeds a third time, and backing up the data in the third time.
In another aspect of the embodiments of the present invention, a system for disaster recovery of a database based on a container is provided, including: the acquisition module is configured for creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times of the container per second at preset time intervals; the judging module is configured to divide the total recording time into a plurality of preset periods and further divide the periods into a plurality of time periods with the first time duration, and judge whether the read-write times per second in each time period exceed a read-write threshold value; the marking module is configured to respond that the reading and writing times per second in a time period exceed the reading and writing threshold value, and mark the time period as an effective drop point; and the backup module is configured to determine whether the backup condition is met or not based on the number of times of reading and writing per second of the current time and the number of the time periods in all the preset periods, to which the current time belongs, recorded as the effective drop points, and to backup the container in response to the backup condition being met.
In another aspect of the embodiments of the present invention, there is also provided a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method as above.
In another aspect of the embodiments of the present invention, a computer-readable storage medium is further provided, in which a computer program for implementing the above method steps is stored when the computer program is executed by a processor.
The invention has the following beneficial technical effects: the deployment mode of the current webpage application and the database is changed into the deployment mode of a container, the backup of the database is realized through the container technology, the database belongs to out-of-band backup, and an internal system is completely unaware; the monitoring is integrated, the database pressure is analyzed more intelligently, backup is carried out in a neutral period, and the service is ensured not to be interrupted to the maximum extent; the scheme which is lighter and more intelligent for medium and small scenes is provided, and the complexity and the dimension difficulty of the clustering scheme are reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
FIG. 1 is a schematic diagram of an embodiment of a container-based database disaster recovery method according to the present invention;
FIG. 2 is a schematic hardware diagram of an embodiment of a container-based database disaster recovery computer device according to the present invention;
FIG. 3 is a schematic diagram of an embodiment of a computer storage medium for container-based database disaster recovery according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
In a first aspect of an embodiment of the present invention, an embodiment of a method for container-based database disaster recovery is provided. Fig. 1 is a schematic diagram illustrating an embodiment of a container-based database disaster recovery method according to the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
s1, creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times per second of the container at preset time intervals;
s2, dividing the total recording time into a plurality of preset periods and further dividing the periods into a plurality of time periods with the first time, and judging whether the reading and writing times per second in each time period exceed the reading and writing threshold value;
s3, in response to the fact that the number of times of reading and writing per second in a time period exceeds the reading and writing threshold value, recording the time period as an effective drop point; and
and S4, determining whether the backup condition is met or not based on the number of times of reading and writing per second of the current time and the number of the time periods of the current time in all preset periods, which are recorded as the effective drop points, and backing up the container in response to the backup condition being met.
The embodiment of the invention solves the disaster tolerance and the rapid recovery of the database by a cloud native mode, has lower cost and more intelligence than the prior mode, and recovers the user data to the maximum extent; in addition, the recovery can be completed without having very professional ability on the database, and the requirement on professional ability is reduced.
Creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times of the container per second at preset time intervals. And constructing a container environment, deploying the database and the WEB application in a container, and operating the database and the WEB application in a container mode.
The container IOPS (read/write times per second) is monitored at preset time intervals, the preset time may be, for example, 10 seconds, the read/write times are respectively recorded in read/write RRD (a time sequence database, the size of which is guaranteed to be unchanged) files, the RRD may be selectively configured to store for 1 week or 1 month, or even longer, and the more history data is stored, the larger local space is occupied. Assuming that the total recording time is D, the monitoring data may be acquired by a disk-io command.
The total recording time is divided into a plurality of preset periods and further divided into a plurality of time periods with the first time, and whether the read-write times per second in each time period exceed the read-write threshold value or not is judged. And recording the time period as an effective drop point in response to the fact that the number of times of reading and writing per second in the time period exceeds the reading and writing threshold value.
And determining the time for performing backup operation according to the set read-write threshold value by analyzing the historical data. The total recording time may be divided into a plurality of preset periods and further divided into a plurality of time periods with a first time, where the preset periods may be, for example, a week and a day, the first time may be, for example, 10 minutes, data in each 10-minute time period may be detected, if each IOPS in a time period is greater than a read-write threshold, the time period is classified as valid data or a time period in which backup may be performed, and the time period may be recorded as a valid drop point.
And determining whether the backup condition is met or not based on the number of times of reading and writing per second of the current time and the number of the time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, and performing backup on the container in response to the condition that the backup condition is met.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: judging whether the read-write times per second in a second time nearest to the current moment exceed the read-write threshold value, wherein the second time is one fourth of the first time; and responding to the time that the reading and writing times per second do not exceed the reading and writing threshold value in the second time nearest to the current time, and determining that the current time does not meet the backup condition. Continuing with the above example, the first time is 10 minutes, then the second time is 2.5 minutes, assuming that the current time is 13: 10: 00, judge 13: 07: 30-13: 10: and whether the read-write times per second between 00 exceed the read-write threshold value or not is judged, and if the read-write times per second do not exceed the read-write threshold value, the current time is determined not to meet the backup condition.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: responding to the fact that the reading and writing times per second in the second time nearest to the current time exceed the reading and writing threshold, and judging whether the number of time periods to which the current time belongs in all preset periods is recorded as the number of effective falling points exceeds the effective falling point threshold or not; and determining that the current time meets the backup condition in response to the fact that the number of the time periods, to which the current time belongs, recorded as effective drop points in all the preset periods exceeds the effective drop point threshold. Continuing with the above example, assume that the current time is Friday 13: 10: 00, total recording time includes 4 weeks, i.e. 4 preset periods, 13: 07: 30-13: 10: and the number of reading and writing times per second between 00 exceeds the reading and writing threshold value, determining 13 of 4 fridays: 00: 00-13: 10: and if the number of the effective falling points in the time period of 00 is 3 and the threshold value of the effective falling points is 2, determining that the current time meets the backup condition.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: adjusting the size of the effective drop point threshold based on the size of the current backup space. If the backup space is smaller, the triggering condition of the backup needs to be improved, and if the backup space is larger, the triggering condition of the backup can be properly relaxed.
In some embodiments, said resizing the effective drop point threshold based on the size of the current backup space comprises: judging whether the current backup space is smaller than a space threshold value; and if the current backup space is smaller than the space threshold, increasing the effective drop point threshold. Effective drop point threshold θknMay be based on a threshold value thetakAnd calculating according to the following calculation formula: thetakn=θkN/7. Wherein N represents the current total data recorded days, 0<θk<1, closer to 1 indicates a more severe trigger condition. The smaller the size of the current backup space is, the threshold value theta iskThe closer to 1.
In some embodiments, the backing up the container comprises: and naming the backed-up file based on the current time. And after the triggering condition of the backup is met, a backup command is triggered, the container backup is executed, and the new backup name is named by time, so that the subsequent searching and recovery are facilitated.
In some embodiments, the method further comprises: judging whether the time difference between the current time and the latest backup time exceeds a third time or not; and responding to the fact that the time difference between the current time and the last backup time exceeds a third time, and backing up the data in the third time. The third time may be, for example, one day, and if there is no backup for more than one day, a compensation mechanism is triggered to forcibly perform backup, and data from the last backup time to the current time is backed up, so that the database is guaranteed to meet certain validity, and excessive data is prevented from being lost when a problem occurs.
The embodiment of the invention changes the deployment mode of the current webpage application and the database into the deployment mode of the container, realizes the backup of the database through the container technology, belongs to out-of-band backup, and has no perception of an internal system; the monitoring is integrated, the database pressure is analyzed more intelligently, backup is carried out in a neutral period, and the service is ensured not to be interrupted to the maximum extent; the scheme which is lighter and more intelligent for medium and small scenes is provided, and the complexity and the dimension difficulty of the clustering scheme are reduced.
It should be particularly noted that, the steps in the embodiments of the container-based database disaster recovery method described above can be mutually intersected, replaced, added, and deleted, so that these methods of container-based database disaster recovery with reasonable permutation and combination transformation also belong to the scope of the present invention, and the scope of the present invention should not be limited to the embodiments.
In view of the above object, a second aspect of the embodiments of the present invention provides a system for container-based database disaster recovery, including: the acquisition module is configured for creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times of the container per second at preset time intervals; the judging module is configured to divide the total recording time into a plurality of preset periods and further divide the periods into a plurality of time periods with the first time duration, and judge whether the read-write times per second in each time period exceed a read-write threshold value; the marking module is configured to respond that the reading and writing times per second in a time period exceed the reading and writing threshold value, and mark the time period as an effective drop point; and the backup module is configured to determine whether the backup condition is met or not based on the number of times of reading and writing per second of the current time and the number of the time periods in all the preset periods, to which the current time belongs, recorded as the effective drop points, and to backup the container in response to the backup condition being met.
In some embodiments, the backup module is configured to: judging whether the read-write times per second in a second time nearest to the current moment exceed the read-write threshold value, wherein the second time is one fourth of the first time; and responding to the time that the reading and writing times per second do not exceed the reading and writing threshold value in the second time nearest to the current time, and determining that the current time does not meet the backup condition.
In some embodiments, the backup module is configured to: responding to the fact that the reading and writing times per second in the second time nearest to the current time exceed the reading and writing threshold, and judging whether the number of time periods to which the current time belongs in all preset periods is recorded as the number of effective falling points exceeds the effective falling point threshold or not; and determining that the current time meets the backup condition in response to the fact that the number of the time periods, to which the current time belongs, recorded as effective drop points in all the preset periods exceeds the effective drop point threshold.
In some embodiments, the backup module is configured to: adjusting the size of the effective drop point threshold based on the size of the current backup space.
In some embodiments, the backup module is configured to: judging whether the current backup space is smaller than a space threshold value; and if the current backup space is smaller than the space threshold, increasing the effective drop point threshold.
In some embodiments, the backup module is configured to: and naming the backed-up file based on the current time.
In some embodiments, the system further comprises a forcing module configured to: judging whether the time difference between the current time and the latest backup time exceeds a third time or not; and responding to the time difference between the current time and the latest backup time exceeding a third time, and backing up the data in the third time.
The embodiment of the invention changes the deployment mode of the current webpage application and the database into the deployment mode of the container, realizes the backup of the database through the container technology, belongs to out-of-band backup, and has no perception of an internal system; the monitoring is integrated, the database pressure is analyzed more intelligently, backup is carried out in a neutral period, and the service is ensured not to be interrupted to the maximum extent; the scheme which is lighter and more intelligent for medium and small scenes is provided, and the complexity and the dimension difficulty of the clustering scheme are reduced.
In view of the above object, a third aspect of the embodiments of the present invention provides a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executable by the processor to perform the steps of: s1, creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times per second of the container at preset time intervals; s2, dividing the total recording time into a plurality of preset periods and further dividing the periods into a plurality of time periods with the first time, and judging whether the reading and writing times per second in each time period exceed the reading and writing threshold value; s3, in response to the fact that the number of times of reading and writing per second in a time period exceeds the reading and writing threshold value, recording the time period as an effective drop point; and S4, determining whether the backup condition is met or not based on the number of times of reading and writing per second of the current time and the number of the time periods of the current time in all preset periods, which are recorded as the effective drop points, and backing up the container in response to the backup condition being met.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: judging whether the read-write times per second in a second time nearest to the current moment exceed the read-write threshold value, wherein the second time is one fourth of the first time; and responding to the time that the reading and writing times per second do not exceed the reading and writing threshold value in the second time nearest to the current time, and determining that the current time does not meet the backup condition.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: responding to the fact that the reading and writing times per second in the second time nearest to the current time exceed the reading and writing threshold, and judging whether the number of time periods to which the current time belongs in all preset periods is recorded as the number of effective falling points exceeds the effective falling point threshold or not; and determining that the current time meets the backup condition in response to the fact that the number of the time periods, to which the current time belongs, recorded as effective drop points in all the preset periods exceeds the effective drop point threshold.
In some embodiments, the determining whether the backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, includes: adjusting the size of the effective drop point threshold based on the size of the current backup space.
In some embodiments, said resizing the effective drop point threshold based on the size of the current backup space comprises: judging whether the current backup space is smaller than a space threshold value; and if the current backup space is smaller than the space threshold, increasing the effective drop point threshold.
In some embodiments, the backing up the container comprises: and naming the backed-up file based on the current time.
In some embodiments, the steps further comprise: judging whether the time difference between the current time and the latest backup time exceeds a third time or not; and responding to the fact that the time difference between the current time and the last backup time exceeds a third time, and backing up the data in the third time.
The embodiment of the invention changes the deployment mode of the current webpage application and the database into the deployment mode of the container, realizes the backup of the database through the container technology, belongs to out-of-band backup, and has no perception of an internal system; the monitoring is integrated, the database pressure is analyzed more intelligently, backup is carried out in a neutral period, and the service is ensured not to be interrupted to the maximum extent; the scheme which is lighter and more intelligent for medium and small scenes is provided, and the complexity and the dimension difficulty of the clustering scheme are reduced.
Fig. 2 is a schematic hardware structure diagram of an embodiment of the computer device for container-based database disaster recovery according to the present invention.
Taking the apparatus shown in fig. 2 as an example, the apparatus includes a processor 201 and a memory 202, and may further include: an input device 203 and an output device 204.
The processor 201, the memory 202, the input device 203 and the output device 204 may be connected by a bus or other means, and fig. 2 illustrates the connection by a bus as an example.
The memory 202, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the container-based database disaster recovery method in the embodiments of the present application. The processor 201 executes various functional applications of the server and data processing by running the nonvolatile software programs, instructions and modules stored in the memory 202, that is, the method for implementing the container-based database disaster recovery of the above-described method embodiments.
The memory 202 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the container-based database disaster tolerance method, and the like. Further, the memory 202 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 202 may optionally include memory located remotely from processor 201, which may be connected to local modules via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 203 may receive information such as a user name and a password that are input. The output device 204 may include a display device such as a display screen.
Program instructions/modules corresponding to the one or more container-based database disaster recovery methods are stored in the memory 202, and when executed by the processor 201, perform the container-based database disaster recovery method in any of the above-described method embodiments.
Any embodiment of a computer device that performs the method for container-based database disaster recovery described above may achieve the same or similar effects as any of the preceding method embodiments that correspond thereto.
The invention also provides a computer readable storage medium storing a computer program which, when executed by a processor, performs the method as above.
Fig. 3 is a schematic diagram of an embodiment of a computer storage medium for container-based database disaster recovery according to the present invention. Taking the computer storage medium as shown in fig. 3 as an example, the computer readable storage medium 3 stores a computer program 31 which, when executed by a processor, performs the method as described above.
Finally, it should be noted that, as one of ordinary skill in the art can appreciate that all or part of the processes of the methods of the above embodiments can be implemented by a computer program to instruct related hardware, and the program of the container-based database disaster recovery method can be stored in a computer-readable storage medium, and when executed, the program can include the processes of the embodiments of the methods described above. The storage medium of the program may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a Random Access Memory (RAM), or the like. The embodiments of the computer program may achieve the same or similar effects as any of the above-described method embodiments.
The foregoing are exemplary embodiments of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.
Claims (8)
1. A container-based database disaster recovery method is characterized by comprising the following steps:
creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times of the container per second at preset time intervals;
dividing the total recording time into a plurality of preset periods, further dividing the periods into a plurality of time periods with the first time duration, and judging whether the reading and writing times per second in each time period exceed the reading and writing threshold value;
in response to the fact that the number of times of reading and writing per second in a certain time period exceeds the reading and writing threshold value, recording the time period as an effective drop point; and
determining whether a backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods in all preset periods in which the current time belongs, which are recorded as effective drop points, and backing up the container in response to the backup condition being satisfied,
determining whether the backup condition is met or not based on the number of times of reading and writing per second at the current time and the number of time periods to which the current time belongs in all preset periods, which are recorded as the number of effective drop points, comprises:
judging whether the read-write times per second in a second time nearest to the current moment exceed the read-write threshold value, wherein the second time is one fourth of the first time;
responding to the time that the reading and writing times per second do not exceed the reading and writing threshold value in the second time nearest to the current time, and determining that the current time does not meet the backup condition;
responding to the fact that the reading and writing times per second in the second time nearest to the current time exceed the reading and writing threshold, and judging whether the number of time periods to which the current time belongs in all preset periods is recorded as the number of effective falling points exceeds the effective falling point threshold or not; and
and determining that the current time meets the backup condition in response to the fact that the number of the time periods, to which the current time belongs, recorded as effective drop points in all the preset periods exceeds the effective drop point threshold.
2. The method according to claim 1, wherein the determining whether the backup condition is satisfied based on the number of times of reading and writing per second at the current time and the number of time periods, recorded as valid drop points, to which the current time belongs in all preset periods comprises:
adjusting the size of the effective drop point threshold based on the size of the current backup space.
3. The method of claim 2, wherein the resizing the effective drop point threshold based on the size of the current backup space comprises:
judging whether the current backup space is smaller than a space threshold value; and
and if the current backup space is smaller than the space threshold, increasing the effective drop point threshold.
4. The method of claim 1, wherein the backing up the container comprises:
and naming the backed-up file based on the current time.
5. The method of claim 1, further comprising:
judging whether the time difference between the current time and the latest backup time exceeds a third time or not; and
and responding to the time difference between the current time and the latest backup time exceeding a third time, and backing up the data in the third time.
6. A container-based database disaster recovery system, comprising:
the acquisition module is configured for creating a container environment, deploying a webpage application and a database into the container, and acquiring the read-write times of the container per second at preset time intervals;
the judging module is configured to divide the total recording time into a plurality of preset periods and further divide the periods into a plurality of time periods with the first time duration, and judge whether the read-write times per second in each time period exceed a read-write threshold value;
the marking module is configured to respond that the read-write times per second in a certain time period exceed the read-write threshold value, and mark the time period as an effective drop point; and
a backup module configured to determine whether a backup condition is satisfied based on the number of times of reading and writing per second of the current time and the number of time periods in all preset periods in which the current time belongs, which are recorded as effective drop points, and to backup the container in response to the satisfaction of the backup condition,
wherein the backup module is configured to:
judging whether the read-write times per second in a second time nearest to the current moment exceed the read-write threshold value, wherein the second time is one fourth of the first time;
responding to the time that the reading and writing times per second do not exceed the reading and writing threshold value in the second time nearest to the current time, and determining that the current time does not meet the backup condition;
responding to the fact that the reading and writing times per second in the second time nearest to the current time exceed the reading and writing threshold, and judging whether the number of time periods to which the current time belongs in all preset periods is recorded as the number of effective falling points exceeds the effective falling point threshold or not; and
and determining that the current time meets the backup condition in response to the fact that the number of the time periods, to which the current time belongs, recorded as effective drop points in all the preset periods exceeds the effective drop point threshold.
7. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method of any one of claims 1 to 5.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110682096.4A CN113590257B (en) | 2021-06-19 | 2021-06-19 | Container-based database disaster tolerance method, system, device and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110682096.4A CN113590257B (en) | 2021-06-19 | 2021-06-19 | Container-based database disaster tolerance method, system, device and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113590257A CN113590257A (en) | 2021-11-02 |
CN113590257B true CN113590257B (en) | 2022-05-03 |
Family
ID=78244204
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110682096.4A Active CN113590257B (en) | 2021-06-19 | 2021-06-19 | Container-based database disaster tolerance method, system, device and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113590257B (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2011090401A (en) * | 2009-10-20 | 2011-05-06 | Daikin Industries Ltd | Data storage device and data storage system equipped with the same |
CN105681420A (en) * | 2016-01-18 | 2016-06-15 | 浪潮集团有限公司 | Method for realizing backup of switch operating system based on Docker |
CN110647423B (en) * | 2019-08-15 | 2022-06-14 | 苏州浪潮智能科技有限公司 | Method, device and readable medium for creating storage volume mirror image based on application |
CN111538625B (en) * | 2020-04-29 | 2023-03-28 | 西安交通大学 | Ambari cluster deployment and data backup method based on Docker technology and electronic equipment |
-
2021
- 2021-06-19 CN CN202110682096.4A patent/CN113590257B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN113590257A (en) | 2021-11-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106713487B (en) | Data synchronization method and device | |
CN104199666B (en) | A kind of application program Dynamic Configuration and device | |
CN107832196B (en) | Monitoring device and monitoring method for abnormal content of real-time log | |
US9262260B2 (en) | Information processing apparatus, information processing method, and recording medium | |
CN113111129B (en) | Data synchronization method, device, equipment and storage medium | |
CN103761165B (en) | Log backup method and device | |
CN104679772A (en) | Method, device, equipment and system for deleting files in distributed data warehouse | |
CN109325010B (en) | Log checking method, device, computer equipment and storage medium | |
DE102021109767A1 (en) | SYSTEMS AND METHODS FOR PREDICTIVE SECURITY | |
CN105607973B (en) | Method, device and system for processing equipment fault in virtual machine system | |
CN108647118A (en) | Copy abnormal restoring method, device and computer equipment based on storage cluster | |
CN105354102A (en) | File system maintenance and repairing method and apparatus | |
CN113590257B (en) | Container-based database disaster tolerance method, system, device and medium | |
CN104572339A (en) | Data backup restoring system and method based on distributed file system | |
CN112181638A (en) | Container resource recovery method, system, equipment and medium | |
CN114138187A (en) | Method and device for managing timed snapshot volume of volume mapping copy service plug-in | |
CN114911677A (en) | Monitoring method and device for containers in cluster and computer readable storage medium | |
CN115080309A (en) | Data backup system, method, storage medium, and electronic device | |
CN111324513B (en) | Monitoring management method and system for artificial intelligence development platform | |
CN113886352A (en) | Metadata recovery method, device, equipment and medium for distributed file system | |
CN113157414A (en) | Task processing method and device, nonvolatile storage medium and processor | |
CN113590380A (en) | Database recovery method and system | |
CN113535482A (en) | Cloud backup chain data backup and management method and device, equipment and readable medium | |
CN115237669A (en) | Data backup method, data recovery method, data backup device, data recovery device and electronic equipment | |
CN115391129A (en) | Data monitoring method, device, equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |