CN118626439B - Data archiving method and electronic equipment - Google Patents
Data archiving method and electronic equipment Download PDFInfo
- Publication number
- CN118626439B CN118626439B CN202411095926.3A CN202411095926A CN118626439B CN 118626439 B CN118626439 B CN 118626439B CN 202411095926 A CN202411095926 A CN 202411095926A CN 118626439 B CN118626439 B CN 118626439B
- Authority
- CN
- China
- Prior art keywords
- data
- tape
- archiving
- target
- index area
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 73
- 230000008569 process Effects 0.000 claims description 24
- 238000013480 data collection Methods 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 10
- 230000005856 abnormality Effects 0.000 claims description 4
- 230000002159 abnormal effect Effects 0.000 abstract description 6
- 238000007726 management method Methods 0.000 description 22
- 238000013500 data storage Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 6
- 230000003203 everyday effect Effects 0.000 description 6
- 238000004891 communication Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 230000007774 longterm Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000011084 recovery Methods 0.000 description 3
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009467 reduction Effects 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 208000033748 Device issues Diseases 0.000 description 1
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 1
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 239000000306 component Substances 0.000 description 1
- 239000008358 core component Substances 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000010257 thawing Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/113—Details of archiving
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请实施例提供数据归档方法及电子设备。本申请实施例通过基于实际需求预先配置归档计划时间段和归档执行时间段,这样能够从数据采集设备所采集的数据中筛选实际所要归档的数据,提高归档数据选择的灵活性,还能够控制归档操作的执行时间,在提高归档操作执行的灵活性的同时还可以有效避免由于磁头连续工作而影响磁头使用寿命的问题。还通过在归档任务完成之后,将第一索引区中所记录的信息也同步写入至磁带中,这样能够在第一索引区出现异常而不可用时,利用已写入至磁带中的第一索引区信息恢复该第一索引区,从而避免由于第一索引区不可用而影响长周期数据归档和查询的问题,提高长周期数据归档和查询的可靠性。
The embodiments of the present application provide a data archiving method and an electronic device. The embodiments of the present application pre-configure the archiving plan time period and the archiving execution time period based on actual needs, so that the data actually to be archived can be screened from the data collected by the data acquisition device, the flexibility of archiving data selection can be improved, and the execution time of the archiving operation can be controlled. While improving the flexibility of archiving operation execution, the problem of affecting the service life of the magnetic head due to continuous operation of the magnetic head can also be effectively avoided. After the archiving task is completed, the information recorded in the first index area is also synchronously written to the magnetic tape. In this way, when the first index area is abnormal and unavailable, the first index area can be restored using the first index area information written to the magnetic tape, thereby avoiding the problem of affecting the archiving and query of long-period data due to the unavailability of the first index area, and improving the reliability of long-period data archiving and query.
Description
技术领域Technical Field
本申请涉及数据处理技术领域,尤其涉及数据归档方法及电子设备。The present application relates to the field of data processing technology, and in particular to a data archiving method and an electronic device.
背景技术Background Art
随着信息技术的快速发展,网络存储设备在数据存储等领域得到了广泛的应用,随之而来的是对长周期数据存储的迫切需求;所谓长周期数据是指数据所需保存时间大于设定时长(如一年、十年、或几十年等)的数据。With the rapid development of information technology, network storage devices have been widely used in fields such as data storage, and with it comes an urgent need for long-cycle data storage; the so-called long-cycle data refers to data that requires a storage time greater than a set time (such as one year, ten years, or several decades, etc.).
在实际应用中,磁带由于其低成本、大容量、以及长耐用性等优势,成为了长周期数据归档的最佳选择,所谓归档是指将数据从短周期存储设备(如硬盘等)中读取出来并写入至长周期存储设备(如磁带等)以供长期保存的过程。然而,目前磁带归档方案,通常是对数据采集设备(如网络摄像机、以及图片抓拍机等设备)所采集的数据连续进行归档操作,这样会导致磁带驱动器中的磁头连续工作,导致没有时间对磁带驱动器的磁头进行保养、清洗等操作,从而降低磁头的使用寿命,而磁头的使用寿命降低则会影响后续数据的归档操作。In practical applications, magnetic tape has become the best choice for long-term data archiving due to its advantages such as low cost, large capacity, and long durability. Archiving refers to the process of reading data from short-term storage devices (such as hard disks) and writing it to long-term storage devices (such as magnetic tapes) for long-term preservation. However, the current magnetic tape archiving solution usually archives the data collected by data acquisition devices (such as network cameras and image capture devices) continuously, which causes the magnetic head in the tape drive to work continuously, resulting in no time for maintenance and cleaning of the magnetic head of the tape drive, thereby reducing the service life of the magnetic head. The reduced service life of the magnetic head will affect the subsequent data archiving operations.
发明内容Summary of the invention
有鉴于此,本申请提供了数据归档方法及电子设备,以有效避免由于磁头连续工作而影响磁头使用寿命的问题,从而避免由于磁头的使用寿命降低而影响后续数据的归档操作的问题。In view of this, the present application provides a data archiving method and an electronic device to effectively avoid the problem of the service life of the magnetic head being affected by continuous operation of the magnetic head, thereby avoiding the problem of the subsequent data archiving operation being affected by the reduced service life of the magnetic head.
本申请实施例提供一种数据归档方法,该方法包括:The present application provides a data archiving method, the method comprising:
获得当前归档任务;当前归档任务用于指示在设定归档执行时间段将当前归档任务相关联的数据采集设备采集的目标数据进行归档操作;目标数据为数据采集设备在被配置的设定归档计划时间段所采集的数据;设定归档执行时间段在设定归档计划时间段之后;目标数据在被归档前从数据采集设备获得后存储至指定存储空间;Get the current archiving task; the current archiving task is used to indicate that the target data collected by the data acquisition device associated with the current archiving task is to be archived during the set archiving execution time period; the target data is the data collected by the data acquisition device during the configured set archiving plan time period; the archiving execution time period is set after the set archiving plan time period; the target data is obtained from the data acquisition device before being archived and then stored in the designated storage space;
基于已指定的第一索引区检查目标磁带是否被使用过;目标磁带用于存放被归档的目标数据;第一索引区至少记录了磁带被占用的信息;Checking whether the target tape has been used based on the designated first index area; the target tape is used to store the archived target data; the first index area at least records the information that the tape is occupied;
若目标磁带未被使用过,则将第一索引区记录的信息写入至目标磁带;If the target tape has not been used, writing the information recorded in the first index area to the target tape;
在将第一索引区记录的信息写入至目标磁带后,或者当确定出目标磁带被使用过后,检查目标磁带的可用空间是否满足容纳目标数据和第一索引区记录的信息的要求,如果是,将目标数据写入至目标磁带,如果否,将第一索引区记录的信息写入至目标磁带,将目标数据写入至其它可用磁带;After writing the information recorded in the first index area to the target tape, or when it is determined that the target tape has been used, checking whether the available space of the target tape meets the requirement of accommodating the target data and the information recorded in the first index area, if yes, writing the target data to the target tape, if not, writing the information recorded in the first index area to the target tape, and writing the target data to other available tapes;
在第一索引区记录目标数据占用磁带的信息。The information that the target data occupies the magnetic tape is recorded in the first index area.
本申请实施例还提供一种数据归档装置,该装置包括:The present application also provides a data archiving device, which includes:
获得模块,用于获得当前归档任务;当前归档任务用于指示在设定归档执行时间段将当前归档任务相关联的数据采集设备采集的目标数据进行归档操作;目标数据为数据采集设备在被配置的设定归档计划时间段所采集的数据;设定归档执行时间段在设定归档计划时间段之后;目标数据在被归档前从数据采集设备获得后存储至指定存储空间;The acquisition module is used to obtain the current archiving task; the current archiving task is used to indicate that the target data collected by the data acquisition device associated with the current archiving task is to be archived during the set archiving execution time period; the target data is the data collected by the data acquisition device during the configured set archiving plan time period; the set archiving execution time period is after the set archiving plan time period; the target data is obtained from the data acquisition device before being archived and then stored in the designated storage space;
检查模块,用于基于已指定的第一索引区检查目标磁带是否被使用过;目标磁带用于存放被归档的目标数据;第一索引区至少记录了磁带被占用的信息;The checking module is used to check whether the target tape has been used based on the specified first index area; the target tape is used to store the archived target data; the first index area at least records the information that the tape is occupied;
第一归档模块,用于若目标磁带未被使用过,则将第一索引区记录的信息写入至目标磁带;A first archiving module, used for writing the information recorded in the first index area to the target tape if the target tape has not been used;
第二归档模块,用于在将第一索引区记录的信息写入至目标磁带后,或者当确定出目标磁带被使用过后,检查目标磁带的可用空间是否满足容纳目标数据和第一索引区记录的信息的要求,如果是,将目标数据写入至目标磁带,如果否,将第一索引区记录的信息写入至目标磁带,将目标数据写入至其它可用磁带;A second archiving module is used to check whether the available space of the target tape meets the requirement of accommodating the target data and the information recorded in the first index area after writing the information recorded in the first index area to the target tape or when it is determined that the target tape has been used, and if so, write the target data to the target tape; if not, write the information recorded in the first index area to the target tape and write the target data to other available tapes;
记录模块,用于在第一索引区记录目标数据占用磁带的信息。The recording module is used to record the information that the target data occupies the magnetic tape in the first index area.
本申请实施例还提供一种电子设备,该电子设备包括:The present application also provides an electronic device, the electronic device comprising:
处理器;以及Processor; and
存储器,在该存储器中存储有计算机程序指令,计算机程序指令在被处理器运行时使得处理器执行如上方法的步骤。A memory, in which computer program instructions are stored, and when the computer program instructions are executed by a processor, the processor executes the steps of the above method.
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序指令,该计算机程序指令在被处理器运行时使得处理器执行如上方法中的步骤。An embodiment of the present application further provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps in the above method.
由以上技术方案可以看出,本申请实施例通过基于实际需求预先配置用于数据采集设备所采集数据归档的归档计划时间段和归档执行时间段,这样能够基于归档计划时间段从数据采集设备所采集的数据中筛选实际所要归档的数据,提高归档数据选择的灵活性;还能够控制归档操作的执行时间,这样在提高归档操作执行的灵活性的同时,还可以控制磁头的工作时间以有效避免由于磁头连续工作而降低磁头使用寿命的问题,从而避免由于磁头的使用寿命降低而影响后续数据的归档操作的问题;It can be seen from the above technical solutions that the embodiment of the present application pre-configures the archiving plan time period and the archiving execution time period for archiving the data collected by the data acquisition device based on actual needs, so that the data actually to be archived can be screened from the data collected by the data acquisition device based on the archiving plan time period, thereby improving the flexibility of archiving data selection; it can also control the execution time of the archiving operation, so that while improving the flexibility of the execution of the archiving operation, it can also control the working time of the magnetic head to effectively avoid the problem of reducing the service life of the magnetic head due to continuous operation of the magnetic head, thereby avoiding the problem of affecting the archiving operation of subsequent data due to the reduction of the service life of the magnetic head;
进一步地,本申请实施例在归档任务完成之后,通过将第一索引区中所记录的信息也同步写入至磁带中,这样能够在第一索引区出现异常而不可用时,利用已写入至磁带中的第一索引区信息恢复该第一索引区,从而避免由于第一索引区不可用而影响长周期数据归档和查询的问题,提高长周期数据归档和查询的可靠性。Furthermore, after the archiving task is completed, the embodiment of the present application synchronously writes the information recorded in the first index area to the tape. In this way, when the first index area becomes abnormal and unavailable, the first index area can be restored using the first index area information written to the tape, thereby avoiding the problem of long-period data archiving and querying being affected by the unavailability of the first index area, thereby improving the reliability of long-period data archiving and querying.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处的附图被并入说明书中并构成本申请的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.
图1为本申请实施例提供的方法流程图。FIG1 is a flow chart of a method provided in an embodiment of the present application.
图2为本申请实施例提供的系统结构示意图。FIG. 2 is a schematic diagram of the system structure provided in an embodiment of the present application.
图3为本申请实施例提供的存储设备的实现示意图。FIG3 is a schematic diagram of an implementation of a storage device provided in an embodiment of the present application.
图4为本申请实施例提供的可用磁带个数检测的方法流程图。FIG4 is a flow chart of a method for detecting the number of available tapes provided in an embodiment of the present application.
图5为本申请实施例提供的归档任务生成的方法流程图。FIG5 is a flow chart of a method for generating an archiving task provided in an embodiment of the present application.
图6为本申请实施例提供的归档任务删除的方法流程图。FIG6 is a flow chart of a method for deleting an archiving task provided in an embodiment of the present application.
图7为本申请实施例提供的归档任务执行的方法流程图。FIG. 7 is a flow chart of a method for executing an archiving task provided in an embodiment of the present application.
图8为本申请实施例提供的另一归档任务执行的方法流程图。FIG8 is a flow chart of another method for executing an archiving task provided in an embodiment of the present application.
图9为本申请实施例提供的又一归档任务执行的方法流程图。FIG. 9 is a flow chart of another method for executing an archiving task provided in an embodiment of the present application.
图10为本申请实施例提供的第一索引区处理的方法流程图。FIG. 10 is a flow chart of a method for processing a first index area provided in an embodiment of the present application.
图11为本申请实施例提供的数据查询的方法流程图。FIG. 11 is a flow chart of a method for data query provided in an embodiment of the present application.
图12为本申请实施例提供的第一索引区故障恢复的方法流程图。FIG. 12 is a flow chart of a method for recovering from a failure of a first index area provided in an embodiment of the present application.
图13为本申请实施例提供的一种装置结构图。FIG. 13 is a structural diagram of a device provided in an embodiment of the present application.
图14为本申请实施例提供的电子设备结构示意图。FIG. 14 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
具体实施方式DETAILED DESCRIPTION
为了使本领域技术人员更好地理解本申请实施例提供的技术方案,并使本申请实施例的上述目的、特征和优点能够更加明显易懂,下面结合附图对本申请实施例中技术方案作进一步详细的说明。In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings.
参见图1,图1为本申请实施例提供的方法流程图。该方法应用于电子设备。在本实施例中,该电子设备比如可以为微型电脑、以及服务器等设备,本实施例不作具体限定。Referring to FIG. 1 , FIG. 1 is a flow chart of a method provided in an embodiment of the present application. The method is applied to an electronic device. In the present embodiment, the electronic device may be, for example, a microcomputer, a server, or other device, which is not specifically limited in the present embodiment.
如图1所示,该流程可包括以下步骤:As shown in Figure 1, the process may include the following steps:
步骤101,获得当前归档任务。Step 101, obtain the current archiving task.
在本实施例中,当前归档任务是针对将某一数据采集设备所采集的数据进行归档的任务,也就是说,当前归档任务关联一个对应的数据采集设备。In this embodiment, the current archiving task is a task for archiving data collected by a certain data collection device, that is, the current archiving task is associated with a corresponding data collection device.
在本实施例中,针对上述数据采集设备会配置一个归档执行时间段(也即设定归档执行时间段)和一个归档计划时间段(也即设定归档计划时间段)。基于此,本实施例中,本电子设备可先将从上述数据采集设备所获得的数据存储在指定存储空间中;之后,在获得与上述数据采集设备相关联的当前归档任务时,可在上述设定归档执行时间段从指定存储空间中读取目标数据并进行归档操作;这里,目标数据是指上述数据采集设备在上述设定归档计划时间段所采集的数据。In this embodiment, an archiving execution time period (i.e., a set archiving execution time period) and an archiving plan time period (i.e., a set archiving plan time period) are configured for the above-mentioned data acquisition device. Based on this, in this embodiment, the electronic device can first store the data obtained from the above-mentioned data acquisition device in the designated storage space; thereafter, when the current archiving task associated with the above-mentioned data acquisition device is obtained, the target data can be read from the designated storage space in the above-mentioned set archiving execution time period and archiving operations can be performed; here, the target data refers to the data collected by the above-mentioned data acquisition device in the above-mentioned set archiving plan time period.
在本实施例中,上述数据采集设备是指具备数据采集以及存储功能的设备;作为一个实施例,数据采集设备比如可以包括但不限于网络摄像机、图片抓拍机、数字视频录像机、以及网络视频录像机等。In this embodiment, the above-mentioned data acquisition device refers to a device with data acquisition and storage functions; as an embodiment, the data acquisition device may include but is not limited to a network camera, a picture capture machine, a digital video recorder, and a network video recorder.
可选地,作为一个实施例,本实施例可针对同一数据采集设备,预先为该数据采集设备配置有至少一个设定归档计划时间段、以及至少一个设定归档执行时间段。这里,设定归档计划时间段是指预先设定的待归档的数据所处的数据采集时间段;设定归档执行时间段是指预先设定的待归档的数据被执行归档操作的时间段。其中,设定归档执行时间段在设定归档计划时间段之后;比如,设定归档计划时间段为某日的9:00至12:00(记为9:00-12:00),而设定归档执行时间段要晚于设定归档计划时间段,比如可以为该日的16:00-18:00。Optionally, as an embodiment, this embodiment can pre-configure at least one set archiving plan time period and at least one set archiving execution time period for the same data acquisition device. Here, the set archiving plan time period refers to the pre-set data acquisition time period for the data to be archived; the set archiving execution time period refers to the pre-set time period for the data to be archived to be archived. The archiving execution time period is set after the archiving plan time period; for example, the archiving plan time period is set to 9:00 to 12:00 on a certain day (recorded as 9:00-12:00), and the archiving execution time period is set later than the archiving plan time period, for example, it can be 16:00-18:00 on that day.
本实施例并非对数据采集设备所采集的所有数据均进行归档,而是为数据采集设备预先配置用于数据归档的归档计划时间段和归档执行时间段,以基于实际需求选择性的进行数据归档,这样能够提高数据归档的灵活性。This embodiment does not archive all data collected by the data acquisition device, but pre-configures the data acquisition device with an archiving plan time period and an archiving execution time period for data archiving, so as to selectively archive data based on actual needs, thereby improving the flexibility of data archiving.
可选地,作为一个实施例,上述指定存储空间可以为在本电子设备上所预先配置的存储空间。作为另一个实施例,可以单独设置一个用于短周期(如一个月、或半年等)存储数据的存储设备,这里,存储设备可以直接获得数据采集设备所采集的数据,或者,接收本电子设备所传输的数据采集设备所采集的数据,等等,本实施例不作具体限定;基于此,上述指定存储空间可以为在该存储设备上所预先配置的存储空间。Optionally, as an embodiment, the above-mentioned designated storage space can be a storage space pre-configured on the electronic device. As another embodiment, a storage device for storing data for a short period (such as one month, or half a year, etc.) can be separately set up. Here, the storage device can directly obtain the data collected by the data acquisition device, or receive the data collected by the data acquisition device transmitted by the electronic device, etc., which is not specifically limited in this embodiment; based on this, the above-mentioned designated storage space can be a storage space pre-configured on the storage device.
至于本步骤中如何获得当前归档任务,下文会举例描述,这里暂不赘述。As for how to obtain the current archiving task in this step, an example will be given below and will not be described here.
步骤102,基于已指定的第一索引区检查目标磁带是否被使用过;若否,则执行步骤103;若是,则执行步骤104。Step 102 , based on the designated first index area, check whether the target tape has been used; if not, execute step 103 ; if yes, execute step 104 .
在本实施例中,本电子设备外接一个磁带库;磁带库是指基于磁带的备份系统,如磁带库可以由至少一个磁带驱动器、机械臂、多个磁带、以及多个用于承载磁带的磁带槽组成。其中,磁带库可通过所配置的机械臂以实现磁带驱动器中磁带的拆卸和装填。磁带是指一种用于记录声音、图像、数字或其他信号的载有磁层的带状材料。磁带驱动器是指用于读写磁带的组件,其核心部件是磁头,在具体实现时比如是通过磁头接触磁带以进行数据的读写操作。In this embodiment, the electronic device is connected to an external tape library; the tape library refers to a tape-based backup system, such as a tape library that can be composed of at least one tape drive, a mechanical arm, multiple tapes, and multiple tape slots for carrying tapes. The tape library can realize the removal and loading of tapes in the tape drive through the configured mechanical arm. Tape refers to a strip-shaped material with a magnetic layer for recording sound, images, digital or other signals. The tape drive refers to a component for reading and writing tapes, and its core component is the magnetic head. In the specific implementation, for example, the magnetic head contacts the tape to perform data reading and writing operations.
上述目标磁带是指磁带库中当前正在使用的磁带,比如是指当前位于磁带驱动器中的磁带。这里,目标磁带用于存放被归档的目标数据。The target tape is a tape currently in use in a tape library, such as a tape currently in a tape drive. Here, the target tape is used to store the target data to be archived.
上述第一索引区至少记录了磁带被占用的信息。这里对磁带被占用的信息的具体内容不作限定,比如可包括被占用磁带的磁带标识等信息;这里的磁带标识比如可以为磁带编号(如1、2、3等)等。基于此,作为一个实施例,本步骤102中的基于已指定的第一索引区检查目标磁带是否被使用过,在具体实现时比如可以为:先获得磁带库中当前位于磁带驱动器中的磁带的磁带标识以作为目标磁带的磁带标识;之后,从第一索引区中检查是否存在与目标磁带的磁带标识相匹配的磁带标识,若存在,则确定目标磁带被使用过,否则确定目标磁带未被使用过。The first index area at least records the information that the tape is occupied. The specific content of the information that the tape is occupied is not limited here, for example, it may include information such as the tape identification of the occupied tape; the tape identification here may be, for example, the tape number (such as 1, 2, 3, etc.). Based on this, as an embodiment, the step 102 checks whether the target tape has been used based on the specified first index area. In specific implementation, for example, it may be: first obtain the tape identification of the tape currently located in the tape drive in the tape library as the tape identification of the target tape; then, check from the first index area whether there is a tape identification that matches the tape identification of the target tape. If so, it is determined that the target tape has been used, otherwise it is determined that the target tape has not been used.
可选地,与上述指定存储空间的配置类似,本步骤中的第一索引区可以为在本电子设备上所预先配置的区域;也可以为在上述存储设备上所预先配置的区域,本实施例不作具体限定。本实施例无需额外引入一个硬件设备如元数据服务器以用于记录第一索引区所记录的信息,而是通过在本电子设备或上述存储设备中配置第一索引区,这样不仅能够降低硬件成本,还能够有效避免由于元数据服务器的硬件稳定性和使用寿命而影响其所包含第一索引区信息的可用性的问题。Optionally, similar to the configuration of the above-mentioned designated storage space, the first index area in this step can be an area pre-configured on the electronic device; it can also be an area pre-configured on the above-mentioned storage device, which is not specifically limited in this embodiment. This embodiment does not need to introduce an additional hardware device such as a metadata server to record the information recorded in the first index area, but by configuring the first index area in the electronic device or the above-mentioned storage device, it can not only reduce the hardware cost, but also effectively avoid the problem of the availability of the first index area information contained therein being affected by the hardware stability and service life of the metadata server.
步骤103,将第一索引区记录的信息写入至目标磁带;并继续执行步骤104。Step 103 , writing the information recorded in the first index area to the target magnetic tape; and continuing to step 104 .
在本实施例中,在确定目标磁带未被使用过时,先将第一索引区记录的信息写入至目标磁带中。作为一个实施例,本步骤中将第一索引区记录的信息写入至目标磁带中,在具体实现时比如可以为:将第一索引区记录的信息先转换为文件,之后将该文件写入至目标磁带中。这里对于将该文件写入至目标磁带中的存储位置不作具体限定,比如可以为目标磁带的带头位置。In this embodiment, when it is determined that the target tape has not been used, the information recorded in the first index area is first written into the target tape. As an embodiment, in this step, the information recorded in the first index area is written into the target tape. In a specific implementation, for example, the information recorded in the first index area is first converted into a file, and then the file is written into the target tape. Here, there is no specific limitation on the storage location where the file is written into the target tape, for example, it can be the tape head position of the target tape.
在本实施例中,由于磁带库中的磁带有可能在进入磁带库之前已被使用过,其上可能残留有旧数据,因此,为了避免磁带上残留的旧数据对本实施例中所归档的数据造成影响,作为一个实施例,在将第一索引区记录的信息写入至目标磁带中之前,还可先检查一下目标磁带上是否存在残留的旧数据,若是,则需要将该目标磁带上残留的旧数据删除。In this embodiment, since the tapes in the tape library may have been used before entering the tape library, there may be old data remaining on them. Therefore, in order to avoid the old data remaining on the tapes affecting the data archived in this embodiment, as an embodiment, before writing the information recorded in the first index area to the target tape, it is also possible to check whether there is any old data remaining on the target tape. If so, it is necessary to delete the old data remaining on the target tape.
步骤104,检查目标磁带的可用空间是否满足容纳上述目标数据和第一索引区记录的信息的要求;若是,则执行步骤105;否则,执行步骤106。Step 104, check whether the available space of the target tape meets the requirement of accommodating the above-mentioned target data and the information recorded in the first index area; if so, execute step 105; otherwise, execute step 106.
在本实施例中,在将第一索引区记录的信息写入至目标磁带后,或者当确定出目标磁带被使用过后,检查目标磁带的可用空间是否满足容纳目标数据和第一索引区记录的信息的要求,如果是,则执行步骤105,如果否,则执行步骤106。In this embodiment, after the information recorded in the first index area is written to the target tape, or when it is determined that the target tape has been used, check whether the available space of the target tape meets the requirements for accommodating the target data and the information recorded in the first index area. If so, execute step 105; if not, execute step 106.
作为一个实施例,上述步骤101中的目标数据在存储至指定存储空间后,还需将该目标数据在指定存储空间的占用情况记录至已指定的第二索引区;这里对于该占用情况的具体内容不作限定,比如该占用情况至少包括目标数据的大小、以及目标数据的存储位置等。至于第二索引区的配置,与上述步骤102中的第一索引区的配置类似,这里不再赘述。As an embodiment, after the target data in the above step 101 is stored in the designated storage space, the occupation status of the target data in the designated storage space needs to be recorded in the designated second index area; the specific content of the occupation status is not limited here, for example, the occupation status at least includes the size of the target data and the storage location of the target data, etc. As for the configuration of the second index area, it is similar to the configuration of the first index area in the above step 102, and will not be repeated here.
基于如上描述,作为一个实施例,本步骤104中的检查目标磁带的可用空间是否满足容纳上述目标数据和第一索引区记录的信息的要求,在具体实现时比如可为:先从第二索引区获得目标数据的大小;之后,检查目标磁带的可用空间大小是否大于或等于目标数据的大小以及第一索引区记录的信息的大小的总和,如果是,则确定目标磁带的可用空间满足容纳目标数据和第一索引区记录的信息的要求,如果否,则确定目标磁带的可用空间不满足容纳目标数据和第一索引区记录的信息的要求。Based on the above description, as an embodiment, the step 104 of checking whether the available space of the target tape meets the requirement of accommodating the above-mentioned target data and the information recorded in the first index area may be specifically implemented as follows: first obtain the size of the target data from the second index area; then, check whether the size of the available space of the target tape is greater than or equal to the sum of the size of the target data and the size of the information recorded in the first index area; if so, determine that the available space of the target tape meets the requirement of accommodating the target data and the information recorded in the first index area; if not, determine that the available space of the target tape does not meet the requirement of accommodating the target data and the information recorded in the first index area.
步骤105,将上述目标数据写入至目标磁带;并继续执行步骤107。Step 105 , writing the target data to the target tape; and continuing to step 107 .
在本实施例中,在确定目标磁带的可用空间满足容纳目标数据和第一索引区记录的信息的要求后,将目标数据写入至该目标磁带。In this embodiment, after determining that the available space of the target tape meets the requirement of accommodating the target data and the information recorded in the first index area, the target data is written to the target tape.
作为一个实施例,本步骤105中的将目标数据写入目标磁带的具体实现方式有很多,比如,基于如上描述,可先从上述第二索引区中获得目标数据在指定存储空间中的存储位置;之后,可基于该存储位置从指定存储空间中读取目标数据并写入至目标磁带中。As an embodiment, there are many specific implementation methods for writing the target data to the target tape in step 105. For example, based on the above description, the storage position of the target data in the specified storage space can be obtained from the second index area; then, the target data can be read from the specified storage space based on the storage position and written to the target tape.
在本实施例中,可针对同一数据采集设备,预先为该数据采集设备配置要采集的数据的数据类型,比如为网络摄像机配置的要采集的数据的数据类型为视频类型,为图片抓拍机配置的要采集的数据的数据类型为图片类型,等等。也就是说,目标数据的数据类型可以包括视频类型、以及图片类型等。其中,由于视频数据在指定存储空间中通常是以流式存储方式进行存储的,而不是以文件形式进行存储的;基于此,作为一个实施例,在目标数据为视频数据的情况下,上述在基于该存储位置从指定存储空间中读取目标数据之后,还需先将该目标数据转换为文件,再将该文件写入至目标磁带。In this embodiment, for the same data acquisition device, the data type of the data to be collected can be configured in advance for the data acquisition device, such as the data type of the data to be collected configured for the network camera is a video type, the data type of the data to be collected configured for the image capture machine is a picture type, and so on. That is to say, the data type of the target data may include a video type, a picture type, and so on. Among them, since the video data is usually stored in a designated storage space in a streaming storage manner rather than in a file form; based on this, as an embodiment, in the case where the target data is video data, after reading the target data from the designated storage space based on the storage location, the target data needs to be converted into a file first, and then the file is written to the target tape.
步骤106,将第一索引区记录的信息写入至目标磁带,将目标数据写入至其它可用磁带;并继续执行步骤107。Step 106 , writing the information recorded in the first index area to the target magnetic tape, and writing the target data to other available magnetic tapes; and continuing to execute step 107 .
在本实施例中,在确定目标磁带的可用空间不满足容纳目标数据和第一索引区记录的信息的要求后,先将第一索引区记录的信息写入至目标磁带,之后从磁带库中确定一个其他可用磁带以将目标数据写入至该其它可用磁带。至于如何将目标数据写入至其它可用磁带,与上述步骤105中的如何将目标数据写入至目标磁带类似,这里不再赘述。In this embodiment, after determining that the available space of the target tape does not meet the requirement of accommodating the target data and the information recorded in the first index area, the information recorded in the first index area is first written to the target tape, and then another available tape is determined from the tape library to write the target data to the other available tape. As for how to write the target data to the other available tape, it is similar to how to write the target data to the target tape in the above step 105, and will not be repeated here.
在本实施例中,基于如上描述可知,第一索引区中磁带被占用的信息可包括被占用磁带的磁带标识;基于此,作为一个实施例,本步骤106中的其它可用磁带的确定方式比如可包括:可先基于第一索引区记录的磁带被占用的信息确定被占用磁带的磁带标识;之后,依据所确定的被占用磁带的磁带标识、以及磁带库中所有磁带的磁带标识从磁带库中确定一个当前未被占用的磁带,如从磁带库中查找出第一索引区中记录的磁带标识之外的其中一个磁带标识所对应的磁带以作为当前未被占用的磁带,并将该未被占用的磁带作为其它可用磁带。In this embodiment, based on the above description, it can be known that the information on the occupied tape in the first index area may include the tape identification of the occupied tape; based on this, as an embodiment, the method for determining other available tapes in this step 106 may include, for example: first determining the tape identification of the occupied tape based on the information on the occupied tape recorded in the first index area; then, determining a currently unoccupied tape from the tape library based on the determined tape identification of the occupied tape and the tape identifications of all tapes in the tape library, such as searching the tape library for a tape corresponding to one of the tape identifications other than the tape identification recorded in the first index area as the currently unoccupied tape, and using the unoccupied tape as another available tape.
在本实施例中,作为一个实施例,在上述确定其它可用磁带之后,还可将该其它可用磁带更新为当前正在使用的磁带,如通知磁带库将该其它可用磁带装填至磁带驱动器中;之后,再执行将目标数据写入至其它可用磁带的步骤。In this embodiment, as an embodiment, after determining other available tapes as mentioned above, the other available tapes can also be updated to the tapes currently in use, such as notifying the tape library to load the other available tapes into the tape drive; thereafter, the step of writing the target data to the other available tapes is executed.
步骤107,在第一索引区记录目标数据占用磁带的信息。Step 107, recording the information that the target data occupies the magnetic tape in the first index area.
在本实施例中,在将目标数据写入至对应的磁带中之后,即可认为是完成了上述目标数据的归档操作,此时可在第一索引区中记录目标数据占用磁带的信息。In this embodiment, after the target data is written into the corresponding magnetic tape, it can be considered that the archiving operation of the target data is completed. At this time, the information that the target data occupies the magnetic tape can be recorded in the first index area.
可选地,作为一个实施例,本实施例中第一索引区记录的信息在写入至目标磁带之后,也可以在第一索引区中记录目标磁带被第一索引区记录的信息所占用的信息。Optionally, as an embodiment, after the information recorded in the first index area in this embodiment is written to the target tape, information occupied by the information recorded in the first index area in the target tape may also be recorded in the first index area.
至此,完成图1所示流程。At this point, the process shown in Figure 1 is completed.
通过图1所示流程可以看出,本申请实施例通过基于实际需求预先配置用于数据采集设备所采集数据归档的归档计划时间段和归档执行时间段,这样能够基于归档计划时间段从数据采集设备所采集的数据中筛选实际所要归档的数据,提高归档数据选择的灵活性;还能够控制归档操作的执行时间,这样在提高归档操作执行的灵活性的同时,还可以控制磁头的工作时间以有效避免由于磁头连续工作而降低磁头使用寿命的问题,从而避免由于磁头的使用寿命降低而影响后续数据的归档操作的问题;It can be seen from the process shown in FIG. 1 that the embodiment of the present application pre-configures the archiving plan time period and the archiving execution time period for archiving the data collected by the data acquisition device based on actual needs, so that the data actually to be archived can be screened from the data collected by the data acquisition device based on the archiving plan time period, thereby improving the flexibility of archiving data selection; it can also control the execution time of the archiving operation, so that while improving the flexibility of the execution of the archiving operation, it can also control the working time of the magnetic head to effectively avoid the problem of reducing the service life of the magnetic head due to continuous operation of the magnetic head, thereby avoiding the problem of affecting the archiving operation of subsequent data due to the reduction of the service life of the magnetic head;
进一步地,本申请实施例在执行归档任务的过程中,通过将第一索引区中所记录的信息也同步写入至磁带中,这样能够在第一索引区出现异常而不可用时,利用已写入至磁带中的第一索引区信息恢复该第一索引区,从而避免由于第一索引区不可用而影响长周期数据归档和查询的问题,提高长周期数据归档和查询的可靠性。Furthermore, in the process of executing the archiving task, the embodiment of the present application synchronously writes the information recorded in the first index area to the magnetic tape. In this way, when the first index area becomes abnormal and unavailable, the first index area can be restored using the first index area information written to the magnetic tape, thereby avoiding the problem of long-period data archiving and querying being affected by the unavailability of the first index area, thereby improving the reliability of long-period data archiving and querying.
作为一个实施例,本申请实施例还提供了一种数据归档系统。下面对该数据归档系统进行描述:As an embodiment, the present application also provides a data archiving system. The data archiving system is described below:
参见图2所示,该系统200包括:数据采集设备201、管理设备202、存储设备203、以及磁带库204。As shown in FIG. 2 , the system 200 includes: a data acquisition device 201 , a management device 202 , a storage device 203 , and a tape library 204 .
下面对上述存储设备进行描述:The above storage devices are described below:
在本实施例中,数据采集设备与存储设备连接,该存储设备用于获得数据采集设备所采集的数据并对所获得的数据进行短周期存储。作为一个实施例,参见图3所示,该存储设备300至少包括存储空间301、解冻空间302、第一索引区303、以及第二索引区304。In this embodiment, the data acquisition device is connected to a storage device, and the storage device is used to obtain the data collected by the data acquisition device and store the obtained data for a short period of time. As an embodiment, referring to FIG3 , the storage device 300 at least includes a storage space 301, a thawing space 302, a first index area 303, and a second index area 304.
其中,存储空间是指存储设备中所预先配置的一个数据存储区域,也即上述步骤101中的指定存储空间。存储设备在获得数据采集设备所采集的数据之后,可将所获得的数据存储至存储空间中。The storage space refers to a data storage area pre-configured in the storage device, that is, the designated storage space in the above step 101. After obtaining the data collected by the data collection device, the storage device can store the obtained data in the storage space.
解冻空间是指存储设备中所预先配置的另一个数据存储区域,解冻空间可用于存储从磁带库的磁带中所读取出的数据。A ThawSpace is another data storage area pre-configured in a storage device. A ThawSpace can be used to store data read from tapes in a tape library.
可选地,存储设备中所配置的存储空间和解冻空间可以是合并在一起的数据存储区域,也可以是独立的两个数据存储区域,本实施例不作具体限定。Optionally, the storage space and the thaw space configured in the storage device may be a combined data storage area, or may be two independent data storage areas, which is not specifically limited in this embodiment.
第一索引区是指存储设备中所预先配置的又一个数据存储区域。这里对于第一索引区所记录的信息不作具体限定,比如可包括被占用磁带的磁带标识、被占用磁带上每一数据所来自的数据采集设备的设备标识(如设备名称和设备编号等)、所处的采集时间段、以及数据标识(如数据对应的文件名称等),等等。由此可见,若第一索引区损坏将会使得磁带被数据占用的信息丢失,从而造成磁带上数据的不可查询。The first index area refers to another data storage area pre-configured in the storage device. The information recorded in the first index area is not specifically limited here, for example, it may include the tape identification of the occupied tape, the device identification of the data acquisition device from which each data on the occupied tape comes (such as the device name and device number, etc.), the acquisition time period, and the data identification (such as the file name corresponding to the data, etc.), etc. It can be seen that if the first index area is damaged, the information occupied by the data on the tape will be lost, making the data on the tape unqueryable.
第二索引区是指存储设备中所预先配置的又一个数据存储区域。这里对于第二索引区所记录的信息也不作具体限定,比如可包括存储空间中的每一数据所来自的数据采集设备的设备标识、数据采集时间戳、数据大小、以及在存储空间中的存储位置,等等。The second index area refers to another data storage area pre-configured in the storage device. The information recorded in the second index area is not specifically limited here, for example, it may include the device identification of the data acquisition device from which each data in the storage space comes, the data acquisition timestamp, the data size, and the storage location in the storage space, etc.
可选地,存储设备中所配置的第一索引区和第二索引区可以是合并在一起的数据存储区域,也可以是独立的两个数据存储区域,本实施例不作具体限定。Optionally, the first index area and the second index area configured in the storage device may be a data storage area that is merged together, or may be two independent data storage areas, which is not specifically limited in this embodiment.
可选地,上述存储空间、解冻空间、第一索引区、以及第二索引区的实现方式比如可以是硬盘、闪存芯片、固态硬盘(Solid State Disk,SSD)、基于互联网协议的存储局域网络(Internet Protocol Storage Area Network,IPSAN)、以及网络附加存储(NetworkAttached Storage,NAS)等,本实施例不作具体限定。Optionally, the above-mentioned storage space, thaw space, first index area, and second index area may be implemented, for example, by a hard disk, a flash memory chip, a solid state disk (SSD), an Internet Protocol Storage Area Network (IPSAN), and a network attached storage (NAS), etc., which is not specifically limited in this embodiment.
下面对上述管理设备进行描述:The above management equipment is described below:
管理设备可认为是指用于执行上述本实施例所提供的数据归档方法的电子设备。比如,管理设备可用于数据采集设备的接入管理、数据采集设备的工作模式的管理、数据的写入和读取管理、以及数据的归档管理等等。这里工作模式可包括视频类型的数据的采集、以及图片类型的数据的采集等模式。The management device can be considered to refer to an electronic device used to execute the data archiving method provided in the above embodiment. For example, the management device can be used for access management of data acquisition devices, management of working modes of data acquisition devices, management of data writing and reading, and data archiving management, etc. Here, the working mode may include the collection of video-type data and the collection of picture-type data.
可选地,管理设备和存储设备可以合并为一个电子设备,也可以是独立的两个电子设备,两设备之间通过网络连接,本实施例不作具体限定。其中,在管理设备和存储设备为一个电子设备的情况下,管理设备可以为电子设备中的微处理器或处理芯片等,而存储设备可以为电子设备中的存储介质如硬盘等。Optionally, the management device and the storage device may be combined into one electronic device, or may be two independent electronic devices, which are connected via a network, and this embodiment does not specifically limit this. Where the management device and the storage device are one electronic device, the management device may be a microprocessor or processing chip in the electronic device, and the storage device may be a storage medium such as a hard disk in the electronic device.
下面对上述磁带库进行描述:The following is a description of the above tape library:
磁带库中可包括多个磁带;磁带库可通过其内部配置的机械臂控制磁带进出磁带库中的磁带驱动器以实现当前正在使用的磁带的切换。在磁带库需要更换磁带的情况下,需要人工辅助进行磁带进入磁带库和退出磁带库的操作。The tape library can include multiple tapes; the tape library can control the tapes in and out of the tape drives in the tape library through the mechanical arm configured inside the tape library to switch the tape currently in use. When the tape library needs to replace the tape, manual assistance is required to enter and exit the tape library.
以上对本实施例提供的数据归档系统进行了描述。下面基于如上描述的系统,站在管理设备的角度上对本申请实施例提供的数据归档方法进行描述:The data archiving system provided by this embodiment is described above. Based on the system described above, the data archiving method provided by this embodiment of the application is described from the perspective of a management device:
步骤一,初始化存储设备中的存储空间、解冻空间、第一索引区、以及第二索引区的配置。Step 1: Initialize the configuration of the storage space, the thaw space, the first index area, and the second index area in the storage device.
在本实施例中,初始化配置可以是管理设备自动进行配置,也可以是人工通过管理设备进行配置,本实施例不作具体限定。相应的,这里对于初始化配置的具体内容也不作限定,可基于实际需求进行设定,比如可包括所占用的存储空间的大小和位置等。In this embodiment, the initialization configuration may be automatically configured by the management device or manually configured by the management device, which is not specifically limited in this embodiment. Accordingly, the specific content of the initialization configuration is not limited here either, and may be set based on actual needs, such as including the size and location of the occupied storage space.
步骤二,配置每个数据采集设备的工作模式、数据采集时间段、以及用于指示数据归档的归档策略。Step 2: configure the working mode, data collection time period, and archiving strategy for indicating data archiving of each data collection device.
在本实施例中,可基于实际需求为每个数据采集设备预先配置对应的数据采集时间段以及归档策略;这里归档策略可包括至少一个设定归档计划时间段、以及至少一个设定归档执行时间段,本实施例不作具体限定。In this embodiment, the corresponding data collection time period and archiving strategy can be pre-configured for each data collection device based on actual needs; the archiving strategy here may include at least one set archiving plan time period and at least one set archiving execution time period, which is not specifically limited in this embodiment.
其中,数据采集时间段是指预先设定的数据采集设备采集数据时的采集时间段,如可以包括采集起始时间和采集结束时间;比如可以为8:00-20:00。The data collection time period refers to a pre-set collection time period when the data collection device collects data, such as including a collection start time and a collection end time; for example, it may be 8:00-20:00.
设定归档计划时间段是指预先设定的待归档数据所处的采集时间段,如可以包括归档计划起始时间和归档计划结束时间。设定归档计划时间段可以为从数据采集时间段中所选择的部分或全部时间段,比如可以为9:00-12:00。The archiving plan time period is a pre-set collection time period for the data to be archived, which may include the archiving plan start time and the archiving plan end time. The archiving plan time period may be part or all of the time period selected from the data collection time period, such as 9:00-12:00.
设定归档执行时间段是指预先设定的对待归档数据执行归档操作的时间段,如可以包括归档执行起始时间和归档执行结束时间。设定归档执行时间段在归档计划时间段之后,比如可以为21:00-23:00。The archiving execution time period is a pre-set time period for archiving data, which may include an archiving execution start time and an archiving execution end time. The archiving execution time period is set after the archiving plan time period, which may be 21:00-23:00, for example.
可选地,不同数据采集设备采集的数据的类型相同时,各数据采集设备所对应配置的设定归档执行时间段可以相同,也可以不同。而不同数据采集设备采集的数据的类型不同时,该不同数据采集设备被配置的设定归档执行时间段不相交,这样能够避免不同类型的数据(如视频数据和图片数据等)之间的交叉归档,提高用户体验。Optionally, when the types of data collected by different data collection devices are the same, the set archiving execution time periods configured by the data collection devices can be the same or different. When the types of data collected by different data collection devices are different, the set archiving execution time periods configured by the different data collection devices do not intersect, which can avoid cross-archiving between different types of data (such as video data and image data, etc.) and improve user experience.
步骤三,控制存储设备基于每个数据采集设备所配置的数据采集时间段获得各数据采集设备所采集的数据,并将所获得的数据存储至存储空间中。Step three, controlling the storage device to obtain the data collected by each data collection device based on the data collection time period configured by each data collection device, and storing the obtained data in the storage space.
这里,在将所获得的数据存储至存储空间中之后,同步更新第二索引区所记录的信息。Here, after the acquired data is stored in the storage space, the information recorded in the second index area is synchronously updated.
示例性的,管理设备为数据采集设备A配置的工作模式是视频类型的数据的采集模式,所配置的数据采集时间段为8:00-20:00,设定归档计划时间段为9:00-12:00,设定归档执行时间段为21:00-23:00。也就是说,存储设备每天8:00-20:00从数据采集设备A获取视频数据12个小时,并将所获得的视频数据都保存至存储空间中;其中,将数据采集设备A在9:00-12:00这3个小时所采集的视频数据作为待归档数据(也即上述目标数据),待归档数据将在21:00开始被执行从存储空间写入至磁带库的磁带中的归档操作,并在23:00结束该归档操作。Exemplarily, the working mode configured by the management device for the data acquisition device A is the acquisition mode of video type data, the configured data acquisition time period is 8:00-20:00, the archiving plan time period is set to 9:00-12:00, and the archiving execution time period is set to 21:00-23:00. That is to say, the storage device obtains video data from the data acquisition device A for 12 hours from 8:00 to 20:00 every day, and saves all the obtained video data into the storage space; wherein, the video data collected by the data acquisition device A in the three hours from 9:00 to 12:00 is used as the data to be archived (that is, the above-mentioned target data), and the data to be archived will be executed from the storage space to the tape of the tape library for archiving at 21:00, and the archiving operation will end at 23:00.
又一示例性的,管理设备为数据采集设备B配置的工作模式是图片类型的数据的采集模式,所配置的数据获取时间段为10:00-18:00,设定归档计划时间段设置为10:00-15:00,设定归档执行时间段为23:10-23:30。也就是说,存储设备每天10:00-18:00从数据采集设备B获取抓拍的图片数据8个小时,并将所获得的图片数据都保存至存储空间中;其中,将数据采集设备B在10:00-15:00这5个小时所采集的图片数据作为待归档数据,比如在这5小时内数据采集设备B抓拍了1000张图片,这1000张图片将作为待归档数据在23:10开始被执行从存储空间写入至磁带库的磁带中的归档操作,并在23:30结束该归档操作。In another exemplary embodiment, the management device configures the working mode of the data acquisition device B as a data acquisition mode of the image type, the configured data acquisition time period is 10:00-18:00, the archiving plan time period is set to 10:00-15:00, and the archiving execution time period is set to 23:10-23:30. That is to say, the storage device obtains the captured image data from the data acquisition device B for 8 hours every day from 10:00 to 18:00, and saves the obtained image data to the storage space; wherein, the image data collected by the data acquisition device B in the 5 hours from 10:00 to 15:00 is used as the data to be archived. For example, if the data acquisition device B captures 1,000 images within these 5 hours, these 1,000 images will be used as the data to be archived and the archiving operation of writing them from the storage space to the tape of the tape library will be executed at 23:10, and the archiving operation will end at 23:30.
步骤四,磁带库中的剩余可用磁带的个数检测流程。Step 4: Detection process of the number of remaining available tapes in the tape library.
在本实施例中,参见图4所示,以磁带库中每个磁带的磁带标识为磁带编号为例,上述检测磁带库中的剩余可用磁带的个数的方法流程可包括如下步骤:In this embodiment, referring to FIG. 4 , taking the tape identifier of each tape in the tape library as the tape number as an example, the method flow for detecting the number of remaining available tapes in the tape library may include the following steps:
步骤401,基于第一索引区记录的信息确定被占用磁带的磁带编号,依据该被占用磁带的磁带编号、以及磁带库中所有磁带的磁带编号,确定出磁带库中未被占用磁带的个数。Step 401, determine the tape number of the occupied tape based on the information recorded in the first index area, and determine the number of unoccupied tapes in the tape library according to the tape number of the occupied tape and the tape numbers of all tapes in the tape library.
在本实施例中,依据该被占用磁带的磁带编号、以及磁带库中所有磁带的磁带编号,确定出磁带库中未被占用磁带的个数,在具体实现时比如可为:将磁带库中磁带编号与被占用磁带的磁带编号不同的磁带确定为未被占用磁带,基于此,可确定出磁带库中未被占用磁带的个数。这里的未被占用磁带即可认为是指剩余可用磁带。In this embodiment, the number of unoccupied tapes in the tape library is determined based on the tape number of the occupied tape and the tape numbers of all tapes in the tape library. In a specific implementation, for example, the tapes in the tape library with tape numbers different from the tape number of the occupied tape are determined as unoccupied tapes, and based on this, the number of unoccupied tapes in the tape library can be determined. The unoccupied tapes here can be considered to refer to the remaining available tapes.
步骤402,判断未被占用磁带的个数是否小于预设数值;若是,则执行步骤403;若否,则返回执行步骤401。Step 402, determine whether the number of unoccupied tapes is less than a preset value; if so, execute step 403; if not, return to execute step 401.
这里的预设数值可基于实际需求灵活设定,比如可以为0、1或2等。The preset value here can be flexibly set based on actual needs, for example, it can be 0, 1 or 2.
步骤403,发出预警以提示磁带库的磁带不足需更换磁带,并在更换完成之后返回执行步骤401。Step 403, a warning is issued to prompt that the tape library is running low on tapes and needs to be replaced, and the process returns to step 401 after the replacement is completed.
这里,在发出预警之后,需要人工给磁带库更换补充新的磁带,并在补充完成之后返回执行步骤401。Here, after the early warning is issued, it is necessary to manually replace and replenish the tape library with new tapes, and return to execute step 401 after the replenishment is completed.
示例性的,管理设备通过存储设备检测磁带库中所有磁带的磁带编号001、002、003、004共计4个磁带,将所有磁带的磁带编号在第一索引区进行检索;如果得到编号001、002、003 这3个磁带已经被占用,则可以计算得到磁带库中还剩余1个磁带004未被占用,此时剩余可用磁带个数(即1)大于预设数值0,无需预警提示。如果得到编号001、002、003、004这4个磁带已经被占用,则可以计算得到磁带库中还剩余0个磁带未被占用,此时剩余可用磁带个数(即0)等于预设数值0,此时管理设备发出预警以提示磁带库的磁带不足需更换磁带。Exemplarily, the management device detects the tape numbers 001, 002, 003, and 004 of all the tapes in the tape library through the storage device, and retrieves the tape numbers of all the tapes in the first index area; if the three tapes with numbers 001, 002, and 003 are occupied, it can be calculated that there is one tape 004 left in the tape library that is not occupied. At this time, the number of remaining available tapes (i.e., 1) is greater than the preset value 0, and no warning prompt is required. If the four tapes with numbers 001, 002, 003, and 004 are occupied, it can be calculated that there are 0 tapes left in the tape library that are not occupied. At this time, the number of remaining available tapes (i.e., 0) is equal to the preset value 0. At this time, the management device issues a warning to prompt that the tape library is insufficient and needs to be replaced.
步骤五,归档执行时间段检测流程。Step 5: Archive the execution time period detection process.
作为一个实施例,可基于设定归档执行时间段的起始时间生成归档任务,其在具体实现时比如可以为:针对每一数据采集设备,检查该数据采集设备被配置的设定归档执行时间段的起始时间是否与当前时间匹配;若匹配,则检查归档任务列表中是否存在与该数据采集设备相关联的归档任务,如果否,则生成该数据采集设备相关联的归档任务并加入至归档任务列表中,如果是,则返回针对每一数据采集设备,检查该数据采集设备被配置的设定归档执行时间段的起始时间是否与当前时间匹配的步骤。而若不匹配,则跳过该数据采集设备。As an embodiment, an archiving task can be generated based on the start time of the archiving execution time period. In a specific implementation, for example, the following can be done: for each data acquisition device, check whether the start time of the archiving execution time period configured for the data acquisition device matches the current time; if it matches, check whether there is an archiving task associated with the data acquisition device in the archiving task list; if not, generate the archiving task associated with the data acquisition device and add it to the archiving task list; if so, return to the step of checking whether the start time of the archiving execution time period configured for the data acquisition device matches the current time for each data acquisition device. If it does not match, skip the data acquisition device.
举例来说,参见图5所示,上述基于设定归档执行时间段的起始时间生成归档任务的方法流程可包括如下步骤:For example, referring to FIG5 , the method flow for generating an archiving task based on setting the start time of the archiving execution time period may include the following steps:
步骤501,针对每一数据采集设备,检查该数据采集设备被配置的设定归档执行时间段的起始时间是否与当前时间匹配,若匹配,则执行步骤502。Step 501 , for each data acquisition device, check whether the start time of the archiving execution time period configured for the data acquisition device matches the current time. If so, execute step 502 .
这里,若不匹配,则可跳过该数据采集设备。Here, if there is no match, the data acquisition device can be skipped.
步骤502,判断归档任务列表中是否包含该数据采集设备相关联的归档任务,若否,则执行步骤503;若是,则返回执行步骤501。Step 502 , determining whether the archiving task list contains the archiving task associated with the data acquisition device, if not, executing step 503 ; if yes, returning to executing step 501 .
这里,该数据采集设备相关联的归档任务是指包含该数据采集设备的设备标识以及设定归档执行时间段的归档任务。Here, the archiving task associated with the data acquisition device refers to the archiving task including the device identification of the data acquisition device and a set archiving execution time period.
步骤503,生成该数据采集设备相关联的归档任务并加入至归档任务列表中,并返回执行步骤501。Step 503 , generating an archiving task associated with the data acquisition device and adding it to the archiving task list, and returning to execute step 501 .
在本实施例中,对于所生成的与该数据采集设备相关联的归档任务的数量和具体内容不作限定;比如,在该数据采集设备配置有多个设定归档执行时间段和多个设定归档计划时间段的情况下,所生成的与该数据采集设备相关联的归档任务可以为多个,其中每个归档任务可包括该数据采集设备的设备标识、该数据采集设备的一个设定归档执行时间段、以及一个或多个设定归档计划时间段。In this embodiment, there is no limitation on the number and specific content of the generated archiving tasks associated with the data acquisition device; for example, when the data acquisition device is configured with multiple set archiving execution time periods and multiple set archiving plan time periods, the generated archiving tasks associated with the data acquisition device may be multiple, each of which may include the device identification of the data acquisition device, a set archiving execution time period of the data acquisition device, and one or more set archiving plan time periods.
又比如,在该数据采集设备配置有一个设定归档执行时间段和多个设定归档计划时间段的情况下,所生成的与该数据采集设备相关联的归档任务可以为一个,该归档任务可包括该数据采集设备的设备标识、该数据采集设备的一个设定归档执行时间段、以及该数据采集设备的所有设定归档计划时间段;等等。For another example, when the data acquisition device is configured with one set archiving execution time period and multiple set archiving plan time periods, the archiving task generated and associated with the data acquisition device may be one, and the archiving task may include the device identification of the data acquisition device, one set archiving execution time period of the data acquisition device, and all set archiving plan time periods of the data acquisition device; and so on.
可选地,由于存在不同数据采集设备之间的设定归档执行时间段相同的情况,因此,在上述检查每一数据采集设备被配置的设定归档执行时间段的起始时间是否与当前时间匹配的过程中,若发现存在多个数据采集设备的设定归档执行时间段的起始时间与当前时间相匹配,则可将各数据采集设备所生成的归档任务按照设定规则依次加入至归档任务列表中。这里的设定规则,比如可以为数据采集设备的设备编号的先后顺序,或者预设的数据采集设备的优先级等,本实施例不作具体限定。Optionally, since there is a situation where different data acquisition devices have the same set archiving execution time period, therefore, in the above process of checking whether the start time of the set archiving execution time period configured for each data acquisition device matches the current time, if it is found that the start time of the set archiving execution time period of multiple data acquisition devices matches the current time, the archiving tasks generated by each data acquisition device can be added to the archiving task list in sequence according to the set rules. The set rules here, for example, can be the order of the device numbers of the data acquisition devices, or the priority of the preset data acquisition devices, etc., which are not specifically limited in this embodiment.
基于如上描述,作为一个实施例,上述步骤101中的获得当前归档任务的具体实现方式有很多,比如,可按照加入至归档任务列表的时间先后顺序,从归档任务列表中获得一个归档任务以作为当前归档任务,具体的,比如,可从归档任务列表中选择加入至归档任务列表的时间最早的一个归档任务作为当前归档任务。Based on the above description, as an embodiment, there are many specific implementation methods for obtaining the current archiving task in the above step 101. For example, an archiving task can be obtained from the archiving task list in the order of the time of being added to the archiving task list as the current archiving task. Specifically, for example, an archiving task that was added to the archiving task list the earliest can be selected from the archiving task list as the current archiving task.
作为一个实施例,可基于设定归档执行时间段的结束时间对归档任务列表中的归档任务进行删除处理,其在具体实现时比如可以为:先检查归档任务列表中是否存在归档任务,若归档任务列表中存在归档任务,则从归档任务列表中获得加入至归档任务列表的时间最早的归档任务以作为目标归档任务;之后,检查该目标归档任务指示的设定归档执行时间段的结束时间是否与当前时间匹配。若匹配,则检查该目标归档任务的执行状态是否为用于表示执行中的第一状态,如果是,停止执行该目标归档任务,并从归档任务列表中删除该目标归档任务,如果否,从归档任务列表中删除该目标归档任务。而若不匹配,或者在从归档任务列表中删除该目标归档任务后,则返回检查归档任务列表中是否存在归档任务的步骤。As an embodiment, the archiving tasks in the archiving task list can be deleted based on the end time of the set archiving execution time period. In the specific implementation, for example, it can be as follows: first check whether there is an archiving task in the archiving task list. If there is an archiving task in the archiving task list, obtain the archiving task that is added to the archiving task list the earliest from the archiving task list as the target archiving task; then, check whether the end time of the set archiving execution time period indicated by the target archiving task matches the current time. If it matches, check whether the execution status of the target archiving task is the first state used to indicate that it is in execution. If so, stop executing the target archiving task and delete the target archiving task from the archiving task list. If not, delete the target archiving task from the archiving task list. If it does not match, or after deleting the target archiving task from the archiving task list, return to the step of checking whether there is an archiving task in the archiving task list.
举例来说,参见图6所示,上述基于设定归档执行时间段的结束时间对归档任务列表中的归档任务进行删除处理的方法流程可包括如下步骤:For example, referring to FIG. 6 , the method flow for deleting the archiving tasks in the archiving task list based on the end time of the archiving execution time period may include the following steps:
步骤601,检查归档任务列表中是否存在归档任务;若是,则执行步骤602;若否,则继续执行本步骤601。Step 601 , check whether there is an archiving task in the archiving task list; if so, execute step 602 ; if not, continue to execute this step 601 .
步骤602,从归档任务列表中获得加入至归档任务列表的时间最早的归档任务以作为目标归档任务,检查该目标归档任务指示的设定归档执行时间段的结束时间是否与当前时间匹配;若是,则执行步骤603;若否,则返回执行步骤601。Step 602, obtain the earliest archiving task added to the archiving task list from the archiving task list as the target archiving task, and check whether the end time of the set archiving execution time period indicated by the target archiving task matches the current time; if so, execute step 603; if not, return to execute step 601.
步骤603,检查该目标归档任务的执行状态是否为用于表示执行中的第一状态;若是,则执行步骤604;若否,则执行步骤605。Step 603 , checking whether the execution status of the target archiving task is the first status indicating that it is being executed; if so, executing step 604 ; if not, executing step 605 .
步骤604,停止执行该目标归档任务,并继续执行步骤605。Step 604 , stop executing the target archiving task, and continue to execute step 605 .
步骤605,从归档任务列表中删除该目标归档任务,并返回执行步骤601。Step 605 , deleting the target archiving task from the archiving task list, and returning to step 601 .
步骤六,归档任务执行流程。Step 6: Archive task execution process.
在本实施例中,需说明的是,归档任务列表中的归档任务按照加入至归档任务列表的时间先后顺序执行,通常执行完一个归档任务后才会触发执行下一个归档任务。In this embodiment, it should be noted that the archiving tasks in the archiving task list are executed in the order of the time when they are added to the archiving task list, and usually the execution of the next archiving task is triggered only after the execution of one archiving task is completed.
归档任务按照待归档数据(即目标数据)的数据类型可以分为以下两类:视频数据类型的归档任务、图片数据类型的归档任务。不同类型的归档任务对应不同的归档任务执行流程。Archiving tasks can be divided into the following two categories according to the data type of the data to be archived (i.e., target data): archiving tasks for video data types and archiving tasks for image data types. Different types of archiving tasks correspond to different archiving task execution processes.
作为一个实施例,参见图7所示,本步骤六中的归档任务执行的方法流程包括如下步骤:As an embodiment, referring to FIG. 7 , the method flow for executing the archiving task in step six includes the following steps:
步骤701,判断归档任务列表中是否存在归档任务;若是,则执行步骤702;若否,则继续执行本步骤701。Step 701, determine whether there is an archiving task in the archiving task list; if yes, execute step 702; if no, continue to execute this step 701.
步骤702,按照加入至归档任务列表的时间先后顺序,从归档任务列表中获得当前归档任务。Step 702: Obtain the current archiving task from the archiving task list in the order of time when the task was added to the archiving task list.
步骤703,若当前归档任务为视频数据类型的归档任务,则根据当前归档任务的设定归档计划时间段从存储空间获取对应的视频数据以作为目标数据,并将目标数据写入至磁带中,并继续执行步骤705。Step 703, if the current archiving task is an archiving task of the video data type, obtain the corresponding video data from the storage space as the target data according to the set archiving plan time period of the current archiving task, write the target data to the tape, and continue to execute step 705.
步骤704,若当前归档任务为图片数据类型的归档任务,则根据当前归档任务的设定归档计划时间段从存储空间获取对应的图片以作为目标数据,并将目标数据写入磁带中,并继续执行步骤705。Step 704, if the current archiving task is an archiving task of the picture data type, obtain the corresponding picture from the storage space as the target data according to the set archiving plan time period of the current archiving task, write the target data into the tape, and continue to execute step 705.
步骤705,当前归档任务执行完成后,在归档任务列表中删除该当前归档任务,并返回执行步骤701。Step 705 , after the current archiving task is executed, the current archiving task is deleted from the archiving task list, and the process returns to step 701 .
在本实施例中,作为一个实施例,在对上述目标数据进行归档操作时,在目标数据的数据量较大的情况下,可以将目标数据分为多个批次以得到多个子目标数据,之后对每个子目标数据进行相应的归档操作,这样能够避免由于一次归档的待归档数据的数据量较大而导致资源占用率过高以及设备性能下降等的情况。其中,各个批次下的子目标数据可按照所处的采集时间段的先后顺序被执行归档操作。In this embodiment, as an embodiment, when the target data is archived, if the target data has a large amount of data, the target data can be divided into multiple batches to obtain multiple sub-target data, and then each sub-target data is archived accordingly, so as to avoid the situation where the resource usage rate is too high and the device performance is reduced due to the large amount of data to be archived at one time. The sub-target data under each batch can be archived in the order of the collection time period.
基于如上描述,下面对上述步骤703的具体实现过程进行描述:Based on the above description, the specific implementation process of the above step 703 is described below:
作为一个实施例,以将目标数据分为多个批次之后再进行归档操作为例,参见图8所示,上述步骤703的具体实现过程如下:As an embodiment, taking the case where the target data is divided into multiple batches and then archived, as shown in FIG8 , the specific implementation process of the above step 703 is as follows:
步骤801,针对当前批次下的子目标数据,从第二索引区中获得当前批次下的子目标数据在存储空间中的存储位置和大小。Step 801, for the sub-target data in the current batch, obtain the storage location and size of the sub-target data in the current batch in the storage space from the second index area.
步骤802,在第一索引区中查询当前批次下的子目标数据是否已经完成归档操作,如果是,则执行步骤803;如果否,则执行步骤804。Step 802, query in the first index area whether the sub-target data under the current batch has completed the archiving operation, if yes, execute step 803; if not, execute step 804.
这里,若在第一索引区中能够查询到当前批次下的子目标数据对应的索引信息,则可确定当前批次下的子目标数据已完成归档操作,否则,确定当前批次下的子目标数据未完成归档操作。Here, if the index information corresponding to the sub-target data in the current batch can be queried in the first index area, it can be determined that the sub-target data in the current batch has completed the archiving operation, otherwise, it is determined that the sub-target data in the current batch has not completed the archiving operation.
步骤803,在当前批次不为最后一个批次时,将未被归档的批次中的一个批次作为当前批次,并返回步骤801。Step 803 , when the current batch is not the last batch, one of the batches that have not been archived is used as the current batch, and the process returns to step 801 .
步骤804,将第一索引区所记录的信息以文件的形式写入至目标磁带;并继续执行步骤805。Step 804 , writing the information recorded in the first index area to the target tape in the form of a file; and continuing to execute step 805 .
至于如何将第一索引区所记录的信息以文件的形式写入至目标磁带,下文会举例描述,这里暂不赘述。As for how to write the information recorded in the first index area into the target magnetic tape in the form of a file, an example will be given below to describe it, and no further details will be given here.
步骤805,从存储空间中读取当前批次下的子目标数据后,再将所读取的数据以文件的形式写入至目标磁带中。Step 805, after reading the sub-target data of the current batch from the storage space, the read data is written into the target tape in the form of a file.
这里,文件的名称可以基于数据采集设备的设备标识(如设备名称和设备编号等)、以及数据所处的数据采集时间段(如包括起始时间和结束时间)来确定。Here, the name of the file may be determined based on the device identification of the data acquisition device (such as the device name and device number, etc.) and the data acquisition time period (such as including the start time and the end time) of the data.
步骤806,更新第一索引区所记录的信息,并在当前批次不为最后一个批次时,将未被归档的批次中的一个批次作为当前批次,返回步骤801。Step 806 , updating the information recorded in the first index area, and when the current batch is not the last batch, taking one of the batches that have not been archived as the current batch, and returning to step 801 .
在当前批次为最后一个批次时,则表示当前归档任务对应的目标数据已全部完成归档操作,此时可认为当前归档任务已执行完成。When the current batch is the last batch, it means that the target data corresponding to the current archiving task has completed the archiving operation. At this time, it can be considered that the current archiving task has been completed.
这里,对如何更新第一索引区所记录的信息不作具体限定;比如,如表1所示,可在第一索引区中记录当前批次下的子目标数据所对应的归档次序、设定归档计划时间段(如包括子目标数据的起始时间和结束时间)、文件名称(如包括数据采集设备的设备标识以及设定归档计划时间段)、以及所占用磁带的磁带编号之间的对应关系。Here, there is no specific limitation on how to update the information recorded in the first index area; for example, as shown in Table 1, the first index area may record the corresponding archiving order of the sub-target data under the current batch, the set archiving plan time period (such as including the start time and end time of the sub-target data), the file name (such as including the device identification of the data acquisition device and the set archiving plan time period), and the correspondence between the tape numbers of the occupied tapes.
表1:第一索引区Table 1: First index area
示例性的,数据采集设备A进行每天8:00-20:00的录像,存储设备每天8:00-20:00从数据采集设备A获取视频数据12个小时,并将所获得的视频数据都保存至存储空间中,管理设备为该数据采集设备A配置的设定归档计划时间段为9:00-12:00,设定归档执行时间段为21:00-23:00。之后,管理设备在在执行对应的归档任务时,将数据采集设备A在9:00-12:00这3个小时所采集的视频数据,每次读取1小时的数据,这样可以分成3个批次从存储空间读取视频数据后再以文件的形式写入至磁带中;该归档任务执行到23:00结束。For example, data acquisition device A records video from 8:00 to 20:00 every day, and the storage device obtains video data from data acquisition device A for 12 hours from 8:00 to 20:00 every day, and saves all the obtained video data in the storage space. The management device configures the archiving plan time period for the data acquisition device A to be 9:00-12:00, and the archiving execution time period to be 21:00-23:00. Afterwards, when executing the corresponding archiving task, the management device reads 1 hour of data each time from the video data collected by data acquisition device A during the three hours from 9:00 to 12:00, so that the video data can be divided into three batches and then written to the tape in the form of files after reading from the storage space; the archiving task is executed until 23:00.
下面对上述步骤704的具体实现过程进行描述:The specific implementation process of the above step 704 is described below:
作为一个实施例,以将目标数据分为多个批次(如以一个图片为一个批次)之后再进行归档操作为例,参见图9所示,上述步骤704的具体实现过程如下:As an embodiment, taking the case where the target data is divided into multiple batches (such as one picture as one batch) and then archived, as shown in FIG. 9 , the specific implementation process of the above step 704 is as follows:
步骤901,针对当前图片,从第二索引区获得当前图片在存储空间中的存储位置和大小。Step 901: For a current picture, obtain the storage position and size of the current picture in the storage space from the second index area.
步骤902,在第一索引区中查询当前图片是否已经完成归档操作,如果是,则执行步骤903;如果否,则执行步骤904。Step 902, query in the first index area whether the current picture has completed the archiving operation, if yes, execute step 903; if not, execute step 904.
这里,当前图片即可理解为当前批次下的子目标数据。Here, the current image can be understood as the sub-target data under the current batch.
在第一索引区中查询当前图片是否已经完成归档操作,在具体实现时比如可为:若在第一索引区中能够查询到当前图片对应的索引信息,则可确定当前图片已完成归档操作,否则,确定当前图片未完成归档操作。In the first index area, it is queried whether the current image has completed the archiving operation. In the specific implementation, for example, if the index information corresponding to the current image can be queried in the first index area, it can be determined that the current image has completed the archiving operation; otherwise, it is determined that the current image has not completed the archiving operation.
步骤903,在当前图片不为目标数据中最后一个未被归档的图片时,将目标数据中未被归档的图片中的一个图片作为当前图片,并返回步骤901。Step 903 , when the current picture is not the last unarchived picture in the target data, one of the unarchived pictures in the target data is used as the current picture, and the process returns to step 901 .
步骤904,将第一索引区所记录的信息以文件的形式写入至目标磁带。Step 904: Write the information recorded in the first index area to the target tape in the form of a file.
步骤905,从存储空间中读取当前图片后,将当前图片写入至目标磁带中。Step 905, after reading the current picture from the storage space, write the current picture to the target tape.
这里,由于图片本身就是以文件的形式保存在存储空间中,即图片本身就是一个文件,因此无需再进行转换为文件的过程。图片的名称可以基于数据采集设备的设备标识(如设备名称和设备编号等)、以及图片的采集时间戳等来确定,此处不作具体限定。Here, since the image itself is stored in the storage space in the form of a file, that is, the image itself is a file, there is no need to convert it into a file. The name of the image can be determined based on the device identification of the data acquisition device (such as the device name and device number, etc.) and the acquisition timestamp of the image, which is not specifically limited here.
步骤906,更新第一索引区所记录的信息,并在当前图片不为目标数据中最后一个未被归档的图片时,将目标数据中未被归档的图片中的一个图片作为当前图片,返回步骤901。Step 906, updating the information recorded in the first index area, and when the current picture is not the last unarchived picture in the target data, taking one of the unarchived pictures in the target data as the current picture, and returning to step 901.
在当前图片为目标数据中最后一个未被归档的图片时,则表示当前归档任务对应的目标数据已全部完成归档操作,此时可认为当前归档任务已执行完成。When the current image is the last unarchived image in the target data, it means that the target data corresponding to the current archiving task has completed the archiving operation. At this time, it can be considered that the current archiving task has been completed.
这里,对如何更新第一索引区所记录的信息不作具体限定;比如,如表2所示,可在第一索引区中记录当前图片所对应的归档次序、图片的采集时间戳、文件名称、以及所占用磁带的磁带编号之间的对应关系。Here, there is no specific limitation on how to update the information recorded in the first index area; for example, as shown in Table 2, the corresponding relationship between the filing order corresponding to the current picture, the acquisition timestamp of the picture, the file name, and the tape number of the occupied tape can be recorded in the first index area.
表2:第一索引区Table 2: First index area
示例性的,数据采集设备B进行每天10:00-18:00的图片抓拍,存储设备每天10:00-18:00从数据采集设备B获取抓拍图片数据8个小时,并将所获得的图片数据都保存至存储空间中,管理设备为该数据采集设备B配置的设定归档计划时间段为10:00-15:00,设定归档执行时间段为23:10-23:30。如果在10:00-15:00这5小时内数据采集设备B抓拍了1000张图片,这1000张图片将在23:10开始进行从存储空间归档到磁带库的磁带中的归档操作。For example, data acquisition device B captures pictures from 10:00 to 18:00 every day, and the storage device obtains captured picture data from data acquisition device B for 8 hours from 10:00 to 18:00 every day, and saves all the obtained picture data in the storage space. The management device configures the archiving plan time period for the data acquisition device B to be 10:00-15:00, and the archiving execution time period to be 23:10-23:30. If data acquisition device B captures 1,000 pictures within the 5 hours from 10:00 to 15:00, these 1,000 pictures will be archived from the storage space to the tapes in the tape library starting at 23:10.
之后,管理设备在在执行对应的归档任务时,将数据采集设备B在10:00-15:00这5个小时所采集的1000张图片,按采集时间的先后顺序每次从存储空间读取1个图片并写入至磁带库的磁带中,反复执行1000次后完成该归档任务;该归档任务执行到23:30结束。Afterwards, when the management device executes the corresponding archiving task, it reads the 1000 pictures collected by the data acquisition device B in the five hours from 10:00 to 15:00, one picture at a time from the storage space in the order of collection time and writes them to the tape in the tape library. After repeating this 1000 times, the archiving task is completed; the archiving task is executed until 23:30.
下面对上述如何将第二索引区所记录的信息以文件的形式写入至目标磁带进行描述:The following describes how to write the information recorded in the second index area to the target tape in the form of a file:
作为一个实施例,参见图10所示,上述将第二索引区所记录的信息以文件的形式写入至目标磁带,在具体实现时可包括如下步骤:As an embodiment, referring to FIG. 10 , the above-mentioned writing of the information recorded in the second index area into the target magnetic tape in the form of a file may include the following steps in specific implementation:
步骤1001,在第一索引区中查询目标磁带是否被使用过;若否,则执行步骤1002;若是,则执行步骤1005。Step 1001, query in the first index area whether the target tape has been used; if not, execute step 1002; if yes, execute step 1005.
步骤1002,检查目标磁带上是否有残留的旧数据;若是,则执行步骤1003;若否,则执行步骤1004。Step 1002, check whether there is any old data remaining on the target tape; if so, execute step 1003; if not, execute step 1004.
步骤1003,删除目标磁带中残留的旧数据;并继续执行步骤1004。Step 1003, delete the old data remaining in the target tape; and continue to execute step 1004.
步骤1004,将第一索引区记录的信息以文件的形式写入至目标磁带的带头;并继续执行步骤1005。Step 1004 , write the information recorded in the first index area into the header of the target tape in the form of a file; and continue to execute step 1005 .
步骤1005,检查目标磁带的可用空间大小是否大于或等于当前批次下的子目标数据的大小以及第一索引区记录的信息的大小的总和;若是,则执行步骤1006;若否,则执行步骤1007。Step 1005, check whether the available space size of the target tape is greater than or equal to the sum of the size of the sub-target data under the current batch and the size of the information recorded in the first index area; if so, execute step 1006; if not, execute step 1007.
步骤1006,退出本流程。Step 1006, exit this process.
步骤1007,将第一索引区记录的信息以文件的形式写入至目标磁带的带尾;继续执行步骤1008。Step 1007 , write the information recorded in the first index area to the end of the target tape in the form of a file; and proceed to step 1008 .
这里,若目标磁带的可用空间大小大于或等于当前批次下的子目标数据的大小以及第一索引区记录的信息的大小的总和,则表明目标磁带的可用空间足够容纳当前批次下的子目标数据以及第一索引区记录的信息,此时可退出本流程,返回执行上述将当前批次下的子目标数据写入目标磁带的步骤(即上述步骤804或步骤904)。Here, if the available space size of the target tape is greater than or equal to the sum of the size of the sub-target data under the current batch and the size of the information recorded in the first index area, it means that the available space of the target tape is sufficient to accommodate the sub-target data under the current batch and the information recorded in the first index area. At this time, you can exit this process and return to execute the above step of writing the sub-target data under the current batch to the target tape (that is, the above step 804 or step 904).
若目标磁带的可用空间大小小于当前批次下的子目标数据的大小以及第一索引区记录的信息的大小的总和,则表明目标磁带无法容纳当前批次下的子目标数据以及第一索引区记录的信息,此时可先将第一索引区记录的信息以文件的形式写入至目标磁带的带尾中,之后从磁带库中确定一个其它可用磁带以用于存储当前批次下的子目标数据。If the available space size of the target tape is smaller than the sum of the size of the sub-target data in the current batch and the size of the information recorded in the first index area, it means that the target tape cannot accommodate the sub-target data in the current batch and the information recorded in the first index area. At this time, the information recorded in the first index area can be written to the tail of the target tape in the form of a file, and then another available tape can be determined from the tape library to store the sub-target data in the current batch.
步骤1008,从磁带库中确定其它可用磁带,并将该其它可用磁带作为目标磁带,返回步骤1001。Step 1008 , determine other available tapes from the tape library, and use the other available tapes as target tapes, and return to step 1001 .
至于如何从磁带库中确定其它可用磁带,可参见上述步骤106中的相关描述,这里不再赘述。As for how to determine other available tapes from the tape library, please refer to the relevant description in the above step 106, which will not be repeated here.
本实施例中,为避免由于存储设备中第一索引区损坏而导致归档数据的无法查询的问题,本实施例在归档任务完成之后会在磁带中备份第一索引区所记录的信息,这样能够保证在第一索引区发生异常损坏时,可以通过磁带中所备份的第一索引区信息以对存储设备中的第一索引区进行数据恢复。In this embodiment, in order to avoid the problem of being unable to query archived data due to damage to the first index area in the storage device, this embodiment will back up the information recorded in the first index area on the tape after the archiving task is completed. This can ensure that when the first index area is abnormally damaged, the first index area information backed up on the tape can be used to restore data in the first index area in the storage device.
步骤七:数据的查询流程。Step 7: Data query process.
在本实施例中,作为一个实施例,在接收到外部的数据查询指令时,先检查当前归档任务列表中是否存在归档任务;其中,数据查询指令至少指示了所要查询的查询数据所来自的数据采集设备的设备标识、以及查询数据所处的查询时间段;In this embodiment, as an embodiment, when receiving an external data query instruction, first check whether there is an archiving task in the current archiving task list; wherein the data query instruction at least indicates the device identification of the data acquisition device from which the query data to be queried comes, and the query time period in which the query data is located;
之后,若当前归档任务列表中没有归档任务,则依据数据查询指令以及第二索引区检查指定存储空间中是否存在数据查询指令对应的查询数据;如果是,则基于数据查询指令指示的查询时间段以及设备标识,从第二索引区中获得查询数据对应的存储位置,基于存储位置获得查询数据并输出;如果否,则基于数据查询指令指示的查询时间段以及设备标识,从第一索引区获得查询数据所占用的磁带、以及查询数据对应的数据标识,基于查询数据对应的数据标识从查询数据所占用的磁带中获得查询数据并输出;Afterwards, if there is no archiving task in the current archiving task list, check whether there is query data corresponding to the data query instruction in the specified storage space according to the data query instruction and the second index area; if yes, obtain the storage location corresponding to the query data from the second index area based on the query time period and the device identification indicated by the data query instruction, obtain the query data based on the storage location and output it; if not, obtain the magnetic tape occupied by the query data and the data identification corresponding to the query data from the first index area based on the query time period and the device identification indicated by the data query instruction, obtain the query data from the magnetic tape occupied by the query data based on the data identification corresponding to the query data and output it;
若当前归档任务列表中有归档任务,则输出数据查询失败的指示信息。If there is an archiving task in the current archiving task list, an indication message indicating that the data query failed is output.
在本实施例中,作为一个实施例,上述基于查询数据对应的数据标识从查询数据所占用的磁带中获得查询数据并输出,在具体实现时比如可以为:先基于磁带库中所有磁带的磁带标识检查磁带库中是否存在查询数据所占用的磁带;之后,如果磁带库中存在查询数据所占用的磁带,则检查指定解冻空间(也即上述的解冻空间)的可用空间大小是否大于或等于预设阈值,如果是,则基于查询数据对应的数据标识从查询数据所占用的磁带中读取查询数据并写入至指定解冻空间中,如果否,则清理指定解冻空间中写入至指定解冻空间的时间最早的数据,并返回检查指定解冻空间的可用空间大小是否大于或等于预设阈值的步骤;最后,基于查询数据对应的数据标识从指定解冻空间中获得查询数据并输出。这里的数据标识可以为文件名称等。In this embodiment, as an embodiment, the query data is obtained and outputted from the tape occupied by the query data based on the data identifier corresponding to the query data. In a specific implementation, for example, it can be: first, based on the tape identifiers of all tapes in the tape library, check whether there is a tape occupied by the query data in the tape library; then, if there is a tape occupied by the query data in the tape library, check whether the available space size of the designated thawspace (that is, the above-mentioned thawspace) is greater than or equal to a preset threshold value, if so, read the query data from the tape occupied by the query data based on the data identifier corresponding to the query data and write it to the designated thawspace, if not, clear the earliest data written to the designated thawspace in the designated thawspace, and return to the step of checking whether the available space size of the designated thawspace is greater than or equal to the preset threshold value; finally, obtain the query data from the designated thawspace based on the data identifier corresponding to the query data and output it. The data identifier here can be a file name, etc.
举例来说,参见图11所示,本步骤七中的数据查询的方法流程可包括如下步骤:For example, referring to FIG. 11 , the data query method flow in step seven may include the following steps:
步骤1101,接收外部的数据查询指令。Step 1101, receiving an external data query instruction.
这里,数据查询指令至少指示了所要查询的查询数据所来自的数据采集设备的设备标识、以及查询数据所处的查询时间段。比如,数据查询指令可以为“查找数据采集设备A在2024年4月29日8点到10点之间所采集的数据”等;基于此,设备标识可为“数据采集设备A”,查询时间段可为“2024年4月29日8点到10点”。Here, the data query instruction at least indicates the device identification of the data acquisition device from which the query data to be queried comes, and the query time period in which the query data is located. For example, the data query instruction may be "search for data collected by data acquisition device A between 8:00 and 10:00 on April 29, 2024"; based on this, the device identification may be "data acquisition device A" and the query time period may be "8:00 to 10:00 on April 29, 2024".
步骤1102,检查当前归档任务列表中是否有归档任务;若是,则执行步骤1103;若否,则执行步骤1104。Step 1102 , check whether there is an archiving task in the current archiving task list; if so, execute step 1103 ; if not, execute step 1104 .
步骤1103,返回数据查询失败的指示信息。Step 1103, returning information indicating that the data query failed.
这里,为了避免数据查询和归档任务执行之间的互相影响,在当前归档任务列表中有归档任务时,优先执行归档任务。Here, in order to avoid mutual influence between data query and archiving task execution, when there is an archiving task in the current archiving task list, the archiving task is executed first.
步骤1104,在第二索引区中查询存储空间中是否存在所要查询的查询数据;若是,则执行步骤1105;若否,则执行步骤1106。Step 1104 , query whether the storage space in the second index area contains the query data to be queried; if so, execute step 1105 ; if not, execute step 1106 .
步骤1105,基于数据查询指令指示的查询时间段以及设备标识,从第二索引区中获得查询数据对应的存储位置,基于存储位置获得查询数据并输出。Step 1105, based on the query time period indicated by the data query instruction and the device identification, obtain the storage location corresponding to the query data from the second index area, obtain the query data based on the storage location and output it.
步骤1106,基于数据查询指令指示的查询时间段以及设备标识,从第一索引区获得查询数据所占用的磁带、查询数据对应的文件个数、文件名称、以及文件大小以作为查询结果;并继续执行步骤1107。Step 1106, based on the query time period indicated by the data query instruction and the device identification, obtain from the first index area the tape occupied by the query data, the number of files corresponding to the query data, the file name, and the file size as the query result; and continue to execute step 1107.
步骤1107,在发现磁带库中存在上述查询结果指示的磁带时,判断解冻空间的可用空间大小是否大于或等于预设阈值;若是,则执行步骤1108;若否,则执行步骤1109。Step 1107, when it is found that the tape indicated by the above query result exists in the tape library, determine whether the available space size of the thaw space is greater than or equal to the preset threshold; if so, execute step 1108; if not, execute step 1109.
这里,针对上述查询结果指示的每个磁带,若发现磁带库中不存在该磁带,则需发出提示以指示该磁带不存在于磁带库中,此时需人工将该磁带放入磁带库中,之后继续执行下述的步骤。Here, for each tape indicated by the above query result, if it is found that the tape does not exist in the tape library, a prompt needs to be issued to indicate that the tape does not exist in the tape library. At this time, the tape needs to be manually placed in the tape library, and then continue to execute the following steps.
步骤1108,基于查询数据对应的数据标识从上述查询结果指示的磁带中读取查询数据,并将所读取的查询数据写入至解冻空间中;继续执行步骤1110。Step 1108 , reading the query data from the tape indicated by the query result based on the data identifier corresponding to the query data, and writing the read query data into the ThawSpace; then proceed to step 1110 .
步骤1109,清理解冻空间中写入至解冻空间的时间最早的文件,并返回执行步骤1107。Step 1109 , clear the earliest file written to the ThawSpace in the ThawSpace, and return to step 1107 .
步骤1110,基于上述查询结果所指示的文件名称从解冻空间中读取与该文件名称相匹配的文件以作为查询数据并输出。Step 1110: Based on the file name indicated by the query result, a file matching the file name is read from the ThawSpace and output as query data.
步骤七,第一索引区的故障恢复流程。Step 7: Failure recovery process of the first index area.
作为一个实施例,当发现第一索引区出现异常时,先基于磁带库的各磁带中所记录数据对应的数据标识检查磁带库的各磁带中是否存在至少一个候选数据;这里,候选数据是指指示第一索引区信息的数据;之后,若存在至少一个候选数据,则基于磁带库的各磁带中所记录数据对应的写入至磁带的时间从磁带库的各磁带中确定参考数据并清空第一索引区,从磁带库中读取参考数据并写入至第一索引区,以实现第一索引区信息的恢复。这里,参考数据是指写入至磁带的时间最晚的候选数据。As an embodiment, when an abnormality is found in the first index area, first check whether there is at least one candidate data in each tape of the tape library based on the data identifier corresponding to the data recorded in each tape of the tape library; here, the candidate data refers to the data indicating the information of the first index area; then, if there is at least one candidate data, then determine the reference data from each tape of the tape library based on the time when the data recorded in each tape of the tape library is written to the tape and clear the first index area, read the reference data from the tape library and write it to the first index area, so as to realize the recovery of the information of the first index area. Here, the reference data refers to the candidate data with the latest time of being written to the tape.
至于如何检查第一索引区是否存在异常,下文会举例描述,这里暂不赘述。As for how to check whether there is an abnormality in the first index area, an example will be given below and will not be described here.
示例性的,参见图12所示,本步骤七中的第一索引区的故障恢复流程可包括如下步骤:Exemplarily, referring to FIG. 12 , the failure recovery process of the first index area in step seven may include the following steps:
步骤1201,检查存储设备的第一索引区是否出现异常;若是,则执行步骤1202;若否,则继续执行本步骤1201。Step 1201, check whether the first index area of the storage device is abnormal; if so, execute step 1202; if not, continue to execute this step 1201.
本实施例中,检查存储设备的第一索引区是否出现异常的具体实现方式有很多,比如可为:在发现第一索引区不可访问时,或者,在发现第一索引区的不可访问次数大于设定数值时,确定第一索引区出现异常。这里的不可访问的情况比如可以为无法从第一索引区中写入和/或读取数据,此处对此不作具体限定。In this embodiment, there are many specific implementations for checking whether the first index area of the storage device is abnormal, such as: when it is found that the first index area is inaccessible, or when it is found that the number of inaccessible times of the first index area is greater than a set value, it is determined that the first index area is abnormal. The inaccessible situation here may be, for example, the inability to write and/or read data from the first index area, which is not specifically limited here.
步骤1202,基于磁带库的各磁带中所记录的文件对应的文件名称、以及文件写入时间,检查磁带库的各磁带中是否存在候选文件;若是,则执行步骤1203。Step 1202 , based on the file names corresponding to the files recorded in the tapes of the tape library and the file writing time, check whether there are candidate files in the tapes of the tape library; if so, execute step 1203 .
这里,文件写入时间是指文件写入至磁带的时间。候选文件是指记录有第一索引区信息的文件(也即上述的候选数据)。若磁带库的各磁带中不存在候选文件,则需人工从磁带库外的磁带中选择最近完成归档的磁带,并放入磁带库中,之后继续执行本步骤。Here, the file writing time refers to the time when the file is written to the tape. The candidate file refers to the file that records the information of the first index area (that is, the candidate data mentioned above). If the candidate file does not exist in the tapes of the tape library, it is necessary to manually select the tape that has been archived most recently from the tapes outside the tape library and put it into the tape library, and then continue to execute this step.
步骤1203,从各候选文件中选择文件写入时间最晚的候选文件作为参考文件,并清空第一索引区,从磁带库中读取参考数据并写入至第一索引区。Step 1203: Select the candidate file with the latest file writing time from each candidate file as the reference file, clear the first index area, read the reference data from the tape library and write it into the first index area.
这里,参考文件也即上述的参考数据。Here, the reference document refers to the reference data mentioned above.
本实施例通过在归档任务完成之后将第一索引区所记录的信息备份至磁带中,这样在存储设备中的第一索引区出现异常时,可以通过磁带中所记录的第一索引区信息再次重建第一索引区,从而使得第一索引区可以继续被用于记录归档数据占用磁带的信息,以及磁带中的数据可以再次基于已恢复的第一索引区被检索,从而提高了数据归档和查询的可靠性。This embodiment backs up the information recorded in the first index area to a magnetic tape after the archiving task is completed. In this way, when an abnormality occurs in the first index area in the storage device, the first index area can be rebuilt again using the first index area information recorded in the magnetic tape, so that the first index area can continue to be used to record information about the tape occupied by archived data, and the data in the magnetic tape can be retrieved again based on the restored first index area, thereby improving the reliability of data archiving and query.
需要说明的是,本实施例并不具体限定上述数据归档方法的各个执行步骤的先后顺序。It should be noted that this embodiment does not specifically limit the order of execution of the various steps of the above data archiving method.
至此,完成本实施例提供的方法描述,下面对本申请实施例提供的装置进行描述:At this point, the description of the method provided in this embodiment is completed. The following describes the device provided in this embodiment of the application:
作为一个实施例,本实施例还提供了数据归档装置。参见图13,图13为本申请实施例提供的装置结构示意图。如图13所示,该装置1300包括:As an embodiment, this embodiment also provides a data archiving device. Referring to FIG. 13 , FIG. 13 is a schematic diagram of the structure of the device provided in the embodiment of the present application. As shown in FIG. 13 , the device 1300 includes:
获得模块1301,用于获得当前归档任务;当前归档任务用于指示在设定归档执行时间段将当前归档任务相关联的数据采集设备采集的目标数据进行归档操作;目标数据为数据采集设备在被配置的设定归档计划时间段所采集的数据;设定归档执行时间段在设定归档计划时间段之后;目标数据在被归档前从数据采集设备获得后存储至指定存储空间;The acquisition module 1301 is used to obtain the current archiving task; the current archiving task is used to indicate that the target data collected by the data acquisition device associated with the current archiving task is archived in the set archiving execution time period; the target data is the data collected by the data acquisition device in the configured set archiving plan time period; the set archiving execution time period is after the set archiving plan time period; the target data is obtained from the data acquisition device before being archived and then stored in the designated storage space;
检查模块1302,用于基于已指定的第一索引区检查目标磁带是否被使用过;目标磁带用于存放被归档的目标数据;第一索引区至少记录了磁带被占用的信息;The checking module 1302 is used to check whether the target tape has been used based on the specified first index area; the target tape is used to store the archived target data; the first index area at least records the information that the tape is occupied;
第一归档模块1303,用于若目标磁带未被使用过,则将第一索引区记录的信息写入至目标磁带;The first archiving module 1303 is used to write the information recorded in the first index area to the target tape if the target tape has not been used;
第二归档模块1304,用于在将第一索引区记录的信息写入至目标磁带后,或者当确定出目标磁带被使用过后,检查目标磁带的可用空间是否满足容纳目标数据和第一索引区记录的信息的要求,如果是,将目标数据写入至目标磁带,如果否,将第一索引区记录的信息写入至目标磁带,将目标数据写入至其它可用磁带;The second archiving module 1304 is used to check whether the available space of the target tape meets the requirement of accommodating the target data and the information recorded in the first index area after writing the information recorded in the first index area to the target tape or when it is determined that the target tape has been used, and if so, write the target data to the target tape; if not, write the information recorded in the first index area to the target tape and write the target data to other available tapes;
记录模块1305,用于在第一索引区记录目标数据占用磁带的信息。The recording module 1305 is used to record the information that the target data occupies the magnetic tape in the first index area.
作为一个实施例,该装置还包括:生成模块,用于针对每一数据采集设备,检查该数据采集设备被配置的设定归档执行时间段的起始时间是否与当前时间匹配;若匹配,则检查归档任务列表中是否存在与该数据采集设备相关联的归档任务,如果否,则生成该数据采集设备相关联的归档任务并加入至归档任务列表中,如果是,则返回针对每一数据采集设备,检查该数据采集设备被配置的设定归档执行时间段的起始时间是否与当前时间匹配的步骤;As an embodiment, the apparatus further includes: a generation module, which is used to check, for each data acquisition device, whether the start time of the set archiving execution time period configured for the data acquisition device matches the current time; if so, check whether there is an archiving task associated with the data acquisition device in the archiving task list; if not, generate the archiving task associated with the data acquisition device and add it to the archiving task list; if so, return to the step of checking, for each data acquisition device, whether the start time of the set archiving execution time period configured for the data acquisition device matches the current time;
当前归档任务是按照加入至归档任务列表的时间先后顺序,从归档任务列表中获得的。The current archive tasks are obtained from the archive task list in the order of time when they were added to the archive task list.
作为一个实施例,记录模块1305还用于:目标数据在存储在指定存储空间后,将目标数据在指定存储空间的占用情况记录至已指定的第二索引区;占用情况至少包括目标数据的大小、以及目标数据的存储位置;As an embodiment, the recording module 1305 is further used to: after the target data is stored in the designated storage space, record the occupation status of the target data in the designated storage space to the designated second index area; the occupation status at least includes the size of the target data and the storage location of the target data;
检查目标磁带的可用空间是否满足容纳目标数据和第一索引区记录的信息的要求,包括:从第二索引区获得目标数据的大小;检查目标磁带的可用空间大小是否大于或等于目标数据的大小以及第一索引区记录的信息的大小的总和,如果是,则确定目标磁带的可用空间满足容纳目标数据和第一索引区记录的信息的要求,如果否,则确定目标磁带的可用空间不满足容纳目标数据和第一索引区记录的信息的要求;Checking whether the available space of the target tape meets the requirement of accommodating the target data and the information recorded in the first index area, including: obtaining the size of the target data from the second index area; checking whether the size of the available space of the target tape is greater than or equal to the sum of the size of the target data and the size of the information recorded in the first index area, if yes, determining that the available space of the target tape meets the requirement of accommodating the target data and the information recorded in the first index area, if no, determining that the available space of the target tape does not meet the requirement of accommodating the target data and the information recorded in the first index area;
将目标数据写入至目标磁带或其它可用磁带包括:从第二索引区获得目标数据的存储位置,基于存储位置从指定存储空间读取目标数据并写入至目标磁带或其它可用磁带。Writing the target data to the target tape or other available tapes includes: obtaining the storage location of the target data from the second index area, reading the target data from the designated storage space based on the storage location, and writing the target data to the target tape or other available tapes.
作为一个实施例,第一索引区记录的目标数据占用磁带的信息至少包括:被占用磁带的磁带标识;As an embodiment, the information about the target data occupying the magnetic tape recorded in the first index area at least includes: a magnetic tape identifier of the occupied magnetic tape;
其它可用磁带通过以下步骤确定:基于第一索引区记录的信息确定被占用磁带的磁带标识;依据所确定的被占用磁带的磁带标识、以及磁带库中所有磁带的磁带标识从磁带库中确定一个当前未被占用的磁带,将未被占用的磁带作为其它可用磁带;The other available tapes are determined by the following steps: determining the tape identification of the occupied tape based on the information recorded in the first index area; determining a currently unoccupied tape from the tape library according to the determined tape identification of the occupied tape and the tape identifications of all tapes in the tape library, and using the unoccupied tape as the other available tape;
目标数据为视频数据;将目标数据写入至目标磁带或其它可用磁带包括:将目标数据转换为文件,并将文件写入至目标磁带或其它可用磁带。The target data is video data; writing the target data to the target tape or other available tapes includes: converting the target data into a file, and writing the file to the target tape or other available tapes.
作为一个实施例,第二索引区记录的目标数据在指定存储空间的占用情况还包括:数据采集设备的设备标识、以及目标数据的设定归档计划时间段;第一索引区记录的目标数据占用磁带的信息还包括:数据采集设备的设备标识、设定归档计划时间段、以及目标数据对应的数据标识;As an embodiment, the occupation of the target data in the designated storage space recorded in the second index area also includes: the device identification of the data acquisition device, and the set filing plan time period of the target data; the information of the target data occupying the magnetic tape recorded in the first index area also includes: the device identification of the data acquisition device, the set filing plan time period, and the data identification corresponding to the target data;
该装置还包括:查询模块,用于在接收到外部的数据查询指令时,若当前归档任务列表中没有归档任务,则依据数据查询指令以及第二索引区检查指定存储空间中是否存在数据查询指令对应的查询数据;数据查询指令至少指示了查询数据所来自的数据采集设备的设备标识、以及查询时间段;如果是,则基于数据查询指令指示的查询时间段以及设备标识,从第二索引区中获得查询数据对应的存储位置,基于存储位置获得查询数据并输出;如果否,则基于数据查询指令指示的查询时间段以及设备标识,从第一索引区获得查询数据所占用的磁带、以及查询数据对应的数据标识,基于查询数据对应的数据标识从查询数据所占用的磁带中获得查询数据并输出。The device also includes: a query module, which is used to check whether there is query data corresponding to the data query instruction in the specified storage space based on the data query instruction and the second index area when receiving an external data query instruction, if there is no archiving task in the current archiving task list; the data query instruction at least indicates the device identification of the data acquisition device from which the query data comes, and the query time period; if yes, based on the query time period and the device identification indicated by the data query instruction, obtain the storage location corresponding to the query data from the second index area, obtain the query data based on the storage location and output it; if not, based on the query time period and the device identification indicated by the data query instruction, obtain the magnetic tape occupied by the query data and the data identification corresponding to the query data from the first index area, obtain the query data from the magnetic tape occupied by the query data based on the data identification corresponding to the query data and output it.
作为一个实施例,基于查询数据对应的数据标识从查询数据所占用的磁带中获得查询数据并输出,包括:基于磁带库中所有磁带的磁带标识检查磁带库中是否存在查询数据所占用的磁带;如果磁带库中存在查询数据所占用的磁带,则检查指定解冻空间的可用空间大小是否大于或等于预设阈值,如果是,则基于查询数据对应的数据标识从查询数据所占用的磁带中读取查询数据并写入至指定解冻空间中,如果否,则清理指定解冻空间中写入至指定解冻空间的时间最早的数据,并返回检查指定解冻空间的可用空间大小是否大于或等于预设阈值的步骤;基于查询数据对应的数据标识从指定解冻空间中获得查询数据并输出。As an embodiment, query data is obtained from a magnetic tape occupied by the query data based on a data identifier corresponding to the query data and outputted, including: based on the tape identifiers of all tapes in the tape library, checking whether there is a magnetic tape occupied by the query data in the tape library; if there is a magnetic tape occupied by the query data in the tape library, checking whether the size of the available space in a designated thaw space is greater than or equal to a preset threshold value; if so, reading the query data from the magnetic tape occupied by the query data based on the data identifier corresponding to the query data and writing it to the designated thaw space; if not, clearing the earliest data written to the designated thaw space in the designated thaw space, and returning to the step of checking whether the size of the available space in the designated thaw space is greater than or equal to the preset threshold value; obtaining query data from the designated thaw space based on the data identifier corresponding to the query data and outputting it.
作为一个实施例,该装置还包括:异常处理模块,用于当发现第一索引区出现异常时,基于磁带库的各磁带中所记录数据对应的数据标识检查磁带库的各磁带中是否存在至少一个候选数据;候选数据是指指示第一索引区信息的数据;若存在至少一个候选数据,则基于磁带库的各磁带中所记录数据对应的写入至磁带的时间从磁带库的各磁带中确定参考数据并清空第一索引区,从磁带库中读取参考数据并写入至第一索引区;参考数据是指写入至磁带的时间最晚的候选数据。As an embodiment, the device also includes: an exception handling module, which is used to check whether there is at least one candidate data in each tape of the tape library based on the data identifier corresponding to the data recorded in each tape of the tape library when an exception is found in the first index area; the candidate data refers to the data indicating the information of the first index area; if there is at least one candidate data, based on the time corresponding to the data recorded in each tape of the tape library being written to the tape, the reference data is determined from each tape of the tape library and the first index area is cleared, and the reference data is read from the tape library and written to the first index area; the reference data refers to the candidate data with the latest time of being written to the tape.
作为一个实施例,该装置还包括:删除模块,用于检查归档任务列表中是否存在归档任务,若归档任务列表中存在归档任务,则从归档任务列表中获得加入至归档任务列表的时间最早的归档任务以作为目标归档任务;检查该目标归档任务指示的设定归档执行时间段的结束时间是否与当前时间匹配;若匹配,则检查该目标归档任务的执行状态是否为用于表示执行中的第一状态,如果是,停止执行该目标归档任务,并从归档任务列表中删除该目标归档任务,如果否,从归档任务列表中删除该目标归档任务;若不匹配,或者在从归档任务列表中删除该目标归档任务后,则返回检查归档任务列表中是否存在归档任务的步骤。As an embodiment, the device also includes: a deletion module, used to check whether there is an archiving task in the archiving task list. If there is an archiving task in the archiving task list, obtain the archiving task that is added to the archiving task list the earliest from the archiving task list as the target archiving task; check whether the end time of the set archiving execution time period indicated by the target archiving task matches the current time; if it matches, check whether the execution status of the target archiving task is the first state used to indicate execution, if so, stop executing the target archiving task and delete the target archiving task from the archiving task list, if not, delete the target archiving task from the archiving task list; if it does not match, or after deleting the target archiving task from the archiving task list, return to the step of checking whether there is an archiving task in the archiving task list.
作为一个实施例,不同数据采集设备采集的数据的类型不同时,该不同数据采集设备被配置的设定归档执行时间段不相交。As an embodiment, when different data collection devices collect data of different types, the different data collection devices are configured to have non-overlapping archiving execution time periods.
至此,完成图13所示的装置描述。上述装置中各个模块的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。At this point, the description of the device shown in Figure 13 is completed. The implementation process of the functions and effects of each module in the above device is specifically described in the implementation process of the corresponding steps in the above method, and will not be repeated here.
请参见图14,为本申请一示例性实施例提供的一种电子设备的硬件结构示意图。该电子设备可以包括处理器1401、通信接口1402、存储器1403和通信总线1404。处理器1401、通信接口1402以及存储器1403通过通信总线1404完成相互间的通信。其中,存储器1403上存放有计算机程序指令;处理器1401可以通过执行存储器1403上所存放的计算机程序指令,执行上述实施例描述的方法的步骤。该电子设备根据该电子设备的实际功能,还可以包括其他硬件,对此不再赘述。Please refer to Figure 14, which is a schematic diagram of the hardware structure of an electronic device provided by an exemplary embodiment of the present application. The electronic device may include a processor 1401, a communication interface 1402, a memory 1403 and a communication bus 1404. The processor 1401, the communication interface 1402 and the memory 1403 communicate with each other through the communication bus 1404. Among them, the memory 1403 stores computer program instructions; the processor 1401 can execute the steps of the method described in the above embodiment by executing the computer program instructions stored in the memory 1403. The electronic device may also include other hardware according to the actual function of the electronic device, which will not be described in detail.
对应地,本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质上存储有若干计算机程序指令,该计算机程序指令被处理器执行时,能够实现本申请上述示例公开的方法。Correspondingly, an embodiment of the present application further provides a computer-readable storage medium, on which a number of computer program instructions are stored. When the computer program instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.
示例性的,上述计算机可读存储介质可以是任何电子、磁性、光学或其它物理存储装置,可以包含或存储信息,如可执行指令、数据,等等。例如,计算机可读存储介质可以是:RAM(Radom Access Memory,随机存取存储器)、易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、dvd等),或者类似的存储介质,或者它们的组合。处理器和存储器可由专用逻辑电路补充或并入专用逻辑电路中。Exemplarily, the computer-readable storage medium may be any electronic, magnetic, optical or other physical storage device that may contain or store information, such as executable instructions, data, etc. For example, the computer-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof. The processor and memory may be supplemented by or incorporated into a dedicated logic circuit.
以上仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411095926.3A CN118626439B (en) | 2024-08-09 | 2024-08-09 | Data archiving method and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411095926.3A CN118626439B (en) | 2024-08-09 | 2024-08-09 | Data archiving method and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118626439A CN118626439A (en) | 2024-09-10 |
CN118626439B true CN118626439B (en) | 2024-10-29 |
Family
ID=92605356
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202411095926.3A Active CN118626439B (en) | 2024-08-09 | 2024-08-09 | Data archiving method and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118626439B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114860558A (en) * | 2022-04-21 | 2022-08-05 | 中国资源卫星应用中心 | A method to facilitate remote sensing satellite data archiving and recovery performance testing |
CN117539392A (en) * | 2023-11-13 | 2024-02-09 | 湖南快乐阳光互动娱乐传媒有限公司 | Tape library data processing method and system, electronic equipment and storage medium |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH07121410A (en) * | 1993-10-22 | 1995-05-12 | Hitachi Ltd | Archiving method |
JP2000250845A (en) * | 1999-03-02 | 2000-09-14 | Hitachi Ltd | Method and device for controlling recording medium competition and medium recorded with the processing program therefor |
US8954663B1 (en) * | 2012-06-25 | 2015-02-10 | Kip Cr P1 Lp | System, method and computer program product for synchronizing data written to tape including writing an index into a data partition so that data can be recovered in case of failure |
CN103605587A (en) * | 2013-11-20 | 2014-02-26 | 上海爱数软件有限公司 | Tape library data backup and filing method |
CN105573863A (en) * | 2015-12-14 | 2016-05-11 | 北京尚易德科技有限公司 | Index file recovery method and apparatus and video monitoring system |
CN107590030A (en) * | 2017-09-29 | 2018-01-16 | 郑州云海信息技术有限公司 | A kind of method, apparatus and system of data recording on tape backup |
US11152018B1 (en) * | 2020-10-29 | 2021-10-19 | International Business Machines Corporation | Optimized tape unmount operation |
CN113190520A (en) * | 2021-05-26 | 2021-07-30 | 中国建设银行股份有限公司 | Method and system for processing filing log |
CN115421983A (en) * | 2022-09-29 | 2022-12-02 | 中国农业银行股份有限公司 | Data backup method and device based on mainframe |
-
2024
- 2024-08-09 CN CN202411095926.3A patent/CN118626439B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114860558A (en) * | 2022-04-21 | 2022-08-05 | 中国资源卫星应用中心 | A method to facilitate remote sensing satellite data archiving and recovery performance testing |
CN117539392A (en) * | 2023-11-13 | 2024-02-09 | 湖南快乐阳光互动娱乐传媒有限公司 | Tape library data processing method and system, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN118626439A (en) | 2024-09-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6557073B1 (en) | Storage apparatus having a virtual storage area | |
KR100288203B1 (en) | Real time data recording method | |
US9189309B1 (en) | System and method for predicting single-disk failures | |
US9141457B1 (en) | System and method for predicting multiple-disk failures | |
CN100430906C (en) | Library system, virtual library device, and buffer recovery method used in virtual library device | |
US20050262316A1 (en) | Backup acquisition method and disk array apparatus | |
CN100422920C (en) | Information processing apparatus, information processing method, and information processing program | |
EP2189894A1 (en) | Digital shoebox | |
US8065466B2 (en) | Library apparatus, library system and method for copying logical volume to disk volume in cache disk with smallest access load | |
US20070041719A1 (en) | Circulating recording apparatus, recording method and recording medium storing program of the recording method | |
CN115562582A (en) | Data migration method based on blue-ray disc library, server and blue-ray disc library | |
US20120210077A1 (en) | Recording system, recording method and computer program | |
US9244849B2 (en) | Storage control apparatus, storage system and method | |
CN115756317A (en) | Storage method, storage device, electronic equipment and storage medium of shingled magnetic disk | |
CN118626439B (en) | Data archiving method and electronic equipment | |
TW201417579A (en) | A video recording system, device and the method of the data accessing | |
US8761573B2 (en) | Recording device, imaging and recording device, recording method, and program | |
CN114237489B (en) | Method and device for writing logic resources into SMR disk, electronic equipment and storage medium | |
CN117785070B (en) | Data storage control method and device | |
US12131755B2 (en) | Method for storing multi-lens recording file and multi-lens recording apparatus | |
CN111159054B (en) | Recording device and control method thereof, and storage medium storing control program thereof | |
US20230064391A1 (en) | Information processing apparatus, information processing method, and information processing program | |
JP2002229829A (en) | File management information generation method and device | |
CN111225169B (en) | Storage method and device for small video files | |
JP6437691B2 (en) | File management system, file management method, collection program, and non-transitory computer-readable information recording medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |