Invention content
An embodiment of the present invention provides a kind of method of dual-host backup and server, it is easily lost for solving state table
Problem.
First aspect present invention provides a kind of method of dual-host backup, including:
Primary server determines the current rate of backup link;
The primary server inquires pre-set backup relation table, determines and the current rate pair of the backup link
The priority set answered includes the correspondence between speed range and priority set in the backup relation table;
From all state tables of the primary server, obtain state table to be backed up, the state table to be backed up it is excellent
First grade belongs to the priority set;
The state table to be backed up is sent to the standby server of the primary server.
In first aspect in the first possible realization method, the primary server determines the rate of current backup link
Including:
If current point in time is pre-set BACKUP TIME point or current point in time and last BACKUP TIME point
Difference is equal to pre-set time value, then the primary server determines the current rate of backup link.
With reference to first aspect or first aspect the first possible realization method, in second of possible reality of first aspect
In existing mode, the method further includes:
It is arranged on the state table to be backed up and has backed up flag;
If the primary server deletes first state table, and the first state table includes to have backed up flag, then to
The standby server, which is sent, deletes notice, and the deletion notice is for notifying the standby server to delete the first state
Table.
With reference to first aspect or first aspect the first possible realization method, the third possible reality in first aspect
In existing mode, the method further includes:
If the second state table has been established in the primary server, it is determined that whether the priority of second state table belongs to
The priority set;
If the priority of second state table belongs to the priority set, second state table is sent to institute
State standby server.
With reference to first aspect or first aspect the first possible realization method, in the 4th kind of possible realization method
In, the method further includes:
If the primary server is sent datagram using third state table, it is nearest to update the third state table
The time of first use;
If the priority of the third state table is not highest priority, calculating described third state table the last time makes
Time difference between the time that time and the third state table are established;
If the time difference is greater than or equal to pre-set numerical value, increase the third according to pre-set rule
The priority of state table.
Second aspect of the present invention provides a kind of server, including:
Determination unit, the rate current for determining backup link;
Query unit, after determining the current rate of the backup link in the determination unit, inquiry is set in advance
The backup relation table set, determines corresponding with the rate that the backup link is current priority set, in the backup relation table
Including the correspondence between speed range and priority set;
Acquiring unit, after determining the priority set in the query unit, from all of primary server
In state table, state table to be backed up is obtained, the priority of the state table to be backed up belongs to the priority set;
Transmission unit, after obtaining the state table to be backed up in the acquiring unit, by the state to be backed up
Table is sent to the standby server of the primary server.
In second aspect in the first possible realization method, the determination unit is specifically used for:
If current point in time is pre-set BACKUP TIME point or current point in time and last BACKUP TIME point
Difference is equal to pre-set time value, then the primary server determines the current rate of backup link.
In conjunction with second aspect or second aspect the first possible realization method, in second of possible reality of second aspect
In existing mode, the server further includes:
Setting unit, after obtaining the state table to be backed up in the acquiring unit, in the state to be backed up
It is arranged on table and has backed up flag;
If then the transmission unit is additionally operable to the primary server and deletes first state table, and the first state table packet
It containing flag has been backed up, is then sent to the standby server and deletes notice, the deletion notice is for notifying the spare clothes
Business device deletes the first state table.
In conjunction with second aspect or second aspect the first possible realization method, the third possible reality in second aspect
In existing mode, the server further includes:
Priority determining unit, if the second state table has been established for the primary server, it is determined that second shape
Whether the priority of state table belongs to the priority set;
If then the transmission unit is additionally operable to the priority of second state table and belongs to the priority set, by institute
It states the second state table and is sent to the standby server.
In conjunction with second aspect or second aspect the first possible realization method, in the 4th kind of possible reality of second aspect
In existing mode, the server further includes:
Updating unit, if having been sent datagram using third state table for the primary server, described in update
The time that third state table the last time uses;
Computing unit, after the time that described third state table the last time uses is updated for the updating unit, if
The priority of the third state table is not highest priority, then calculate time that described third state table the last time uses with
Time difference between the time that the third state table is established;
Adjustment unit, after obtaining the time difference in the computing unit, if the time difference is greater than or equal to
Pre-set numerical value then increases the priority of the third state table according to pre-set rule.
As can be seen from the above technical solutions, the embodiment of the present invention has the following advantages:
Primary server determines the current rate of backup link;And backup relation table is inquired, determination is worked as with the backup link
The corresponding priority set of preceding rate, wherein include the correspondence between speed range and priority in backup relation table,
And from all state tables of primary server, obtain state table to be backed up, wherein the priority of state table to be backed up belongs to true
The fixed priority set, and state table to be backed up is sent to the standby server of primary server, to realize state table
Backup can be avoided effectively by obtaining state table to be backed up based on the current rate of backup link because of the excessive band of state table
The case where state table come is easily lost, backup mode is more flexible, and state table to be backed up can be determined according to priority, makes
The high state table of priority can preferentially be backed up by obtaining.
Term " first ", " second ", " third " in description and claims of this specification and above-mentioned attached drawing etc. are (such as
Fruit presence) it is for distinguishing similar object, without being used to describe specific sequence or precedence.It should be appreciated that making in this way
Data can be interchanged in the appropriate case, so that the embodiment of the present invention described herein for example can be in addition to herein
Sequence other than those of diagram or description is implemented.In addition, term " comprising " and " having " and their any deformation, it is intended that
Be to cover it is non-exclusive include, for example, containing the process of series of steps or unit, method, system, product or equipment not
Those of be necessarily limited to clearly to list step or unit, but may include not listing clearly or for these processes, side
The intrinsic other steps of method, product or equipment or unit.
An embodiment of the present invention provides a kind of method of dual-host backup and servers, for solving the shape due to needing to back up
The problem of state table excessively causes state table to be easily lost.
In embodiments of the present invention, primary server state table is backed up can be back up for the first time, back up in realtime and
Timed backup, wherein backup refers to that primary server and standby server are established after backup relation for the first time, i.e., by primary service
State table on device backups on standby server;Back up in realtime refers to that stateful table is deleted or creates it in primary server
Afterwards, it is backed up on primary server real-time informing standby server;Wherein, timed backup refers to primary server scheduled
Time point backs up the state table in primary server after preset time period after last time backup.
Primary server is described in greater detail below and standby server carries out the process of state table backup.
Referring to Fig. 1, for a kind of embodiment of the method for dual-host backup in the embodiment of the present invention, including:
101, primary server determines the current rate of backup link;
In embodiments of the present invention, primary server establish and standby server between main and standby relation after, need into
Row backs up for the first time, the primary server rate current by backup link is determined.
Wherein, which is that primary server and standby server are established after main and standby relation, primary server and
The link dedicated for backup data transmitting established between standby server.
In embodiments of the present invention, primary server complete for the first time back up after, can also according to it is pre-set when
Between put or time interval backup is timed to the primary server, specifically:Primary server will be monitored the time,
It is equal to if current point in time is pre-set BACKUP TIME point or current point in time and the difference of last BACKUP TIME point
Pre-set time value, then primary server determine the current rate of backup link.Such as:If pre-set BACKUP TIME
Point is 10 AM, then in daily 10 AM, primary server all by the way of embodiment illustrated in fig. 1 to state table
It is backed up;Alternatively, if pre-set time value is 1 hour, last BACKUP TIME point is at 9 points in the morning, current time
Point is 10 AM, since the difference between current point in time and the last time BACKUP TIME point is 1 hour, is equal to this in advance
The time value of setting, then primary server state table will be backed up in the way of embodiment illustrated in fig. 1.
102, primary server inquires pre-set backup relation table, and determination is corresponding with the rate that backup link is current
Priority set includes the correspondence between speed range and priority set in backup relation table;
In embodiments of the present invention, backup relation table is pre-set in primary server, which includes speed
Correspondence between rate range and priority set, wherein priority refers to the priority of state table, which can
Priority set for obtaining state table to be backed up.For example, backup relation table can refer to following format:
Speed range (V3 > V2 > V1 > V0) |
Priority set |
V0~V1 |
P1 |
V0~V2 |
P1、P2 |
V0~V3 |
P1、P2、P3 |
In embodiments of the present invention, if priority-level be P1 > P2 > P3, according to upper table describe backup relation table,
The purpose of the high state table of preferential backup priority then can be achieved.
In embodiments of the present invention, primary server will inquire this in advance after determining the current rate of backup link
The backup relation table of setting determines priority set corresponding with the rate that backup link is current.
103, from all state tables of primary server, state table to be backed up, the priority of state table to be backed up are obtained
Belong to priority set;
In embodiments of the present invention, primary server obtain the corresponding priority set of the current rate of backup link it
Afterwards, by from all state tables of primary server, state table to be backed up is obtained, wherein the state table to be backed up belongs to preferential
Grade set, such as:If it is determined that priority set in include priority P 1 and P2, then it is excellent in all state tables of primary server
First grade is that the state table of P1 or P2 is state table to be backed up.
It should be noted that in embodiments of the present invention, the priority of state table can be based on agreement or user
Priority, such as:If determining that priority, administrative staff can pre-set the corresponding priority of different agreements based on agreement,
So that when primary server establishes state table, the priority of the state table is determined using agreement used in the state table.Again
Such as:If determining priority based on user, system can according to administrative staff to the priority of the classification setting user of user, and
The priority of responsible consumer is higher than the priority of ordinary user, and a user may include at least one state table, belong to the user
All state tables priority it is all identical.
104, state table to be backed up is sent to the standby server of primary server.
In embodiments of the present invention, the state table to be backed up of acquisition is sent to the standby of the primary server by primary server
With server, to realize the backup of the state table in primary server.
In embodiments of the present invention, primary server determines the current rate of backup link;And backup relation table is inquired, really
Fixed priority set corresponding with the rate that the backup link is current, wherein comprising speed range and preferentially in backup relation table
Correspondence between grade, and from all state tables of primary server, obtain state table to be backed up, wherein shape to be backed up
The priority of state table belongs to the determining priority set, and state table to be backed up is sent to the active service of primary server
Device, by obtaining state table to be backed up based on the current rate of backup link, can effectively be kept away with realizing the backup of state table
The case where state table for exempting from excessively to bring by state table is easily lost, backup mode is more flexible, and can be true according to priority
Fixed state table to be backed up so that can preferentially back up the high state table of priority.
Technical solution in embodiment in order to better understand the present invention, referring to Fig. 2, to be a kind of in the embodiment of the present invention
The embodiment of the method for dual-host backup, including:
201, primary server determines the current rate of backup link;
202, primary server inquires pre-set backup relation table, and determination is corresponding with the rate that backup link is current
Priority set includes the correspondence between speed range and priority set in backup relation table;
203, from all state tables of primary server, state table to be backed up, the priority of state table to be backed up are obtained
Belong to priority set;
204, state table to be backed up is sent to the standby server of primary server;
Step 201 is similar to the content of the step 101 described in embodiment illustrated in fig. 1 to 104 descriptions to step 204, this
Place repeats no more.
205, it is arranged on state table to be backed up and has backed up flag;
In embodiments of the present invention, primary server is in the active service that state table to be backed up is sent to primary server
After device, it will also be arranged on the state table to be backed up itself preserved and backed up flag, this has backed up flag for identifying
State table has backed up standby server.And if state table to be backed up has been set in upper primary backup and has backed up mark
Position, in current backup, the backup flag of the reconfigurable state table to be backed up.
If 206, primary server deletes first state table, and first state table includes to have backed up flag, then to spare
Server, which is sent, deletes notice, deletes notice for notifying standby server to delete first state table.
In embodiments of the present invention, if primary server deletes first state table, primary server will determine first shape
Whether state table, which has been arranged, has been backed up flag, and if comprising having backed up flag in first state table, primary server is to standby
It is sent with server and deletes notice, deletion notice is for notifying standby server to delete first state table;If primary server
First state table is deleted, and primary server determines in first state table not include to have backed up flag, it is determined that first shape
State table is not synchronized to standby server, then primary server need not send the deletion of the first state table to standby server
Notice.It determines the need for sending to delete to standby server notifying by using flag has been backed up, can effectively realize
Primary server is synchronous with the update of standby server.
Preferably, in embodiments of the present invention, state table can be also created in primary server, if primary server newly-built the
Two-state table, it is determined that whether the priority of second state table belongs to the corresponding priority set of the current rate of backup link
Close, and if the priority of the second state table belong to the corresponding priority set of the current rate of backup link, primary server
Second state table is sent to standby server, to be backed up to the second state table on standby server.
Preferably, in embodiments of the present invention, primary server can also flexibly be modified the priority of state table,
Specifically:If primary server is sent datagram using third state table, the use of third state table the last time is updated
Time;And if the priority of third state table is not highest priority, calculate that third state table the last time uses when
Between third state table establish time between time difference;If the time difference is greater than or equal to pre-set numerical value, press
Increase the priority of third state table according to pre-set rule.Such as:If primary server sends number using third state table
According to message, and the time that third state the last time uses is had updated as the morning 10 on November 28th, 2013:00, and if the third
The priority of state table is 4 grades, is not highest priority, and the settling time of third state table is on 28 days October in 2013
Noon 10:00, then its settling time of time gap that the third state table the last time uses is separated by one month, has been more than to set in advance
The numerical value set two days is 3 grades then by the priority elevated by one step of the third state table.
In embodiments of the present invention, the corresponding priority set of rate that primary server can utilize backup link current,
Priority is obtained in the state table all from the primary server belongs to the state table of the priority set as state to be backed up
Table, and state table to be backed up is sent to the standby server of primary server, it can effectively realize the backup of state table, and
The state table to be backed up sent can't be more than the bandwidth of backup link, can effectively avoid the feelings that state table is easily lost
Condition, backup mode is more flexible, and state table to be backed up can be determined according to priority so that it is high can preferentially to back up priority
State table, in addition, also flag can have been backed up by being arranged on state table to be backed up so that stateful in primary server
When table is deleted, it can effectively realize that primary server is synchronous with standby server.
Referring to Fig. 3, for the schematic diagram of the structure of server in the embodiment of the present invention, including:
Determination unit 301, the rate current for determining backup link;
Query unit 302, after determining the current rate of backup link in determination unit 301, inquiry is pre-set
Backup relation table, determine corresponding with the rate that backup link is current priority set, include rate model in backup relation table
Enclose the correspondence between priority set;
Acquiring unit 303, after determining priority set in query unit 302, from all shapes of primary server
In state table, state table to be backed up is obtained, the priority of state table to be backed up belongs to priority set;
Transmission unit 304, after obtaining the state table to be backed up in acquiring unit 303, by state table to be backed up
It is sent to the standby server of primary server.
In embodiments of the present invention, the determination unit 301 in server determines that the current rate of backup link is then looked into
It askes unit 302 and inquires pre-set backup relation table, determine the corresponding priority set of the current rate of backup link, and by
Acquiring unit 303 obtains the Status of Backups table that priority belongs to the priority set, most from all state tables of master server
There is transmission unit 304 that state table to be backed up is sent to the standby server of master server afterwards.
It should be noted that the structure of the as primary server of embodiment illustrated in fig. 3 description.
In embodiments of the present invention, primary server determines the current rate of backup link;And backup relation table is inquired, really
Fixed priority set corresponding with the rate that the backup link is current, wherein comprising speed range and preferentially in backup relation table
Correspondence between grade, and from all state tables of primary server, obtain state table to be backed up, wherein shape to be backed up
The priority of state table belongs to the determining priority set, and state table to be backed up is sent to the active service of primary server
Device, by obtaining state table to be backed up based on the current rate of backup link, can effectively be kept away with realizing the backup of state table
The case where state table for exempting from excessively to bring by state table is easily lost, backup mode is more flexible, and can be true according to priority
Fixed state table to be backed up so that can preferentially back up the high state table of priority.
In order to better understand the present invention in embodiment primary server structure, referring to Fig. 4, be the embodiment of the present invention
The embodiment of the structure of middle server, including:
Determination unit 301, query unit 302, acquiring unit 303 and transmission unit described in embodiment as shown in Figure 3
304, and the content as shown in figure 3 described in embodiment is similar, is not repeated herein.
Wherein it is determined that unit 301 is specifically used for:
If current point in time is pre-set BACKUP TIME point or current point in time and last BACKUP TIME point
Difference is equal to pre-set time value, then primary server determines the current rate of backup link.
Wherein, server further includes:
Setting unit 401 is set after obtaining state table to be backed up in acquiring unit 303 on state table to be backed up
It sets and has backed up flag;
If then transmission unit 304 is additionally operable to primary server and deletes first state table, and first state table includes to have backed up
Flag then sends to standby server and deletes notice, deletes notice for notifying standby server to delete first state table.
Wherein, server further includes:
Priority determining unit 402, if the second state table has been established for primary server, it is determined that the second state table
Whether priority belongs to priority set;
If then transmission unit 304 is additionally operable to the priority of the second state table and belongs to priority set, by the second state table
It is sent to standby server.
In embodiments of the present invention, server further includes:
Updating unit 403 updates third shape if having sent datagram using third state table for primary server
The time that state table the last time uses;
Computing unit 404, after the time used for updating unit update third state table the last time, if third shape
The priority of state table is not highest priority, then calculates time and the foundation of third state table that third state table the last time uses
Time between time difference;
Adjustment unit 405, after obtaining the time difference in computing unit, if the time difference is more than or equal to pre-set
Numerical value then increases the priority of third state table according to pre-set rule.
In embodiments of the present invention, the determination unit 301 in server determines that the current rate of backup link is then looked into
It askes unit 302 and inquires pre-set backup relation table, determine the corresponding priority set of the current rate of backup link, and by
Acquiring unit 303 obtains the Status of Backups table that priority belongs to the priority set, connects from all state tables of master server
It setting unit 401 and is arranged on state table to be backed up and backed up flag;Finally there is transmission unit 304 by state table to be backed up
It is sent to the standby server of master server.
In embodiments of the present invention, if primary server deletes first state table, and first state table includes to have backed up mark
Know position, then transmission unit 304 sends to standby server and deletes notice, deletes notice for notifying standby server to delete first
State table.
In embodiments of the present invention, if the second state table has been established in primary server, priority determining unit 402 determines
Whether the priority of the second state table belongs to priority set.And if the priority of the second state table belongs to priority set,
Second state table is sent to standby server by transmission unit 304.
In embodiments of the present invention, if primary server is sent datagram using third state table, updating unit
The time that 403 update third state table the last times used;If the priority of third state table is not highest priority, calculate
Time difference between the time that unit 404 calculates the time used third state table the last time and third state table is established;And
If the time difference is greater than or equal to pre-set numerical value, adjustment unit 405 increases the third state according to pre-set rule
The priority of table.
In embodiments of the present invention, the corresponding priority set of rate that primary server can utilize backup link current,
Priority is obtained in the state table all from the primary server belongs to the state table of the priority set as state to be backed up
Table, and state table to be backed up is sent to the standby server of primary server, it can effectively realize the backup of state table, and
The state table to be backed up sent can't be more than the bandwidth of backup link, can effectively avoid the feelings that state table is easily lost
Condition, backup mode is more flexible, and state table to be backed up can be determined according to priority so that it is high can preferentially to back up priority
State table, in addition, also flag can have been backed up by being arranged on state table to be backed up so that stateful in primary server
When table is deleted, it can effectively realize that primary server is synchronous with standby server.
Referring to Fig. 5, for the schematic diagram of the structure of server in the embodiment of the present invention, which can be primary service
Device, including:
Processor 501, reception device 502, sending device 503, memory 504,;
Wherein, processor 501 is for determining the current rate of backup link;Pre-set backup relation table is inquired, really
Fixed priority set corresponding with the rate that the backup link is current, in the backup relation table comprising speed range with preferentially
Correspondence between grade set;From all state tables of above-mentioned primary server, obtain state table to be backed up, it is described wait for it is standby
The priority of part state table belongs to the priority set;
Wherein, sending device 503 is used to the state table to be backed up being sent to the standby server of the primary server.
One of ordinary skill in the art will appreciate that implement the method for the above embodiments be can be with
Relevant hardware is instructed to complete by program, the program can be stored in a kind of computer readable storage medium, on
It can be read-only memory, disk or CD etc. to state the storage medium mentioned.
The method and server of a kind of dual-host backup provided by the present invention are described in detail above, for ability
The those skilled in the art in domain, the thought of embodiment, has change in specific embodiments and applications according to the present invention
Place, in conclusion the content of the present specification should not be construed as limiting the invention.