Method, device, processor and electronic equipment for storing surveillance video

By clustering the edge nodes of enterprise business outlets and generating cluster controllers, the problem of communication lines being occupied by the transmission of surveillance video was solved, and distributed storage and rapid retrieval of surveillance video were realized, thereby improving the office efficiency of business outlets.

CN116383159BActive Publication Date: 2025-11-25INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310358011.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-04
Publication Date
2025-11-25
Estimated Expiration
2043-04-04

AI Technical Summary

Technical Problem

When the monitoring center at the company headquarters accesses or downloads surveillance footage from the company's various business outlets, the video stream data is transmitted through the communication lines of each business outlet, causing the communication lines of the business outlets to be occupied, which seriously affects office efficiency.

Method used

By clustering n edge nodes, m sub-clusters are generated, and a cluster controller is generated. The storage location of the surveillance video fragments in the edge nodes is determined, the fragment index is obtained, and it is stored in the monitoring center so that the target object can retrieve the surveillance video from the monitoring center according to the fragment index.

Benefits of technology

It effectively reduced the peak traffic of individual business outlets, prevented the download of surveillance videos from blocking business processing, and improved the work efficiency of multiple business outlets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116383159B_ABST
    Figure CN116383159B_ABST
Patent Text Reader

Abstract

The application discloses a storage method and device of monitoring video, a processor and electronic equipment, the method is applied to the cloud computing technical field, and the method comprises the steps of clustering n edge nodes according to the resource quantity of each edge node in the n edge nodes to obtain m clusters; generating a cluster controller according to the resource quantity of each cluster in the m clusters to obtain m cluster controllers; determining the storage position of the monitoring video fragments in the n edge nodes through the m cluster controllers to obtain a fragment index; and storing the fragment index to a monitoring center through the m cluster controllers. Through the application, the problem that the communication lines of each business site are occupied and the office efficiency of each business site of an enterprise is seriously affected when the monitoring center of the enterprise headquarters reviews or downloads the monitoring video of each business site under the jurisdiction of the enterprise by transmitting video stream data through the communication lines of each business site in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of cloud computing, in particular, to a storage method and device of monitoring video, a processor and an electronic device. BACKGROUND

[0002] At present, in order to provide rich and high-quality financial services to customers, a large number of business outlets directly contacting customers are set in the organizational structure of a financial enterprise. In order to guarantee the service quality and customer satisfaction of each business outlet, each type of financial enterprise formulates a series of service rules and business operation specifications for the business outlets under its jurisdiction. And through the establishment of an operation supervision post and regular off-site monitoring and inspection, problems and deficiencies of the business outlets in on-site management and business operation are found and corrected in time, so as to urge the business outlets to comprehensively standardize on-site management and business operation behavior, improve the system execution force, and improve the customer satisfaction. Among them, the off-site monitoring and inspection refers to that the inspection personnel identifies the deficiencies and risk hidden dangers of the business personnel in on-site management and business operation by reviewing the monitoring video of each business outlet in the monitoring center, so as to timely correct the inappropriate operation or service of the business personnel. If necessary, the monitoring video also needs to be downloaded to a storage medium for archiving as case data.

[0003] Since the monitoring video in the prior art is stored in the monitoring gun of the business outlet, when the monitoring video is reviewed or downloaded in the monitoring center, the video stream data is generally transmitted to the monitoring center through the communication line of the business outlet, which occupies the bandwidth of the communication line of the business outlet and reduces the speed of the business outlet for obtaining data through the communication line. If it is in the business hours of the business outlet, it will seriously affect the speed of handling business of the business outlet and reduce the service quality and office efficiency. In addition, the business outlet has a huge traffic load only when the monitoring video is reviewed or downloaded, but the business outlet is in an idle state most of the time, which causes the business outlet to be unable to fully utilize the idle communication resources to balance the traffic load.

[0004] In view of the problem in the related art that when the monitoring video of each business outlet under the jurisdiction of the enterprise is reviewed or downloaded in the monitoring center of the headquarters of the enterprise, the video stream data is transmitted through the communication line of each business outlet, which occupies the communication line of each business outlet and seriously affects the office efficiency of each business outlet of the enterprise, no effective solution has been proposed so far. SUMMARY

[0005] The main purpose of the present application is to provide a storage method and device of monitoring video, a processor and an electronic device, to solve the problem in the related art that when the monitoring video of each business outlet under the jurisdiction of the enterprise is reviewed or downloaded in the monitoring center of the headquarters of the enterprise, the video stream data is transmitted through the communication line of each business outlet, which occupies the communication line of each business outlet and seriously affects the office efficiency of each business outlet of the enterprise.

[0006] To achieve the above object, according to one aspect of the present application, a storage method of surveillance video is provided, which comprises: clustering n edge nodes according to resource quantity of each edge node in the n edge nodes to obtain m clusters, wherein the edge nodes represent business outlets of an enterprise, m is greater than or equal to 2, n is greater than or equal to m, and m and n are positive integers; generating cluster controllers according to resource quantity of each cluster in the m clusters to obtain m cluster controllers; determining storage locations of fragments of the surveillance video in the n edge nodes by the m cluster controllers to obtain a fragment index; and storing the fragment index to a surveillance center by the m cluster controllers, so that a target object can retrieve surveillance video from the surveillance center according to the fragment index.

[0007] Further, the clustering of the n edge nodes according to resource quantity of each edge node in the n edge nodes to obtain m clusters comprises: calculating average resource quantity of each cluster load according to node information of each edge node; determining m edge nodes in the n edge nodes to obtain m initial nodes; calculating distances between the m initial nodes and other edge nodes according to physical positions of the edge nodes to obtain m distance sets; and clustering the n edge nodes into the m clusters according to the m distance sets and the average resource quantity.

[0008] Further, the calculation of the average resource quantity of each cluster load according to node information of each edge node comprises: substituting resource information of each edge node into Formula One to calculate comprehensive resource quantity of each edge node, wherein Formula One is as follows,

[0009] S i = αf(i) + βk(i) + σr(i) + ξg(i)

[0010] wherein S i represents comprehensive resource quantity of edge node i, f(i) represents processor resource quantity of edge node i, k(i) represents memory resource quantity of edge node i, r(i) represents storage resource quantity of edge node i, g(i) represents line bandwidth resource quantity of edge node i, α represents weight of the processor resource quantity, β represents weight of the memory resource quantity, σ represents weight of the storage resource quantity, and ξ represents weight of the line bandwidth resource quantity, and α + β + σ + ξ = 1; substituting the comprehensive resource quantity of each edge node, total number of clusters m and total number of edge nodes n into Formula Two to calculate the average resource quantity, wherein Formula Two is as follows,

[0011]

[0012] wherein i represents the i-th edge node, S iS represents the total amount of resources of the edge nodes, and S i represents the total amount of resources of the edge node i. av m represents the total number of clusters, and n represents the total number of edge nodes.

[0013] Further, according to the physical position of each edge node, the distances of the m initial nodes to other edge nodes are calculated to obtain m distance sets, including: obtaining the first coordinates of each edge node according to the physical position of each edge node; and bringing the first coordinates of each edge node into Formula Three to calculate the physical distances of each initial node to other edge nodes to obtain the m distance sets, Formula Three being as follows,

[0014]

[0015] wherein (x0, y0) represents the first coordinates of the initial node, D represents the distance between the edge node i and the initial node, (x 1i ,y 1i ) represents the first coordinates of the edge node i.

[0016] Further, according to the m distance sets and the average resource amount, the n edge nodes are clustered into the m clusters, including: sorting the values in each distance set in ascending order to obtain m sorted distance sets; dividing the m initial nodes into the m clusters respectively, and calculating the total amount of resources of the m clusters; if there is a target cluster in the m clusters, the total amount of resources of which has a difference greater than 1 from the average resource amount, then the edge nodes in a target distance set are divided into the target cluster in sequence until the difference between the total amount of resources of the target cluster and the average resource amount is not greater than 1, to obtain the clustered target cluster, wherein the target distance set represents the distance set corresponding to a target initial node, and the target initial node represents the initial node corresponding to the target cluster; if there is no target cluster in the m clusters, then the clustered m clusters are obtained, and the cluster ID of each cluster and the member node ID of each member node in each cluster are set.

[0017] Further, determining the storage locations of the fragments of the monitoring video in the n edge nodes by the m cluster controllers to obtain a fragment index comprises: performing hash operation on the first coordinate of each edge node to obtain a hash domain, wherein the hash domain contains n partitions; dividing the monitoring video into v fragments of a preset size, and configuring a fragment ID of each fragment and a video ID of the monitoring video, wherein v is a positive integer; performing calculation on the video stream data of each fragment of the v fragments to determine the first partition corresponding to each fragment in the hash domain, and the edge node corresponding to each first partition; and obtaining the fragment index according to the first partition corresponding to each fragment, the edge node corresponding to each first partition, the video ID and the fragment ID of each fragment.

[0018] Further, performing hash operation on the first coordinate of each edge node to obtain a hash domain comprises: substituting the static IP of each edge node into formula four to obtain the second coordinate of each edge node, formula four being as follows,

[0019]

[0020] wherein (x 2i ,y 2i ) represents the second coordinate of edge node i, IP i represents the static IP of edge node i, k represents a calculation performance parameter, and Hash represents a hash function; sorting the n edge nodes in ascending order according to the abscissa of the second coordinate to obtain an edge node array; determining the coordinate range in which the abscissa value and the ordinate value are both greater than the second coordinate of the i th edge node and less than the second coordinate of the i-1 th edge node as the i th partition in a rectangular coordinate system to obtain the n partitions corresponding to the n edge nodes, wherein the i th edge node and the i-1 th edge node are both edge nodes in the edge node array; and determining the hash domain from the n partitions corresponding to the n edge nodes.

[0021] Further, performing calculation on the video stream data of each fragment of the v fragments to determine the first partition corresponding to each fragment in the hash domain and the edge node corresponding to each first partition comprises: substituting the video stream data of each fragment of the v fragments into formula five to obtain the third coordinate corresponding to the v fragments, formula five being as follows,

[0022]

[0023] wherein (x 3i ,y 3i ) represents the third coordinate of edge node i, data iLet i represent the video stream data of segment i, k represent the computational performance parameter, and Hash represent the hash function. In the hash domain, the first partition corresponding to each segment and the edge node corresponding to each first partition are determined based on the third coordinates corresponding to the v segments.

[0024] Furthermore, after determining the storage location of the surveillance video fragments in the n edge nodes through the m cluster controllers and obtaining the fragment index, the method further includes: copying the video stream data of the v fragments to obtain v copied fragments and a copied fragment ID for each copied fragment; substituting the video stream data of each copied fragment into Formula Six for calculation to obtain the fourth coordinate corresponding to each copied fragment, as shown in Formula Six below.

[0025]

[0026] Among them, (x 4i ,y 4i ) represents the fourth coordinate of the copied fragment i, data i Let i represent the video stream data of segment i, k represent the computational performance parameter, and Hash represent the hash function. In the hash domain, based on the fourth coordinates corresponding to the v replicated segments, determine the second partition corresponding to each replicated segment, the edge node corresponding to each second partition, and the replicated segment ID of each replicated segment to obtain the replicated segment index. The replicated segment index is stored in the monitoring center through the m cluster controllers.

[0027] Furthermore, after storing the fragment index to the monitoring center through the m cluster controllers, the method further includes: obtaining the target video ID of the target surveillance video; determining q target edge nodes for storing r target fragments of the target surveillance video based on the target video ID and the fragment index, where r is greater than or equal to q, and r and q are positive integers; obtaining the r target fragments from the q target edge nodes and merging the r target fragments to obtain the target surveillance video.

[0028] Further, after obtaining the r target fragments from the q target edge nodes and merging the r target fragments to obtain the target surveillance video, the method further includes: if there are missing target fragments among the q target edge nodes, obtaining the target copy fragments corresponding to the missing target fragments according to the copy fragment index; obtaining the r target fragments from the non-missing target fragments and the target copy fragments, and merging the r target fragments to obtain the target surveillance video.

[0029] Further, after the m cluster controllers store the shard index to the monitoring center, the method further comprises: determining whether there is an offline edge node or a new edge node in the n edge nodes every preset time length; if there is the offline edge node or the new edge node, recalculating the hash domain to obtain an updated hash domain; recalculating the new edge node corresponding to each shard of the monitoring video according to the updated hash domain; updating the shard index according to the new edge node corresponding to each shard to obtain an updated shard index; adjusting the edge node stored by each shard of the monitoring video according to the updated shard index and the replica shard index; and storing the updated shard index to the monitoring center through the m cluster controllers.

[0030] To achieve the above object, according to another aspect of the present application, a storage device for monitoring video is provided, which comprises: a clustering unit configured to cluster n edge nodes according to resource quantity of each edge node in the n edge nodes to obtain m clusters, wherein the edge node represents a business site of an enterprise, m is greater than or equal to 2, n is greater than or equal to m, and m and n are positive integers; a generating unit configured to generate a cluster controller according to resource quantity of each cluster in the m clusters to obtain m cluster controllers; a first determining unit configured to determine storage location of a shard of the monitoring video in the n edge nodes through the m cluster controllers to obtain a shard index; and a first storage unit configured to store the shard index to a monitoring center through the m cluster controllers, so that a target object retrieves the monitoring video from the monitoring center according to the shard index.

[0031] To achieve the above object, according to one aspect of the present application, a processor is provided, which is configured to run a program, wherein the program performs any one of the above monitoring video storage methods when running.

[0032] To achieve the above object, according to one aspect of the present application, an electronic device is provided, which comprises one or more processors and a memory, the memory being configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement any one of the above monitoring video storage methods.

[0033] According to the application, the following steps are adopted: clustering n edge nodes according to the resource quantity of each edge node, to obtain m clusters, wherein the edge nodes represent business outlets of an enterprise, m is greater than or equal to 2, n is greater than or equal to m, and m and n are positive integers; generating a cluster controller according to the resource quantity of each cluster in the m clusters, to obtain m cluster controllers; determining the storage location of a fragment of the monitoring video in the n edge nodes through the m cluster controllers, to obtain a fragment index; and storing the fragment index to a monitoring center through the m cluster controllers, so that a target object can retrieve the monitoring video from the monitoring center according to the fragment index, thereby solving the problem in the related art that when the monitoring center of the enterprise headquarters retrieves or downloads the monitoring video of each business outlet under the enterprise, the communication line of each business outlet is occupied, which seriously affects the office efficiency of each business outlet of the enterprise. By clustering multiple edge nodes, generating a cluster controller, and distributing multiple fragments of the monitoring video in multiple edge nodes (i.e., business outlets) through the cluster controller to obtain a fragment index, the monitoring video can be quickly obtained from multiple business outlets according to the fragment index, so that the huge traffic generated when the monitoring center retrieves and downloads the monitoring video can be evenly distributed to multiple business outlets, effectively reducing the traffic peak of a single business outlet, avoiding the blocking of the business outlet for downloading the monitoring video, and achieving the effect of improving the work efficiency of multiple business outlets. BRIEF DESCRIPTION OF DRAWINGS

[0034] The accompanying drawings, which form a part of this application, are included to provide a further understanding of the application and are incorporated in and constitute a part of this application. The embodiments of this application illustrated in the drawings, and their description, are presented to explain the application and not to limit or define it. In the drawings:

[0035] Figure 1 is a flow chart of the storage method of the monitoring video according to the first embodiment of the application;

[0036] Figure 2 is a schematic diagram of the optional storage method of the monitoring video according to the first embodiment of the application Figure 1 ;

[0037] Figure 3 is a schematic diagram of the optional storage method of the monitoring video according to the first embodiment of the application Figure 2 ;

[0038] Figure 4 is a schematic diagram of the optional storage method of the monitoring video according to the first embodiment of the application Figure 3 ;

[0039] Figure 5is a schematic view of a storage device for monitoring video provided according to Embodiment Two of the present application;

[0040] Figure 6 is a schematic view of an electronic device for storing monitoring video provided according to Embodiment Five of the present application. DETAILED DESCRIPTION

[0041] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0042] It should be noted that the user information (including but not limited to user device information, user personal information, information collected by the user's monitored device, etc.) and data (including but not limited to data for analysis, stored data, displayed data, data collected by business outlets, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of the country and region, and provide corresponding operation portal for the user to choose authorization or refusal.

[0043] In order to enable persons skilled in the art to better understand the present application scheme, the technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should belong to the scope of protection of the present application.

[0044] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0045] Embodiment One

[0046] The present application will be described below in combination with preferred implementation steps, Figure 1 is a flowchart of a storage method for monitoring video provided according to Embodiment One of the present application, as shown in Figure 1 The method comprises the following steps:

[0047] Step S101, according to the resource amount of each edge node in the n edge nodes, clustering the n edge nodes to obtain m clusters, wherein the edge node represents the business site of the enterprise, m is greater than or equal to 2, n is greater than or equal to m, m and n are positive integers.

[0048] In the first embodiment, the edge node stores the monitoring video collected by the monitoring device of each business site of the enterprise, and the edge node can communicate with other edge nodes through the monitoring network. A cluster represents a plurality of edge nodes logically aggregated together, and the edge nodes in the same cluster are called member nodes of the cluster. Each cluster contains at least two member nodes, and each member node in the cluster shares storage resources. By clustering the n edge nodes, the edge nodes with different resource amounts can be integrated to obtain multiple clusters with balanced resources, thereby realizing effective utilization and distribution of resources. Figure 2 is a schematic diagram of an enterprise monitoring system. As shown in Figure 2 , the staff of the enterprise retrieves and downloads the monitoring video of each business site through the communication network in the monitoring center, wherein cluster A includes edge node A1, edge node A2 and edge node A3, and cluster B includes edge node B1 and edge node B2.

[0049] Step S102, generating a cluster controller according to the resource amount of each cluster in the m clusters, to obtain m cluster controllers.

[0050] Based on virtualization technology and containerization technology, the storage resources and computing resources of multiple member nodes in the same cluster can be integrated, and a virtual cluster controller can be automatically generated. The cluster controller is used to coordinate and arrange the storage resources and computing resources of each member node in the cluster, and the cluster controller only exists in the logical layer. Figure 3 is a schematic diagram of the relationship between the cluster controller and the member nodes in the cluster. As shown in Figure 3 , the cluster controller in the logical layer can control and schedule the storage resources and computing resources of multiple edge nodes (such as Figure 3 edge node A1, edge node A2 and edge node An in ). By generating a cluster controller through virtualization technology, the computing resources and storage resources of multiple edge nodes can be integrated, improving the utilization rate of the computing power and storage resources of multiple edge nodes, thereby making the enterprise monitoring system more flexible and efficient.

[0051] Step S103, determining the storage location of the monitoring video fragments in the n edge nodes through the m cluster controllers to obtain a fragment index.

[0052] In the first embodiment, the storage locations of the multiple fragments of the monitoring video in the multiple edge nodes are calculated by the cluster controllers. For example, the monitoring video A includes 10 fragments, which are stored in the edge node B1, the edge node B2 and the edge node B3. The calculation by the cluster controllers determines that the fragment A1, the fragment A2 and the fragment A3 are stored in the edge node B1, the fragment A4, the fragment A5 and the fragment A6 are stored in the edge node B2, and the fragment A7, the fragment A8, the fragment A9 and the fragment A10 are stored in the edge node B3.

[0053] In step S104, the fragment index is stored to the monitoring center by the m cluster controllers, so that the target object can retrieve the monitoring video from the monitoring center according to the fragment index.

[0054] In the first embodiment, the fragment index is used to store the storage locations of the multiple fragments of the monitoring video. For example, the fragment index can be shown in Table 1, the fragment s1 of the monitoring video with the video ID v1 is stored in the edge node A1, and the fragment s3 of the monitoring video with the video ID v3 is stored in the edge node C3.

[0055] Table 1 Fragment index

[0056] Video fragment Fragment s1 Fragment s2 Fragment s3 .... Video ID_v1 Edge node A1 Edge node A2 Edge node A3 .... Video ID_v2 Edge node B1 Edge node B2 Edge node B3 .... Video ID_v3 Edge node C1 Edge node C2 Edge node C3 .... .... ... ... ... ..

[0057] In summary, the storage method of the monitoring video provided in the first embodiment of the present application clusters the n edge nodes according to the resource amount of each edge node in the n edge nodes, to obtain m clusters, wherein the edge node represents a business outlet of an enterprise; generates a cluster controller according to the resource amount of each cluster in the m clusters, to obtain m cluster controllers; determines the storage locations of the fragments of the monitoring video in the n edge nodes by the m cluster controllers, to obtain a fragment index; and stores the fragment index to the monitoring center by the m cluster controllers, so that the target object can retrieve the monitoring video from the monitoring center according to the fragment index. The problem that when the monitoring center of the enterprise headquarters retrieves or downloads the monitoring videos of the business outlets under the enterprise, the communication lines of the business outlets are occupied due to the transmission of video stream data through the communication lines, which seriously affects the office efficiency of the business outlets of the enterprise, is solved. By clustering the multiple edge nodes, generating the cluster controllers, and distributing the multiple fragments of the monitoring video in the multiple edge nodes (i.e. business outlets) by the cluster controllers to obtain the fragment index, the monitoring video can be quickly obtained from the multiple business outlets according to the fragment index, so that the huge traffic generated when the monitoring video is retrieved and downloaded in the monitoring center can be evenly distributed to the multiple business outlets, effectively reducing the traffic peak of a single business outlet, avoiding the blockage of the business outlet for downloading the monitoring video, and achieving the effect of improving the work efficiency of the multiple business outlets.

[0058] Optionally, in the storage method of the monitoring video provided in Embodiment One of the present application, the n edge nodes are clustered according to the resource amount of each edge node in the n edge nodes, to obtain m clusters, including: calculating the average resource amount of each cluster load according to the node information of each edge node; determining m edge nodes in the n edge nodes to obtain m initial nodes; calculating the distance between the m initial nodes and other edge nodes according to the physical location of each edge node to obtain m distance sets; and clustering the n edge nodes into m clusters according to the m distance sets and the average resource amount.

[0059] In Embodiment One, the computing resources and storage resources of the edge nodes are quantified, and the multiple edge nodes are clustered according to the principle that the resource capacity of each cluster is basically consistent and the edge nodes are preferentially aggregated according to the physical location, so as to better utilize the multiple edge nodes to store the monitoring video. The principle that the resource capacity of each cluster is basically consistent and the edge nodes are preferentially aggregated according to the physical location means that the total resource amount of each cluster is basically the same, and each cluster contains multiple edge nodes that are relatively close. For example, the edge node A1 with a resource amount of 0.5, the edge node A2 with a resource amount of 0.5, and the edge node A3 with a resource amount of 0.9 are distributed in the A region, the edge node B1 with a resource amount of 0.5 and the edge node B2 with a resource amount of 0.5 are distributed in the B region, and the distance between the A region and the B region is large. If the edge node A1, the edge node A2, the edge node A3, the edge node B1, and the edge node B2 are divided into three clusters, then the average resource amount of the three clusters is first calculated to be 0.97; then, according to the physical location of the edge nodes, the edge node A1 and the edge node A2 are divided into the cluster C1, and the edge node B1 and the edge node B1 are divided into the cluster C2; finally, the edge node A3 is divided into the cluster C3 according to the calculated average resource amount.

[0060] By clustering the multiple edge nodes according to the physical location and the resource amount of the edge nodes, the traffic load of the multiple edge nodes can be balanced, the influence of the large traffic load of a single edge node on the business handled by the edge node is avoided, the performance and reliability of the enterprise monitoring system are improved, the monitoring video can be stored in the edge nodes that are relatively close, the distance and time of data transmission are reduced, the speed of data transmission is improved, and the working efficiency of the multiple business sites is improved.

[0061] Optionally, in the storage method of the monitoring video provided in Embodiment One of the present application, calculating the average resource amount of each cluster load according to the node information of each edge node includes: substituting the resource information of each edge node into Formula One to calculate the comprehensive resource amount of each edge node, and Formula One is as follows,

[0062] Si = αf(i) + βk(i) + σr(i) + ξg(i)

[0063] wherein S i represents the comprehensive resource quantity of the edge node i, f(i) represents the processor resource quantity of the edge node i, k(i) represents the memory resource quantity of the edge node i, r(i) represents the storage resource quantity of the edge node i, g(i) represents the line bandwidth resource quantity of the edge node i, α represents the weight of the processor resource quantity, β represents the weight of the memory resource quantity, σ represents the weight of the storage resource quantity, ξ represents the weight of the line bandwidth resource quantity, and α + β + σ + ξ = 1; the comprehensive resource quantity of each edge node, the total number of clusters m and the total number of edge nodes n are substituted into Formula Two to obtain the average resource quantity, Formula Two is as follows,

[0064]

[0065] wherein i represents the i-th edge node, S i represents the comprehensive resource quantity of the edge node i, S av represents the average resource quantity, m represents the total number of clusters, and n represents the total number of edge nodes.

[0066] In the first embodiment, the resource quantity of the edge node is quantified as the processor resource quantity, the memory resource quantity, the storage resource quantity and the line bandwidth resource quantity, and reasonable weights are configured for the multiple quantified resources, so as to reasonably calculate the comprehensive resource quantity of each edge node. According to the total resource quantity of all edge nodes and the total number of clusters, the average resource quantity of each cluster can be calculated, so as to subsequently cluster the multiple edge nodes according to the average resource quantity of each cluster. By quantifying the resource of the edge node, calculating the comprehensive resource quantity of each edge node and the average resource quantity of each cluster, the multiple edge nodes can be reasonably clustered, the multiple clusters with balanced resources are obtained, the performance and utilization of the enterprise monitoring system are improved, the stability and reliability of the multiple business sites are improved, and the working efficiency of the multiple business sites is further improved.

[0067] Optionally, in the storage method of the monitoring video provided in the first embodiment of the present application, the distances of the m initial nodes to other edge nodes are calculated according to the physical positions of each edge node to obtain m distance sets, including: obtaining the first coordinates of each edge node according to the physical positions of each edge node; the first coordinates of each edge node are substituted into Formula Three to calculate the physical distances of each initial node to other edge nodes to obtain m distance sets, Formula Three is as follows,

[0068]

[0069] wherein (x0, y0) represents the first coordinate of the initial node, D represents the distance between the edge node i and the initial node, and (x 1i 1i ) represents the first coordinate of the edge node i.

[0070] In the first embodiment, the physical location of the edge node can use the location of the business site corresponding to the edge node in the map, that is, the first coordinate of the edge node is determined according to the map coordinate of the business site in the map. The initial node represents the edge node referenced when clustering each cluster and calculating the distance between the edge nodes. For example, the edge node A1, the edge node A2, the edge node A3 and the edge node A4 are divided into two clusters. After taking the edge node A1 as the initial node of the cluster B1, the distance D1 between the edge node A1 and the edge node A2, the distance D2 between the edge node A1 and the edge node A3, and the distance D3 between the edge node A1 and the edge node A4 are referenced to determine the edge nodes contained in the cluster B1. Then, the first coordinate of the edge node A1 and the first coordinates of the other edge nodes are substituted into the formula three to calculate the distance set corresponding to the edge node A1. Similarly, the edge node A3 is taken as the initial node of the cluster B2, and the first coordinate of the edge node A3 and the first coordinates of the other edge nodes are substituted into the formula three to calculate the distance set corresponding to the edge node A3.

[0071] By calculating the distances between the plurality of edge nodes, the edge nodes with close distances can be divided into the same cluster, which is beneficial for the edge nodes in the same cluster to quickly transmit data through the monitoring network, reduces the distance and time of data transmission, and achieves the effect of improving the data transmission efficiency.

[0072] Optionally, in the storage method of the monitoring video provided in the first embodiment of the present application, clustering the n edge nodes into m clusters according to the m distance sets and the average resource amount comprises: sorting the values in each distance set in ascending order to obtain m sorted distance sets; dividing the m initial nodes into the m clusters respectively, and calculating the total resource amount of the m clusters; if there is a target cluster in the m clusters, the difference between the total resource amount of the target cluster and the average resource amount is greater than 1, then the edge nodes in the target distance set are divided into the target cluster in turn until the difference between the total resource amount of the target cluster and the average resource amount is not greater than 1, to obtain the clustered target cluster, wherein the target distance set represents the distance set corresponding to the target initial node, and the target initial node represents the initial node corresponding to the target cluster; if there is no target cluster in the m clusters, then the m clusters after clustering are obtained, and the cluster ID of each cluster and the member node ID of each member node in each cluster are set.

[0073] ​For example, assume that edge node A1, edge node A2, edge node A3 and edge node A4 are divided into two clusters (i.e. cluster B and cluster C). The average resource amount of each cluster is calculated, and the distance set D1 of edge node A1 to other edge nodes and the distance set D2 of edge node A4 to other edge nodes are obtained. First, the values in the distance set D1 are sorted in ascending order, and the order of the edge nodes is {A3, A2, A4}. The values in the distance set D2 are sorted, and the order is {A1, A3, A2}. Then, edge node A1 is divided into cluster B, and edge node A4 is divided into cluster C. Then, the difference between the total resource amount and the average resource amount of cluster B is greater than 1, and the edge node A3 closest to edge node A1 is further divided into cluster B. At this time, the difference between the total resource amount and the average resource amount of cluster B is less than 1, and cluster B is obtained. The cluster ID of cluster B is set as g1, the member node ID of edge node A1 is g1_1, and the member node ID of edge node A3 is g1_2. Since the difference between the total resource amount and the average resource amount of cluster C is greater than 1, the processing of cluster C is continued. Since edge node A1 and edge node A3 close to edge node A4 have been divided into cluster B, edge node A2 is divided into cluster C. At this time, the difference between the total resource amount and the average resource amount of cluster C is less than 1, and cluster C is obtained. The cluster ID of cluster C is set as g2, the member node ID of edge node A2 is g2_1, and the member node ID of edge node A4 is g2_2.

[0074] By clustering the plurality of edge nodes according to the physical positions and resource amounts of the edge nodes, the edge nodes close to each other can be divided into the same cluster, the transmission time and distance of data are reduced, the traffic load of the plurality of edge nodes can be balanced, the load of a single edge node is avoided to be too large to affect the business of the edge node, the stability and reliability of the plurality of edge nodes are improved, and the working efficiency of the plurality of business sites is improved.

[0075] Optionally, in the storage method of the monitoring video provided in the first embodiment of the present application, the storage positions of the fragments of the monitoring video in the n edge nodes are determined by the m cluster controllers, and the fragment index is obtained by: performing a hash operation on the first coordinates of each edge node to obtain a hash domain, wherein the hash domain contains n partitions; dividing the monitoring video into v fragments of a preset size, and configuring a fragment ID of each fragment and a video ID of the monitoring video, wherein v is a positive integer; calculating the video stream data of each fragment in the v fragments to determine the first partition corresponding to each fragment in the hash domain, and the edge node corresponding to each first partition; and obtaining the fragment index according to the first partition corresponding to each fragment, the edge node corresponding to each first partition, the video ID and the fragment ID of each fragment.

[0076] In the first embodiment, the hash field represents a plurality of partitions corresponding to each of the plurality of edge nodes in a rectangular coordinate system after a hash operation is performed on the first coordinates of the plurality of edge nodes. Figure 4 is a schematic diagram of the hash field, where N1, N2, N3, and N4 represent four edge nodes, and partition 1 represents a partition corresponding to edge node N1. After the hash field is determined, a hash operation is performed on the video stream data of each fragment of the surveillance video to obtain a partition corresponding to each fragment in the hash field. Finally, according to the partition corresponding to each fragment and the edge node corresponding to each partition, the plurality of fragments of the surveillance video are stored in the corresponding edge nodes to obtain a fragment index. Specifically, as shown in Figure 4 , fragment 1 corresponds to partition 2, and partition 2 corresponds to edge node N2, so fragment 1 is stored in edge node N2 and recorded in the fragment index.

[0077] By dividing the surveillance video into a plurality of fragments and distributing the plurality of fragments in the plurality of edge nodes through the cluster controller, the access speed of the surveillance video is improved, and the traffic load of a single edge node for transmitting the surveillance video is reduced, thereby improving the work efficiency of the plurality of business sites.

[0078] Optionally, in the method for storing the surveillance video provided in the first embodiment of the present application, the hash operation on the first coordinates of each edge node to obtain the hash field includes: substituting the static IP of each edge node into formula four to obtain the second coordinates of each edge node, and formula four is as follows,

[0079]

[0080] where (x 2i ,y 2i ) represents the second coordinates of edge node i, IP i represents the static IP of edge node i, k represents a calculation performance parameter, and Hash represents a hash function; the n edge nodes are sorted in ascending order according to the horizontal coordinates of the second coordinates to obtain an edge node array; in a rectangular coordinate system, a coordinate range in which the value of the horizontal coordinate and the value of the vertical coordinate are greater than the second coordinates of the i-th edge node and less than the second coordinates of the (i-1)-th edge node is determined as the i-th partition to obtain n partitions corresponding to the n edge nodes, where the i-th edge node and the (i-1)-th edge node are both edge nodes in the edge node array; and the hash field is determined by the n partitions corresponding to the n edge nodes.

[0081] Hash operations can map data of any size to a hash value of a fixed size. In this first embodiment, hash operations are used to calculate the static IP addresses of multiple edge nodes, quickly determining the partitions corresponding to multiple edge nodes and obtaining the hash domain. The value of k in Formula 4 can be adjusted appropriately based on the number of member nodes within a cluster. For example, when a single cluster contains 100 member nodes, the value of k can be set to 110 to ensure that the partitions corresponding to each edge node do not overlap.

[0082] Specifically, after hashing the static IP of edge node N1, the second coordinate of edge node N1 is (1, 1). Similarly, the second coordinate of edge node N2 is (2, 2), the second coordinate of edge node N3 is (3, 3), and the second coordinate of edge node N4 is (4, 4). Figure 4 As shown, from the second coordinate (1, 1) of edge node N1, draw lines X = 1 perpendicular to the X-axis and Y = 1 perpendicular to the Y-axis. The region enclosed by the rectangular coordinate system, lines X = 1, and Y = 1 is defined as partition 1 corresponding to edge node N1. From the second coordinate (2, 2) of edge node N2, draw lines X = 2 perpendicular to the X-axis and Y = 2 perpendicular to the Y-axis. The region enclosed by the two lines corresponding to the previous edge node and the two lines corresponding to edge node N2 is defined as partition 2 corresponding to edge node N2. That is, let the region enclosed by lines X = 1, Y = 1, X = 2, and Y = 2 be defined as partition 2 corresponding to edge node N2. Similarly, partition 3 corresponding to edge node N3 is as follows. Figure 4 In partition 3, partition 4 corresponding to edge node N4 is as follows: Figure 4 Partition 4 in the middle.

[0083] By hashing the static IP addresses of multiple edge nodes, the corresponding partitions of multiple edge nodes can be quickly determined, and multiple edge nodes can be mapped to a Cartesian coordinate system. This avoids duplicate areas between different partitions, ensures the independence of each partition, and guarantees the independence and integrity of multiple segments of the surveillance video, thereby improving the work efficiency of multiple business outlets.

[0084] Optionally, in the method for storing surveillance video provided in Embodiment 1 of this application, calculating the video stream data of each of the v segments to determine the first partition corresponding to each segment in the hash domain, and the edge node corresponding to each first partition, includes: substituting the video stream data of each of the v segments into Formula 5 for calculation to obtain the third coordinates corresponding to the v segments, as shown in Formula 5 below.

[0085]

[0086] Among them, (x 3i ,y3i ) represents the third coordinate of the edge node i, data i represents the video stream data of the slice i, k represents the computing performance parameter, Hash represents the hash function; in the hash domain, the first partition corresponding to each slice is determined according to the third coordinate corresponding to the v slices, and the edge node corresponding to each first partition.

[0087] In the first embodiment, the corresponding relationship between each slice and the edge node is obtained by performing hash operation on the video stream data of the multiple slices of the monitoring video. Specifically, after performing hash operation on the slice 1, the third coordinate corresponding to the slice 1 is (1.5, 1.5). As shown in FIG. 2, the third coordinate (1.5, 1.5) corresponding to the slice 1 is in the range of the hash domain partition 2, so the slice 1 corresponds to the partition 2, that is, the slice 1 corresponds to the edge node N2. By performing hash operation on the video stream data of the multiple slices of the monitoring video, the multiple slices can be quickly matched with the multiple partitions in the hash domain, and the storage position of each slice in the multiple edge nodes is obtained. Figure 4

[0088] Optionally, in the storage method of the monitoring video provided in the first embodiment of the present application, after the storage positions of the slices of the monitoring video in the n edge nodes are determined by the m cluster controllers, and the slice index is obtained, the method further includes: copying the video stream data of the v slices to obtain v copied slices and a copied slice ID of each copied slice; and substituting the video stream data of each copied slice into formula six to obtain a fourth coordinate corresponding to each copied slice, formula six being as follows,

[0089]

[0090] wherein, (x 4i ,y 4i ) represents the fourth coordinate of the copied slice i, data i represents the video stream data of the slice i, k represents the computing performance parameter, Hash represents the hash function; in the hash domain, the second partition corresponding to each copied slice, the edge node corresponding to each second partition and the copied slice ID of each copied slice are determined according to the fourth coordinate corresponding to the v copied slices, to obtain a copied slice index; and the copied slice index is stored to the monitoring center by the m cluster controllers.

[0091] ​In this first embodiment, by performing a secondary hash operation on multiple segments of the surveillance video, the storage location of the duplicate segments is obtained. When a single edge node fails, the segment data of the failed edge node can be recovered from the duplicate segments stored on other edge nodes, preventing the loss of segment data of multiple segments of the surveillance video. This improves the reliability and integrity of the segment data of the surveillance video and avoids economic or other losses to enterprises and users caused by data loss.

[0092] Specifically, two hash operations are performed on segment s1 of the surveillance video to obtain the fourth coordinate of the copy segment s1_c of segment s1, which is (2.5, 2.5). For example... Figure 4 As shown, the copied fragment s1_c is stored in partition 2. Fragment s1 of the surveillance video is stored in edge node N1 corresponding to partition 1, and the copied fragment s1_c is stored in edge node N2 corresponding to partition 2. If edge node N1 fails, the copied fragment s1_c can be obtained from edge node N2; if fragment s1 of the surveillance video is lost, the copied fragment s1_c can be obtained from edge node N2 and copied to edge node N1 to ensure the integrity of the surveillance video.

[0093] Optionally, in the method for storing surveillance video provided in Embodiment 1 of this application, after storing the fragment index to the monitoring center through m cluster controllers, the method further includes: obtaining the target video ID of the target surveillance video; determining q target edge nodes for storing r target fragments of the target surveillance video based on the target video ID and the fragment index, where r is greater than or equal to q, and r and q are positive integers; obtaining r target fragments from the q target edge nodes and merging the r target fragments to obtain the target surveillance video.

[0094] Specifically, if the video ID of the surveillance video is v1, then the fragments s1, s2, and s3 of surveillance video v1 are searched in the fragment index and stored in edge nodes N1, N2, and N3 respectively. Next, three threads simultaneously download fragments s1, s2, and s3 from edge nodes N1, N2, and N3. After the download is complete, fragments s1, s2, and s3 are merged into surveillance video v1.

[0095] In this first embodiment, using a shard index to find multiple target shards of the target surveillance video significantly improves query speed, avoids the time spent traversing multiple edge nodes, and reduces the traffic load on multiple edge nodes. Furthermore, multiple threads can be used to simultaneously download multiple target shards of the target surveillance video from multiple target edge nodes, improving download and preview speeds. Specifically, the preset time for storing surveillance videos can be scheduled during non-business hours at the business outlets.

[0096] Optionally, in the storage method of the monitoring video provided in Embodiment One of the present application, after obtaining r target shards from q target edge nodes and merging the r target shards to obtain the target monitoring video, the method further comprises: if there is a missing target shard in the q target edge nodes, obtaining a target replication shard corresponding to the missing target shard according to the replication shard index; obtaining r target shards from the target shard without missing and the target replication shard, and merging the r target shards to obtain the target monitoring video.

[0097] Specifically, if the shards s1 and s2 of the monitoring video are missing, the replication shard s1_c of the shard s1 is stored in the edge node N1 and the replication shard s2_c of the shard s2 is stored in the edge node N2 according to the replication shard index. Then, the replication shard s1_c is obtained in the edge node N1 and copied to the edge node where the shard s1 is located; the replication shard s2_c is obtained in the edge node N2 and copied to the edge node where the shard s2 is located. Through the replication shard and the replication shard index, the missing shard data in multiple edge nodes can be recovered in time, the reliability and integrity of the storage of the monitoring video are improved, and the economic loss or other loss caused by the missing of the shard data to the enterprise and the user is avoided.

[0098] Optionally, in the storage method of the monitoring video provided in Embodiment One of the present application, after the shard index is stored to the monitoring center by the m cluster controllers, the method further comprises: judging whether there is an offline edge node or a new edge node in the n edge nodes every preset time length; if there is an offline edge node or a new edge node, recalculating the hash domain to obtain an updated hash domain; recalculating the new edge node corresponding to each shard of the monitoring video according to the updated hash domain; updating the shard index according to the new edge node corresponding to each shard to obtain an updated shard index; adjusting the edge node where each shard of the monitoring video is stored according to the updated shard index and the replication shard index; and storing the updated shard index to the monitoring center by the m cluster controllers.

[0099] In Embodiment One, in order to prevent the failure of a single edge node from causing the loss of the shard data of the monitoring video, periodic checking and maintenance of multiple edge nodes are needed. In addition, the storage of the replication shard can also be periodically checked and maintained.

[0100] Specifically, it is determined whether there is an offline edge node or a new edge node every week. If there is an offline edge node, the partition corresponding to each edge node is recalculated according to the edge nodes currently in the running state, and an updated hash domain is obtained. The new edge node corresponding to each shard of the monitoring video is recalculated according to the updated hash domain, and an updated shard index is obtained. Then, the replication shard of the lost shard in the offline edge node is obtained according to the replication shard index, and the replication shard of the lost shard is migrated to the new edge node according to the updated shard index. The updated shard index is stored in the monitoring center through the cluster controller. In addition, if the other edge nodes except the offline edge node need to adjust the shard data, the corresponding adjustment is made according to the updated shard index and the replication shard index.

[0101] If there is a new edge node, the partition corresponding to each edge node is recalculated according to the edge nodes currently in the running state, and an updated hash domain is obtained. The new edge node corresponding to each shard of the monitoring video is recalculated according to the updated hash domain, and an updated shard index is obtained. Then, the shard data stored in the new edge node is obtained according to the updated shard index, and is stored in the new edge node. If the other edge nodes except the new edge node need to adjust the shard data, the corresponding adjustment is made according to the updated shard index and the replication shard index.

[0102] If the storage capacity of a single edge node is detected to be insufficient, or the bandwidth of a single edge node is long-term in a full load state, the edge node is treated as an offline edge node. If the storage capacity of the edge node recovers to a normal state and the bandwidth idle rate of the edge node reaches a preset value, the edge node is treated as a new edge node.

[0103] Through periodic maintenance and inspection of the plurality of edge nodes, the performance and stability of the plurality of edge nodes can be improved, and the reliability and integrity of the monitoring video can be improved, thereby improving the working efficiency of the plurality of business outlets. In addition, the running situation of the plurality of edge nodes can be analyzed and mined to optimize the node architecture of the edge nodes and improve the performance of the entire monitoring system.

[0104] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a group of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in an order different from that shown herein.

[0105] Embodiment Two

[0106] The embodiment two of the present application further provides a storage device for monitoring video, and it needs to be noted that the storage device for monitoring video of the embodiment two of the present application can be used to execute the method for storing monitoring video provided by the embodiment one of the present application. The storage device for monitoring video provided by the embodiment two of the present application is introduced as follows.

[0107] Figure 5 is a schematic diagram of the storage device for monitoring video according to the embodiment two of the present application. As shown in the figure, Figure 5 the device comprises a clustering unit 501, a generating unit 502, a first determining unit 503 and a first storage unit 504.

[0108] Specifically, the clustering unit 501 is configured to cluster n edge nodes according to resource amounts of each of the n edge nodes, to obtain m clusters, wherein the edge node represents a business site of an enterprise, m is greater than or equal to 2, n is greater than or equal to m, and m and n are positive integers.

[0109] The generating unit 502 is configured to generate a cluster controller according to a resource amount of each of the m clusters, to obtain m cluster controllers.

[0110] The first determining unit 503 is configured to determine storage positions of the monitoring video fragments in the n edge nodes through the m cluster controllers, to obtain a fragment index.

[0111] The first storage unit 504 is configured to store the fragment index to a monitoring center through the m cluster controllers, so that a target object can retrieve the monitoring video from the monitoring center according to the fragment index.

[0112] The storage device for monitoring video provided in the second embodiment of the present application clusters the n edge nodes according to the resource quantity of each edge node in the n edge nodes by the clustering unit 501, to obtain m clusters, wherein the edge node represents a business outlet of the enterprise, m is greater than or equal to 2, n is greater than or equal to m, and m and n are positive integers; the generating unit 502 generates a cluster controller according to the resource quantity of each cluster in the m clusters, to obtain m cluster controllers; the first determining unit 503 determines the storage location of the fragment of the monitoring video in the n edge nodes through the m cluster controllers, to obtain a fragment index; and the first storage unit 504 stores the fragment index to the monitoring center through the m cluster controllers, so that the target object can retrieve the monitoring video from the monitoring center according to the fragment index, thereby solving the problem that in the related art, when the monitoring center of the enterprise headquarters retrieves or downloads the monitoring video of each business outlet under the jurisdiction of the enterprise, the communication line of each business outlet is occupied due to the transmission of video stream data through the communication line of each business outlet, which seriously affects the office efficiency of each business outlet of the enterprise. By clustering multiple edge nodes, generating a cluster controller, and distributing the multiple fragments of the monitoring video in multiple edge nodes (i.e., business outlets) through the cluster controller to obtain a fragment index, the monitoring video can be quickly obtained from multiple business outlets according to the fragment index, so that the huge traffic generated when the monitoring video is retrieved and downloaded in the monitoring center can be evenly distributed to multiple business outlets, effectively reducing the traffic peak of a single business outlet, avoiding the blocking of the business of the single business outlet due to the downloading of the monitoring video through the single business outlet, and achieving the effect of improving the work efficiency of multiple business outlets.

[0113] Optionally, in the storage device for monitoring video provided in the second embodiment of the present application, the clustering unit 501 includes: a first calculation subunit, configured to calculate the average resource quantity of each cluster according to the node information of each edge node; a determination subunit, configured to determine m edge nodes from the n edge nodes, to obtain m initial nodes; a second calculation subunit, configured to calculate the distance between the m initial nodes and other edge nodes according to the physical position of each edge node, to obtain m distance sets; and a clustering subunit, configured to cluster the n edge nodes into m clusters according to the m distance sets and the average resource quantity.

[0114] Optionally, in the storage device for monitoring video provided in the second embodiment of the present application, the first calculation subunit includes: a first calculation module, configured to substitute the resource information of each edge node into Formula One to calculate the comprehensive resource quantity of each edge node, wherein Formula One is as follows,

[0115] S i = αf(i) + βk(i) + σr(i) + ξg(i)

[0116] wherein, Si S(i) represents the comprehensive resource amount of the edge node i, f(i) represents the processor resource amount of the edge node i, k(i) represents the memory resource amount of the edge node i, r(i) represents the storage resource amount of the edge node i, g(i) represents the line bandwidth resource amount of the edge node i, a represents the weight of the processor resource amount, β represents the weight of the memory resource amount, σ represents the weight of the storage resource amount, ξ represents the weight of the line bandwidth resource amount, and a + β + σ + ξ = 1; a second calculation module is configured to calculate the average resource amount by substituting the comprehensive resource amount of each edge node, the total number of clusters m and the total number of edge nodes n into Formula Two, and Formula Two is as follows,

[0117]

[0118] wherein i represents the ith edge node, S i represents the comprehensive resource amount of the edge node i, S av represents the average resource amount, m represents the total number of clusters, and n represents the total number of edge nodes.

[0119] Optionally, in the storage device for monitoring video provided in Embodiment Two of the present application, the second calculation subunit includes: an acquisition module configured to acquire the first coordinates of each edge node according to the physical positions of the edge nodes; and a third calculation module configured to calculate the physical distances between each initial node and other edge nodes by substituting the first coordinates of each edge node into Formula Three, and obtain m distance sets, and Formula Three is as follows,

[0120]

[0121] wherein (x0, y0) represents the first coordinates of the initial node, D represents the distance between the edge node i and the initial node, (x 1i ,y 1i ) represents the first coordinates of the edge node i.

[0122] Optionally, in the storage device for monitoring video provided in Embodiment Two of the present application, the clustering subunit comprises: a first sorting module, configured to sort the values in each distance set in ascending order to obtain m sorted distance sets; a fourth calculation module, configured to divide the m initial nodes into m clusters respectively, and calculate the total resource amount of the m clusters; a clustering module, configured to, if there is a target cluster in the m clusters whose difference between the total resource amount and the average resource amount is greater than 1, divide the edge nodes in the target distance set into the target cluster in turn until the difference between the total resource amount and the average resource amount of the target cluster is not greater than 1, to obtain the clustered target cluster, wherein the target distance set represents the distance set corresponding to the target initial node, and the target initial node represents the initial node corresponding to the target cluster; and a configuration module, configured to, if there is no target cluster in the m clusters, obtain the clustered m clusters, and set the cluster ID of each cluster and the member node ID of each member node in each cluster.

[0123] Optionally, in the storage device for monitoring video provided in Embodiment Two of the present application, the first determination unit 503 comprises: a third calculation subunit, configured to perform a hash operation on the first coordinates of each edge node to obtain a hash domain, wherein the hash domain comprises n partitions; a cutting subunit, configured to cut the monitoring video into v fragments of a preset size, and configure the fragment ID of each fragment and the video ID of the monitoring video, wherein v is a positive integer; a fourth calculation subunit, configured to calculate the video stream data of each fragment in the v fragments to determine the first partition corresponding to each fragment in the hash domain, and the edge node corresponding to each first partition; and an acquisition subunit, configured to acquire the fragment index according to the first partition corresponding to each fragment, the edge node corresponding to each first partition, the video ID, and the fragment ID of each fragment.

[0124] Optionally, in the storage device for monitoring video provided in Embodiment Two of the present application, the third calculation subunit comprises: a fifth calculation module, configured to substitute the static IP of each edge node into Formula Four to calculate the second coordinates of each edge node, Formula Four being as follows,

[0125]

[0126] wherein (x 2i ,y 2i ) represents the second coordinates of the edge node i, IP iThe first module represents the static IP of edge node i, k represents the computational performance parameter, and Hash represents the hash function; the second sorting module is used to sort the n edge nodes in ascending order according to the horizontal coordinate of the second coordinate to obtain an edge node array; the first determining module is used to determine the coordinate range in the rectangular coordinate system where the values ​​of both the horizontal and vertical coordinates are greater than the second coordinate of the i-th edge node and less than the second coordinate of the (i-1)-th edge node as the i-th partition, thus obtaining n partitions corresponding to the n edge nodes, where the i-th edge node and the (i-1)-th edge node are both edge nodes in the edge node array; the second determining module is used to determine the hash domain from the n partitions corresponding to the n edge nodes.

[0127] Optionally, in the surveillance video storage device provided in Embodiment 2 of this application, the aforementioned fourth calculation subunit includes: a sixth calculation module, used to substitute the video stream data of each of the v segments into Formula 5 for calculation to obtain the third coordinates corresponding to the v segments, as shown in Formula 5 below.

[0128]

[0129] Among them, (x 3i ,y 3i ) represents the third coordinate of edge node i, data i The video stream data of segment i is represented by k, the performance parameter is represented by k, and the hash function is represented by Hash. The third determination module is used to determine the first partition corresponding to each segment and the edge node corresponding to each first partition in the hash domain based on the third coordinates corresponding to v segments.

[0130] Optionally, in the surveillance video storage device provided in Embodiment 2 of this application, the device further includes: a first acquisition unit, configured to, after determining the storage location of the surveillance video segments in n edge nodes through m cluster controllers and obtaining the segment index, copy the video stream data of v segments to obtain v copied segments and a copied segment ID for each copied segment; and a first calculation unit, configured to substitute the video stream data of each copied segment into Formula 6 for calculation to obtain the fourth coordinate corresponding to each copied segment, as shown in Formula 6 below.

[0131]

[0132] Among them, (x 4i ,y 4i ) represents the fourth coordinate of the copied fragment i, data ivideo stream data representing a slice i, k represents a computing performance parameter, Hash represents a hash function; a second determining unit, configured to determine, in a hash domain, a second partition corresponding to each of the v replicated slices according to a fourth coordinate corresponding to each of the v replicated slices, an edge node corresponding to each of the second partitions, and a replicated slice ID of each of the replicated slices, to obtain a replicated slice index; and a second storage unit, configured to store the replicated slice index to a monitoring center through the m cluster controllers.

[0133] Optionally, in the storage device for the monitoring video provided in Embodiment Two of the present application, the device further includes: a second obtaining unit, configured to, after the m cluster controllers store the slice index to the monitoring center, obtain a target video ID of a target monitoring video; a third determining unit, configured to determine q target edge nodes of r target slices storing the target monitoring video according to the target video ID and the slice index, where r is greater than or equal to q, and r and q are positive integers; a third obtaining unit, configured to obtain the r target slices from the q target edge nodes and merge the r target slices to obtain the target monitoring video.

[0134] Optionally, in the storage device for the monitoring video provided in Embodiment Two of the present application, the device further includes: a fourth obtaining unit, configured to, after the m cluster controllers store the slice index to the monitoring center, obtain a target video ID of a target monitoring video; a third determining unit, configured to determine q target edge nodes of r target slices storing the target monitoring video according to the target video ID and the slice index, where r is greater than or equal to q, and r and q are positive integers; a third obtaining unit, configured to obtain the r target slices from the q target edge nodes and merge the r target slices to obtain the target monitoring video.

[0135] Optionally, in the storage device for the monitoring video provided in Embodiment Two of the present application, the device further includes: a judging unit, configured to, after the m cluster controllers store the slice index to the monitoring center, judge whether there is an offline edge node or a new edge node in the n edge nodes every preset time length; a second calculating unit, configured to, if there is an offline edge node or a new edge node, recalculate a hash domain to obtain an updated hash domain; a third calculating unit, configured to recalculate a new edge node corresponding to each slice of the monitoring video according to the updated hash domain; a modifying unit, configured to modify the slice index according to the new edge node corresponding to each slice to obtain a modified slice index; an adjusting unit, configured to adjust an edge node storing each to-be-adjusted slice that needs to be adjusted in storage position in the monitoring video according to the modified slice index; and a third storage unit, configured to store the updated slice index to the monitoring center through the m cluster controllers.

[0136] The storage device of the monitoring video comprises a processor and a memory, and the clustering unit 501, the generating unit 502, the first determining unit 503 and the first storage unit 504 are stored in the memory as program units, and the corresponding functions are realized by the processor executing the program units stored in the memory.

[0137] The processor comprises a core, and the core calls the corresponding program units in the memory.

[0138] The memory can comprise a non-permanent memory in a computer readable medium, a random access memory (RAM) and / or a non-volatile memory such as a read-only memory (ROM) or a flash memory (flash RAM), and the memory comprises at least one memory chip.

[0139] Embodiment three of the present application provides a computer readable storage medium, which stores a program, and the program is executed by a processor to realize the storage method of the monitoring video.

[0140] Embodiment four of the present application provides a processor, which is used to run a program, and the program is executed to realize the storage method of the monitoring video.

[0141] As shown in Fig. Figure 6 Embodiment five of the present application provides an electronic device, which comprises a processor, a memory and a program stored in the memory and capable of running on the processor, and the processor realizes the following steps when executing the program: clustering n edge nodes according to the resource amount of each edge node in the n edge nodes to obtain m clusters, wherein the edge node represents a business site of an enterprise, m is greater than or equal to 2, n is greater than or equal to m, m and n are positive integers; generating a cluster controller according to the resource amount of each cluster in the m clusters to obtain m cluster controllers; determining the storage location of a monitoring video fragment in the n edge nodes through the m cluster controllers to obtain a fragment index; and storing the fragment index to a monitoring center through the m cluster controllers, so that a target object can call the monitoring video from the monitoring center according to the fragment index.

[0142] The processor further realizes the following steps when executing the program: clustering the n edge nodes according to the resource amount of each edge node in the n edge nodes to obtain m clusters, which comprises: calculating the average resource amount of each cluster load according to the node information of each edge node; determining m edge nodes in the n edge nodes to obtain m initial nodes; calculating the distance between the m initial nodes and other edge nodes according to the physical position of each edge node to obtain m distance sets; and clustering the n edge nodes into m clusters according to the m distance sets and the average resource amount.

[0143] The processor further implements the following steps when executing the program: calculating the average resource amount of each cluster according to the node information of each edge node, including: substituting the resource information of each edge node into Formula One to calculate the comprehensive resource amount of each edge node, and obtaining the average resource amount of each cluster according to Formula Two, Formula One being as follows,

[0144] S i = αf(i) + βk(i) + σr(i) + ξg(i)

[0145] wherein S i represents the comprehensive resource amount of the edge node i, f(i) represents the processor resource amount of the edge node i, k(i) represents the memory resource amount of the edge node i, r(i) represents the storage resource amount of the edge node i, g(i) represents the line bandwidth resource amount of the edge node i, α represents the weight of the processor resource amount, β represents the weight of the memory resource amount, σ represents the weight of the storage resource amount, ξ represents the weight of the line bandwidth resource amount, and α + β + σ + ξ = 1; substituting the comprehensive resource amount of each edge node, the total number of clusters m and the total number of edge nodes n into Formula Two to calculate the average resource amount, Formula Two being as follows,

[0146]

[0147] wherein i represents the i-th edge node, S i represents the comprehensive resource amount of the edge node i, S av represents the average resource amount, m represents the total number of clusters, and n represents the total number of edge nodes.

[0148] The processor further implements the following steps when executing the program: calculating the distances of the m initial nodes to other edge nodes according to the physical positions of each edge node to obtain m distance sets, including: obtaining the first coordinates of each edge node according to the physical positions of each edge node; substituting the first coordinates of each edge node into Formula Three to calculate the physical distances of each initial node to other edge nodes to obtain m distance sets, Formula Three being as follows,

[0149]

[0150] wherein (x0, y0) represents the first coordinates of the initial node, D represents the distance between the edge node i and the initial node, and (x 1i , y 1i ) represents the first coordinates of the edge node i.

[0151] The processor further implements the following steps when executing the program: clustering the n edge nodes into m clusters according to the m distance sets and the average resource amount includes: sorting the values in each distance set in ascending order to obtain m sorted distance sets; dividing the m initial nodes into the m clusters respectively, and calculating the total resource amount of the m clusters; if there is a target cluster in the m clusters whose difference between the total resource amount and the average resource amount is greater than 1, then successively dividing the edge nodes in the target distance set into the target cluster until the difference between the total resource amount of the target cluster and the average resource amount is not greater than 1, to obtain the clustered target cluster, wherein the target distance set represents the distance set corresponding to the target initial node, and the target initial node represents the initial node corresponding to the target cluster; if there is no target cluster in the m clusters, then obtaining the clustered m clusters, and setting the cluster ID of each cluster and the member node ID of each member node in each cluster.

[0152] The processor further implements the following steps when executing the program: determining the storage location of the video fragments of the surveillance video in the n edge nodes through the m cluster controllers to obtain the fragment index includes: performing hash operation on the first coordinates of each edge node to obtain a hash domain, wherein the hash domain contains n partitions; dividing the surveillance video into v fragments of a preset size, and configuring the fragment ID of each fragment and the video ID of the surveillance video, wherein v is a positive integer; performing calculation on the video stream data of each fragment in the v fragments to determine the first partition corresponding to each fragment in the hash domain, and the edge node corresponding to each first partition; obtaining the fragment index according to the first partition corresponding to each fragment, the edge node corresponding to each first partition, the video ID and the fragment ID of each fragment.

[0153] The processor further implements the following steps when executing the program: performing hash operation on the first coordinates of each edge node to obtain a hash domain includes: substituting the static IP of each edge node into formula four to calculate the second coordinates of each edge node, and formula four is as follows,

[0154]

[0155] wherein, (x 2i ,y 2i ) represents the second coordinates of the edge node i, IP iLet represent the static IP of edge node i, k represent the computational performance parameter, and Hash represent the hash function. Based on the x-coordinate of the second coordinate, sort the n edge nodes in ascending order to obtain an edge node array. In a Cartesian coordinate system, define the range of coordinates where both the x-coordinate and y-coordinate values ​​are greater than the second coordinate of the i-th edge node and less than the second coordinate of the (i-1)-th edge node as the i-th partition, thus obtaining n partitions corresponding to the n edge nodes. The i-th and (i-1)-th edge nodes are both edge nodes in the edge node array. The hash domain is determined by the n partitions corresponding to the n edge nodes.

[0156] When the processor executes the program, it also performs the following steps: Calculates the video stream data of each of the v segments to determine the first partition corresponding to each segment in the hash domain, and the edge node corresponding to each first partition. This includes substituting the video stream data of each of the v segments into Formula 5 for calculation to obtain the third coordinates corresponding to the v segments. Formula 5 is shown below.

[0157]

[0158] Among them, (x 3i ,y 3i ) represents the third coordinate of edge node i, data i Let i represent the video stream data of segment i, k represent the computational performance parameter, and Hash represent the hash function. In the hash domain, the first partition corresponding to each segment and the edge node corresponding to each first partition are determined based on the third coordinates corresponding to the v segments.

[0159] When the processor executes the program, it also performs the following steps: After determining the storage location of the surveillance video fragments in the n edge nodes through m cluster controllers and obtaining the fragment index, the method further includes: copying the video stream data of v fragments to obtain v copied fragments and the copied fragment ID of each copied fragment; substituting the video stream data of each copied fragment into Formula 6 for calculation to obtain the fourth coordinate corresponding to each copied fragment, as shown in Formula 6 below.

[0160]

[0161] Among them, (x 4i ,y 4i ) represents the fourth coordinate of the copied fragment i, data iVideo stream data representing a slice i, k represents a computing performance parameter, Hash represents a hash function; in the hash domain, according to the fourth coordinates corresponding to the v replica slices, the second partitions corresponding to each replica slice, the edge nodes corresponding to each second partition and the replica slice IDs of each replica slice, a replica slice index is obtained; the replica slice index is stored to the monitoring center through the m cluster controllers.

[0162] When the processor executes the program, the following steps are also implemented: after the slice index is stored to the monitoring center through the m cluster controllers, the method further comprises: obtaining a target video ID of a target monitoring video; determining q target edge nodes of r target slices storing the target monitoring video according to the target video ID and the slice index, wherein r is greater than or equal to q, and r and q are positive integers; obtaining the r target slices from the q target edge nodes and merging the r target slices to obtain the target monitoring video.

[0163] When the processor executes the program, the following steps are also implemented: after the slice index is stored to the monitoring center through the m cluster controllers, the method further comprises: obtaining a target video ID of a target monitoring video; determining q target edge nodes of r target slices storing the target monitoring video according to the target video ID and the slice index, wherein r is greater than or equal to q, and r and q are positive integers; obtaining the r target slices from the q target edge nodes and merging the r target slices to obtain the target monitoring video.

[0164] When the processor executes the program, the following steps are also implemented: after the slice index is stored to the monitoring center through the m cluster controllers, the method further comprises: every preset time length, determining whether there is an offline edge node or a new edge node in the n edge nodes; if there is an offline edge node or a new edge node, recalculating the hash domain to obtain an updated hash domain; according to the updated hash domain, recalculating new edge nodes corresponding to each slice of the monitoring video; according to the new edge nodes corresponding to each slice, updating the slice index to obtain an updated slice index; according to the updated slice index and the replica slice index, adjusting the edge nodes stored by each slice of the monitoring video; storing the updated slice index to the monitoring center through the m cluster controllers.

[0165] The device herein can be a server, a PC, a PAD, a mobile phone, etc.

[0166] The application further provides a computer program product, which is adapted to execute a program for initializing the following method steps when executed on a data processing device: clustering n edge nodes according to resource amounts of each of the n edge nodes to obtain m clusters, wherein the edge nodes represent business outlets of an enterprise, m is greater than or equal to 2, n is greater than or equal to m, m and n are positive integers; generating a cluster controller according to a resource amount of each of the m clusters to obtain m cluster controllers; determining storage locations of fragments of monitoring video in the n edge nodes by the m cluster controllers to obtain a fragment index; and storing the fragment index to a monitoring center by the m cluster controllers, so that a target object can retrieve the monitoring video from the monitoring center according to the fragment index.

[0167] When executed on a data processing device, the program is further adapted to initialize the following method steps: clustering n edge nodes according to resource amounts of each of the n edge nodes to obtain m clusters includes: calculating an average resource amount of each cluster load according to node information of each edge node; determining m edge nodes from the n edge nodes to obtain m initial nodes; calculating distances of the m initial nodes to other edge nodes according to physical positions of the edge nodes to obtain m distance sets; and clustering the n edge nodes into the m clusters according to the m distance sets and the average resource amount.

[0168] When executed on a data processing device, the program is further adapted to initialize the following method steps: calculating an average resource amount of each cluster load according to node information of each edge node includes: substituting resource information of each edge node into Formula One to calculate a comprehensive resource amount of each edge node, Formula One is as follows,

[0169] S i = αf(i) + βk(i) + σr(i) + ξg(i)

[0170] wherein S i represents the comprehensive resource amount of the edge node i, f(i) represents a processor resource amount of the edge node i, k(i) represents a memory resource amount of the edge node i, r(i) represents a storage resource amount of the edge node i, g(i) represents a line bandwidth resource amount of the edge node i, α represents a weight of the processor resource amount, β represents a weight of the memory resource amount, σ represents a weight of the storage resource amount, ξ represents a weight of the line bandwidth resource amount, and α + β + σ + ξ = 1; substituting the comprehensive resource amount of each edge node, a total number of clusters m and a total number of edge nodes n into Formula Two to calculate the average resource amount, Formula Two is as follows,

[0171]

[0172] wherein i represents the i th edge node, Si S represents the total amount of resources of the edge nodes, S av S represents the average amount of resources, m represents the total number of clusters, and n represents the total number of edge nodes.

[0173] When executed on the data processing device, the program is also adapted to perform the following method steps: calculating distances of m initial nodes from other edge nodes according to physical positions of each edge node to obtain m distance sets, including: obtaining first coordinates of each edge node according to the physical positions of each edge node; and bringing the first coordinates of each edge node into Formula Three to calculate physical distances of each initial node from other edge nodes to obtain m distance sets, Formula Three being as follows,

[0174]

[0175] wherein (x0, y0) represents the first coordinates of the initial node, D represents the distance between the edge node i and the initial node, and (x 1i ,y 1i ) represents the first coordinates of the edge node i.

[0176] When executed on the data processing device, the program is also adapted to perform the following method steps: clustering n edge nodes into m clusters according to the m distance sets and the average amount of resources, including: sorting values in each distance set in ascending order to obtain m sorted distance sets; dividing m initial nodes into m clusters respectively to calculate total amounts of resources of the m clusters; if there is a target cluster in the m clusters, the total amount of resources of which has a difference greater than 1 from the average amount of resources, then sequentially dividing edge nodes in a target distance set into the target cluster until the total amount of resources of the target cluster has a difference not greater than 1 from the average amount of resources to obtain a clustered target cluster, wherein the target distance set represents a distance set corresponding to a target initial node, and the target initial node represents an initial node corresponding to the target cluster; if there is no target cluster in the m clusters, then obtaining the m clustered clusters, and setting a cluster ID of each cluster and a member node ID of each member node in each cluster.

[0177] When executed on a data processing device, it is also adapted to execute a program initialized with the following method steps: determining, by the m cluster controllers, storage locations of the shards of the surveillance video in the n edge nodes, obtaining a shard index comprises: performing a hash operation on a first coordinate of each edge node to obtain a hash domain, wherein the hash domain contains n partitions; dividing the surveillance video into v shards of a preset size, and configuring a shard ID of each shard and a video ID of the surveillance video, wherein v is a positive integer; performing a calculation on video stream data of each shard of the v shards to determine a first partition corresponding to each shard in the hash domain, and an edge node corresponding to each first partition; obtaining the shard index according to the first partition corresponding to each shard, the edge node corresponding to each first partition, the video ID and the shard ID of each shard.

[0178] When executed on a data processing device, it is also adapted to execute a program initialized with the following method steps: performing a hash operation on a first coordinate of each edge node to obtain a hash domain comprises: substituting a static IP of each edge node into formula four to obtain a second coordinate of each edge node, formula four is as follows,

[0179]

[0180] wherein, (x 2i ,y 2i ) represents the second coordinate of the edge node i, IP i represents the static IP of the edge node i, k represents a calculation performance parameter, and Hash represents a hash function; sorting the n edge nodes in ascending order according to the abscissa of the second coordinate to obtain an edge node array; determining a coordinate range in which the value of the abscissa and the value of the ordinate are both greater than the second coordinate of the i th edge node and less than the second coordinate of the i-1 th edge node as the i th partition in the rectangular coordinate system to obtain n partitions corresponding to the n edge nodes, wherein the i th edge node and the i-1 th edge node are both edge nodes in the edge node array; determining the hash domain from the n partitions corresponding to the n edge nodes.

[0181] When executed on a data processing device, it is also adapted to execute a program initialized with the following method steps: performing a calculation on video stream data of each shard of the v shards to determine a first partition corresponding to each shard in the hash domain, and an edge node corresponding to each first partition comprises: substituting the video stream data of each shard of the v shards into formula five to obtain third coordinates corresponding to the v shards, formula five is as follows,

[0182]

[0183] wherein, (x 3i ,y 3irepresents the third coordinate of the edge node i, data i represents the video stream data of the slice i, k represents the computing performance parameter, and Hash represents a hash function; in the hash domain, each slice corresponds to a first partition according to the third coordinate corresponding to the v slices, and each first partition corresponds to an edge node.

[0184] When executed on the data processing device, the program is also adapted to execute the method initialized with the following method steps: after determining the storage locations of the slices of the monitoring video in the n edge nodes by the m cluster controllers to obtain the slice index, the method further comprises: copying the video stream data of the v slices to obtain v copied slices and a copied slice ID of each copied slice; and substituting the video stream data of each copied slice into formula six to obtain a fourth coordinate corresponding to each copied slice, formula six being as follows,

[0185]

[0186] wherein (x 4i ,y 4i ) represents the fourth coordinate of the copied slice i, data i represents the video stream data of the slice i, k represents the computing performance parameter, and Hash represents a hash function; in the hash domain, each copied slice corresponds to a second partition according to the fourth coordinate corresponding to the v copied slices, each second partition corresponds to an edge node, and a copied slice ID of each copied slice is obtained to obtain a copied slice index; and the copied slice index is stored to the monitoring center by the m cluster controllers.

[0187] When executed on the data processing device, the program is also adapted to execute the method initialized with the following method steps: after storing the slice index to the monitoring center by the m cluster controllers, the method further comprises: obtaining a target video ID of a target monitoring video; determining q target edge nodes storing r target slices of the target monitoring video according to the target video ID and the slice index, wherein r is greater than or equal to q, and r and q are positive integers; obtaining the r target slices from the q target edge nodes and merging the r target slices to obtain the target monitoring video.

[0188] When executed on the data processing device, the program is also adapted to execute the method initialized with the following method steps: after obtaining the r target slices from the q target edge nodes and merging the r target slices to obtain the target monitoring video, the method further comprises: if there is a missing target slice in the q target edge nodes, obtaining a target copied slice corresponding to the missing target slice according to the copied slice index; obtaining the r target slices from the target copied slice and the non-missing target slices and merging the r target slices to obtain the target monitoring video.

[0189] When executed on the data processing device, the program is also adapted to perform the following method steps: after the m cluster controllers store the shard index to the monitoring center, the method further comprises: determining whether there is an offline edge node or a new edge node in the n edge nodes every preset time length; if there is an offline edge node or a new edge node, recalculating the hash domain to obtain an updated hash domain; according to the updated hash domain, recalculating the new edge node corresponding to each shard of the monitoring video; according to the new edge node corresponding to each shard, updating the shard index to obtain an updated shard index; according to the updated shard index and the replica shard index, adjusting the edge node stored by each shard of the monitoring video; and storing the updated shard index to the monitoring center through the m cluster controllers.

[0190] Those skilled in the art will understand that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage, etc.) containing computer usable program code.

[0191] The present application is described with reference to the flowcharts and / or block diagrams according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks

[0192] These computer program instructions can also be stored in a computer-readable memory capable of guiding a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including instruction devices that implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks

[0193] These computer program instructions can also be loaded into a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 Figure 1

[0194] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0195] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) about which the processor can execute instructions. The memory can also include non-volatile memory, such as read only memory (ROM), electrically programmable read only memory (EPROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), erasable programmable read only memory (EPROM), flash memory, or a combination of non-volatile memories in different types. The memory can also include a compact disk read only memory (CD-ROM), digital versatile disk (DVD), Blu-ray, or another non-transitory computer readable medium, which is non-volatile and non-transitory in nature, but volatile in that it can lose its content if the power to the computer is turned off or if the computer crashes. The memory is an example of a computer readable medium.

[0196] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD), or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer readable media does not include transitory media such as modulated data signals and carriers.

[0197] It should also be noted that the terms "comprising," "including," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements recited, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the statement "comprising a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0198] ​​Those skilled in the art will appreciate that embodiments of the present application can be devised for a method, a system, or a computer program product. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer readable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer readable program code thereon for use by or in connection with an instruction execution system. For the purposes of this description, a computer usable or computer readable storage medium can be any apparatus that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The medium can be electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) including a computer readable storage medium. Examples of a computer readable storage medium include an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system (or apparatus or device) including a computer readable storage medium.

[0199] The foregoing is merely illustrative of the principles of the application and various modifications can be made by persons skilled in the art. The present application is not intended to be limited to the embodiments shown, but is to be accorded the full scope that resides in the art thereof. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A storage method of monitoring video, characterized by, The method comprises the following steps: clustering n edge nodes according to resource amounts of each of the n edge nodes to obtain m clusters, wherein the edge nodes represent business outlets of an enterprise, m is greater than or equal to 2, n is greater than or equal to m, and m and n are positive integers; generating cluster controllers according to resource amounts of each of the m clusters to obtain m cluster controllers; determining storage locations of fragments of the monitoring video in the n edge nodes by the m cluster controllers to obtain a fragment index; storing the fragment index to a monitoring center by the m cluster controllers, so that a target object can retrieve the monitoring video from the monitoring center according to the fragment index; clustering the n edge nodes according to resource amounts of each of the n edge nodes to obtain m clusters comprises: calculating an average resource amount of each cluster load according to node information of each edge node; determining m edge nodes from the n edge nodes to obtain m initial nodes; calculating distances of the m initial nodes from other edge nodes according to physical positions of each edge node to obtain m distance sets; clustering the n edge nodes into the m clusters according to the m distance sets and the average resource amount.

2. The method of claim 1, wherein, calculating an average resource amount of each cluster load according to node information of each edge node comprises: substituting resource information of each edge node into Formula 1 to calculate a comprehensive resource amount of each edge node, Formula 1 being as follows, ; wherein denotes the amount of aggregated resources of edge node i, denotes the amount of processor resources of edge node i, denotes the amount of memory resources of edge node i, denotes the amount of storage resources of edge node i, denotes the amount of line bandwidth resources of edge node i, denotes the weight of the amount of processor resources, denotes the weight of the amount of memory resources, denotes the weight of the amount of storage resources, denotes the weight of the amount of line bandwidth resources, and ; substituting the comprehensive resource amount of each edge node, the total number of clusters m and the total number of edge nodes n into Formula 2 to calculate the average resource amount, Formula 2 being as follows, ; wherein i represents the ith edge node, denotes the total resource amount of the edge node i, denotes the average resource amount, m denotes the total number of clusters, and n denotes the total number of edge nodes.

3. The method of claim 1, wherein, calculating distances of the m initial nodes from other edge nodes according to physical positions of each edge node to obtain m distance sets comprises: obtaining a first coordinate of each edge node according to the physical position of each edge node; substituting the first coordinate of each edge node into Formula 3 to calculate physical distances of each initial node from other edge nodes to obtain the m distance sets, Formula 3 being as follows, ; wherein, denotes a first coordinate of the initial node, denotes a distance between the edge node i and the initial node, denotes a first coordinate of the edge node i.

4. The method of claim 1, wherein, clustering the n edge nodes into the m clusters according to the m distance sets and the average resource amount comprises: sorting values in each distance set in ascending order to obtain m sorted distance sets; dividing the m initial nodes into the m clusters respectively to calculate total resource amounts of the m clusters; if there is a target cluster in the m clusters, the total resource amount of which has a difference greater than 1 from the average resource amount, then edge nodes in a target distance set are divided into the target cluster in sequence until the difference between the total resource amount of the target cluster and the average resource amount is not greater than 1, to obtain a clustered target cluster, wherein the target distance set represents a distance set corresponding to a target initial node, and the target initial node represents an initial node corresponding to the target cluster. If the target cluster does not exist in the m clusters, the m clusters after clustering are obtained, and a cluster ID of each cluster and a member node ID of each member node in each cluster are set.

5. The method of claim 3, wherein, The storage locations of the fragments of the monitoring video in the n edge nodes are determined by the m cluster controllers, and a fragment index is obtained, including: hashing the first coordinate of each edge node to obtain a hash domain, wherein the hash domain contains n partitions; the monitoring video is divided into v fragments of a preset size, and a fragment ID of each fragment and a video ID of the monitoring video are configured, wherein v is a positive integer; video stream data of each fragment of the v fragments is calculated to determine a first partition corresponding to each fragment in the hash domain and an edge node corresponding to each first partition; the fragment index is obtained according to the first partition corresponding to each fragment, the edge node corresponding to each first partition, the video ID and the fragment ID of each fragment.

6. The method of claim 5, wherein, hashing the first coordinate of each edge node to obtain a hash domain includes: the static IP of each edge node is substituted into formula four to calculate the second coordinate of each edge node, and formula four is as follows, ; wherein, denotes a second coordinate of edge node i, denotes a static IP of edge node i, denotes a computing performance parameter, denotes a hash function; the n edge nodes are sorted in ascending order according to the abscissa of the second coordinate to obtain an edge node array; in a rectangular coordinate system, a coordinate range in which the value of the abscissa and the value of the ordinate are both greater than the second coordinate of the i th edge node and less than the second coordinate of the i-1 th edge node is determined as the i th partition to obtain n partitions corresponding to the n edge nodes, wherein the i th edge node and the i-1 th edge node are both edge nodes in the edge node array; the hash domain is determined by the n partitions corresponding to the n edge nodes.

7. The method of claim 5, wherein, calculating the video stream data of each fragment of the v fragments to determine a first partition corresponding to each fragment in the hash domain and an edge node corresponding to each first partition includes: the video stream data of each fragment of the v fragments is substituted into formula five to calculate the third coordinate corresponding to the v fragments, and formula five is as follows, ; wherein, denotes a third coordinate of the edge node i, denotes video stream data of the shard i, denotes a computing performance parameter, denotes a hash function; in the hash domain, the first partition corresponding to each fragment and the edge node corresponding to each first partition are determined according to the third coordinate corresponding to the v fragments.

8. The method of claim 5, wherein, After determining the storage locations of the fragments of the monitoring video in the n edge nodes by the m cluster controllers to obtain the fragment index, the method further includes: video stream data of the v fragments is copied to obtain v copied fragments and a copied fragment ID of each copied fragment; the video stream data of each copied fragment is substituted into formula six to calculate the fourth coordinate corresponding to each copied fragment, and formula six is as follows, ; wherein, denotes a fourth coordinate of the replica shard i, denotes video stream data of the shard i, denotes a computing performance parameter, denotes a hash function; in the hash domain, the second partition corresponding to each copied fragment, the edge node corresponding to each second partition and the copied fragment ID of each copied fragment are determined according to the fourth coordinate corresponding to the v copied fragments to obtain a copied fragment index; storing, by the m cluster controllers, the replicated shard index to the monitoring center.

9. The method of claim 8, wherein, After storing, by the m cluster controllers, the shard index to the monitoring center, the method further comprises: obtaining a target video ID of a target monitoring video; determining q target edge nodes storing r target shards of the target monitoring video according to the target video ID and the shard index, wherein r is greater than or equal to q, and r and q are positive integers; obtaining the r target shards from the q target edge nodes and merging the r target shards to obtain the target monitoring video.

10. The method of claim 9, wherein, After obtaining the r target shards from the q target edge nodes and merging the r target shards to obtain the target monitoring video, the method further comprises: if there is a missing target shard in the q target edge nodes, obtaining a target replicated shard corresponding to the missing target shard according to the replicated shard index; obtaining the r target shards from the non-missing target shard and the target replicated shard, and merging the r target shards to obtain the target monitoring video.

11. The method of claim 8, wherein, After storing, by the m cluster controllers, the shard index to the monitoring center, the method further comprises: judging whether there is an offline edge node or a new edge node in the n edge nodes every preset time length; if there is the offline edge node or the new edge node, recalculating the hash domain to obtain an updated hash domain; recalculating new edge nodes corresponding to each shard of the monitoring video according to the updated hash domain; updating the shard index according to the new edge nodes corresponding to each shard to obtain an updated shard index; adjusting edge nodes storing each shard of the monitoring video according to the updated shard index and the replicated shard index; storing, by the m cluster controllers, the updated shard index to the monitoring center.

12. A storage device for surveillance video, characterized by comprises: a clustering unit configured to cluster n edge nodes according to resource amounts of the n edge nodes to obtain m clusters, wherein the edge nodes represent business outlets of an enterprise; a generating unit configured to generate a cluster controller according to a resource amount of each cluster in the m clusters to obtain m cluster controllers; a first determining unit configured to determine storage locations of shards of the monitoring video in the n edge nodes by the m cluster controllers to obtain a shard index; a first storing unit configured to store the shard index to a monitoring center by the m cluster controllers, so that a target object retrieves a monitoring video from the monitoring center according to the shard index; The clustering unit comprises: a first calculation sub-unit, configured to calculate an average resource amount of each cluster according to node information of each edge node; a determination sub-unit, configured to determine m edge nodes from n edge nodes to obtain m initial nodes; a second calculation sub-unit, configured to calculate distances between the m initial nodes and other edge nodes according to physical positions of each edge node to obtain m distance sets; and a clustering sub-unit, configured to cluster the n edge nodes into m clusters according to the m distance sets and the average resource amount.

13. A processor, comprising: The processor is configured to run a program, and the program, when running, performs the storage method of the surveillance video of any one of claims 1 to 11.

14. An electronic device, comprising: The apparatus comprises one or more processors and a memory configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the storage method of the surveillance video of any one of claims 1 to 11.

Citation Information

Patent Citations

  • Model file storage method and device, readable storage medium and computer device

    CN109977077A

  • Edge cloud collaboration method and device

    CN113630383A