CN106021026B - Backup method and device - Google Patents

Backup method and device Download PDF

Info

Publication number
CN106021026B
CN106021026B CN201610351846.9A CN201610351846A CN106021026B CN 106021026 B CN106021026 B CN 106021026B CN 201610351846 A CN201610351846 A CN 201610351846A CN 106021026 B CN106021026 B CN 106021026B
Authority
CN
China
Prior art keywords
space
backup
task
target
size
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610351846.9A
Other languages
Chinese (zh)
Other versions
CN106021026A (en
Inventor
成浩
周后取
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN201610351846.9A priority Critical patent/CN106021026B/en
Publication of CN106021026A publication Critical patent/CN106021026A/en
Application granted granted Critical
Publication of CN106021026B publication Critical patent/CN106021026B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a backup method and a backup device, wherein the method comprises the following steps: when video backup is needed, determining the size of a target space needed to be occupied by a task to be backed up; acquiring a candidate backup management server BM which has residual backup capacity and has a residual space larger than or equal to the size of the target space; if the number of the candidate BMs is larger than 0, determining the level of the task to be backed up according to the size of the target space; determining a target BM for executing backup according to the level of the task to be backed up and the size of the residual space of each candidate BM; and allocating the task to be backed up to the target BM and executing backup by the target BM. The embodiment of the invention can optimize the using effect of resources such as BM backup capability, backup space and the like during video backup.

Description

Backup method and device
Technical Field
The present invention relates to the field of storage technologies, and in particular, to a backup method and apparatus.
Background
In the application of video monitoring industries such as public security, garden and the like, the following video backup requirements exist for original videos: backup is required to be performed for some important time periods selected by the user (for example, the time period related to the camera in the public security major case). Namely: the part of the video data is transmitted from the original storage space and stored in the storage space special for backup, thereby effectively preventing the situations of video coverage, recording loss and the like caused by limited original storage resources.
Before executing the video backup, the BM (backup management server) needs to divide the storage resources used for backup to store the backup video. For a large monitoring storage office point, the number of cameras that need to perform video backup is large, so multiple BMs need to be deployed to perform video backup.
When a plurality of BMs exist in the system, how to allocate backup tasks of a plurality of cameras to the BM for execution becomes a problem to be solved urgently.
Disclosure of Invention
The invention provides a backup method and a backup device, which are used for optimizing the backup capability of a BM (broadcast multicast) and the use effect of a backup space during video backup.
According to a first aspect of the present invention, there is provided a backup method comprising:
when video backup is needed, determining the size of a target space needed to be occupied by a task to be backed up;
acquiring a candidate backup management server BM which has residual backup capacity and has a residual space larger than or equal to the size of the target space;
if the number of the candidate BMs is larger than 0, determining the level of the task to be backed up according to the size of the target space;
determining a target BM for executing backup according to the level of the task to be backed up and the size of the residual space of each candidate BM;
and allocating the task to be backed up to the target BM and executing backup by the target BM.
According to a second aspect of the present invention, there is provided a backup apparatus comprising:
the first determining unit is used for determining the size of a target space occupied by a task to be backed up when video backup is required;
an obtaining unit, configured to obtain a candidate backup management server BM that has a remaining backup capability and has a remaining space greater than or equal to the size of the target space;
a second determining unit, configured to determine, according to the size of the target space, a level of the task to be backed up if the number of the candidate BMs is greater than 0;
a third determining unit, configured to determine a target BM for performing backup according to the level of the task to be backed up and the size of the remaining space of each candidate BM;
and the allocation unit is used for allocating the task to be backed up to the target BM and executing backup by the target BM.
By applying the technical scheme disclosed by the invention, when video backup is required, and the system has residual backup capability and the residual space is larger than or equal to the candidate BM of the size of the target space required to be occupied by the task to be backed up, the level of the task to be backed up is determined according to the size of the target space, the target BM used for executing backup is determined according to the level of the task to be backed up and the size of the residual space of each candidate BM, the residual backup capability and the residual space of each BM are considered, and the use effect of resources such as the BM backup capability and the backup space during video backup is optimized.
Drawings
Fig. 1 is a schematic flowchart of a backup method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another backup method provided in an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a backup device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another backup device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another backup device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of another backup device according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions in the embodiments of the present invention better understood and make the above objects, features and advantages of the embodiments of the present invention more comprehensible, the technical solutions in the embodiments of the present invention are described in further detail below with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a schematic flowchart of a backup method according to an embodiment of the present invention, and as shown in fig. 1, the backup method may include:
it should be noted that the execution subject of step 101 to step 105 may be a management node of the BM cluster or a processor in the management node of the BM cluster, such as a Central Processing Unit (CPU), and for convenience of description, the execution subject of step 101 to step 105 is taken as the management node for example.
Step 101, when video backup is needed, determining the size of a target space needed to be occupied by a task to be backed up.
In the embodiment of the present invention, when the management node receives the video backup task, the management node may first determine the size of the space that needs to be occupied by the task to be backed up (i.e., the size of the task to be backed up, which is referred to herein as the size of the target space).
In the embodiment of the invention, the size of the target space required to be occupied by the task to be backed up can be determined by the video recording code rate of the camera required to be backed up and the backup time length of the backup task.
For example, the size of the target space occupied by the task to be backed up can be determined by the following formula:
target space size is video camera recording code rate backup duration
The video code rate of the camera is the video code rate of the camera needing to be backed up, and the backup time length is the backup time length of the task to be backed up (the backup time length can be directly determined according to the starting time and the ending time of the task to be backed up).
In the embodiment of the present invention, in consideration that there may be some cameras in the system that cannot query the video recording code rate from the database, such as cameras pushed by an external domain, the management node may determine the video recording code rate of the camera according to the following method:
and calculating the video recording code rate of the camera by dividing the latest size of the backup file which is completely backed up by the backup time length of the backup file.
It should be noted that, in the embodiment of the present invention, for a newly configured backup camera, since a backup file for which backup is completed does not exist, for a first backup task of the camera, an average bitrate of each camera with a known video bitrate in a system may be used as a video bitrate of the camera, and after the first backup task of the camera is completed, a corresponding video bitrate is updated according to a size of an actual backup task and a backup duration.
For example, the management node may add a global hash table for maintaining the code rates of all the cameras in the system that need to perform backup (each camera constructs a hash node). The global hash table may also maintain an average code rate, a total number, and the like of all cameras in the system.
In the backup starting stage, the management node may query all cameras that need to perform backup from the database, and then process the cameras one by one:
a. inquiring a latest backup file of the camera from the backup file information table based on the camera code, and returning information such as the file size, the video recording starting time, the video recording ending time and the like;
b. if the record is inquired:
subtracting the video starting time from the video ending time to obtain the corresponding backup time;
dividing the backup time length by the size of the backup file to obtain the code rate of the camera;
constructing a new hash node, recording the coding and code rate of the camera, and inserting the hash node into a hash table (taking the camera coding as a key value);
and updating the total code rate (accumulating the code rate of the current camera), the total number (adding 1 to the number of cameras) and the average code rate of all the cameras.
c. If the record is not inquired:
and taking the average code rate as the video recording code rate of the camera, and updating the corresponding video recording code rate according to the size of the actual backup task and the backup duration after the first backup task of the camera is completed.
Based on the global hash table, when the management node needs to acquire the video recording code rate of a certain camera, the management node can inquire the global hash table according to the camera code, and if the corresponding hash node is inquired, the video recording code rate recorded in the global hash table is determined as the video recording code rate of the camera; and if the corresponding hash node is not inquired, taking the average code rate as the video recording code rate of the camera, updating the corresponding video recording code rate according to the size of the actual backup task and the backup duration after the first backup task of the camera is completed, and adding the corresponding hash node in the global hash table.
After the management node obtains the video recording code rate of the camera, the size of the target space occupied by the task to be backed up can be calculated according to the video recording code rate of the camera and the backup duration of the task to be backed up.
For the first backup task of the camera, the average code rate and the average backup duration (which may be empirical values, such as 1800 seconds, 3600 seconds, and the like) may be directly used for calculation.
And 102, acquiring a BM list with residual backup capability and residual space larger than or equal to the size of the target space.
In the embodiment of the present invention, after the management node determines the size of the target space that needs to be occupied by the task to be backed up, the management node may query the BMs (referred to herein as candidate BMs) that have the remaining backup capability and the remaining space is greater than or equal to the size of the target space in the system.
The management node may record, in the form of a list, the BM which has the remaining backup capability and is found by querying, and the remaining space is greater than or equal to the size of the target space.
And 103, if the number of the candidate BMs is larger than 0, determining the level of the task to be backed up according to the size of the target space.
In the embodiment of the present invention, when the number of candidate BMs acquired by the management node is not 0 (the BM list is not empty), that is, there are BMs having a remaining backup capability and a remaining space greater than or equal to the size of the target space in the system, the management node may determine the level of the task to be backed up according to the size of the target space that the task to be backed up needs to occupy.
In the embodiment of the invention, the backup task is directly allocated to the BM with the residual backup capability and the largest residual space if the backup task needs to be performed each time, so that the backup task with the smaller occupied space possibly occupies the backup capability of the BM with the larger residual space, and further, when the management node needs to perform backup on the backup task with the larger occupied space, the BM with the enough residual space does not have the backup capability, but has the backup capability and the residual space is insufficient, so that the backup task fails to be issued.
For example, assume that BMs with remaining backup capability in the system include BM1, BM2, and BM3, wherein the remaining backup space of BM1 with a remaining backup space of 1.5G, BM is 200M for 1G, BM3, and the remaining backup capabilities of BM1, BM2, and BM3 can only support 1-way video backup; supposing that at a certain moment, the management node detects that IPC1, IPC2 and IPC3 need to perform video backup, the size of the space occupied by the tasks to be backed up is 100M (IPC1), 200M (IPC2) and 1G (IPC3), the management node firstly allocates the backup tasks of IPC1 to BM1 and IPC2 to BM2, and for the backup tasks of IPC3, due to insufficient remaining space of BM3, the sending fails.
Therefore, in the embodiment of the present invention, when the management node selects the target BM for performing backup for the task to be backed up, the management node does not strictly select the BM having the remaining backup capability and the largest remaining space according to the principle of selecting the BM having the largest remaining space, but may first determine the level of the task to be backed up according to the size of the target space, and then select the target BM for performing backup for the task to be backed up according to the level of the task to be backed up.
As an optional implementation manner, in the embodiment of the present invention, determining the level of the task to be backed up according to the size of the target space may include:
when the size of the target space is larger than or equal to a first proportion of the average size of the backup tasks, determining the level of the tasks to be backed up as a first level; wherein the first proportion is greater than 100%;
when the size of the target space is smaller than or equal to a second proportion of the average size of the backup tasks, determining the level of the tasks to be backed up as a second level; wherein the second proportion is less than 100%;
and when the target space size is smaller than the first proportion of the average size of the backup tasks and larger than the second proportion of the average size of the backup tasks, determining the level of the tasks to be backed up as a third level.
In this embodiment, to determine the level of the task to be backed up, the management node may first determine the average size of the backup tasks in the system.
Wherein, the average size of the backup tasks in the system can be determined by the following formula:
average size of backup task is average code rate and average backup duration
The average code rate is an average code rate of all cameras in the system (the determination method may refer to the related description in step 101), the average backup duration is an empirical value, and the average backup duration may be set by an administrator according to a specific scenario, such as 1800 seconds, 3600 seconds, and the like.
In this embodiment, after determining the average size of the backup tasks in the system, the management node may determine, as a first level, a level of the task to be backed up, where the size of the space to be occupied (or referred to as the size of the backup task) is greater than or equal to a first proportion of the average size of the backup task; determining the level of the tasks to be backed up, which needs to occupy the space with the size less than or equal to the average size of the backup tasks and has a second proportion, as a second level; the size of the space required to be occupied is smaller than the first proportion of the average size of the backup tasks, and the level of the tasks to be backed up, which is larger than the second proportion of the average size of the backup tasks, is determined as a third level.
For example, assuming that the first proportion is 125% and the second proportion is 75%, the management node may level the backup tasks in the following manner:
first level (high size): the size of the backup task is more than or equal to the average code rate and the average backup duration 125 percent;
second grade (low size): the backup task size is less than or equal to the average code rate and the average backup duration is 75 percent;
third grade (medium size): the backup task size is between the two values.
It is worth noting that in this embodiment, for the first backup task of any camera, the level of the backup task may be determined as the third level.
It should be appreciated that the above dividing manner of the level of the task to be backed up is only a specific example in the embodiment of the present invention, and is not limited to the scope of the present invention, that is, in the embodiment of the present invention, the dividing manner of the level of the task to be backed up may also be implemented in other manners, for example, the level of the task to be backed up may be only divided into two levels, a backup task that is greater than or equal to the average size of the backup task is a first level, and a backup task that is smaller than the average size of the backup task is a second level; or, the level of the task to be backed up may also be divided into four or more levels, and the specific implementation thereof is not described herein.
For ease of understanding, in the embodiments of the present invention, the description is made with the level division in the above examples as an example.
And step 104, determining a target BM for executing backup according to the level of the task to be backed up and the size of the residual space of each candidate BM.
In the embodiment of the present invention, after the management node determines the level of the task to be backed up, a target BM for performing backup may be determined according to the level of the task to be backed up and the size of the remaining space of each candidate BM.
As an optional implementation manner, in the embodiment of the present invention, determining a target BM for performing backup according to the level of the task to be backed up and the size of the remaining space of each candidate BM may include:
when the level of the task to be backed up is a first level, determining a candidate BM with the largest residual space as a target BM, wherein the residual space in the candidate BM is larger than the average residual space of the system;
when the level of the task to be backed up is a second level, determining that the residual space in the candidate BMs is smaller than the average residual space of the system, and the candidate BM with the largest residual space is a target BM;
and when the level of the task to be backed up is the third level, determining the candidate BM with the largest residual space in the candidate BMs as the target BM.
In this embodiment, the management node may level the candidate BMs according to the remaining space of each candidate BM.
For example, the management node may divide BMs having a remaining space greater than the system average remaining space into candidate BMs of a first level and BM having a remaining space less than the system average remaining space into candidate BMs of a second level.
Wherein the system average remaining space may be a ratio of the sum of the remaining spaces of all online BMs of the system to the number of all online BMs of the system.
In the embodiment of the invention, the online BM refers to a BM in a working state, and the management node can monitor the online state of the BM through a heartbeat keep-alive message between the management node and the BM.
In this embodiment, for a task to be backed up at a first level, the management node may determine a candidate BM with the largest remaining space among the candidate BMs at the first level as a target BM; for the task to be backed up at the second level, the management node may determine a candidate BM with the largest remaining space in the candidate BMs at the second level as a target BM; for the task to be backed up at the third level, the management node can determine the candidate BM with the largest residual space in the candidate BMs as the target BM, so that the problem that the task to be backed up with a smaller occupied space occupies the backup capability of the BM with a larger residual space can be effectively avoided, and the residual backup capability of the BM and the allocation of the residual space are optimized.
It should be noted that, in the embodiment of the present invention, when a target BM of a task to be backed up at a first level needs to be determined but a candidate BM at the first level does not exist (that is, the remaining space of the candidate BM is smaller than the average remaining space of the system), or when a target BM of a task to be backed up at a second level needs to be determined but a candidate BM at a second level does not exist (that is, the remaining space of the candidate BM is larger than the average remaining space of the system), the management node may consider that the BM selection fails, first does not issue the task to be backed up to the BM, and after a certain time, re-determines the target BM according to the above steps.
It should be appreciated that the above-mentioned level division manner of the candidate BM is only a specific example in the embodiment of the present invention, and is not limited to the protection scope of the present invention, that is, in the embodiment of the present invention, the level division of the candidate BM may also be implemented in other manners, for example, the level of the task to be backed up may be only divided into three or more levels, and the specific implementation thereof is not described herein again.
And 105, allocating the task to be backed up to the target BM and executing backup by the target BM.
In the embodiment of the invention, after the management node determines the target BM, the management node can allocate a task to be backed up to the target BM and the target BM executes backup; the specific implementation of the target BM performing the backup may refer to the related description in the existing related flow, and the embodiment of the present invention is not described herein again.
It can be seen that, in the method flow shown in fig. 1, when there is a candidate BM with a remaining backup capability and a remaining space greater than or equal to the size of the target space in the system, the level of the task to be backed up is determined according to the size of the target space that needs to be occupied by the task to be backed up, and the target BM for performing backup is determined according to the level of the task to be backed up and the size of the remaining space of each candidate BM.
Referring to fig. 2, fig. 2 is a schematic flowchart of another backup method according to an embodiment of the present invention, and as shown in fig. 2, the backup method may include the following steps:
step 201, when video backup is needed, determining the size of a target space needed to be occupied by a task to be backed up.
Step 202, obtaining candidate BMs having a remaining backup capability and a remaining space greater than or equal to the size of the target space. If the number of the candidate BMs is greater than 0, go to step 203; if the number of candidate BMs is 0, go to step 208.
In the embodiment of the present invention, specific implementation of steps 201 to 202 may refer to the related description in steps 101 to 102, which is not described herein again.
Step 203, determine whether the BM remaining space balance adjustment function is in an enabled state. If yes, go to step 204; otherwise, go to step 207.
In the embodiment of the present invention, when the remaining space between online BMs in the system is more balanced, it is not necessary to consider whether the remaining backup capability of a BM having a larger remaining space will be occupied by a backup task having a smaller space, and therefore, in order to improve the backup efficiency under this condition, a BM remaining space balancing adjustment function may be newly added to the system, and when the BM remaining space balancing adjustment function is in an enabled state, the management node may perform backup according to the method shown in fig. 1; when the BM remaining space balance adjustment function is in the off state, the management node may directly determine the target BM according to the remaining space size of each candidate BM.
Correspondingly, in the embodiment of the present invention, when there is a candidate BM with a remaining backup capability and a remaining space greater than or equal to the size of the target space in the system, the management node may further determine whether the BM remaining space balancing adjustment function is in an enabled state. If yes, go to step 204; otherwise, 207 is performed.
As an alternative embodiment, the enabling and disabling of the BM remaining space balancing adjustment function may be determined by:
when the balance adjustment function of the residual BM space is closed and the unbalance degree of the residual BM space on line in the system meets a first preset condition, setting the balance adjustment function of the residual BM space to be in an enabled state;
and when the balance adjusting function of the residual BM space is in an enabled state and the unbalance degree of the residual BM space on line in the system meets a second preset condition, setting the balance adjusting function of the residual BM space to be in a closed state.
In this embodiment, the management node may determine whether the state of the BM remaining space balance adjustment function needs to be adjusted according to the state (enabled or disabled) of the current BM remaining space balance adjustment function and the degree of imbalance of the remaining space of online BMs in the system.
When the unbalance degree of the residual space of the online BM in the system meets a first preset condition, the management node can consider that the balance adjustment function of the residual space of the BM needs to be started, and at the moment, if the balance adjustment function of the residual space of the BM is in a closed state, the management node can adjust the balance adjustment function of the residual space of the BM to be in a starting state; if the BM remaining space balancing adjustment function is in the enabled state, the management node may keep it in the enabled state.
When the unbalance degree of the residual space of the online BM in the system meets a second preset condition, the management node can consider that the balance adjustment function of the residual space of the BM needs to be closed, and at the moment, if the balance adjustment function of the residual space of the BM is in a starting state, the management node can adjust the balance adjustment function of the residual space of the BM to be in a closing state; if the BM remaining space balancing adjustment function is in the off state, the management node may keep it in the off state.
The condition that the unbalance degree of the remaining space of the online BMs in the system satisfies the first preset condition may include, but is not limited to, a difference value or a ratio of the remaining space of the online BM with the largest remaining space to the remaining space of the online BM with the smallest remaining space in the system being greater than or equal to a first threshold value, and the like.
The degree of imbalance of the remaining space of the online BMs in the system to satisfy the second preset condition may include, but is not limited to, that a difference or a ratio of the remaining space of the online BM with the largest remaining space in the system to the remaining space of the online BM with the smallest remaining space is less than or equal to a second threshold, and the like. Wherein the first threshold is greater than the second threshold.
For example, the management node may consider that the degree of imbalance of the remaining space of the online BMs in the system satisfies a first preset condition when the remaining space of the online BMs in the system satisfies the following condition:
the residual space of the online BM with the largest residual space-the residual space of the online BM with the smallest residual space is more than or equal to 3 times the maximum space occupied by the backup task
The maximum space that the backup task needs to occupy may be an empirical value, and may be set by the user according to a specific scenario, for example, the maximum space that the backup task needs to occupy may be 1.5G, and at this time, the first threshold is 4.5G.
In addition, the management node may consider that the degree of imbalance of the remaining space of the online BM in the system satisfies a second preset condition when the remaining space of the online BM in the system satisfies the following condition:
the maximum space occupied by the backup task is less than or equal to 1 ×, the residual space of the online BM with the maximum residual space-the residual space of the online BM with the minimum residual space
When the maximum space required to be occupied by the backup task may be 1.5G, the second threshold is 1.5G.
And step 204, determining the level of the task to be backed up according to the size of the target space.
Step 205, determining a target BM for performing backup according to the level of the task to be backed up and the size of the remaining space of each candidate BM.
And step 206, allocating the task to be backed up to the target BM. The backup is performed by the target BM.
In the embodiment of the present invention, the specific implementation of step 204 to step 206 may refer to the related description in step 103 to step 105, and is not described herein again.
Step 207, determining the candidate BM with the largest residual space in the candidate BMs as the target BM, allocating the task to be backed up to the target BM, and performing the backup by the target BM.
In the embodiment of the present invention, if the management node determines that the balance adjustment function of the BM remaining space is in an off state, that is, the remaining space of the online BMs in the system is relatively balanced, and it is not necessary to consider whether the backup task requiring a smaller occupied space occupies the backup capability of the BM having a larger remaining space, the management node may directly determine the candidate BM having the largest remaining space in the candidate BMs as the target BM, allocate the task to be backed up to the target BM, and execute the backup by the target BM.
And step 208, judging whether the online BM with the residual space larger than or equal to the target space exists in the system. If yes, go to step 209; otherwise, a full coverage operation is performed.
In the embodiment of the present invention, when the management node determines that the system does not have the remaining backup capability and the remaining space is greater than or equal to the size of the target space that needs to be occupied by the task to be backed up, the management node may further determine whether an online BM having a remaining space greater than or equal to the size of the target space exists in the system (that is, the online BM having no remaining backup capability but having a remaining space greater than or equal to the size of the target space).
If there is an online BM with a remaining space greater than or equal to the size of the target space (but no remaining backup capability) in the system, step 209 may be executed; otherwise, a full coverage operation is performed.
The specific implementation of the management node executing the full coverage operation may refer to related implementation in the existing related flow, which is not described herein again in the embodiments of the present invention.
Step 209, determine whether there is an online BM with the remaining backup capability in the system. If yes, go to step 210; otherwise, determining that the BM selection fails.
Step 210, adding 1 to a global variable for counting the number of global task stacks, and determining whether the number of global task stacks exceeds a preset threshold. If yes, executing full coverage operation; otherwise, determining that the BM selection fails.
In the embodiment of the present invention, when there is an online BM with a remaining space greater than or equal to the size of the target space (but no remaining capacity), the management node may further determine whether there is an online BM with a remaining backup capacity (i.e., having a remaining backup capacity, but a remaining space smaller than the size of the target space) in the system; if the backup task exists, the management node can take the task to be backed up as a stacking task, add 1 to a global variable for counting the stacking number of the global tasks, and judge whether the stacking number of the global tasks exceeds a threshold value; if the threshold value is exceeded, executing full coverage operation; otherwise, the management node may determine that the BM selection fails, and the backup task is not scheduled to be issued this time.
When the management node determines that the selection of the BM fails and the backup task is not issued this time, the management node may select the BM for the backup task after a certain time.
It can be seen that in the method flow shown in fig. 2, the management node may select a target BM for performing backup for the task to be backed up in different ways according to different states of the BM remaining space balance adjustment function, thereby improving the flexibility of backup.
As can be seen from the above description, in the technical solution provided in the embodiment of the present invention, when video backup is required, and a candidate BM exists in the system, where the remaining backup capability exists, and the remaining space is greater than or equal to the size of the target space that needs to be occupied by the task to be backed up, the level of the task to be backed up is determined according to the size of the target space, and a target BM for performing backup is determined according to the level of the task to be backed up and the size of the remaining space of each candidate BM, and the remaining backup capability and the remaining space of each BM are taken into consideration, so that the use effect of resources such as the BM backup capability and the backup space during video backup is optimized.
Referring to fig. 3, a schematic structural diagram of a backup device according to an embodiment of the present invention is shown in fig. 3, where the backup device may include:
a first determining unit 310, configured to determine, when video backup needs to be performed, a size of a target space that needs to be occupied by a task to be backed up;
an obtaining unit 320, configured to obtain a candidate backup management server BM that has a remaining backup capability and has a remaining space greater than or equal to the size of the target space;
a second determining unit 330, configured to determine, if the number of the candidate BMs is greater than 0, a level of the task to be backed up according to the size of the target space;
a third determining unit 340, configured to determine a target BM for performing backup according to the level of the task to be backed up and the size of the remaining space of each candidate BM;
an allocating unit 350, configured to allocate the task to be backed up to the target BM, and perform backup by the target BM.
In an optional embodiment, the second determining unit 330 may be specifically configured to determine, when the size of the target space is greater than or equal to a first ratio of the average size of the backup tasks, that the level of the task to be backed up is a first level; wherein the first proportion is greater than 100%; when the size of the target space is smaller than or equal to a second proportion of the average size of the backup tasks, determining the level of the task to be backed up as a second level; wherein the second proportion is less than 100%; and when the target space size is smaller than the first proportion of the average size of the backup tasks and larger than the second proportion of the average size of the backup tasks, determining the level of the tasks to be backed up as a third level.
In an optional embodiment, the third determining unit 340 may be specifically configured to, when the level of the task to be backed up is a first level, determine a candidate BM whose remaining space is greater than the average remaining space of the system among the candidate BMs and whose remaining space is the largest as a target BM; when the level of the task to be backed up is a second level, determining a candidate BM with the largest residual space as a target BM, wherein the residual space in the candidate BM is smaller than the average residual space of the system; and when the level of the task to be backed up is a third level, determining the candidate BM with the largest residual space in the candidate BMs as a target BM.
Referring to fig. 4, a schematic structural diagram of another backup device according to an embodiment of the present invention is shown, where on the basis of the embodiment shown in fig. 3, the backup device shown in fig. 4 may further include:
a first determining unit 360, configured to determine whether the BM remaining space balancing adjusting function is in an enabled state if the number of the candidate BMs is greater than 0;
correspondingly, the second determining unit 330 may be specifically configured to determine, when the first determining unit 360 determines that the task is to be backed up, a level of the task to be backed up according to the size of the target space;
the third determining unit 340 may be further configured to determine, as a target BM, a candidate BM with the largest remaining space in the candidate BMs when the first determining unit 360 determines that the candidate BM is not the target BM;
the allocating unit 350 may be further configured to allocate the task to be backed up to the target BM, and perform backup by the target BM.
Referring to fig. 5, a schematic structural diagram of another backup device according to an embodiment of the present invention is shown, where on the basis of the embodiment shown in fig. 4, the backup device shown in fig. 5 may further include:
the setting unit 370 may be configured to set the BM remaining space balancing and adjusting function to an enabled state when the BM remaining space balancing and adjusting function is in an off state and an imbalance degree of remaining spaces of online BMs in the system meets a first preset condition; and when the balance adjusting function of the residual BM space is in an enabled state and the unbalance degree of the residual BM space on line in the system meets a second preset condition, setting the balance adjusting function of the residual BM space to be in a closed state.
Referring to fig. 6, a schematic structural diagram of another backup device according to an embodiment of the present invention is shown, and based on the embodiment shown in fig. 3, the backup device shown in fig. 6 may further include:
a second determining unit 380, configured to determine whether there is an online BM with a remaining space greater than or equal to the size of the target space in the system if the number of the candidate BMs is 0;
a processing unit 390, configured to execute a full coverage operation if there is no online BM with a remaining space greater than or equal to the target space size in the system;
the second determining unit 380 may be further configured to determine whether an online BM with a remaining backup capability exists in the system if the online BM with a remaining space greater than or equal to the size of the target space exists in the system;
the second determining unit 380 may be further configured to, if there is an online BM with a remaining backup capability in the system, add 1 to a global variable used for counting the global task accumulation number, and determine whether the global task accumulation number exceeds a preset threshold;
the processing unit 390 is further configured to execute a full coverage operation if the global task accumulation number exceeds a preset threshold; otherwise, determining that BM selection fails;
the processing unit 390 may further be configured to determine that the BM selection fails if there is no online BM with the remaining backup capability in the system.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the invention. One of ordinary skill in the art can understand and implement it without inventive effort.
It can be seen from the above embodiments that, when video backup is required, and a residual backup capability exists in the system, and a candidate BM whose residual space is greater than or equal to the size of a target space that needs to be occupied by a task to be backed up, the level of the task to be backed up is determined according to the size of the target space, and a target BM for performing backup is determined according to the level of the task to be backed up and the size of the residual space of each candidate BM, and the residual backup capability and the residual space of each BM are taken into account, so that the use effects of resources such as the BM backup capability and the backup space during video backup are optimized.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (12)

1. A backup method, comprising:
when video backup is needed, determining the size of a target space needed to be occupied by a task to be backed up; the size of the target space is determined by the video recording code rate and the backup time length of a camera corresponding to the task to be backed up;
acquiring a candidate backup management server BM which has residual backup capacity and has a residual space larger than or equal to the size of the target space;
if the number of the candidate BMs is larger than 0, determining the level of the task to be backed up by comparing the size of the target space with the average size of the backup task; the average size of the backup task is determined by the average code rate and the average backup duration of all cameras in the system;
determining a target BM for executing backup according to the level of the task to be backed up and the size of the residual space of each candidate BM;
and allocating the task to be backed up to the target BM and executing backup by the target BM.
2. The method of claim 1, wherein determining the level of the task to be backed up according to the size of the target space comprises:
when the size of the target space is larger than or equal to a first proportion of the average size of the backup tasks, determining the level of the task to be backed up as a first level; wherein the first proportion is greater than 100%;
when the size of the target space is smaller than or equal to a second proportion of the average size of the backup tasks, determining the level of the task to be backed up as a second level; wherein the second proportion is less than 100%;
and when the target space size is smaller than the first proportion of the average size of the backup tasks and larger than the second proportion of the average size of the backup tasks, determining the level of the tasks to be backed up as a third level.
3. The method according to claim 2, wherein the determining a target BM for performing backup according to the level of the task to be backed up and the size of the remaining space of each candidate BM comprises:
when the level of the task to be backed up is a first level, determining a candidate BM with the largest residual space as a target BM, wherein the residual space in the candidate BM is larger than the average residual space of the system;
when the level of the task to be backed up is a second level, determining a candidate BM with the largest residual space as a target BM, wherein the residual space in the candidate BM is smaller than the average residual space of the system;
and when the level of the task to be backed up is a third level, determining the candidate BM with the largest residual space in the candidate BMs as a target BM.
4. The method of claim 1, wherein if the number of candidate BMs is greater than 0, before the determining the level of the task to be backed up according to the size of the target space, further comprising:
judging whether the BM residual space balance adjustment function is in an enabled state;
if yes, determining to execute the step of determining the level of the task to be backed up according to the size of the target space;
otherwise, determining the candidate BM with the largest residual space in the candidate BMs as a target BM, allocating the task to be backed up to the target BM, and executing backup by the target BM.
5. The method of claim 4, further comprising:
when the balance adjusting function of the residual BM space is in a closed state and the unbalance degree of the residual BM space on line in the system meets a first preset condition, setting the balance adjusting function of the residual BM space to be in an enabled state;
and when the balance adjusting function of the residual BM space is in an enabled state and the unbalance degree of the residual BM space on line in the system meets a second preset condition, setting the balance adjusting function of the residual BM space to be in a closed state.
6. The method of claim 1, further comprising:
if the number of the candidate BMs is 0, judging whether online BMs with residual space larger than or equal to the size of the target space exist in the system or not;
if no online BM with the residual space larger than or equal to the size of the target space exists in the system, executing full coverage operation;
if the online BM with the residual space larger than or equal to the size of the target space exists in the system, judging whether the online BM with the residual backup capability exists in the system;
if the online BM with the residual backup capability exists in the system, adding 1 to a global variable for counting the global task accumulation quantity, judging whether the global task accumulation quantity exceeds a preset threshold value, and if so, executing full coverage operation; otherwise, determining that BM selection fails;
and if no online BM with the residual backup capability exists in the system, determining that the BM selection fails.
7. A backup device, comprising:
the first determining unit is used for determining the size of a target space occupied by a task to be backed up when video backup is required; the size of the target space is determined by the video recording code rate and the backup time length of a camera corresponding to the task to be backed up;
an obtaining unit, configured to obtain a candidate backup management server BM that has a remaining backup capability and has a remaining space greater than or equal to the size of the target space;
a second determining unit, configured to determine the level of the task to be backed up by comparing the size of the target space and the average size of the backup tasks if the number of the candidate BMs is greater than 0; the average size of the backup task is determined by the average code rate and the average backup duration of all cameras in the system;
a third determining unit, configured to determine a target BM for performing backup according to the level of the task to be backed up and the size of the remaining space of each candidate BM;
and the allocation unit is used for allocating the task to be backed up to the target BM and executing backup by the target BM.
8. The apparatus of claim 7,
the second determining unit is specifically configured to determine that the level of the task to be backed up is a first level when the size of the target space is greater than or equal to a first proportion of the average size of the backup tasks; wherein the first proportion is greater than 100%; when the size of the target space is smaller than or equal to a second proportion of the average size of the backup tasks, determining the level of the task to be backed up as a second level; wherein the second proportion is less than 100%; and when the target space size is smaller than the first proportion of the average size of the backup tasks and larger than the second proportion of the average size of the backup tasks, determining the level of the tasks to be backed up as a third level.
9. The apparatus of claim 8,
the third determining unit is specifically configured to, when the level of the task to be backed up is the first level, determine, as the target BM, a candidate BM whose remaining space is greater than the average remaining space of the system in the candidate BMs and whose remaining space is the largest; when the level of the task to be backed up is a second level, determining a candidate BM with the largest residual space as a target BM, wherein the residual space in the candidate BM is smaller than the average residual space of the system; and when the level of the task to be backed up is a third level, determining the candidate BM with the largest residual space in the candidate BMs as a target BM.
10. The apparatus of claim 7, further comprising:
a first judging unit, configured to judge whether the BM remaining space balancing adjustment function is in an enabled state if the number of the candidate BMs is greater than 0;
the second determining unit is specifically configured to determine, when the first determining unit determines that the target space is the backup target space, the level of the task to be backed up according to the size of the target space;
the third determining unit is further configured to determine, as the target BM, the candidate BM with the largest remaining space in the candidate BMs when the first determining unit determines that the candidate BM is not the target BM;
the allocation unit is further configured to allocate the task to be backed up to the target BM, and the target BM performs backup.
11. The apparatus of claim 10, further comprising:
the setting unit is used for setting the balance adjusting function of the residual BM space to be in an enabled state when the balance adjusting function of the residual BM space is in a closed state and the unbalance degree of the residual BM space on line in the system meets a first preset condition; and when the balance adjusting function of the residual BM space is in an enabled state and the unbalance degree of the residual BM space on line in the system meets a second preset condition, setting the balance adjusting function of the residual BM space to be in a closed state.
12. The apparatus of claim 7, further comprising:
a second judging unit, configured to judge whether there is an online BM with a remaining space greater than or equal to the size of the target space in the system if the number of the candidate BMs is 0;
the processing unit is used for executing full coverage operation if no online BM with the residual space larger than or equal to the target space size exists in the system;
the second judging unit is further configured to judge whether an online BM with a remaining backup capability exists in the system if the online BM with a remaining space greater than or equal to the size of the target space exists in the system;
the second judging unit is further configured to, if there is an online BM with a remaining backup capability in the system, add 1 to a global variable used for counting the global task accumulation number, and judge whether the global task accumulation number exceeds a preset threshold;
the processing unit is further used for executing full coverage operation if the global task accumulation quantity exceeds a preset threshold; otherwise, determining that BM selection fails;
the processing unit is further configured to determine that selecting the BM fails if there is no online BM with the remaining backup capability in the system.
CN201610351846.9A 2016-05-23 2016-05-23 Backup method and device Active CN106021026B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610351846.9A CN106021026B (en) 2016-05-23 2016-05-23 Backup method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610351846.9A CN106021026B (en) 2016-05-23 2016-05-23 Backup method and device

Publications (2)

Publication Number Publication Date
CN106021026A CN106021026A (en) 2016-10-12
CN106021026B true CN106021026B (en) 2020-02-18

Family

ID=57094617

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610351846.9A Active CN106021026B (en) 2016-05-23 2016-05-23 Backup method and device

Country Status (1)

Country Link
CN (1) CN106021026B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106998436B (en) * 2017-03-24 2020-09-01 浙江宇视科技有限公司 Video backup method and device
CN109783275A (en) * 2018-12-17 2019-05-21 北京春鸿科技有限公司 The method and terminal of file backup are carried out to multiple wifi storage equipment
CN111930566A (en) * 2020-07-28 2020-11-13 友谊时光科技股份有限公司 Data backup method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092527A (en) * 2011-10-31 2013-05-08 深圳市快播科技有限公司 Storage method and storage system for small files
CN103268290A (en) * 2013-01-04 2013-08-28 苏州懿源宏达知识产权代理有限公司 Priority-locking-based flash memory storage method
CN105045725A (en) * 2015-08-04 2015-11-11 Tcl移动通信科技(宁波)有限公司 Multi-storage-card storage realization method and system for mobile terminal
CN105245912A (en) * 2015-10-21 2016-01-13 东方网力科技股份有限公司 Methods and devices for caching video data and reading video data
CN105592123A (en) * 2014-11-12 2016-05-18 富泰华工业(深圳)有限公司 Storage management system, management apparatus and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7958303B2 (en) * 2007-04-27 2011-06-07 Gary Stephen Shuster Flexible data storage system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092527A (en) * 2011-10-31 2013-05-08 深圳市快播科技有限公司 Storage method and storage system for small files
CN103268290A (en) * 2013-01-04 2013-08-28 苏州懿源宏达知识产权代理有限公司 Priority-locking-based flash memory storage method
CN105592123A (en) * 2014-11-12 2016-05-18 富泰华工业(深圳)有限公司 Storage management system, management apparatus and method
CN105045725A (en) * 2015-08-04 2015-11-11 Tcl移动通信科技(宁波)有限公司 Multi-storage-card storage realization method and system for mobile terminal
CN105245912A (en) * 2015-10-21 2016-01-13 东方网力科技股份有限公司 Methods and devices for caching video data and reading video data

Also Published As

Publication number Publication date
CN106021026A (en) 2016-10-12

Similar Documents

Publication Publication Date Title
US10637916B2 (en) Method and device for storage resource allocation for video cloud storage
JP6881575B2 (en) Resource allocation systems, management equipment, methods and programs
CN110753131A (en) Microservice distributed current limiting method and device, storage medium and electronic equipment
US9405588B2 (en) Cloud resource allocation system and method
CN104836819A (en) Dynamic load balancing method and system, and monitoring and dispatching device
CN107278365B (en) Apparatus for scalable peer matching
JP2004021982A (en) Method and system for dynamically allocating computer system resource
WO2019170011A1 (en) Task allocation method and device, and distributed storage system
CN107026900B (en) Shooting task allocation method and device
CN112214288B (en) Pod scheduling method, device, equipment and medium based on Kubernetes cluster
CN104090806A (en) Method and device for processing upgrade patch and upgrade request
US20140244844A1 (en) Control device and resource control method
CN101510167A (en) Plug-in component operation method, apparatus and system
CN106021026B (en) Backup method and device
US20120233313A1 (en) Shared scaling server system
CN105049509A (en) Cluster scheduling method, load balancer and clustering system
CN109597800B (en) Log distribution method and device
CN110012076B (en) Connection establishing method and device
CN105915630A (en) Cross-network data transmission system and load balancing scheduling method
US20220012084A1 (en) Systems and methods for improved management of virtual machine clusters
CN111008071A (en) Task scheduling system, method and server
CN109960565B (en) Cloud platform, and virtual machine scheduling method and device based on cloud platform
CN106790354B (en) Communication method and device for preventing data congestion
CN117369941A (en) Pod scheduling method and system
US20170149893A1 (en) Metadata server, network device and automatic resource management method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant