CN114650392A - Resource management method and device, electronic equipment and storage medium - Google Patents

Resource management method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114650392A
CN114650392A CN202011520601.7A CN202011520601A CN114650392A CN 114650392 A CN114650392 A CN 114650392A CN 202011520601 A CN202011520601 A CN 202011520601A CN 114650392 A CN114650392 A CN 114650392A
Authority
CN
China
Prior art keywords
resource
resources
capacity
state
resource pool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011520601.7A
Other languages
Chinese (zh)
Inventor
寇毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Yu Vision Mdt Infotech Ltd
Original Assignee
Xi'an Yu Vision Mdt Infotech Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xi'an Yu Vision Mdt Infotech Ltd filed Critical Xi'an Yu Vision Mdt Infotech Ltd
Priority to CN202011520601.7A priority Critical patent/CN114650392A/en
Publication of CN114650392A publication Critical patent/CN114650392A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
    • H04N7/181Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast for receiving images from a plurality of remote sources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals

Abstract

The embodiment of the application discloses a resource management method, a resource management device, electronic equipment and a storage medium, wherein the method specifically comprises the following steps: initializing the use states of all resources in the resource pool into a dormant state; activating at least one target resource in the resource pool according to the storage capacity allocated by the user, so that the data acquired by the collector is stored in the target resource in an activated state based on a consistent hash algorithm; and responding to the triggering operation of capacity reduction on the resource pool, and selecting the resource meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool. Because the data is only stored in the resources in the activated state, when the resource pool is reduced, the resources in the dormant state are directly selected for reducing the capacity of the resource pool, so that the reduced capacity resources do not need to be subjected to data migration, the operation time of reducing the capacity of the resource pool is reduced, the performance pressure of reading and writing the disk is reduced, and the aim of optimizing the management effect of the resource pool is fulfilled.

Description

Resource management method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of monitoring technologies, and in particular, to a resource management method and apparatus, an electronic device, and a storage medium.
Background
With the continuous development of social economy, user objects are more and more diversified, and the storage requirements of massive picture and video data related to a monitoring system are more and more, so that the flexible configuration requirements of the cloud storage system are higher and higher, the flexible configuration requirements of different types of services are met, and the construction and control of a complex monitoring networking on site are met. Currently, cloud storage applied in the monitoring industry takes resources as a management unit, and the usage capacity allocated by a user is based on the resources of a resource pool, so that management (such as expansion and reduction) of the resource pool is very important in meeting the requirement of configuration diversification.
After the storage capacity is allocated to the user on the resource pool, an IPC (IP Camera) belonging to the user in the monitoring system uniformly stores the acquired data on all resources in the resource pool. Therefore, when the resource pool needs to be managed, for example, when the resource pool is subjected to capacity reduction, if the capacity of the capacity required to be reduced by a user is large and the amount of data stored in the previous period is large, the number of resources selected by the storage system for capacity reduction is large, and a large amount of data needs to be migrated to other resources, so that the time consumption for capacity reduction of the resource pool is long, the read-write pressure of a disk is large, and the storage performance is affected. In addition, when the resource pool is reduced in capacity, the risk of long-time data migration is uncontrollable, and various other abnormal conditions may occur in the data migration process to cause migration interruption, so that the capacity reduction of the resource pool fails. Therefore, the management effect of the resource pool in the prior art is poor.
Disclosure of Invention
The embodiment of the application provides a resource management method, a resource management device, an electronic device and a storage medium, so as to achieve the purpose of optimizing the management effect of a resource pool.
In a first aspect, an embodiment of the present application provides a resource management method, where the method includes:
initializing the use states of all resources in the resource pool into a dormant state; the data stored by the resources in the dormant state is in a read-only and deletion-allowed state;
activating at least one target resource in the resource pool according to the storage capacity allocated by the user, so that the data acquired by the collector is stored in the target resource in an activated state based on a consistent hash algorithm;
and responding to the triggering operation of capacity reduction on the resource pool, and selecting the resource meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
In a second aspect, an embodiment of the present application provides an apparatus for resource management, where the apparatus includes:
the initialization module is used for initializing the use states of all resources in the resource pool into a dormant state; the data stored by the resources in the dormant state is in a read-only and deletion-allowed state;
the resource activation module is used for activating at least one target resource in the resource pool according to the storage capacity allocated by the user, so that the data acquired by the acquisition unit is stored in the target resource in an activated state based on a consistent Hash algorithm;
and the capacity reduction management module is used for responding to the triggering operation of capacity reduction on the resource pool, and selecting the resources meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
In a third aspect, an embodiment of the present application further provides an electronic device, including:
one or more processors;
a storage device to store one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement a resource management method as in any embodiment of the present application.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a resource management method according to any embodiment of the present application.
In the embodiment of the application, a certain amount of resources are activated to be responsible for data storage according to the storage capacity allocated by a user, other resources are in a dormant state, when the capacity reduction of the resource pool is needed, the resources meeting the capacity requirement are directly selected from the resources in the dormant state to carry out the capacity reduction of the resource pool, and the resources in the dormant state do not store the data collected by the collector, so that data migration is not needed during the capacity reduction, the operation time of the capacity reduction of the resource pool is shortened, the performance pressure of disk reading and writing is reduced, and the purpose of optimizing the management effect of the resource pool is finally realized.
Drawings
FIG. 1a is a schematic flow chart of a resource management method in a first embodiment of the present application;
FIG. 1b is a schematic diagram of a resource pool in the first embodiment of the present application;
FIG. 1c is a schematic diagram of the resource pool capacity reduction in the first embodiment of the present application;
FIG. 2a is a schematic flow chart of a resource management method in a second embodiment of the present application;
FIG. 2b is a schematic diagram illustrating a descending order of resources in a resource pool according to a second embodiment of the present application;
FIG. 3a is a flow chart of a resource management method in a third embodiment of the present application;
FIG. 3b is a schematic diagram of a hash ring in a third embodiment of the present application; FIG. 4 is a schematic flow chart of a resource management method in a fourth embodiment of the present application;
FIG. 5a is a flow chart of a resource management method in a fifth embodiment of the present application;
FIG. 5b is a schematic structural diagram of a resource pool after a user allocates storage capacity for multiple times in a fifth embodiment of the present application;
FIG. 6 is a flowchart illustrating a resource management method according to a sixth embodiment of the present application;
FIG. 7 is a schematic structural diagram of a resource management apparatus according to a seventh embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device implementing a resource management method in an eighth embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some of the structures related to the present application are shown in the drawings, not all of the structures.
Fig. 1a is a flowchart of a resource management method according to a first embodiment of the present application, where this embodiment is applicable to a case of performing capacity reduction management on a resource pool of a monitoring system, and the method may be executed by a resource management apparatus, where the apparatus may be implemented in a software and/or hardware manner, and may be integrated in an electronic device, for example, a data storage server integrated in the monitoring system.
As shown in fig. 1a, the resource management method specifically includes the following processes:
s101, initializing the use states of all resources in the resource pool into a dormant state.
In the embodiment of the present application, the usage state of the resource includes a sleep state and an active state. The data stored by the resources in the dormant state is in a read-only and deletion-allowed state; in the active state, the data stored by the resource is in a readable and writable state.
In the embodiment of the present application, in order to avoid that the collector of the monitoring system uniformly stores the acquired data on all resources of the resource pool, the use states of all resources in the resource pool are initialized to the dormant state, that is, data are prohibited to be written into each resource of the resource pool. Exemplarily, referring to fig. 1b, a schematic diagram of a resource pool structure is shown, wherein the resource pool includes 20 resources, and the usage states of resources 1 to 20 are adjusted to the dormant state in the initial state.
S102, activating at least one target resource in the resource pool according to the storage capacity distributed by the user, and storing the data collected by the collector in the activated target resource based on the consistent Hash algorithm.
In the embodiment of the application, the storage capacity allocated by the USER is USER, and the USER refers to a block of logic space divided from a resource pool, and the USER can allocate the logic space at will to provide the size of the virtual space for data writing to a collector of the monitoring system. The collector of the monitoring system is an IPC (IP Camera) which is a trend of IP video monitoring and high-definition video monitoring, and the IPC has the function of integrating a Camera and an encoder, digitalizing and compressing and encoding analog video and audio signals to form an IP data packet and transmitting the IP data packet to a specified destination address by using a network.
And activating at least one target resource in the resource pool according to the storage capacity allocated by the user, as long as the total resource capacity of the activated at least one target resource is not less than the storage capacity allocated by the user. Illustratively, in conjunction with fig. 1b, when the storage capacity allocated by the user is 8T, when activating the resources in the resource pool, only resource 1 with a capacity of 10T, or only resource 2 with a capacity of 18T, or both resource 3 with a capacity of 5T and resource 20 with a capacity of 3T may be activated.
On the basis of activating at least one target resource, the data collected by the collector can be stored in the target resource in the activated state based on a consistent hash algorithm.
S103, responding to the trigger operation of capacity reduction on the resource pool, and selecting the resource meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
In the embodiment of the application, a user can trigger a resource pool to perform capacity reduction by issuing a capacity reduction control instruction, wherein the capacity reduction control instruction at least comprises capacity reduction capacity. And then selecting resources meeting the capacity reduction requirement from the resources in the dormant state for capacity reduction of the resource pool, namely selecting at least one resource from the resources in the dormant state, wherein the sum of the capacities of the selected resources is equal to the capacity reduction capacity. Furthermore, if no data storage exists in the selected resources, the data storage is directly removed from the resource pool, so that the purpose of capacity reduction of the resource pool is achieved.
Exemplarily, referring to fig. 1c, a schematic diagram of resource pool reduction is shown. Wherein, according to the storage capacity (USER) distributed by the USER, the resource 1, the resource 2 and the resource 3 are activated, and each collector (IPC) belonging to the USER uniformly stores the collected IPC data streams in the resource 1, the resource 2 and the resource 3 through a consistent hash algorithm. In response to the triggering operation of performing capacity reduction on the resource pool, selecting a resource meeting the capacity reduction requirement from the resources in the dormant state for performing resource pool capacity reduction, for example, if the capacity reduction specified by the user is 3T, deleting the resource 20 (with the capacity of 3T) in the dormant state from the resource pool, so as to achieve the purpose of capacity reduction.
In the embodiment of the application, a certain amount of resources are activated to be responsible for data storage according to the storage capacity allocated by a user, other resources are in a dormant state, and when the capacity reduction of the resource pool is needed, resources meeting the capacity requirement are directly selected from the resources in the dormant state to carry out the capacity reduction of the resource pool.
Fig. 2a is a flowchart of a resource management method according to a second embodiment of the present application, where this embodiment optimizes an operation of activating at least one target resource in a resource pool according to a storage capacity allocated by a user, referring to fig. 2a, the method includes:
s201, initializing the use states of all resources in the resource pool into a dormant state.
And in the dormant state, the data stored by the resource is in a read-only state and is allowed to be deleted.
S202, all resources in the dormant state are sorted in a descending manner according to the resource capacity.
For example, referring to fig. 2b, it shows a schematic diagram of the structure after the resources in the resource pool are sorted in a descending order, the resource 2 with the largest capacity is arranged at the head, and the resource 20 with the smallest capacity is arranged at the end.
S203, according to the storage capacity distributed by the user, activating at least one target resource according to the sequence of the resource capacity from large to small, so that the data collected by the collector is stored in the target resource in the activated state based on the consistent hash algorithm.
After all resources in the dormant state are sorted in a descending manner according to the resource capacity, at least one target resource is activated according to the sequence of the resource capacity from large to small, wherein the total resource capacity of the at least one activated target resource is not less than the storage capacity allocated by a user. That is, the resources are sequentially activated according to the sequence of the resource capacity from large to small until the sum of the total capacity of the activated resources is not less than the storage capacity allocated by the user. For example, if the storage capacity allocated by the user is 10T, only the resource 2 with the first-ranked 18T capacity needs to be activated, and the other resources still remain in the dormant state.
It should be noted that, the activation of the resource with the largest capacity is performed first, so as to ensure that the number of activated resources is reduced when the user subsequently reallocates the storage capacity. For example, after allocating 10T of storage capacity, the user allocates 5T of storage capacity, and the activated resource 2 (with a capacity of 18T) can completely meet the requirement without deactivating other resources.
S204, responding to the triggering operation of capacity reduction on the resource pool, and selecting the resource meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
In the embodiment of the application, the resources are sorted in a descending order according to the capacity and then activated in a descending order according to the capacity of the resources, so that the activated resources are least in quantity under the condition of meeting the storage requirement of a user, and the resources in the resource pool are convenient to manage.
Fig. 3a is a flowchart of a resource management method according to a third embodiment of the present application, where this embodiment is optimized based on the foregoing embodiment, and referring to fig. 3a, the method includes:
s301, initializing the use states of all resources in the resource pool to be dormant states.
In the embodiment of the present application, the usage state of the resource includes a sleep state and an active state. The data stored by the resources in the dormant state is in a read-only and deletion-allowed state; in the active state, the data stored by the resource is in a readable and writable state.
S302, activating at least one target resource in the resource pool according to the storage capacity allocated by the user.
For the process of activating at least one target resource in the resource pool according to the storage capacity allocated by the user, reference may be made to the description of the foregoing embodiment, and details are not repeated here.
In this embodiment, a process of storing data collected by a collector to an activated resource is mainly described. Because the data collected by the collector is stored based on the consistent hash algorithm, the data needs to be added with suffixes in advance according to the names of the resources forming the resource poolIn the form of a fixed value as a basic value for hash (hash) calculation, and a ring space composed of the fixed value, see fig. 3b for an example, which shows a schematic diagram of a hash ring, where the size of the ring space is 232The 32 hash values calculated by each resource are uniformly distributed on the hash ring. See S303-S305 for a specific process of storing data based on a consistent hashing algorithm.
It should be noted that the virtual node corresponding to the resource in the dormant state on the hash ring is in a read-only state, which means that the acquired data cannot be stored in the resource corresponding to the virtual node; the virtual node corresponding to the resource in the activated state on the hash ring is in a read-write permission state, that is, the acquired data can be stored in the resource corresponding to the virtual node.
And S303, calculating to obtain a hash value according to the equipment code of the collector and a preset hash function.
S304, searching target virtual nodes adjacent to the hash value on the hash ring according to a preset sequence.
S305, when the target virtual node is judged to be in the read-write permission state and the number of the collectors which store the data into the resources corresponding to the target virtual node is smaller than the first preset number, storing the collected data into the target resources corresponding to the target virtual node.
When data are stored in the activated resources, a hash value is calculated according to the device code of the collector and a preset hash function, the nearest virtual node is searched on a hash ring according to a preset sequence (for example, clockwise), and the state of the virtual node is judged. If the virtual node is in a readable and writable state (i.e., a read-write allowed state), it indicates that the resource corresponding to the virtual node is in an active state, and may be selected to be used for data storage, and if the virtual node is in a read-only state, it indicates that the resource corresponding to the virtual node is in a dormant state, and cannot be used for storing data, it needs to skip the virtual node, and continue to search for the next nearest virtual node clockwise until the readable and writable virtual node is encountered.
Furthermore, in consideration of the read-write pressure of the disk, each virtual node on the hash ring supports a first preset number of collectors to store data into the resource corresponding to the virtual node, and each resource supports a second preset number of collectors to store data, wherein the second preset number is equal to the product of the first preset number and the number of virtual nodes corresponding to one resource. Therefore, after determining that the target virtual node is in the read-write enabled state, it is further determined whether the number of collectors that have executed to store data into the resource corresponding to the target virtual node is smaller than a first preset number. If yes, storing the acquired data into a target resource corresponding to the target virtual node; if not, skipping the target virtual node, and clockwise searching the next adjacent readable and writable virtual node.
Illustratively, each resource supports 512-way collector (IPC) storage, and thus its corresponding 32 virtual nodes, each virtual node supports 16-way collector (IPC) storage. If a virtual node in a readable and writable state has been selected by 16 IPCs, then the next adjacent readable and writable virtual node needs to be skipped and looked up clockwise.
It should be noted that, the currently activated resource node needs to satisfy all the IPC storage requirements configured by the user, and when the IPC does not find an available virtual node on the hash ring, the system needs to activate another virtual node.
S306, responding to the triggering operation of capacity reduction on the resource pool, and selecting the resource meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
In an optional implementation manner, in response to a triggering operation for performing capacity reduction on a resource pool, selecting a resource meeting capacity reduction requirements from resources currently in a dormant state to perform resource pool capacity reduction, including: responding to the trigger operation of capacity reduction on the resource pool, and selecting at least one resource from the resources in the dormant state; the sum of the resource capacity of at least one selected resource is the same as the capacity reduction capacity; and deleting the selected at least one resource from the resource pool, and deleting the virtual node corresponding to the deleted resource on the hash ring.
In the embodiment of the application, whether the data acquired by the current acquisition device is stored in the resource corresponding to the virtual node is judged by judging the state of a certain virtual node and determining the times that the virtual node is selected by other acquisition devices. Therefore, the data are accurately stored in the resources in the activated state, and the disk reading and writing pressure of the resources is also considered.
Fig. 4 is a flowchart of a resource management method according to a fourth embodiment of the present application, where this embodiment is optimized based on the foregoing embodiment, and referring to fig. 4, the method includes:
s401, initializing the use states of all resources in the resource pool to be dormant states.
S402, activating at least one target resource in the resource pool according to the storage capacity distributed by the user, and storing the data collected by the collector in the activated target resource based on the consistent Hash algorithm.
And S403, if the activated target resource is abnormal, adjusting the virtual node of the target resource on the hash ring to be in an abnormal state.
In the embodiment of the application, if an abnormal condition occurs in the activated target resource during the data storage process and the activated target resource cannot work normally, the target resource is adjusted to be in a dormant state, that is, the abnormal resource is prohibited from storing data again. And meanwhile, the virtual node of the target resource on the hash ring is adjusted to be in an abnormal state, so that the virtual node corresponding to the target resource is not hit by data selection storage any more. It should be noted that, when the target resource goes to sleep, the data (IPC data stream) currently stored on the target resource needs to be stored again by selecting the resource virtual node.
S404, selecting at least one standby resource with the sum of the capacities not less than the capacity of the abnormal target resource from other resources in the dormant state, and activating the at least one standby resource so that the standby resource can continuously store the data collected by the collector.
When the abnormal resources are adjusted to be in the dormant state, in order to guarantee the requirements of users, the total capacity of the currently activated resources is compared with the total capacity of the requirements of the users, and if the total capacity of the currently activated resources is smaller than the total capacity of the requirements of the users, standby resources with the same capacity or larger than the capacity of the abnormal resources are awakened from other resources in the dormant state, so that the standby resources can continuously store the data acquired by the acquirer.
S405, responding to the trigger operation of capacity reduction on the resource pool, and selecting the resources meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
It should be noted that, if the resource meeting the capacity reduction requirement is selected from the resources currently in the dormant state and is a resource adjusted to the dormant state due to an abnormality, a small amount of data is stored in the selected resource, and during capacity reduction, the small amount of data stored in the selected resource needs to be migrated to other resources in the active state, and then the selected resource dormant due to the abnormality needs to be deleted from the resource pool.
In the embodiment of the application, when a certain resource is abnormal, the abnormal resource is dormant, and the resource with the capacity not less than that of the abnormal resource is selected to replace the abnormal resource to work, so that the safety of data storage is ensured, and the elastic management of the resource is realized. And even if the resource dormant due to the abnormality is selected during capacity reduction, only a small amount of data migration is needed, the capacity reduction time is short, and the performance pressure on the disk is small.
Fig. 5a is a flowchart of a resource management method according to a fifth embodiment of the present application, where the present embodiment is optimized based on the foregoing embodiments, and referring to fig. 5a, the method includes:
s501, initializing the use states of all resources in the resource pool to be dormant states.
In the embodiment of the present application, the usage state of the resource includes a sleep state and an active state. The data stored by the resources in the dormant state is in a read-only and deletion-allowed state; in the active state, the data stored by the resource is in a readable and writable state.
S502, activating at least one target resource in the resource pool according to the storage capacity allocated by the user, so that the data acquired by the collector is stored in the target resource in the activated state based on the consistent Hash algorithm.
S503, if the user deletes the storage capacity allocated for a certain time, adjusting part of the resources in the activated state to the dormant state according to the residual storage capacity of the user.
In the embodiment of the present application, the USER may allocate the storage capacity multiple times, for example, see fig. 5b, which shows that the USER allocates the storage capacity three times (USER1, USER2, USER3), each time the allocated storage capacity is 10T, and resource 2, resource 1 and resource 3 in the corresponding resource pool are activated.
If the user deletes the storage capacity allocated at a certain time, the storage system will recover the corresponding capacity, and then adjust part of the resources in the activated state to the dormant state according to the remaining storage capacity of the user. In an alternative embodiment, adjusting the partial resources in the active state to the dormant state according to the remaining storage capacity of the user includes: the resources in the activated state are sorted in a descending manner according to the resource capacity; and sequentially adjusting the resources in the activated state to the dormant state from small to large until the total resource capacity of the remaining resources in the activated state is not less than the remaining storage capacity of the user. It should be noted that the sleep is performed in sequence from small to large, so as to ensure that the resources in the activated state are as few as possible, facilitate management, and do not activate the resources frequently. Moreover, when the resource is dormant, the data (IPC data stream) currently stored on the resource needs to be stored again by selecting the resource virtual node.
For example, if the USER deletes for USER2 and USER3, resource 1 and resource 3 in the active state may be adjusted to the dormant state, and the remaining resource 2(18T capacity) is sufficient for the USER to use.
S504, responding to the triggering operation of capacity reduction on the resource pool, and selecting the resource meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
It should be noted that, if the resource meeting the capacity reduction requirement is selected from the resources currently in the dormant state, and the resource is adjusted to the dormant state because the user deletes the storage capacity, a small amount of data is stored in the selected resource, and during capacity reduction, the small amount of data stored in the selected resource needs to be migrated to other resources in the active state, and then the selected resource which is abnormally dormant is deleted from the resource pool.
In the embodiment of the application, when the user deletes the storage capacity, the partially activated resources are adjusted to be in the dormant state to wait for being activated next time, so that the data are ensured to be stored in the minimum range of resources at any time, and the capacity reduction management of the resource pool is facilitated.
Fig. 6 is a flowchart of a resource management method according to a sixth embodiment of the present application, where this embodiment is optimized based on the foregoing embodiments, in this embodiment, a state of a resource includes a use state (including a sleep state and an active state) and a loading state, and the loading state includes both an online state and an offline state; wherein, the loading state represents that the resource is available when online; the load state being offline indicates that the resource is unavailable due to an exception. Referring to fig. 6, the method includes:
s601, updating and recording the change of the use state and the loading state of the resource in the database in real time.
When the resource is unavailable due to the abnormal condition of the resource, the loading state of the resource is updated to an offline state and is synchronously updated to the database, which indicates that the resource can not carry out data reading and writing operations.
The resource use state is divided into a dormant state and an active state, and is used for distinguishing whether the resource is currently activated by the resource pool or not to provide data storage service for the data stream. The use state of all resources after the resource pool is divided is initialized to a dormant state, the corresponding state of all resources is marked as 'unused' in the database, and when a certain resource is activated, the use state of the resource is updated and marked as 'in use' in the database. Meanwhile, if a certain resource is adjusted from the active state to the dormant state, the mark 'in use' of the resource is updated to 'unused' in the database. Therefore, the change of the use state and the loading state of the recording resource can be updated in real time through the database.
And S602, initializing the resources according to the use state and the loading state of each resource recorded in the database when the equipment is restarted.
For example, if the resource usage status in the database is marked as "in use", the resource is activated in the resource pool during initialization; and if the resource with the use state marked as 'unused', the resource is initialized to the dormant state in the resource pool, namely the resource in the dormant state only supports data reading and deleting and does not support data writing.
In the embodiment of the application, the change of the use state and the loading state of the resource is recorded through the database, so that when the equipment needs to be restarted in case of abnormal conditions, the initialization can be completed according to the state data recorded by the database, and the resource in the resource pool can continuously work according to the state before restarting.
Fig. 7 is a schematic structural diagram of a resource management apparatus according to a seventh embodiment of the present application, where this embodiment is applicable to a situation where a monitoring system resource pool performs capacity reduction management, and referring to fig. 3, the apparatus includes:
a first initialization module 701, configured to initialize the use states of all resources in the resource pool to a dormant state; the data stored by the resources in the dormant state is in a read-only and deletion-allowed state;
a resource activation module 702, configured to activate at least one target resource in the resource pool according to a storage capacity allocated by a user, so that data acquired by the collector is stored in the target resource in an activated state based on a consistent hash algorithm;
the capacity reduction management module 703 is configured to select, in response to a trigger operation for performing capacity reduction on a resource pool, a resource that meets a capacity reduction requirement from resources currently in a dormant state to perform capacity reduction on the resource pool.
On the basis of the foregoing embodiment, optionally, the resource activation module includes:
the first sequencing unit is used for carrying out descending sequencing on all resources in the dormant state according to the resource capacity;
the activation unit is used for activating at least one target resource according to the storage capacity distributed by the user and the sequence of the resource capacity from large to small; wherein the total resource capacity of the activated at least one target resource is not less than the storage capacity allocated by the user.
On the basis of the above embodiment, optionally, the virtual node corresponding to the resource in the dormant state on the hash ring is in a read-only state; and the virtual node corresponding to the resource in the activated state on the hash ring is in a read-write permission state.
On the basis of the foregoing embodiment, optionally, the apparatus further includes:
the first state adjusting module is used for adjusting a certain activated target resource into a dormant state if the target resource is abnormal, and adjusting a virtual node of the target resource on a hash ring into an abnormal state;
the first screening module is used for selecting at least one standby resource with the capacity sum not smaller than the capacity of the abnormal target resource from other resources in the dormant state and activating the at least one standby resource so that the standby resource can continuously store the data collected by the collector.
On the basis of the above embodiment, optionally, each virtual node on the hash ring supports a first preset number of collectors to store data into a resource corresponding to the virtual node, and each resource supports a second preset number of collectors to store data.
On the basis of the foregoing embodiment, optionally, the process of storing, by the collector, the collected data in the target resource in the activated state based on the consistent hash algorithm includes:
calculating to obtain a hash value according to the equipment code of the collector and a preset hash function;
searching a target virtual node adjacent to the hash value on the hash ring according to a preset sequence;
and when the target virtual node is judged to be in a read-write permission state and the number of the collectors which store the data into the resources corresponding to the target virtual node is smaller than a first preset number, storing the collected data into the target resources corresponding to the target virtual node.
On the basis of the foregoing embodiment, optionally, the capacity reduction management module includes:
the resource screening unit is used for responding to the trigger operation of capacity reduction on the resource pool and selecting at least one resource from the resources in the dormant state; the sum of the resource capacity of the selected at least one resource is the same as the capacity reduction capacity;
and the resource deleting unit is used for deleting the selected at least one resource from the resource pool and deleting the virtual node corresponding to the deleted resource on the hash ring.
On the basis of the above embodiment, optionally, the apparatus further includes:
and the second state adjusting module is used for adjusting part of resources in the activated state to be in the dormant state according to the residual storage capacity of the user if the user deletes the storage capacity allocated at a certain time.
On the basis of the foregoing embodiment, optionally, the second state adjustment module includes:
the second sequencing unit is used for sequencing the resources in the activated state in a descending manner according to the resource capacity;
and the state adjusting unit is used for sequentially adjusting the resources in the activated state to the dormant state from small to large until the total resource capacity of the remaining resources in the activated state is not less than the remaining storage capacity of the user.
On the basis of the above embodiment, optionally, the states of the resources further include a loading state, and the loading state includes an online state and an offline state;
wherein, the loading state represents that the resource is available when online; the load state being offline indicates that the resource is unavailable due to an exception.
On the basis of the above embodiment, optionally, the apparatus further includes:
the updating recording module is used for updating and recording the change of the use state and the loading state of the resource in the database in real time;
and the second initialization module is used for initializing the resources according to the use state and the loading state of each resource recorded in the database when the equipment is restarted.
The resource management device provided by the embodiment of the application can execute the resource management method provided by any embodiment of the application, and has corresponding functional modules and beneficial effects of the execution method.
Fig. 8 is a schematic structural diagram of an electronic device provided in an eighth embodiment of the present application. As shown in fig. 8, the electronic device provided in the embodiment of the present application includes: one or more processors 802 and memory 801; the processor 802 in the electronic device may be one or more, and one processor 802 is taken as an example in fig. 8; the memory 801 is used to store one or more programs; the one or more programs are executed by the one or more processors 802 such that the one or more processors 802 implement a method of resource management as in any of the embodiments of the present application.
The electronic device may further include: an input device 803 and an output device 804.
The processor 802, the memory 801, the input device 803, and the output device 804 in the electronic apparatus may be connected by a bus or other means, and fig. 8 illustrates an example of a connection by a bus.
The storage device 801 in the electronic device is used as a computer-readable storage medium for storing one or more programs, which may be software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the resource management method provided in the embodiment of the present application. The processor 802 executes various functional applications and data processing of the electronic device by running software programs, instructions and modules stored in the storage device 801, namely, implements the resource management method in the above method embodiment.
The storage device 801 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 801 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 801 may further include memory located remotely from the processor 802, which may be connected to the device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input unit 803 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic device. The output device 804 may include a display device such as a display screen.
And when the one or more programs included in the electronic device are executed by the one or more processors 802, the programs perform the following operations:
initializing the use states of all resources in the resource pool into a dormant state; the data stored by the resources in the dormant state is in a read-only and deletion-allowed state;
activating at least one target resource in the resource pool according to the storage capacity allocated by the user, so that the data acquired by the collector is stored in the target resource in an activated state based on a consistent hash algorithm;
and responding to the triggering operation of capacity reduction on the resource pool, and selecting the resource meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
Of course, it will be understood by those skilled in the art that when one or more programs included in the electronic device are executed by the one or more processors 802, the programs may also perform related operations in the resource management method provided in any embodiment of the present application.
One embodiment of the present application provides a computer-readable storage medium having stored thereon a computer program for executing, when executed by a processor, a method of resource management, the method comprising:
initializing the use states of all resources in the resource pool into a dormant state; the data stored by the resources in the dormant state is in a read-only and deletion-allowed state;
activating at least one target resource in the resource pool according to the storage capacity allocated by the user, so that the data acquired by the collector is stored in the target resource in an activated state based on a consistent hash algorithm;
and responding to the triggering operation of capacity reduction on the resource pool, and selecting the resource meeting the capacity reduction requirement from the resources in the dormant state to carry out the capacity reduction on the resource pool.
Optionally, the program, when executed by a processor, may be further configured to perform the method provided in any of the embodiments of the present application.
The computer storage media of embodiments of the present application may take any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read Only Memory (ROM), an Erasable Programmable Read Only Memory (EPROM), a flash Memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. A computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take a variety of forms, including, but not limited to: an electromagnetic signal, an optical signal, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, Radio Frequency (RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including, for example, a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present application and the technical principles employed. It will be understood by those skilled in the art that the present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims (10)

1. A method for resource management, comprising:
initializing the use states of all resources in a resource pool into a dormant state; the data stored by the resources in the dormant state is in a read-only and deletion-allowed state;
activating at least one target resource in the resource pool according to the storage capacity allocated by the user, so that the data acquired by the collector is stored in the target resource in an activated state based on a consistent hash algorithm;
and responding to the triggering operation of capacity reduction on the resource pool, and selecting the resources meeting the capacity reduction requirement from the resources in the dormant state at present to carry out the capacity reduction on the resource pool.
2. The method of claim 1, wherein activating at least one target resource in the resource pool according to a user allocated storage capacity comprises:
all resources in the dormant state are sorted in a descending manner according to the resource capacity;
according to the storage capacity distributed by the user, activating at least one target resource according to the sequence of the resource capacity from large to small; wherein the total resource capacity of the activated at least one target resource is not less than the storage capacity allocated by the user.
3. The method of claim 1, wherein the virtual node corresponding to the resource in the dormant state on the hash ring is in a read-only state; and the virtual node corresponding to the resource in the activated state on the hash ring is in a read-write permission state.
4. The method of claim 3, further comprising:
if some activated target resource is abnormal, adjusting the target resource to be in a dormant state, and adjusting a virtual node of the target resource on the hash ring to be in an abnormal state;
and selecting at least one standby resource with the capacity sum not less than the capacity of the abnormal target resource from other resources in the dormant state, and activating the at least one standby resource so that the standby resource continuously stores the data acquired by the acquisition unit.
5. The method of claim 3, wherein the step of the collector storing the collected data in the activated target resource based on the consistent hash algorithm comprises:
calculating to obtain a hash value according to the equipment code of the collector and a preset hash function;
searching a target virtual node adjacent to the hash value on the hash ring according to a preset sequence;
and when the target virtual node is judged to be in the read-write permission state and the number of the collectors which store the data into the resources corresponding to the target virtual node is smaller than a first preset number, storing the collected data into the target resources corresponding to the target virtual node.
6. The method according to claim 3, wherein in response to a triggering operation for performing capacity reduction on the resource pool, selecting a resource meeting capacity reduction requirements from resources currently in a dormant state for performing resource pool capacity reduction, comprising:
responding to the trigger operation of capacity reduction on the resource pool, and selecting at least one resource from the resources in the dormant state; the sum of the resource capacity of at least one selected resource is the same as the capacity reduction capacity;
and deleting the selected at least one resource from the resource pool, and deleting the virtual node corresponding to the deleted resource on the hash ring.
7. The method of claim 1, further comprising:
if the user deletes the storage capacity allocated at a certain time, the resources in the activated state are sorted in a descending manner according to the resource capacity;
and sequentially adjusting the resources in the activated state to the dormant state from small to large until the total resource capacity of the remaining resources in the activated state is not less than the remaining storage capacity of the user.
8. A resource management apparatus, comprising:
the initialization module is used for initializing the use states of all resources in the resource pool into a dormant state; wherein, the data stored in the resources in the dormant state is in a read-only and deletion-allowed state;
the resource activation module is used for activating at least one target resource in the resource pool according to the storage capacity distributed by the user, so that the data acquired by the acquisition unit is stored in the target resource in an activated state based on a consistent hash algorithm;
and the capacity reduction management module is used for responding to the triggering operation of capacity reduction on the resource pool, and selecting the resources meeting the capacity reduction requirement from the resources in the dormant state at present to carry out the capacity reduction on the resource pool.
9. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the resource management method of any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method for resource management according to any one of claims 1 to 7.
CN202011520601.7A 2020-12-21 2020-12-21 Resource management method and device, electronic equipment and storage medium Pending CN114650392A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011520601.7A CN114650392A (en) 2020-12-21 2020-12-21 Resource management method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011520601.7A CN114650392A (en) 2020-12-21 2020-12-21 Resource management method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114650392A true CN114650392A (en) 2022-06-21

Family

ID=81991033

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011520601.7A Pending CN114650392A (en) 2020-12-21 2020-12-21 Resource management method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114650392A (en)

Similar Documents

Publication Publication Date Title
US9276959B2 (en) Client-configurable security options for data streams
CN103443770A (en) Terminal device, process management method and process management program
JPWO2007072544A1 (en) Information processing apparatus, computer, resource allocation method, and resource allocation program
CN111800285B (en) Instance migration method and device and electronic equipment
WO2019012735A1 (en) Ran slice resource management device and ran slice resource management method
JPWO2016030973A1 (en) Multi-tenant resource arbitration method
US20100211680A1 (en) Apparatus and method to allocate limited resources
CN110287009A (en) A kind of working node selection method, device, storage medium and server
CN113382077B (en) Micro-service scheduling method, micro-service scheduling device, computer equipment and storage medium
CN112153167A (en) Internet interconnection protocol management method, device, electronic equipment and storage medium
CN112199193A (en) Resource scheduling method and device, electronic equipment and storage medium
US8458719B2 (en) Storage management in a data processing system
CN114661419A (en) Service quality control system and method
CN106649654A (en) Data updating method and device
CN113515317A (en) Data recovery method and device
US8977752B2 (en) Event-based dynamic resource provisioning
CN115686346A (en) Data storage method and device and computer readable storage medium
CN114650392A (en) Resource management method and device, electronic equipment and storage medium
CN113127430A (en) Mirror image information processing method and device, computer readable medium and electronic equipment
CN114489761B (en) Service integration and application integration method based on container cluster
US20100228933A1 (en) Automatic selection of storage volumes in a data storage system
JP5617586B2 (en) Information processing program, relay device, and relay management device
CN113258679B (en) Power grid monitoring system channel distribution method based on server instance capacity reduction
CN111459653B (en) Cluster scheduling method, device and system and electronic equipment
CN110874344B (en) Data migration method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination