CN107229541A - Backup method, standby system and the server of Transaction Information - Google Patents
Backup method, standby system and the server of Transaction Information Download PDFInfo
- Publication number
- CN107229541A CN107229541A CN201710477551.0A CN201710477551A CN107229541A CN 107229541 A CN107229541 A CN 107229541A CN 201710477551 A CN201710477551 A CN 201710477551A CN 107229541 A CN107229541 A CN 107229541A
- Authority
- CN
- China
- Prior art keywords
- server
- identification code
- database
- standby
- transaction information
- 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.)
- Granted
Links
Classifications
-
- 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/1474—Saving, restoring, recovering or retrying in transactions
-
- 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Databases & Information Systems (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Hardware Redundancy (AREA)
Abstract
The present invention provides a kind of backup method of Transaction Information, standby system and server, and the standby system includes the server where a primary database and the server where one or more standby databases, and the backup method includes:An identification code is transmitted while server where the primary database is with server transport Transaction Information where the standby database, and respectively according to the transmission situation of Transaction Information, indicate the state of the corresponding backup operation of the identification code, when the server where the server or the standby database where the primary database is in either step failure, the server of the failure is according to the inquiry of the identification code and its flag states to complete the synchronization of the primary database and the standby database.Backup method, standby system and the server for the Transaction Information that the present invention is provided in any server failure, can realize the synchronization of primary database and standby database.
Description
Technical field
The present invention relates to Computer Applied Technology field, more particularly to a kind of backup method of Transaction Information, standby system
And server.
Background technology
In data storage and the technology of data backup, usual unit database only can guarantee that the integrality of data, once
Delay machine, it is impossible to which offer service is provided.
In order to keep the continuity of service, partial database provides the service mode of master slave mode in high reliability, when
The service after machine of delaying of server where primary database is switched to standby database and continues to provide on the server.For example, MySQL
Database is exactly to provide reliability of service using master slave mode mode.The high reliability that master slave mode is provided passes through host data
Change data are sent to slave, same operation is completed on slave.So as to be consistent in data with main frame.
Then, existing MySQL leader follower replication, occurs the inconsistent situation of data in certain extreme cases.Such as, it is main
Delta data is submitted to local with server where database, but the delta data takes where being not sent to standby database
There is the machine of delaying when business device.Complete after failover, server where standby database lacks the data of the part, because
, there is the inconsistent situation of data in this.
The content of the invention
There is provided a kind of backup method of Transaction Information, backup in order to overcome the defect that above-mentioned prior art is present by the present invention
System and server, it in any server failure, can realize the synchronization of primary database and standby database.
It is described standby according to an aspect of the present invention there is provided a kind of backup method of the standby system for Transaction Information
Part system includes the server where a primary database and the server where one or more standby databases, the backup
Method includes following backup-step:Server where the primary database generates an identification code, institute according to a Transaction Information
The backup operation of Transaction Information described in identification code unique mark is stated, the flag states of the corresponding backup operation of the identification code are defined
It is unfinished;Server where the primary database sends the Transaction Information and the identification code at least one institute
State the server where standby database;Server where the standby database is by the identification code and the Transaction Information
Persistence, and in identification code described in the server mark where the standby database, make the corresponding backup behaviour of the identification code
The flag states of work are to have completed;Server where the standby database is returned to the server where the primary database
A multiple return information, the return information indicates that the Transaction Information completes backup;Server where the primary database
According to the return information by the identification code and the Transaction Information persistence and in the service where the primary database
Identification code described in device mark, makes the flag states of the corresponding backup operation of the identification code to have completed, wherein, when described primary
The server where server or the standby database where database is in any of the above-described backup-step failure, the event
The server of barrier is according to the inquiry of the identification code and its flag states to complete the primary database and the preliminary data
The synchronization in storehouse.
Alternatively, when the server failure where the primary database, by one or more of standby databases
A standby database be used as the primary database;It regard the primary database as a standby database.
Alternatively, when any server failure is restarted, inquiry is with the presence or absence of mark in the server restarted
State is the unfinished identification code of the backup operation of Transaction Information, if in the presence of, the server restarted to current primary data
Place server send a Query Information to inquire about mark of the identification code in the server where current primary database
Will state, the server restarted is synchronous with current primary database to complete according to the result of the Query Information.
Alternatively, if the result of the Query Information represents the identification code in the server where current primary database
Flag states indicate that the backup operation of the Transaction Information has been completed, then where the server restarted to current primary database
Server ask the Transaction Information.
Alternatively, if the result of the Query Information represents the identification code in the server where current primary database
Flag states indicate that the backup operation of the Transaction Information is not completed, then the server restarted is deleted in corresponding database
To should identification code Transaction Information and the identification code.
Alternatively, when the server failure where the primary database, serviced where each standby database
Device inquires about the identification code of the primary database, and the identification code is not complete in the flag states of the primary database
Into the flag states using the identification code in the backup database are used as primary data for completed standby database
Storehouse.
Alternatively, first mark of the flag states of the identification code as the server where positioned at the primary database
Position and represented positioned at the second flag bit of the server where the standby database, first flag bit and described second
The different value of flag bit represents whether the backup operation of the corresponding Transaction Information of identification code of association completes.
Alternatively, first queue of the flag states of the identification code as the server where positioned at the primary database
Represented with the second queue positioned at the server where the standby database, the server where the primary database
When generating the identification code, the identification code is put into the first queue, when the server where the primary database is complete
Into after the Transaction Information and the persistence of the identification code, the identification code is removed from the first queue;When described
When server where standby database receives the identification code, the identification code is put into the second queue, when described standby
After the persistence that the Transaction Information and the identification code are completed with the server where database, by the identification code from described
Removed in second queue.
Alternatively, the server where the primary database has a primary mark.
Alternatively, the identification code is:Server generation where general unique identifier or the primary database
Random number.
According to another aspect of the invention, a kind of standby system of Transaction Information is also provided, including:One primary data place
Server, including:First processor;First computer-readable recording medium, stores the first computer program, institute thereon
State and following primary DB Backup step is realized when the first computer program is performed by the first processor:The primary data
Place server according to a Transaction Information generate an identification code, the backup of Transaction Information described in the identification code unique mark
Operation, it is unfinished to define the flag states of the corresponding backup operation of the identification code;Service where the primary database
Device sends the Transaction Information and the identification code to the server where at least one standby database;The primary data
Place the return information replied according to the server where the standby database of server by the identification code and described
Transaction Information persistence and in identification code described in the server mark where the primary database, makes the identification code corresponding
The flag states of backup operation are to have completed;Server where one or more standby databases, each standby database
The server at place includes:Second processor;Second computer readable storage medium storing program for executing, stores second computer program thereon,
The second computer program realizes following standby database backup-step when being performed by the second processor:The standby number
According to place server receive the identification code and the Transaction Information, the identification code and the Transaction Information is lasting
Change, and in identification code described in the server mark where the standby database, make the corresponding backup operation of the identification code
Flag states are to have completed;Server where the standby database replys one to the server where the primary database
Return information, the return information indicates that the Transaction Information completes backup;Wherein, when the service where the primary database
Server where device or the standby database is in any of the above-described primary DB Backup step or preliminary data library backup
During step failure, the server of the failure is according to the inquiry of the identification code and its flag states to complete the primary data
Storehouse and the synchronization of the standby database.
Alternatively, the server where the primary database has a primary mark, when the primary mark is changed extremely
During another server, first computer program realizes the preliminary data library backup step when being performed by the first processor
Suddenly, the primary DB Backup step is realized when the second computer program is performed by the second processor.
Alternatively, when restarting after any server failure, inquiry is with the presence or absence of mark in the server restarted
Will state is the unfinished identification code of the backup operation of Transaction Information, if in the presence of, the server restarted to current primary number
According to place server send a Query Information to inquire about the identification code in the server where current primary database
Flag states, the server restarted is synchronous with current primary database to complete according to the result of the Query Information.
According to another aspect of the invention, a kind of server is also provided, for realizing primary database and standby database
Between data backup, including:Processor;Computer-readable recording medium, stores computer program, the computer thereon
Following steps are realized when program is by the computing device:If the server is used as the server where a primary database
When, the server generates an identification code, the backup of Transaction Information described in the identification code unique mark according to a Transaction Information
Operation, it is unfinished to define the flag states of the corresponding backup operation of the identification code;The server is by the Transaction Information
And the identification code is sent to the server where at least one standby database;The server is according to the standby database
The return information that the server at place is replied is by the identification code and the Transaction Information persistence and in the server mark
The identification code, makes the flag states of the corresponding backup operation of the identification code to have completed;If the server is standby as one
During with server where database, the server receives the identification code and the Transaction Information, by the identification code and
The Transaction Information persistence, and in identification code described in the server mark, make the corresponding backup operation of the identification code
Flag states are to have completed;The server replys a return information, the reply letter to the server where primary database
Breath indicates that the Transaction Information completes backup;Wherein, when the server is in any of the above-described step failure, the clothes of the failure
Business device is according to the identification code with the inquiry of its flag states to complete the same of the primary database and the standby database
Step.
Compared with prior art, advantage of the invention is that passing through the server where primary database and preliminary data place
Server transport Transaction Information while transmit an identification code, and respectively according to the transmission situation of Transaction Information, mark with
The state of the backup operation of the corresponding Transaction Information of the identification code, when the server where primary database or preliminary data place
Server in either step failure when, the server of the failure according to the identification code and its flag states inquiry with
The synchronization of the primary database and the standby database is completed, realizes that primary database is consistent with the data of standby database
Property.
Brief description of the drawings
Its example embodiment is described in detail by referring to accompanying drawing, above and other feature of the invention and advantage will become
It is more obvious.
Fig. 1 shows the structural representation of the standby system of Transaction Information according to embodiments of the present invention.
Fig. 2 show server where primary database in the standby system of Transaction Information according to embodiments of the present invention therefore
Structural representation after barrier.
Fig. 3 shows the schematic diagram of the standby system of Transaction Information according to embodiments of the present invention.
Fig. 4 shows the timing diagram of the backup method of Transaction Information according to embodiments of the present invention.
Server failure where Fig. 5 shows primary database according to embodiments of the present invention restart after backup method
Timing diagram.
Server failure where Fig. 6 shows primary database according to embodiments of the present invention restart after backup method
Timing diagram.
Server failure where Fig. 7 shows standby database according to embodiments of the present invention restart after backup method
Timing diagram.
Server failure where Fig. 8 shows standby database according to embodiments of the present invention restart after backup method
Timing diagram.
Embodiment
Example embodiment is described more fully with referring now to accompanying drawing.However, example embodiment can be with a variety of shapes
Formula is implemented, and is not understood as limited to embodiment set forth herein;On the contrary, thesing embodiments are provided so that the present invention will
Fully and completely, and by the design of example embodiment those skilled in the art is comprehensively conveyed to.Identical is attached in figure
Icon note represents same or similar structure, thus will omit repetition thereof.
Described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner
In.Embodiments of the present invention are fully understood so as to provide there is provided many details in the following description.However,
One of ordinary skill in the art would recognize that, without one or more in the specific detail, or using other methods, group
Member, material etc., can also put into practice technical scheme.In other cases, it is not shown in detail or describes known features, material
Material operates to avoid the fuzzy present invention.
Block diagram shown in accompanying drawing is only functional entity, not necessarily must be corresponding with physically separate entity.
I.e., it is possible to realize these functional entitys using software form, or realize that these functions are real in one or more integrated circuits
Body, or realize in heterogeneous networks and/or processor device and/or microcontroller device these functional entitys.
Ordinal numbers such as heretofore described " first ", " second " is only that name is distinguished, and is not intended to limit different set
Standby or different structure.
In order to solve the defect of prior art, the data consistency of standby database and primary database is realized, the present invention
The backup method and standby system of a kind of Transaction Information are provided.Standby system includes the server and one where a primary database
Server where individual or multiple standby databases.The backup method includes following backup-step:The primary data place
Server according to a Transaction Information generate an identification code, Transaction Information described in the identification code unique mark backup behaviour
Make, it is unfinished to define the corresponding flag states of the identification code;Server where the primary database is by the affairs
Data and the identification code send the server to where standby database at least one described;Where the standby database
Server makes described by the identification code and the Transaction Information persistence, and in the server where the standby database
The flag states of the corresponding backup operation of identification code are to have completed;Server where the standby database is to the primary number
According to place server reply a return information, the return information indicates that the Transaction Information completes backup;It is described primary
Server where database is according to the return information by the identification code and the Transaction Information persistence and in the master
With identification code described in the server mark where database, the flag states for making the corresponding backup operation of the identification code are complete
Into, wherein, when the server where the server or the standby database where the primary database is any of the above-described standby
During part step failure, the server of the failure is according to the inquiry of the identification code and its flag states to complete the primary number
According to the synchronization of storehouse and the standby database.
Illustrate multiple embodiments that the present invention is provided below in conjunction with the accompanying drawings.Shown referring first to Fig. 1, Fig. 1 according to this hair
The structural representation of the standby system of the Transaction Information of bright embodiment.Standby system includes the server where a primary database
110 and one or more standby databases where server 120.The service where a primary database is shown in Fig. 1
Server 120 where device 110 and four standby databases, but server where standby database quantity not as
Limit.Server 110 where primary database communicates with the server 120 where each standby database.In some embodiments
In, the server 110 where primary database is located in same LAN with the server 120 where each standby database, and
Wirelessly it is connected with each other.In some other embodiments, the server 110 where primary database and each preliminary data
Place server 120 be located in internet, and be wirelessly connected with each other.In other embodiments, primary number
According to place server 110 can also be connected by wired mode with the server 120 where each standby database.Ability
Field technique personnel can realize different connecting communication modes, will not be described here.
In certain embodiments, the server 120 where the server 110 and standby database where primary database is
Identical equipment, the operation needed for performing primary database when server is as server 110 where primary database, when
Server is used as the operation needed for standby database is performed during server 120 where standby database.In other embodiment
In, above-mentioned each server can also be different equipment, but can perform identical operation.
In the embodiment shown in fig. 1, when producing Transaction Information, as the server 110 where primary database by thing
Business data are sent to the server 120 where multiple standby databases, and at the server 120 where multiple standby databases
Persistence is to complete the backup of Transaction Information.Further, in the present invention, the server 110 where primary database with it is standby
The clothes where an identification code, and primary database are transmitted while with the 120 transmission transaction data of server where database
Business device 110, respectively according to the transmission situation of Transaction Information, indicates identification code correspondence with the server 120 where standby database
Transaction Information backup operation Status of Backups.
Specifically, in the standby system of Transaction Information, if the failure (example of server 120 where a standby database
Such as delay machine) when, the server 110 where primary database continues offer service.The weight of server 120 where the standby database
Qi Hou, continuation is used as the server 120 where standby database, and is continued according to the inquiry of identification code and its flag states
Backup operation before the failure of server 120 is to realize the uniformity of primary database and standby database.In other words, so
Embodiment in, the failure of server 120 where standby database restart after system architecture and the standby database where
It is identical before the failure of server 120.
With reference to Fig. 1 and Fig. 2, Fig. 2 shows primary data in the standby system of Transaction Information according to embodiments of the present invention
Structural representation of the place after server failure.If during the failure of server 110 (such as machine of delaying) where a primary database,
Continue offer service as the server 210 where primary database as the server 120 where a standby database.In addition,
In a preferred embodiment, as the current Transaction Information backup of the failure of server 110 where one completes primary database
Standby database where server 120 be used as server 210 where primary database to continue offer service.The failure
After server 110 where primary database is restarted, used as the server 220 where standby database.The master of the failure
Continued after being restarted with the server 220 where database according to the inquiry of identification code and its flag states before the failure of server 220
Backup operation to realize the uniformity of primary database and standby database.In other words, in such embodiments, primary number
According to place the failure of server 110 restart after system architecture will be as shown in Figure 2.
Further, when relate to server failure in the above description, the friendship of primary database and standby database
For using, specific over-over mode may refer to Fig. 3, and Fig. 3 shows the standby system of Transaction Information according to embodiments of the present invention
Schematic diagram.For the sake of clarity, Fig. 3 shows two servers 810 and 820.Server 810 includes processor 811 and meter
Calculation machine readable storage medium storing program for executing 812.Server 820 includes processor 821 and computer-readable recording medium 822.
When a primary mark 830 is located at server 810, server 810 is the server where primary database, service
Device 820 is the server where standby database.Accordingly, the computer program on computer-readable recording medium 812 is located
Reason device 811 can realize the primary DB Backup step of the primary database of correspondence when performing;On computer-readable recording medium 822
Computer program the standby database backup-step of correspondence standby database can be realized when being performed by processor 821.
When 810 failure of server, a primary mark 830 is set first at server 820, and when the weight of server 810
Qi Shi, deletes its primary mark.Now, server 810 is the server where standby database, and server 820 is primary number
According to place server.Accordingly, when the computer program on computer-readable recording medium 812 is performed by processor 811
The standby database backup-step of correspondence standby database can be achieved;Computer program on computer-readable recording medium 822
The primary DB Backup step of the primary database of correspondence can be realized when being performed by processor 821.
Referring to Fig. 4, Fig. 4 shows the timing diagram of the backup method of Transaction Information according to embodiments of the present invention.For
For the sake of clear, Fig. 4 only shows the server 110 where a primary database and server where a standby database
120.It is appreciated that the server 110 where the primary database can be using identical step sequential and other standby databases
The server at place carries out data backup.
Step S301 is first carried out in server 110 where primary database, and an identification code is generated according to a Transaction Information.
The backup operation of identification code unique mark Transaction Information.The identification code can be general unique identifier (UUID) or by primary
The random number that server 110 where database is generated.Identification code association corresponding with one first flag bit, the first flag bit
Whether the corresponding backup operation of flag states sign code completes.In certain embodiments, first flag bit can identification code
Associatedly it is arranged in a file.In some other embodiments, first flag bit may also be arranged on the identification code front side or
Rear side, for example, 0000000 (identification code) 0 (the first flag bit, for example, 0 represents that backup operation is not completed, 1 expression backup operation
Complete).
Then, the server 110 where primary database performs step S302, and Transaction Information and identification code are sent to standby
With the server 120 where database.
Afterwards, the server 120 where standby database performs step S303, by identification code and Transaction Information persistence,
And the second flag bit that identification code is associated is set in the server 120 where standby database.
Specifically, in certain embodiments, when the server 120 where standby database receives identification code and affairs
After data, in the internal memory of the server 120 where identification code and Transaction Information are stored in standby database, preliminary data place
Server 120 need to carry out persistence operation to identification code and Transaction Information, by the data model translation in internal memory to deposit
Model is stored up, to realize the storage of persistence.Further, in certain embodiments, the first flag bit associated with identification code is same
Identification code sends the server 120 to where standby database and as the second flag bit together, and where standby database
After the persistence identification code of server 120 and Transaction Information, the second flag bit (example that identification code is associated is set at server 120
The second flag bit is such as set to 1, to represent that backup operation has been completed).In other change case, where standby database
After the persistence identification code of server 120 and Transaction Information, the second mark for being generated at server 120 and setting the identification code to associate
Will position.Second flag bit can be associatedly stored in a file of server 120 with identification code, or by second flag bit
After persistence with identification code storage together.Those skilled in the art can realize more variation patterns, will not be described here.
Then, the server 120 where standby database performs step S304, the server to where primary database
110 reply a return information.Return information indicates that Transaction Information completes backup.
Then, server 110 where primary database performs step S305, according to return information by identification code and affairs
Data persistence simultaneously sets the first flag bit that identification code is associated in the server 110 where primary database.
It is with the server 120 where standby database that identification code and Transaction Information persistence is identical, primary data place
Server 110 persistence operation is carried out to identification code and Transaction Information, be storage mould by the data model translation in internal memory
Type.After the persistence identification code of server 110 and Transaction Information where primary database, identification code is set at server 110
The first flag bit (the first flag bit being for example set to 1, to represent that backup operation has been completed) of association.
In the above-described embodiments, if the server where server or standby database where primary database is above-mentioned
Failure in step S301 to S305 arbitrary steps, then the server of failure can according to identification code and flag bit inquiry with complete
Into the synchronization of primary database and standby database, it will be described as follows with reference to Fig. 5 to Fig. 8.
Server failure where Fig. 5 shows primary database according to embodiments of the present invention restart after backup method
Timing diagram.In such embodiments, as where a standby database after the server failure where primary database is restarted
Server 220 use, and the server where standby database during failure that server where primary database is non-
Used as the server 210 where current primary database.As described above, in a preferred embodiment, being completed by one
Server 120 where the standby database of the current Transaction Information backup of the failure of server 110 where primary database is made
Continue to provide service for the server 210 where primary database.For example, can looking into by the second flag bit of identification code
Ask, will not there is identification code to associate the second flag bit and be used as primary data for the server 120 where unfinished standby database
Place server 210 continue offer service, and other exist identification code association second flag bits be do not complete standby number
According to place server 120 interacted with the server 210 where primary database to complete the Transaction Information that these are unfinished
Backup operation.
Now, step S401 is first carried out in the server 220 restarted, and it judges exist in the server restarted 220
First flag bit is (backup operation of correspondence Transaction Information) unfinished identification code.Specifically, the server 220 restarted can
To read the file containing the first flag bit Yu identification code incidence relation, to judge the state of the first flag bit.Further, since weight
The server as primary database before the failure of server 220 opened, its first flag bit is arranged on preliminary data service
Device is set after the setting of the second flag bit, therefore, if it is not complete that the first flag bit is not present in the server restarted 220
Into identification code, then it represents that the backup operation of the Transaction Information of all identification codes mark has been completed, follow-up same without carrying out
Step operation, will not be repeated here.
After step S401, the server 220 restarted performs step S402, the server to where current primary database
210 send a Query Information.The first flag bit is inquired in step S401 comprising the server 220 restarted in the Query Information
Flag states be unfinished identification code.
Afterwards, the server 210 where current primary database performs step S403, according to the mark in the Query Information
Code inquiry is in the server 210 where current primary database, the corresponding deputy state of the identification code.In the present embodiment
In, the server 210 where current primary database inquires the mark in the server 210 where current primary database
Corresponding second flag bit of code indicates that the backup of corresponding Transaction Information has been completed.
After inquiry, the server 210 where current primary database performs step S404, to the server restarted 220 times
Multiple Query Result.
The server 220 restarted receives the Query Result in step S405.According to the Query Result, the first flag bit is in weight
The server 220 opened is unfinished identification code, and it is in the second flag bit of the server 210 where current primary database
It has been completed that, illustrate the corresponding Transaction Information of the identification code persistence in the server 210 where current primary database, and
The not persistence in the server 220 restarted.
Therefore, the server 220 restarted is in step S406 to the request transaction of server 210 where current primary database
Data (there may be the partial data persistence in the server 220 restarted, can be only to the service where current primary database
Device 210 asks the Transaction Information of remainder).Afterwards, the server 210 where current primary database is to the server restarted
220 send the Transaction Information (alternatively, while sending corresponding identification code).The server 220 restarted is received after Transaction Information
In step S408, it is set to by the corresponding identification code persistence of Transaction Information, and by the first flag bit that identification code is associated
The backup operation of Transaction Information has been completed.
In a Fig. 5 change case, Fig. 6 is may refer to, Fig. 6 shows primary database according to embodiments of the present invention
Place server failure restart after backup method timing diagram.
In Fig. 6, step S501 to step S502 is identical with step S401 and step S402.
Afterwards, the server 210 where current primary database performs step S503, the clothes where current primary database
Identification code of the business device 210 in the step S502 Query Information is inquired in the service where current primary database
Corresponding second flag bit of the identification code indicates that the backup of corresponding Transaction Information is not completed in device 210.
After inquiry, the server 210 where current primary database performs step S504, to the server restarted 220 times
Multiple Query Result.
The server 220 restarted receives the Query Result in step S505.According to the Query Result, the first flag bit is in weight
The server 220 opened is unfinished identification code, and it is in the second flag bit of the server 210 where current primary database
Do not complete, illustrate the corresponding Transaction Information of the identification code not persistence in the server 210 where current primary database,
The not persistence in the server 220 restarted.
Therefore, the server 220 restarted understands that the Transaction Information of correspondence identification code (may have partial transaction in step S506
Data persistence in the server 220 restarted, understands the partial data) and while the identification code is understood, to be returned to data
State before backup.
By the sequential shown in above-mentioned Fig. 5 and Fig. 6, the synchronization of the primary database after restarting and standby database is completed,
So that data are consistent.
Specifically, if server (server 220 restarted) where primary database in step S301 shown in Fig. 4 or
Break down, then it is appreciated that data are not transmitted, and handled affairs business failure in the server 220 restarted at S302, it is and standby
With server (server 210 where current primary database) no data where database, state is consistent.
If the server (server 220 restarted) where primary database is sent out at step S304 shown in Fig. 4 or S305
Failure is given birth to, then the server where standby database has completed Transaction Information and the persistence of identification code, and the preliminary data
Place server primary will be used as current with server where database 210.Service where primary database
Server 210 where current primary use database is connected when device (server 220 restarted) is restarted, is identified the second mark of code
The inquiry of will position, backup operation of the server 210 for the Transaction Information of the identification code where judging current primary use database
Whether complete (inquiry flag bit).
In other words, if the second flag bit of the association identification code of inquiry has completed for backup operation, Transaction Information is illustrated
Where current primary use database server 210 persistence, it is necessary to the backup of unfinished Transaction Information be completed, to the portion
Point Transaction Information is recovered.If the second flag bit of the association identification code of inquiry does not complete for backup operation, illustrate current
It is primary with server 210 where database be not present to should identification code Transaction Information, it is necessary on the server 220 restarted
The Transaction Information and corresponding identification code is removed to return to the state before Transaction Information backup.
Server failure where the foregoing describing original primary database restart after backup sequential, root separately below
Server failure where describing standby database according to Fig. 7 and Fig. 8 restart after backup sequential.Fig. 7 is shown according to the present invention
Server failure where the standby database of embodiment restart after backup method timing diagram.Fig. 8 is shown according to the present invention
Server failure where the standby database of embodiment restart after backup method timing diagram.
Such as the server 120 (server where the standby database of script) that shows to restart in Fig. 7 and current primary
Server 110 (server where the primary database of script) where database, its sequential is similar with shown in Fig. 5.
Step S601 is first carried out in the server 120 restarted, and it judges there is the second mark in the server restarted 120
Will position is (backup operation of correspondence Transaction Information) unfinished identification code.If the is not present in the server restarted 120
Two flag bits are unfinished identification code, then it represents that without carrying out follow-up simultaneously operating.
After step S601, the server 120 restarted performs step S602, the server to where current primary database
110 send a Query Information.The second flag bit is inquired in step s 601 comprising the server 120 restarted in the Query Information
For unfinished identification code.Afterwards, the server 110 where current primary database performs step S603, is believed according to the inquiry
Identification code in breath inquires corresponding first flag bit of the identification code in the server 110 where current primary database and referred to
Show that the backup of corresponding Transaction Information has been completed.After inquiry, the server 110 where current primary database performs step
S604, Query Result is replied to the server 120 restarted.
The server 120 restarted receives the Query Result in step S605.According to the Query Result, the second flag bit is in weight
The server 120 opened is unfinished identification code, and it is in the first flag bit of the server 110 where current primary database
It has been completed that, illustrate the corresponding Transaction Information of the identification code persistence in the server 110 where current primary database, and
The not persistence in the server 120 restarted.
Therefore, the server 120 restarted is associated in the backup of step S606 to S608 completion Transaction Informations and identification code
The setting operation of second flag bit.In certain embodiments, above-mentioned situation may be not present, therefore, in these embodiments without
Above-mentioned steps need to be performed.
Referring to Fig. 8, in Fig. 8, step S701 to step S702 is identical with step S601 and step S602.
Afterwards, the server 110 where current primary database performs step S703, is believed according to the step S702 inquiry
Identification code in breath inquires corresponding first mark of the identification code in the server 110 where current primary database
Position indicates that the backup of corresponding Transaction Information is not completed.After inquiry, the server 110 where current primary database performs step
S704, Query Result is replied to the server 720 restarted.
The server 120 restarted receives the Query Result in step S705.According to the Query Result, the second flag bit is in weight
The server 120 opened is unfinished identification code, and it is in the first flag bit of the server 110 where current primary database
Do not complete, illustrate the corresponding Transaction Information of the identification code not persistence in the server 110 where current primary database,
The not persistence in the server 120 restarted.
Therefore, the server 120 restarted understands that the Transaction Information of correspondence identification code (may have partial transaction in step S706
Data persistence in the server 120 restarted, understands the partial data) and while the identification code is understood, to be returned to data
State before backup.
In order to ensure that the timing diagram shown in Fig. 5 to Fig. 8 is smoothed out, the setting of identification code, Transaction Information and flag bit is suitable
Sequence is persistence identification code first preferably, then persistence Transaction Information, and it is association identification code correspondence finally to set flag bit
The backup of Transaction Information completed.
Figure 5 above merely depict the mark for the backup operation that the corresponding Transaction Information of identification code is represented with flag bit to Fig. 8
The embodiment of will state.In some change case of the present invention, line flag can also be entered in the form of queue.
For example, the flag states of identification code are as the first queue of the server where positioned at primary database and positioned at standby
The second queue of server where database is represented.When the server where primary database generates identification code, it will mark
Knowledge is piled up into first queue.After the server where primary database completes the persistence of Transaction Information and identification code, it will mark
Know code to remove from first queue.When the server where standby database receives identification code, identification code is put into the second team
Row, after the server where standby database completes the persistence of Transaction Information and identification code, by identification code from second queue
It is middle to remove.According to aforesaid way, the backup operation of the corresponding Transaction Information of identification code in first queue is in primary data
Place server do not complete, and the backup operation for the corresponding Transaction Information of identification code not occurred in first queue is in master
Completed with the server where database;The backup operation of the corresponding Transaction Information of identification code in second queue is standby
Do not completed with the server where database, and the backup for the corresponding Transaction Information of identification code not occurred in second queue is grasped
Work has been completed in the server where standby database.After consequent malfunction is restarted, it is only necessary to the identification code in query request
Determine the flag states of the backup operation of the corresponding Transaction Information of identification code.
Compared with prior art, advantage of the invention is that passing through the server where primary database and preliminary data place
Server transport Transaction Information while transmit an identification code, and respectively according to the transmission situation of Transaction Information, mark with
The state of the backup operation of the corresponding Transaction Information of the identification code, when the server where primary database or preliminary data place
Server in either step failure when, the server of the failure according to the identification code and its flag states inquiry with
The synchronization of the primary database and the standby database is completed, realizes that primary database is consistent with the data of standby database
Property.
Through the above description of the embodiments, those skilled in the art is it can be readily appreciated that the embodiment of the present disclosure can lead to
Hardware realization is crossed, can also be realized by way of software combines necessary hardware.Therefore, the technical side of the embodiment of the present disclosure
Case can be embodied in the form of software product, and the software product can be stored in a non-volatile memory medium (can be with
Be CD-ROM, USB flash disk, mobile hard disk etc.) in, including some instructions to cause a computing device (can be personal computer,
Server, mobile terminal or network equipment etc.) perform according to the method for disclosure embodiment.
It will be understood by those skilled in the art that accompanying drawing is the schematic diagram of example embodiment, module or stream in accompanying drawing
Journey is not necessarily implemented necessary to the disclosure, therefore cannot be used for limiting the protection domain of the disclosure.
It will be appreciated by those skilled in the art that above-mentioned each module can be distributed in device according to the description of embodiment, also may be used
It is disposed other than with carrying out respective change in one or more devices of the present embodiment.The module of above-described embodiment can be merged into
One module, can also be further split into multiple submodule.
The illustrative embodiments of the present invention are particularly shown and described above.It should be understood that the invention is not restricted to institute
Disclosed embodiment, on the contrary, it is intended to cover comprising various modifications within the scope of the appended claims and equivalent put
Change.
Claims (14)
1. the backup method of a kind of standby system for Transaction Information, it is characterised in that it is primary that the standby system includes one
The server where server and one or more standby databases where database, the backup method includes following backup
Step:
Server where the primary database generates an identification code, the identification code unique mark institute according to a Transaction Information
The backup operation of Transaction Information is stated, it is unfinished to define the flag states of the corresponding backup operation of the identification code;
Server where the primary database sends the Transaction Information and the identification code to standby at least one described
With the server where database;
Server where the standby database is by the identification code and the Transaction Information persistence, and in the standby number
According to place server mark described in identification code, make the flag states of the corresponding backup operation of the identification code to have completed;
Server where the standby database replys a return information to the server where the primary database, described
Return information indicates that the Transaction Information completes backup;
Server where the primary database is lasting by the identification code and the Transaction Information according to the return information
Change and in identification code described in the server mark where the primary database, make the mark of the corresponding backup operation of the identification code
Will state is to have completed,
Wherein, when the server where the server or the standby database where the primary database is any of the above-described standby
During part step failure, the server of the failure is according to the inquiry of the identification code and its flag states to complete the primary number
According to the synchronization of storehouse and the standby database.
2. backup method as claimed in claim 1, it is characterised in that
Server failure where the primary database, by a standby number in one or more of standby databases
The primary database is used as according to storehouse;It regard the primary database as a standby database.
3. backup method as claimed in claim 2, it is characterised in that heavy in this when any server failure is restarted
Inquiry is the unfinished identification code of the backup operation of Transaction Information with the presence or absence of flag states in the server opened, if in the presence of,
The server restarted sends a Query Information to the server where current primary database and worked as with inquiring about the identification code
The flag states of server where preceding primary database, the server restarted is according to the result of the Query Information to complete
It is synchronous with current primary database.
4. backup method as claimed in claim 3, it is characterised in that
If the result of the Query Information represents that the identification code refers in the flag states of the server where current primary database
Show that the backup operation of the Transaction Information has been completed, then the server restarted please to the server where current primary database
Seek the Transaction Information.
5. backup method as claimed in claim 3, it is characterised in that
If the result of the Query Information represents that the identification code refers in the flag states of the server where current primary database
Show that the backup operation of the Transaction Information is not completed, then the server restarted is deleted in corresponding database to that should identify
The Transaction Information and the identification code of code.
6. backup method as claimed in claim 2, it is characterised in that the server failure where the primary database
When, in the identification code of primary database described in server lookup where each standby database, the identification code is in institute
The flag states for stating primary database be it is unfinished, by the identification code the backup database flag states to be complete
Into standby database be used as primary database.
7. the backup method as described in any one of claim 1 to 6, it is characterised in that
The flag states of the identification code are as the first flag bit of the server where positioned at the primary database and positioned at institute
State the second flag bit of the server where standby database to represent, first flag bit and second flag bit are different
Value represent whether the backup operation of the corresponding Transaction Information of identification code of association completes.
8. the backup method as described in any one of claim 1 to 6, it is characterised in that
The flag states of the identification code are as the first queue of the server where positioned at the primary database and positioned at described
The second queue of server where standby database represents,
When the server where the primary database generates the identification code, the identification code is put into the first team
Row, will be described after the server where the primary database completes the persistence of the Transaction Information and the identification code
Identification code is removed from the first queue;
When the server where the standby database receives the identification code, the identification code is put into second team
Row, will be described after the server where the standby database completes the persistence of the Transaction Information and the identification code
Identification code is removed from the second queue.
9. the backup method as described in any one of claim 1 to 6, it is characterised in that the service where the primary database
Utensil has a primary mark.
10. the backup method as described in any one of claim 1 to 6, it is characterised in that the identification code is:General unique knowledge
The random number of server generation where other code or the primary database.
11. a kind of standby system of Transaction Information, it is characterised in that including:
Server where one primary database, including:
First processor;
First computer-readable recording medium, stores the first computer program thereon, and first computer program is described
Following primary DB Backup step is realized when first processor is performed:
Server where the primary database generates an identification code, the identification code unique mark institute according to a Transaction Information
The backup operation of Transaction Information is stated, it is unfinished to define the flag states of the corresponding backup operation of the identification code;
Server where the primary database sends the Transaction Information and the identification code at least one standby number
According to place server;
Server where the primary database will according to the return information that the server where the standby database is replied
The identification code and the Transaction Information persistence and in identification code described in the server mark where the primary database, make
The flag states of the corresponding backup operation of the identification code is have completed;
Server where one or more standby databases, the server where each standby database includes:
Second processor;
Second computer readable storage medium storing program for executing, stores second computer program thereon, and the second computer program is described
Second processor realizes following standby database backup-step when performing:
Server where the standby database receives the identification code and the Transaction Information, by the identification code and described
Transaction Information persistence, and in identification code described in the server mark where the standby database, make the identification code correspondence
Backup operation flag states to have completed;
Server where the standby database replys a return information to the server where the primary database, described
Return information indicates that the Transaction Information completes backup;
Wherein, when the server where the server or the standby database where the primary database is in any of the above-described master
During with DB Backup step or standby database backup-step failure, the server of the failure according to the identification code and
The inquiry of its flag states is to complete the synchronization of the primary database and the standby database.
12. the standby system of Transaction Information as claimed in claim 11, it is characterised in that the clothes where the primary database
Business utensil has a primary mark,
When the primary mark is changed to another server, when first computer program is performed by the first processor
The standby database backup-step is realized, the second computer program realizes the master when being performed by the second processor
Use DB Backup step.
13. the standby system of Transaction Information as claimed in claim 12, it is characterised in that after any server failure
When restarting, inquiry is the unfinished mark of the backup operation of Transaction Information with the presence or absence of flag states in the server restarted
Code, if in the presence of the server restarted sends a Query Information to inquire about to the server where current primary database
Flag states of the identification code in the server where current primary database are stated, the server restarted is according to the Query Information
Result it is synchronous with current primary database to complete.
14. a kind of server, for realizing the data backup between primary database and standby database, it is characterised in that bag
Include:
Processor;
Computer-readable recording medium, stores computer program, when the computer program is by the computing device thereon
Realize following steps:
If the server is as server where a primary database,
The server generates an identification code, the backup of Transaction Information described in the identification code unique mark according to a Transaction Information
Operation, it is unfinished to define the flag states of the corresponding backup operation of the identification code;
The server sends the Transaction Information and the identification code to the server where at least one standby database;
The return information that the server is replied according to the server where the standby database is by the identification code and described
Transaction Information persistence and in identification code described in the server mark, makes the mark shape of the corresponding backup operation of the identification code
State is to have completed;
If the server is as server where a standby database,
The server receives the identification code and the Transaction Information, by the identification code and the Transaction Information persistence,
And in identification code described in the server mark, make the flag states of the corresponding backup operation of the identification code to have completed;
The server replys a return information to the server where primary database, and the return information indicates the affairs
Data complete backup;
Wherein, when the server is in any of the above-described step failure, the server of the failure is according to the identification code and its
The inquiry of flag states is to complete the synchronization of the primary database and the standby database.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710477551.0A CN107229541B (en) | 2017-06-20 | 2017-06-20 | Backup method, standby system and the server of Transaction Information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710477551.0A CN107229541B (en) | 2017-06-20 | 2017-06-20 | Backup method, standby system and the server of Transaction Information |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107229541A true CN107229541A (en) | 2017-10-03 |
CN107229541B CN107229541B (en) | 2019-11-26 |
Family
ID=59935070
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710477551.0A Active CN107229541B (en) | 2017-06-20 | 2017-06-20 | Backup method, standby system and the server of Transaction Information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107229541B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109213631A (en) * | 2018-08-22 | 2019-01-15 | 郑州云海信息技术有限公司 | A kind of transaction methods, device, equipment and readable storage medium storing program for executing |
CN111106947A (en) * | 2018-10-29 | 2020-05-05 | 北京金山云网络技术有限公司 | Node downtime repairing method and device, electronic equipment and readable storage medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020029200A1 (en) * | 1999-09-10 | 2002-03-07 | Charles Dulin | System and method for providing certificate validation and other services |
CN1851658A (en) * | 2005-08-02 | 2006-10-25 | 上海华为技术有限公司 | Data management system and method |
CN101038591A (en) * | 2007-04-11 | 2007-09-19 | 华为技术有限公司 | Method and system for synchronizing data base |
WO2007134008A3 (en) * | 2006-05-08 | 2008-10-09 | Firestar Software Inc | System and method for exchanging transaction information using images |
CN101706795A (en) * | 2009-11-30 | 2010-05-12 | 上海世范软件技术有限公司 | Method for synchronizing data of database in active/standby server |
CN102662793A (en) * | 2012-03-07 | 2012-09-12 | 江苏引跑网络科技有限公司 | Hot backup and recovery method of distributed database with guarantee of data consistency |
CN103077242A (en) * | 2013-01-11 | 2013-05-01 | 北京佳讯飞鸿电气股份有限公司 | Method for hot standby of dual database servers |
US8554727B2 (en) * | 2006-05-19 | 2013-10-08 | Inmage Systems, Inc. | Method and system of tiered quiescing |
CN103902617A (en) * | 2012-12-28 | 2014-07-02 | 华为技术有限公司 | Distributed database synchronization method and system |
-
2017
- 2017-06-20 CN CN201710477551.0A patent/CN107229541B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020029200A1 (en) * | 1999-09-10 | 2002-03-07 | Charles Dulin | System and method for providing certificate validation and other services |
CN1851658A (en) * | 2005-08-02 | 2006-10-25 | 上海华为技术有限公司 | Data management system and method |
WO2007134008A3 (en) * | 2006-05-08 | 2008-10-09 | Firestar Software Inc | System and method for exchanging transaction information using images |
US8554727B2 (en) * | 2006-05-19 | 2013-10-08 | Inmage Systems, Inc. | Method and system of tiered quiescing |
CN101038591A (en) * | 2007-04-11 | 2007-09-19 | 华为技术有限公司 | Method and system for synchronizing data base |
CN101706795A (en) * | 2009-11-30 | 2010-05-12 | 上海世范软件技术有限公司 | Method for synchronizing data of database in active/standby server |
CN102662793A (en) * | 2012-03-07 | 2012-09-12 | 江苏引跑网络科技有限公司 | Hot backup and recovery method of distributed database with guarantee of data consistency |
CN103902617A (en) * | 2012-12-28 | 2014-07-02 | 华为技术有限公司 | Distributed database synchronization method and system |
CN103077242A (en) * | 2013-01-11 | 2013-05-01 | 北京佳讯飞鸿电气股份有限公司 | Method for hot standby of dual database servers |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109213631A (en) * | 2018-08-22 | 2019-01-15 | 郑州云海信息技术有限公司 | A kind of transaction methods, device, equipment and readable storage medium storing program for executing |
CN111106947A (en) * | 2018-10-29 | 2020-05-05 | 北京金山云网络技术有限公司 | Node downtime repairing method and device, electronic equipment and readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN107229541B (en) | 2019-11-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103019960B (en) | Distributed caching method and system | |
CN109949111A (en) | Electronic bill mark distributing method, electronic bill generation method, apparatus and system | |
CN106843749B (en) | Write request processing method, device and equipment | |
CN106059791B (en) | Link switching method of service in storage system and storage device | |
CN109308227B (en) | Fault detection control method and related equipment | |
CN110807064B (en) | Data recovery device in RAC distributed database cluster system | |
US11250395B2 (en) | Blockchain-based transaction processing methods and apparatuses and electronic devices | |
CN108762668B (en) | Method and device for processing write conflict | |
CN105446827A (en) | Data storage method and device for database at failure | |
US11630821B2 (en) | Blockchain-based data processing method and apparatus, device, and medium | |
CN106776146A (en) | A kind of data verification method, apparatus and system | |
CN106648959A (en) | Data storage method and storage system | |
CN113656501B (en) | Data reading method, device, equipment and storage medium | |
CN104765661A (en) | Multiple-node hot standby method of metadata service nodes in cloud storage service | |
CN107211003A (en) | Distributed memory system and the method for managing metadata | |
CN106802892A (en) | For the method and apparatus of master/slave data consistency verification | |
CN109495540A (en) | A kind of method, apparatus of data processing, terminal device and storage medium | |
EP3026574A1 (en) | Affair processing method and device | |
CN108319617A (en) | Determine the method, apparatus and method for handover control, device of database principal and subordinate's difference | |
CN107229541A (en) | Backup method, standby system and the server of Transaction Information | |
CN109462507A (en) | Configure update method, device, system and electronic equipment | |
CN106201772A (en) | The backup of a kind of operating system based on data center, restoration methods and device | |
CN115757616A (en) | Data consistency checking method, device and medium based on binary log | |
TWI712879B (en) | Disaster tolerance data processing method, device, equipment and system | |
CN108418859A (en) | The method and apparatus for writing data |
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 |