Cloud host cleaning method and device, computer equipment, storage medium and computer program product
By dividing the importance level for cloud hosts and setting corresponding cleaning conditions, the problem of low accuracy in cloud host cleaning judgment in the existing technology is solved, improving the cleaning accuracy and protecting important cloud hosts.
Patent Information
- Application Number
- CN202411708901.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-11
AI Technical Summary
In the management of existing technologies, there is a problem of not being accurate in determining whether cloud hosts need to be cleaned, and it is easy to clean up important cloud hosts incorrectly.
By dividing the importance levels for the cloud hosts to be cleaned and setting different first and second cleaning conditions according to each level, the cloud hosts carrying the cleaning mark are formally cleaned.
Improve the accuracy of judging whether cloud hosts need to be cleaned, ensure protection of important cloud hosts, and avoiding incorrect cleaning.
Smart Images

Figure CN119597477A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a cloud host cleaning method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of cloud computing, more and more applications are integrated into cloud hosts, and the management requirements for cloud hosts are getting higher and higher. Under the condition of limited computing node resources in the test environment, how to manage cloud hosts to improve resource utilization is the focus of current cloud host management.
[0003] In the related art, cloud hosts with low usage rates are usually identified at regular intervals and cleaned up. This method uses the same cleaning judgment standard for different cloud hosts, which can easily lead to the mistaken cleaning of cloud hosts that are less used but more important. Therefore, the related art has the problem of low accuracy in judging whether a cloud host needs to be cleaned up. Summary of the invention
[0004] Based on this, it is necessary to provide a cloud host cleaning method, device, computer equipment, storage medium and computer program product to address the above technical problems.
[0005] In a first aspect, the present application provides a cloud host cleaning method. The method comprises:
[0006] Obtain cloud hosts to be cleaned up, and determine the importance level of each of the cloud hosts to be cleaned up;
[0007] For any of the to-be-cleaned cloud hosts corresponding to any of the importance levels, determining usage status information of the to-be-cleaned cloud hosts, and if the usage status information satisfies a first cleaning condition corresponding to the importance level, taking the to-be-cleaned cloud hosts as target to-be-cleaned cloud hosts, wherein the target to-be-cleaned cloud hosts carry a cleaning mark;
[0008] When the target cloud host to be cleaned meets the second cleaning condition, the target cloud host to be cleaned is cleaned.
[0009] In one embodiment, the importance level includes at least a first importance level and a second importance level, and the method further includes:
[0010] In the case where the cloud host to be cleaned up is a public type cloud host, setting the importance level of the cloud host to be cleaned up to the first importance level; or,
[0011] In a case where the cloud host to be cleaned up is a private type cloud host, setting the importance level of the cloud host to be cleaned up to the second importance level;
[0012] The second importance level is lower than the first importance level.
[0013] In one of the embodiments, the second cleaning condition at least includes that the number of the target cloud hosts to be cleaned reaches a preset number.
[0014] In one of the embodiments, when the importance level is the first importance level, the method further includes:
[0015] Obtaining the expiration time of the cloud host to be cleaned up and the validity status of the cloud host;
[0016] If the expiration time is earlier than the target cleanup time, or the cloud host validity state is invalid, the first expiration state is determined as the expiration state of the cloud host to be cleaned corresponding to the target cleanup time;
[0017] When the expiration status of the cloud host to be cleaned up corresponding to the target cleanup time is the first expiration status, it is determined that the usage status information of the cloud host to be cleaned up satisfies a first cleanup condition corresponding to the first importance level.
[0018] In one embodiment, before taking the cloud host to be cleaned up as the target cloud host to be cleaned up, the method further includes:
[0019] Periodically acquiring valid cloud hosts to be cleaned up whose effective status is valid, and sending cleaning notification messages to user accounts corresponding to the valid cloud hosts to be cleaned up respectively, wherein the cleaning notification messages are used to prompt the user accounts to postpone processing of the valid cloud hosts to be cleaned up;
[0020] If a use extension request for the valid cloud host to be cleaned up is received, then based on the use extension request, the expiration time of the valid cloud host to be cleaned up is updated; or,
[0021] If a request to terminate the use of the valid cloud host to be cleaned up is received, the cloud host validity status of the valid cloud host to be cleaned up is updated to invalid.
[0022] In one embodiment, before cleaning the target cloud host to be cleaned up, the method further includes:
[0023] Performing shutdown processing for a preset time on each of the target cloud hosts to be cleaned up;
[0024] If a use extension request is received for any cloud host that is in a shutdown state and is to be cleaned up within the preset time period, the expiration time of the cloud host that is to be cleaned up is updated based on the use extension request, and if the expiration time is not earlier than the target cleaning time, the cleaning mark of the cloud host that is to be cleaned up is removed, and the cloud host that is to be cleaned up is powered on.
[0025] In a second aspect, the present application also provides a cloud host cleaning device. The device comprises:
[0026] A first determination module is used to obtain cloud hosts to be cleaned up and determine the importance level of each of the cloud hosts to be cleaned up;
[0027] A second determination module is used to determine the usage status information of any of the cloud hosts to be cleaned corresponding to any of the importance levels, and if the usage status information satisfies the first cleaning condition corresponding to the importance level, use the cloud host to be cleaned as a target cloud host to be cleaned, and the target cloud host to be cleaned carries a cleaning mark;
[0028] The cleaning module is used to clean up the target cloud host to be cleaned if the target cloud host to be cleaned meets the second cleaning condition.
[0029] In one embodiment, the importance level includes at least a first importance level and a second importance level, and the apparatus further includes:
[0030] The third determination module is used to set the importance level of the cloud host to be cleaned up to the first importance level when the cloud host to be cleaned up is a public type cloud host; or to set the importance level of the cloud host to be cleaned up to the second importance level when the cloud host to be cleaned up is a private type cloud host; wherein the second importance level is lower than the first importance level.
[0031] In one of the embodiments, the second cleaning condition at least includes that the number of the target cloud hosts to be cleaned reaches a preset number.
[0032] In one embodiment, when the importance level is the first importance level, the second determining module is further configured to:
[0033] Obtaining the expiration time of the cloud host to be cleaned up and the validity status of the cloud host;
[0034] If the expiration time is earlier than the target cleanup time, or the cloud host validity state is invalid, the first expiration state is determined as the expiration state of the cloud host to be cleaned corresponding to the target cleanup time;
[0035] When the expiration status of the cloud host to be cleaned up corresponding to the target cleanup time is the first expiration status, it is determined that the usage status information of the cloud host to be cleaned up satisfies a first cleanup condition corresponding to the first importance level.
[0036] In one embodiment, the device further comprises:
[0037] a sending module, used for periodically acquiring valid cloud hosts to be cleaned up whose effective status is valid, and sending cleaning notification messages to user accounts corresponding to the valid cloud hosts to be cleaned up respectively, wherein the cleaning notification messages are used for prompting the user accounts to postpone the processing of the valid cloud hosts to be cleaned up;
[0038] An update module is configured to update the expiration time of the valid cloud host to be cleaned up based on a use extension request received for the valid cloud host to be cleaned up; or to update the cloud host validity status of the valid cloud host to be cleaned up to invalidated if a use termination request is received for the valid cloud host to be cleaned up.
[0039] In one embodiment, the device further comprises:
[0040] A shutdown module, used to shut down each of the target cloud hosts to be cleaned for a preset time;
[0041] The startup module is used to update the expiration time of the cloud host to be cleaned up based on the usage extension request if a usage extension request is received for any cloud host to be cleaned up in the shutdown state within the preset time period, and remove the cleaning mark of the cloud host to be cleaned up when the expiration time is not earlier than the target cleaning time, and start up the cloud host to be cleaned up.
[0042] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any one of the above methods is implemented.
[0043] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any of the above methods is implemented.
[0044] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.
[0045] The above-mentioned cloud host cleaning method, device, computer equipment, storage medium and computer program product divide the importance level of each cloud host to be cleaned, and each importance level corresponds to a different first cleaning condition. When the usage status information of the cloud host to be cleaned meets the first cleaning condition corresponding to this importance level, a cleaning mark is added to the cloud host to be cleaned. When the second cleaning condition continues to be met, each cloud host to be cleaned with a cleaning mark is formally cleaned. Therefore, different standards can be used to determine whether to clean up cloud hosts of different importance levels, thereby improving the accuracy of the judgment on whether the cloud host needs to be cleaned. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of a flow chart of a cloud host cleaning method in one embodiment;
[0047] Figure 2 A schematic diagram of a flow chart for determining whether usage status information satisfies a first cleaning condition in one embodiment;
[0048] Figure 3 A schematic diagram of a process of sending a cleanup notification message to a user account in one embodiment;
[0049] Figure 4 A schematic diagram of a process of shutting down a cloud host to be cleaned up in one embodiment;
[0050] Figure 5 A schematic diagram of a flow chart of a cloud host cleaning method in one embodiment;
[0051] Figure 6 is a structural block diagram of a cloud host cleaning device in one embodiment;
[0052] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0054] In one embodiment, Figure 1 As shown, a cloud host cleaning method is provided. This embodiment uses the method applied to a server as an example for illustration. It is understandable that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0055] Step 102: Obtain cloud hosts to be cleaned up, and determine the importance level of each cloud host to be cleaned up.
[0056] In the embodiment of the present application, the cloud host to be cleaned up has been preliminarily screened and is judged to be a cloud host that may need to be cleaned up, such as a cloud host whose growth rate of the amount of data stored on the disk is less than a certain threshold over a period of time (that is, a cloud host with a low usage rate), a cloud host that has not been turned on for a period of time, a cloud host that has reached its expiration date, etc.
[0057] The importance level of the cloud host to be cleaned up is used to characterize the importance of the business running in the cloud host to be cleaned up to the user. The higher the importance level, the more important the business is to the user. The importance level can be generated in real time for the cloud host to be cleaned up after the cloud host to be cleaned up is determined, or the importance level can be determined in advance for each cloud host in the platform, and after the cloud host to be cleaned up is determined, the importance level corresponding to the cloud host to be cleaned up can be obtained.
[0058] The embodiments of the present application do not limit how the importance level is determined. In one embodiment, the importance level is determined based on the importance tag set by the user. When a cloud host is created, the user can manually set an importance tag for the cloud host. When the importance level needs to be determined, the server uses the importance level corresponding to the importance tag as the importance level corresponding to the cloud host to be cleaned.
[0059] In another embodiment, the importance level is determined based on the creation time of the cloud host to be cleaned, the number of usage extensions of the cloud host to be cleaned, and the storage data size corresponding to the cloud host to be cleaned. The number of usage extensions refers to the number of times the user sends a usage extension request to the server, so that the server modifies the expiration time of the cloud host to be cleaned. The storage data size refers to the total size of various data generated by the cloud host to be cleaned during operation.
[0060] Considering that the longer the creation time, the more times the use extensions are, and the larger the storage data, the more important the business running on the cloud host to be cleaned is, the importance level can be positively correlated with the creation time, the number of use extensions, and the storage data. Exemplarily, the server can set weights for the creation time, the number of use extensions, and the size of the stored data, respectively, and then calculate an importance score by weighting and summing the above three data according to their respective weights. The server can also pre-divide multiple preset importance levels, and set the importance score interval corresponding to each importance level, and then use the importance level corresponding to the importance score interval to which the importance score corresponding to the cloud host to be cleaned belongs as the importance level of the cloud host to be cleaned.
[0061] In another embodiment, the importance level is determined according to the host type. The host type is set by the user when creating a cloud host. The host type can be divided into a service scope type and a function type. The service scope type is used to characterize the service scope of the service provided by the cloud host. The function type is used to characterize the category of the service provided by the cloud host.
[0062] Exemplarily, service scope types may include public type (all users can use the business services of the cloud host), small-scale shared type (a part of designated users can use the business services of the cloud host), private type (a single user can use the business services of the cloud host), etc.; functional types may include front-end type (responsible for providing users with business services related to front-end pages), back-end type (responsible for providing users with business services related to back-end computing), database type (responsible for storing user data), etc.
[0063] In one embodiment, the importance level may include at least a first importance level and a second importance level. When the cloud host to be cleaned is a public type cloud host, the importance level of the cloud host to be cleaned is set to the first importance level; or when the cloud host to be cleaned is a private type cloud host, the importance level of the cloud host to be cleaned is set to the second importance level; wherein the second importance level is lower than the first importance level. In the embodiment of the present application, the wider the service scope represented by the service scope type, the higher the importance level of the cloud host to be cleaned, so that the cloud host serving more users can correspond to a higher importance.
[0064] In another embodiment, the above method also includes: obtaining a function type importance sequence corresponding to the cloud host to be cleaned; adjusting the importance level of the cloud host to be cleaned according to the importance level adjustment range of the importance level corresponding to the cloud host to be cleaned, and the arrangement order of the function type of the cloud host to be cleaned in the function type importance sequence.
[0065] In the embodiment of the present application, the function type importance sequence is obtained by the user ranking the importance of each function type from high to low when the cloud host is created. The higher the ranking of the function type, the higher the importance level of the cloud host to be cleaned. The function type importance sequence corresponding to the cloud host to be cleaned refers to the function type importance sequence set by the user account that created the cloud host to be cleaned. The function type importance sequence set by each user account may be different.
[0066] The importance level adjustment range is the range within which the importance level can fluctuate. In the embodiment of the present application, each importance level is pre-divided. For example, 6 importance levels can be pre-divided, and the first importance level is set to importance level 2, and the corresponding importance level adjustment range is importance level 1-3; the second importance level is importance level 5, and the corresponding importance level adjustment range is importance level 4-6.
[0067] The higher the function type of the cloud host to be cleaned is ranked in the function type importance sequence, the greater the possibility that the importance level will float upward, and the lower the function type is ranked in the function type importance sequence, the greater the possibility that the importance level will float downward. To illustrate with a practical example, suppose that the user ranks the importance of function types as follows: database is greater than backend, and backend is greater than frontend. Then, if the service scope type of the cloud host to be cleaned is public and the function type is database, the importance level of the cloud host to be cleaned can be set to importance level 1. If the service scope type of the cloud host to be cleaned is private and the function type is frontend, the importance level of the cloud host to be cleaned can be set to importance level 6.
[0068] Step 104, for any cloud host to be cleaned corresponding to any importance level, determine the usage status information of the cloud host to be cleaned, and if the usage status information meets the first cleaning condition corresponding to the importance level, use the cloud host to be cleaned as a target cloud host to be cleaned, and the target cloud host to be cleaned carries a cleaning mark.
[0069] In the embodiment of the present application, the usage status information is used to characterize the usage status of the cloud host to be cleaned, such as usage time, expiration time, recent active status, etc. Each importance level may correspond to a different first cleaning condition. When the usage status information satisfies the first cleaning condition, the cloud host to be cleaned is set with a cleaning mark and becomes a target cloud host to be cleaned that officially needs to be cleaned.
[0070] The higher the importance level, the looser the first cleaning condition, and the lower the probability that the corresponding cloud host to be cleaned becomes a cloud host that needs to be cleaned. The definition of "the first cleaning condition corresponding to a higher importance level is looser" is: the cloud hosts to be cleaned that meet the first cleaning condition corresponding to a higher importance level are a subset of the cloud hosts to be cleaned that meet the first cleaning condition corresponding to a lower importance level.
[0071] For example, when the first cleaning condition is related to the growth rate of the amount of data stored in the disk, the first cleaning condition corresponding to the highest importance level may be a growth rate less than 1%, while the first cleaning condition corresponding to the lowest importance level may be a growth rate less than 5%.
[0072] For another example, when the first cleaning condition is related to the usage duration, the first cleaning condition corresponding to the highest importance level may be less than 14 days in total in the past year, while the first cleaning condition corresponding to the lowest importance level may be less than 2 months in total in the past year.
[0073] In one embodiment, Figure 2 As shown, when the importance level is the first importance level, the above method further includes:
[0074] Step 202, obtaining the expiration time of the cloud host to be cleaned up and the validity status of the cloud host;
[0075] Step 204: if the expiration time is earlier than the target cleanup time, or the cloud host validity state is invalid, the first expiration state is determined as the expiration state of the cloud host to be cleaned corresponding to the target cleanup time;
[0076] Step 206 , when the expiration state of the cloud host to be cleaned corresponding to the target cleaning time is the first expiration state, it is determined that the usage state information of the cloud host to be cleaned satisfies the first cleaning condition corresponding to the first importance level.
[0077] In an embodiment of the present application, the expiration time of the cloud host to be cleaned up may be the actual expiration time pre-set by the platform, or may be the time obtained by adding the extension time corresponding to the importance level of the cloud host to be cleaned up to the actual expiration time. The extension time refers to the time during which the user is allowed to continue to use the cloud host to be cleaned up after the cloud host to be cleaned up expires. Exemplarily, the length of the extension time is positively correlated with the importance level. For example, the extension time corresponding to the highest importance level may be 5 days, and the extension time corresponding to the lowest importance level may be 0 days. To illustrate with a practical example, assuming that the actual expiration time of a cloud host to be cleaned up is September 8, then when the corresponding importance level of the cloud host to be cleaned up is the highest, the expiration time of the cloud host to be cleaned up is September 13, and when the corresponding importance level is the lowest, the expiration time of the cloud host to be cleaned up is still September 8.
[0078] The cloud host validity status is used to indicate whether the cloud host is still in use. When the user does not need to continue using the cloud host but the cloud host expiration date has not yet arrived, the user can actively set the cloud host validity status to invalid to indicate that the cloud host is no longer needed.
[0079] The target cleaning time is the date determined by the platform when all cloud hosts to be cleaned need to be cleaned up uniformly. For example, the target cleaning time can be set to the first day of each month, the first day of every three months, etc., which is not specifically limited in the embodiments of the present application.
[0080] For a cloud host to be cleaned up whose importance level is the first importance level, if the cloud host to be cleaned up has expired when the target cleanup time arrives, or the cloud host to be cleaned up has failed, the cloud host to be cleaned up meets the first cleanup condition, that is, the cloud host to be cleaned up can be converted into a cloud host that needs to be formally cleaned up.
[0081] If the cloud host to be cleaned has not expired and has not expired when the target cleanup time arrives, the cloud host to be cleaned does not meet the first cleanup condition. In this case, the expiration state of the cloud host to be cleaned corresponding to the target cleanup time can be set to the second expiration state, and the cloud host to be cleaned will not meet the first cleanup condition, that is, it will not be formally cleaned.
[0082] The above method can avoid losses caused by the early cleaning of important cloud hosts before their expiration.
[0083] In one embodiment, Figure 3 As shown, before taking the cloud host to be cleaned as the target cloud host to be cleaned, the method further includes:
[0084] Step 302, periodically obtain the valid cloud hosts to be cleaned up whose valid status is valid, and send a cleaning notification message to the user account corresponding to each valid cloud host to be cleaned up, the cleaning notification message is used to prompt the user account to postpone the processing of the valid cloud host to be cleaned up;
[0085] Step 304: if a use extension request for a valid cloud host to be cleaned up is received, then based on the use extension request, the expiration time of the valid cloud host to be cleaned up is updated; or,
[0086] Step 306: If a termination request for the valid cloud host to be cleaned up is received, the cloud host validity status of the valid cloud host to be cleaned up is updated to invalid.
[0087] In the embodiment of the present application, for the cloud host whose effective status is valid and to be cleaned up, since the user has not explicitly indicated that the cloud host does not need to be used any more, before the cloud host to be cleaned up is converted to the target cloud host to be cleaned up that needs to be cleaned up, the server can also periodically notify the user account corresponding to the valid cloud host to be cleaned up before the target cleaning time arrives, and guide the user account to postpone the processing of the valid target cloud host to be cleaned up. The cleaning notification message can carry the identifier of the valid cloud host to be cleaned up.
[0088] After receiving the cleanup notification message through the user account, the user can choose to extend the valid cloud host to be cleaned up, or indicate that the valid cloud host to be cleaned up is no longer needed. If the user needs to extend the use, the user can send a use extension request to the server through the user account, and carry the new expiration time in the use extension request. After receiving the new expiration time, the server updates the expiration time of the valid cloud host to be cleaned up based on the new expiration time.
[0089] When the user indicates that he does not need to continue using the valid cloud host to be cleaned up, the user can send a termination request to the server through the user account. After receiving the termination request, the server updates the valid cloud host status of the valid cloud host to be cleaned up to invalid.
[0090] After the target cleaning time arrives, the server may re-execute steps 202 to 206 in the above embodiment to re-acquire each cloud host to be cleaned that meets the first cleaning condition, and set a cleaning mark for each cloud host to be cleaned.
[0091] Step 106: When the target cloud host to be cleaned meets the second cleaning condition, clean up the target cloud host to be cleaned.
[0092] In the embodiment of the present application, if the second cleaning condition is met, the server formally cleans up the target cloud host to be cleaned up with the cleaning mark. The specific cleaning method can be to use the bottom layer instructions in the platform to delete the cloud host to be cleaned up with the cleaning mark.
[0093] The second cleaning condition may be that a preset length of time (e.g., 7 days) has passed after the target cleaning time arrives, or the number of target cloud hosts to be cleaned up with cleaning marks has reached a preset number, so the server needs to clean up the cloud hosts once to release cloud host resources.
[0094] In one embodiment, to avoid mistaken cleaning as much as possible, Figure 4 As shown, before cleaning the target cloud host to be cleaned up, the above method further includes:
[0095] Step 402, shutting down each target cloud host to be cleaned up for a preset time period;
[0096] Step 404: If a use extension request is received within the preset time period for any cloud host that is in a shutdown state and is to be cleaned up, the expiration time of the cloud host that is to be cleaned up is updated based on the use extension request, and if the expiration time is not earlier than the target cleaning time, the cleaning mark of the cloud host that is to be cleaned up is removed, and the cloud host that is to be cleaned up is powered on.
[0097] In the embodiment of the present application, before the target cloud host to be cleaned is formally cleaned, the server first shuts down each target cloud host to be cleaned for a preset time. The preset time can be 3 days, 7 days, etc., which is not specifically limited in the embodiment of the present application. The target cloud host to be cleaned after shutdown is called a shut-down cloud host to be cleaned.
[0098] After shutting down the target cloud host to be cleaned, if the business in the target cloud host to be cleaned is relatively important, the user is likely to find that the target cloud host to be cleaned has been shut down. After the user finds that the target cloud host to be cleaned has been shut down, he can send a use extension request to the server to request an extension for the target cloud host to be cleaned.
[0099] After receiving the extension request, the server updates the expiration time. If the expiration time is not earlier than the target cleanup time, the server removes the cleanup mark of the cloud host to be cleaned up and restarts the cloud host to be cleaned up so that the cloud host to be cleaned up can continue to perform business normally.
[0100] If the user does not send a usage extension request to the server, the server will formally clean up each cloud host that is shut down and waiting to be cleaned up and carries a cleanup mark after the preset time period ends.
[0101] The cloud host cleaning method provided in the embodiment of the present application divides each cloud host to be cleaned into importance levels, and each importance level corresponds to a different first cleaning condition. When the usage status information of the cloud host to be cleaned meets the first cleaning condition corresponding to this importance level, a cleaning mark is added to the cloud host to be cleaned. When the second cleaning condition continues to be met, each cloud host to be cleaned that carries the cleaning mark is formally cleaned. Therefore, different standards can be used to determine whether to clean up cloud hosts of different importance levels, thereby improving the accuracy of the judgment on whether the cloud host needs to be cleaned.
[0102] In one embodiment, Figure 5 As shown, a cloud host cleaning method is provided, including:
[0103] Step 501, set up a list of important cloud hosts to be protected.
[0104] In the embodiment of the present application, the server can determine the importance level of each cloud host on the platform, and set up an important cloud host protection list (hereinafter referred to as the important protection list) according to the importance level of each cloud host. The server can determine the importance level of each public cloud host (such as a network time server, a jump server, and a yum source (a software warehouse)) as extremely important. The user can also specify the importance of each cloud host by himself, for example, the importance of some front-end, back-end and database servers can be determined as important.
[0105] The re-protection list stores information of cloud hosts of various importance levels that meet the importance level requirements. For example, when the importance levels are divided into extremely important, important, and unimportant from high to low, the importance level requirement may be that the importance level is higher than unimportant.
[0106] The information of the cloud host stored in the re-protection list may include the usage status information of the cloud host, the user account information corresponding to the cloud host, and the basic information of the cloud host. The usage status information may include the start date of use of the cloud host, the end date of use (i.e., the expiration time in the aforementioned embodiment), etc. The user account information may include the user's communication information, such as an email address, a mobile phone number, etc. The basic information may include the identification of the cloud host in the platform resource pool, the function type of the cloud host, the importance level of the cloud host, etc. An example of the re-protection list is shown in Table 1:
[0107] Table 1
[0108]
[0109] The resource pool name is the name of the resource pool to which the cloud host belongs, the resource pool ID (Identity) is the identifier of the cloud host in the resource pool, the cloud host name is the name set by the user for the cloud host, the cloud host ID is the unique identifier of the cloud host, the cloud host purpose is the functional type of the cloud host, the start date is the date when the user starts using the cloud host, the end date is the expiration date of the cloud host, the cloud host owner is the user account corresponding to the cloud host, the owner product line is the department to which the user account corresponding to the cloud host belongs, the record status refers to whether the information of this cloud host is still valid (since the valid status of the cloud host information is the valid status of the cloud host, if the record status is valid, it means that the cloud host is still valid; if the record status is invalid, it means that the cloud host is invalid), the registration time is the time when the cloud host information is first recorded, and the modification time is the time when the cloud host information is modified.
[0110] 30 days, 15 days, 7 days, and 3 days before the expiration date, the server can send emails and text messages to the cloud host owner's email and mobile phone to notify the cloud host that the cloud host is about to expire, prompting the user to extend the expiration date in time. If the user does not need to use the cloud host, he or she can choose not to extend the expiration date, or update the cloud host's valid status to invalid. When the server updates the cloud host's valid status to invalid, it can update the record status of the cloud host in the re-insurance list to invalid.
[0111] Step 502, looping through the list of cloud hosts to be cleaned up, and for each piece of information of the cloud host to be cleaned up, determining whether the information of the cloud host to be cleaned up is in the re-protection list.
[0112] If the information of the cloud host to be cleaned up is not in the re-protection list, the information of the cloud host to be cleaned up will be written into the formal cleanup list.
[0113] If the information of the cloud host to be cleaned up is in the re-protection list, and the expiration date in the re-protection list is earlier than the target cleanup date, the information of the cloud host to be cleaned up will be written into the formal cleanup list.
[0114] If the information of the cloud host to be cleaned up is in the re-protection list, and the expiration date in the re-protection list is not earlier than the target cleanup date, and the record status is invalid, the information of the cloud host to be cleaned up will be written into the formal cleanup list.
[0115] If the information of the cloud host to be cleaned up is in the re-protection list, and the expiration date in the re-protection list is not earlier than the target cleanup date, and the record status is valid, then continue to traverse the list of cloud hosts to be cleaned up.
[0116] In the embodiment of the present application, the list of cloud hosts to be cleaned up includes various cloud hosts to be cleaned up, and each cloud host to be cleaned up is pre-screened from various cloud hosts according to certain rules.
[0117] For each importance level that is not in the re-protection list, the first cleanup condition is none, that is, all cloud hosts to be cleaned up at each importance level that are not in the re-protection list will be written into the formal cleanup list. For each importance level that is in the re-protection list, the first cleanup condition is that the expiration date is earlier than the target cleanup date, or the expiration date is not earlier than the target cleanup date but the record status is invalid.
[0118] The target cleanup date can be found in the description of the above embodiment, and the present embodiment will not be repeated. 5 days, 4 days, 3 days, 2 days, 1 day before the target cleanup date, the server can also execute the above steps of sending emails and text messages to the mailbox and mobile phone of the cloud host owner to notify the cloud host that the cloud host is about to expire, and prompt the user to extend the usage deadline in time.
[0119] Step 503: After the list of cloud hosts to be cleaned up is traversed, each cloud host to be cleaned up in the formal cleanup list is shut down for a preset time.
[0120] If during the shutdown period, the user account extends the expiration date, and the new expiration date is not earlier than the target cleanup date, step 504 is executed: the cloud host to be cleaned is powered on, and the cloud host to be cleaned is deleted from the formal cleanup list.
[0121] Otherwise, execute step 505: do not modify the formal cleanup list.
[0122] After the preset time has passed, step 506 is executed: each cloud host to be cleaned up in the formal cleanup list is cleaned up.
[0123] Step 507: Delete the cloud host information whose record status is invalid and whose modification time is earlier than the target cleanup time from the re-protection list.
[0124] In the embodiment of the present application, after the cloud host is cleaned up, the re-protection list needs to be updated. Before cleaning up each cloud host to be cleaned up in step 506, the server can modify the record status of the cleaned cloud host to be invalid. When updating the re-protection list, the server can delete the cloud host information whose record status is invalid and whose information is modified before the target cleaning time, so as to delete the information of the cleaned cloud host from the re-protection list.
[0125] The cloud host cleanup method provided in the embodiment of the present application has a clear design for updating and maintaining the cloud host re-protection list. At the same time, using the cloud host re-protection list to filter the cloud host list to be cleaned can reduce the business impact caused by accidental shutdown. Furthermore, before the formal cleanup, the embodiment of the present application also shuts down the cloud hosts in the formal cleanup list for a period of time, and dynamically updates the formal cleanup list during the shutdown period, which can reduce the cost of environmental reconstruction caused by erroneous cleanup.
[0126] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0127] Based on the same inventive concept, the embodiment of the present application also provides a cloud host cleaning device for implementing the cloud host cleaning method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more cloud host cleaning device embodiments provided below can refer to the limitations of the cloud host cleaning method above, and will not be repeated here.
[0128] In one embodiment, Figure 6 As shown, a cloud host cleaning device 600 is provided, comprising: a first determination module 602, a second determination module 604, and a cleaning module 606, wherein:
[0129] A first determination module 602 is used to obtain cloud hosts to be cleaned up and determine the importance level of each of the cloud hosts to be cleaned up;
[0130] The second determination module 504 is used to determine the usage status information of any of the cloud hosts to be cleaned corresponding to any of the importance levels, and if the usage status information satisfies the first cleaning condition corresponding to the importance level, use the cloud host to be cleaned as a target cloud host to be cleaned, and the target cloud host to be cleaned carries a cleaning mark;
[0131] The cleaning module 606 is configured to clean up the target cloud host to be cleaned if the target cloud host to be cleaned meets a second cleaning condition.
[0132] The cloud host cleaning device provided in the embodiment of the present application divides each cloud host to be cleaned into importance levels, and each importance level corresponds to a different first cleaning condition. When the usage status information of the cloud host to be cleaned meets the first cleaning condition corresponding to this importance level, a cleaning mark is added to the cloud host to be cleaned. When the second cleaning condition continues to be met, each cloud host to be cleaned carrying the cleaning mark is formally cleaned. Therefore, different standards can be used to determine whether to clean the cloud hosts to be cleaned of different importance levels, thereby improving the accuracy of the judgment on whether the cloud host needs to be cleaned.
[0133] In one embodiment, the importance level includes at least a first importance level and a second importance level, and the apparatus further includes:
[0134] The third determination module is used to set the importance level of the cloud host to be cleaned up to the first importance level when the cloud host to be cleaned up is a public type cloud host; or to set the importance level of the cloud host to be cleaned up to the second importance level when the cloud host to be cleaned up is a private type cloud host; wherein the second importance level is lower than the first importance level.
[0135] In one of the embodiments, the second cleaning condition at least includes that the number of the target cloud hosts to be cleaned reaches a preset number.
[0136] In one embodiment, when the importance level is the first importance level, the second determining module is further configured to:
[0137] Obtaining the expiration time of the cloud host to be cleaned up and the validity status of the cloud host;
[0138] If the expiration time is earlier than the target cleanup time, or the cloud host validity state is invalid, the first expiration state is determined as the expiration state of the cloud host to be cleaned corresponding to the target cleanup time;
[0139] When the expiration status of the cloud host to be cleaned up corresponding to the target cleanup time is the first expiration status, it is determined that the usage status information of the cloud host to be cleaned up satisfies a first cleanup condition corresponding to the first importance level.
[0140] In one embodiment, the device further comprises:
[0141] a sending module, used for periodically acquiring valid cloud hosts to be cleaned up whose effective status is valid, and sending cleaning notification messages to user accounts corresponding to the valid cloud hosts to be cleaned up respectively, wherein the cleaning notification messages are used for prompting the user accounts to postpone the processing of the valid cloud hosts to be cleaned up;
[0142] An update module is configured to update the expiration time of the valid cloud host to be cleaned up based on a use extension request received for the valid cloud host to be cleaned up; or to update the cloud host validity status of the valid cloud host to be cleaned up to invalidated if a use termination request is received for the valid cloud host to be cleaned up.
[0143] In one embodiment, the device further comprises:
[0144] A shutdown module, used to shut down each of the target cloud hosts to be cleaned for a preset time;
[0145] The startup module is used to update the expiration time of the cloud host to be cleaned up based on the usage extension request if a usage extension request is received for any cloud host to be cleaned up in the shutdown state within the preset time period, and remove the cleaning mark of the cloud host to be cleaned up when the expiration time is not earlier than the target cleaning time, and start up the cloud host to be cleaned up.
[0146] Each module in the above device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.
[0147] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a cloud host cleaning method is implemented.
[0148] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0149] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0150] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0151] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0152] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0153] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0154] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0155] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A cloud host cleaning method, characterized in that: The method comprises: Obtain cloud hosts to be cleaned up, and determine the importance level of each of the cloud hosts to be cleaned up; For any of the to-be-cleaned cloud hosts corresponding to any of the importance levels, determining usage status information of the to-be-cleaned cloud hosts, and if the usage status information satisfies a first cleaning condition corresponding to the importance level, taking the to-be-cleaned cloud hosts as target to-be-cleaned cloud hosts, wherein the target to-be-cleaned cloud hosts carry a cleaning mark; When the target cloud host to be cleaned meets the second cleaning condition, the target cloud host to be cleaned is cleaned.
2. The method according to claim 1, characterized in that: The importance level includes at least a first importance level and a second importance level, and the method further includes: In the case where the cloud host to be cleaned up is a public type cloud host, setting the importance level of the cloud host to be cleaned up to the first importance level; or, In a case where the cloud host to be cleaned up is a private type cloud host, setting the importance level of the cloud host to be cleaned up to the second importance level; The second importance level is lower than the first importance level.
3. The method according to claim 1, characterized in that The second cleaning condition at least includes that the number of the target cloud hosts to be cleaned reaches a preset number.
4. The method according to claim 2, characterized in that: When the importance level is the first importance level, the method further includes: Obtaining the expiration time of the cloud host to be cleaned up and the validity status of the cloud host; If the expiration time is earlier than the target cleanup time, or the cloud host validity state is invalid, the first expiration state is determined as the expiration state of the cloud host to be cleaned corresponding to the target cleanup time; When the expiration status of the cloud host to be cleaned up corresponding to the target cleanup time is the first expiration status, it is determined that the usage status information of the cloud host to be cleaned up satisfies a first cleanup condition corresponding to the first importance level.
5. The method according to claim 4, characterized in that Before taking the cloud host to be cleaned up as the target cloud host to be cleaned up, the method further includes: Periodically acquiring valid cloud hosts to be cleaned up whose effective status is valid, and sending cleaning notification messages to user accounts corresponding to the valid cloud hosts to be cleaned up respectively, wherein the cleaning notification messages are used to prompt the user accounts to postpone processing of the valid cloud hosts to be cleaned up; If a use extension request for the valid cloud host to be cleaned up is received, then based on the use extension request, the expiration time of the valid cloud host to be cleaned up is updated; or, If a request to terminate the use of the valid cloud host to be cleaned up is received, the cloud host validity status of the valid cloud host to be cleaned up is updated to invalid.
6. The method according to claim 4, characterized in that Before cleaning the target cloud host to be cleaned, the method further includes: Performing shutdown processing for a preset time on each of the target cloud hosts to be cleaned up; If a use extension request is received for any cloud host that is shut down and to be cleaned up and is in a shut down state within the preset time period, the expiration time of the cloud host that is shut down and to be cleaned up is updated based on the use extension request, and if the expiration time is not earlier than the target cleaning time, the cleaning mark of the cloud host that is shut down and to be cleaned up is removed, and the cloud host that is shut down and to be cleaned up is powered on.
7. A cloud host cleaning device, characterized in that: The device comprises: A first determination module is used to obtain cloud hosts to be cleaned up and determine the importance level of each of the cloud hosts to be cleaned up; A second determination module is used to determine the usage status information of any of the cloud hosts to be cleaned corresponding to any of the importance levels, and if the usage status information satisfies the first cleaning condition corresponding to the importance level, use the cloud host to be cleaned as a target cloud host to be cleaned, and the target cloud host to be cleaned carries a cleaning mark; The cleaning module is used to clean up the target cloud host to be cleaned if the target cloud host to be cleaned meets the second cleaning condition.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.