A virtual machine isolation method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202110703950.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-24
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2041-06-24
AI Technical Summary
[0004]然而发明人发现,现有的隔离方式存在着人工操作容易失误的风险,也可能因未及时发现故障隐患而导致业务面临较高风险
[0043] The above-mentioned technical solutions adopted in the embodiments of this application can achieve the following beneficial effects: The virtual machine isolation method of the embodiments of this application can be executed by a separately deployed middleware platform server. When performing virtual machine isolation, a virtual machine isolation request can first be received through a unified virtual machine isolation interface. This virtual machine isolation request refers to a request to isolate middleware services deployed on a virtual machine. Then, based on the virtual machine IP address carried in the virtual machine isolation request, the target virtual machine and the middleware service deployed on the target virtual machine are determined. Next, based on the type of middleware service, an isolation policy corresponding to the middleware service is determined. Finally, the middleware service deployed on the target virtual machine is isolated according to the isolation policy, resulting in a virtual machine isolation result. The virtual machine isolation method of the embodiments of this application can isolate middleware services deployed on corresponding virtual machines according to different isolation policies through a unified virtual machine isolation interface, eliminating the need for manual login to the virtual machine for operation and maintenance, reducing the risk of human error, and thus improving virtual machine operation and maintenance efficiency.
Smart Images

Figure CN115525386B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of microservices technology, and in particular to a virtual machine isolation method and apparatus, electronic device and storage medium. Background Technology
[0002] Middleware is a type of software that sits between application systems and system software. It uses the basic services (functions) provided by the system software to connect different application systems or different parts of an application system, thereby achieving the purpose of resource sharing and function sharing.
[0003] Middleware primarily provides services through clustering, achieving high availability through redundant deployment of multiple cluster nodes. For middleware services deployed in virtual machine clusters, when the physical machine hosting individual nodes in the cluster has potential failures, "isolving" the middleware services provided by the virtual machine nodes deployed on that physical machine can ensure, to the greatest extent possible, that the middleware services provided by the virtual machine cluster hosting the middleware services are not affected.
[0004] However, the inventors discovered that existing isolation methods are prone to errors due to human error and may lead to higher business risks due to failure to detect potential faults in a timely manner. Summary of the Invention
[0005] This application provides a virtual machine isolation method, apparatus, electronic device, and storage medium to reduce the risk of errors that are easily made when manually performing virtual machine isolation operations.
[0006] The embodiments of this application adopt the following technical solutions:
[0007] In a first aspect, embodiments of this application provide a virtual machine isolation method, executed by a middleware platform server, wherein the method includes:
[0008] The virtual machine isolation request is received through the virtual machine isolation interface, where the virtual machine isolation request refers to a request to isolate the middleware service deployed on the virtual machine.
[0009] Based on the virtual machine IP address carried in the virtual machine isolation request, determine the target virtual machine and the middleware service deployed on the target virtual machine;
[0010] Determine the isolation strategy corresponding to the middleware service based on its type;
[0011] The middleware service deployed on the target virtual machine is isolated according to the isolation policy to obtain the virtual machine isolation result.
[0012] Optionally, determining the target virtual machine and the middleware service deployed on the target virtual machine based on the virtual machine IP address carried in the virtual machine isolation request includes:
[0013] Based on the virtual machine IP address, query the configuration management database for the middleware services deployed on the target virtual machine and the type of the middleware services.
[0014] Optionally, after determining the target virtual machine and the middleware service deployed on the target virtual machine based on the virtual machine IP address carried in the virtual machine isolation request, the method further includes:
[0015] Perform pre-isolation checks on the middleware services deployed on the target virtual machine;
[0016] The steps involve determining whether to execute an isolation strategy based on the type of middleware service, according to the results of the pre-isolation checks.
[0017] Optionally, the pre-isolation check of the middleware service deployed on the target virtual machine includes:
[0018] Determine the number of available virtual machine nodes where the middleware service resides;
[0019] If the number of available virtual machine nodes is greater than a preset threshold, then the result of the pre-isolation check is determined to be that the pre-isolation check has passed.
[0020] If the number of available virtual machine nodes is not greater than a preset threshold, the result of the pre-isolation check is determined to be a failure, and an alarm is triggered.
[0021] Optionally, the virtual machine isolation result includes a successful isolation result or an isolation failure result. The isolation failure result includes a failure to pass the pre-isolation check or an operation timeout. After performing the pre-isolation check on the middleware service deployed on the target virtual machine, the method further includes:
[0022] Determine whether the isolation can be successfully completed within a preset time or whether the pre-isolation check fails.
[0023] If not, the isolation failure result is determined to be an operation timeout.
[0024] Optionally, determining the isolation strategy corresponding to the middleware service based on its type includes:
[0025] Determine whether the middleware service is a middleware service hosted in the Supervisor process management program;
[0026] If so, the isolation strategy is determined to be to call the Supervisor interface to isolate the middleware service through the Supervisor interface.
[0027] Optionally, determining the isolation strategy corresponding to the middleware service based on its type includes:
[0028] If the middleware service is a Redis middleware service, then determine whether the virtual machine where the Redis middleware service resides is the master node;
[0029] If so, the isolation strategy is determined to be to send an isolation command to the virtual machine where the Redis middleware service resides, in order to switch the master node to a slave node and stop the Redis middleware service.
[0030] Optionally, determining the isolation strategy corresponding to the middleware service based on its type includes:
[0031] Determine whether the middleware service is a service registered in the Dubbo framework;
[0032] If so, the isolation strategy is determined to be to reduce the weight of the virtual machine where the middleware service resides and take the middleware service offline.
[0033] Optionally, determining the isolation strategy corresponding to the middleware service based on its type includes:
[0034] If the middleware service is not a middleware service hosted in the Supervisor process management program, and is neither a Redis middleware service nor a service registered in the Dubbo framework, then the isolation strategy is determined to be to remotely execute the isolation operation through a script execution platform.
[0035] Optionally, after isolating the middleware service deployed on the target virtual machine according to the isolation policy, the method further includes:
[0036] The virtual machine isolation results are checked according to the type of the middleware service;
[0037] The results of the inspection determine whether the middleware service on the virtual machine has been successfully isolated.
[0038] Secondly, embodiments of this application also provide a virtual machine isolation device applied to a middleware platform server, wherein the device is used to implement any of the methods described above.
[0039] Thirdly, embodiments of this application also provide an electronic device, including:
[0040] Processor; and
[0041] A memory configured to store computer-executable instructions, which, when executed, cause the processor to perform any of the methods described above.
[0042] Fourthly, embodiments of this application also provide a computer-readable storage medium that stores one or more programs, which, when executed by an electronic device including multiple applications, cause the electronic device to perform any of the methods described above.
[0043] The above-mentioned technical solutions adopted in the embodiments of this application can achieve the following beneficial effects: The virtual machine isolation method of the embodiments of this application can be executed by a separately deployed middleware platform server. When performing virtual machine isolation, a virtual machine isolation request can first be received through a unified virtual machine isolation interface. This virtual machine isolation request refers to a request to isolate middleware services deployed on a virtual machine. Then, based on the virtual machine IP address carried in the virtual machine isolation request, the target virtual machine and the middleware service deployed on the target virtual machine are determined. Next, based on the type of middleware service, an isolation policy corresponding to the middleware service is determined. Finally, the middleware service deployed on the target virtual machine is isolated according to the isolation policy, resulting in a virtual machine isolation result. The virtual machine isolation method of the embodiments of this application can isolate middleware services deployed on corresponding virtual machines according to different isolation policies through a unified virtual machine isolation interface, eliminating the need for manual login to the virtual machine for operation and maintenance, reducing the risk of human error, and thus improving virtual machine operation and maintenance efficiency. Attached Figure Description
[0044] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0045] Figure 1 This is a flowchart illustrating a virtual machine isolation method according to an embodiment of this application;
[0046] Figure 2 This is a schematic diagram of a physical machine operation and maintenance system architecture in an embodiment of this application;
[0047] Figure 3 This is a schematic diagram of a virtual machine isolation process in an embodiment of this application;
[0048] Figure 4 This is a schematic diagram of the structure of a virtual machine isolation device according to an embodiment of this application;
[0049] Figure 5This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0051] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0052] The existing virtual machine isolation process typically involves inspection personnel patrolling virtual machines. When a virtual machine with potential faults is found, such as a cluster node about to become unavailable or a service level that cannot be guaranteed, an alarm is triggered, and operations and maintenance personnel handle the situation. The specific operations and maintenance operations generally include the following two types:
[0053] 1) Operations and maintenance personnel manually log in to the virtual machine with potential faults and take the virtual machine node offline from the cluster;
[0054] 2) No action is taken; when a virtual machine node fails, the services on the virtual machine are restored through the cluster self-healing mechanism.
[0055] However, these two operations have the following problems:
[0056] 1) Manually logging into virtual machines with potential faults for maintenance is a large workload. Different types of middleware deployed on virtual machines have different skill requirements for maintenance personnel, resulting in training and knowledge transfer costs. In addition, manual operation carries the risk of operational errors.
[0057] 2) If virtual machines with potential faults are not dealt with, the self-healing mechanisms of some middlewares may cause service unavailability for a short period of time due to costs such as node detection, and there is no way to manually intervene to avoid business peaks, which may cause uncontrollable risks to actual business.
[0058] Based on this, embodiments of this application provide a virtual machine isolation method, executed by a middleware platform server, such as... Figure 1 The diagram illustrates a flowchart of a virtual machine isolation method according to an embodiment of this application. The method includes at least the following steps S110 to S140:
[0059] Step S110: Receive a virtual machine isolation request through the virtual machine isolation interface, wherein the virtual machine isolation request refers to a request to isolate the middleware service deployed on the virtual machine.
[0060] The virtual machine isolation method in this application embodiment can be understood as a method for isolating intermediate services deployed on virtual machines, and therefore can be executed by a separately deployed middleware platform server.
[0061] In real-world applications, virtual machines (VMs) are typically distributed across multiple physical machines in a cluster. Each VM can host different middleware services, and the same middleware service can be distributed across different VMs, forming a middleware service cluster. Multiple VM clusters across multiple physical machines are deployed uniformly in the same cloud environment, allowing services to be provided externally through the middleware services deployed within these clusters. Therefore, when an infrastructure operations and maintenance platform detects a potential fault on a physical machine, it needs to isolate all VMs deployed on that machine. To ensure that the middleware services deployed on these VMs do not affect the entire middleware service cluster they belong to, further isolation of the middleware services deployed on these VMs is required. For example... Figure 2 As shown, a schematic diagram of a physical machine operation and maintenance system architecture is provided in an embodiment of this application.
[0062] When isolating middleware services deployed on virtual machines, virtual machine isolation requests can be received through a pre-configured virtual machine isolation interface. These requests can be understood as requests to isolate the middleware services deployed on the virtual machine. When the infrastructure operations and maintenance platform detects a potential fault on a physical machine, it can send a request to the middleware platform to isolate the virtual machines deployed on that physical machine. Alternatively, the virtual machine isolation request can be triggered manually by entering information on the front-end page provided by the middleware platform. The specific method for receiving virtual machine isolation requests can be flexibly configured by those skilled in the art according to actual circumstances, and no specific limitations are made here.
[0063] In this embodiment, a unified external virtual machine isolation interface is pre-set on the middleware platform server. This interface can include settings for the interface path, interface parameters, and return value. The interface path can be, for example, in the form of " / api / tower / beoffline", where "tower" represents the module project code. Interface parameters can include information such as virtual machine IP addresses. When there are multiple virtual machine IP addresses, they can be separated by commas, such as "10.0.0.1,10.0.0.2". The maximum number of virtual machine IP addresses that can be transmitted in a single virtual machine isolation request can also be set, for example, 10. The return value is mainly used to characterize the isolation status or isolation result of the virtual machine. Its specific format can also be flexibly set according to actual conditions and is not specifically limited here.
[0064] Step S120: Determine the target virtual machine and the middleware service deployed on the target virtual machine based on the virtual machine IP address carried in the virtual machine isolation request.
[0065] As mentioned earlier, the virtual machine isolation request received through the configured virtual machine isolation interface will carry the virtual machine IP address. Therefore, based on the virtual machine IP address, the virtual machine with potential faults, i.e. the target virtual machine, and the middleware services deployed on these target virtual machines can be identified.
[0066] Step S130: Determine the isolation strategy corresponding to the middleware service based on the type of middleware service.
[0067] In real-world applications, there are generally many types of middleware services deployed on virtual machines, and the isolation strategies for different types of middleware services are also different. Therefore, this application embodiment needs to determine the isolation strategy corresponding to the middleware service based on the type of middleware service deployed on the target virtual machine. Here, the isolation strategy can be understood as the specific isolation operation taken for the middleware service.
[0068] Step S140: Isolate the middleware service deployed on the target virtual machine according to the isolation policy to obtain the virtual machine isolation result.
[0069] Once the isolation policy is determined, the corresponding middleware services deployed on the target virtual machine can be isolated according to the isolation policy, thereby obtaining the virtual machine isolation result.
[0070] The virtual machine isolation method in this application embodiment can isolate middleware services deployed on corresponding virtual machines according to different isolation strategies through a unified virtual machine isolation interface. It eliminates the need for manual login to the virtual machine for operation and maintenance, reduces the risk of human error, and thus improves the efficiency of virtual machine operation and maintenance.
[0071] In one embodiment of this application, determining the target virtual machine and the middleware service deployed on the target virtual machine based on the virtual machine IP address carried in the virtual machine isolation request includes: querying the configuration management database for the middleware service deployed on the target virtual machine and the type of the middleware service based on the virtual machine IP address.
[0072] In this embodiment of the application, the middleware platform server can determine the target virtual machine and the middleware services deployed on the target virtual machine by querying the Configuration Management Database (CMDB). The CMDB typically stores various configuration information related to devices in the enterprise IT architecture. It is closely linked to all service support and service delivery processes, supporting the operation of these processes, realizing the value of configuration information, and relying on related processes to ensure the accuracy of the data.
[0073] Specifically, in this embodiment of the application, when determining the virtual machine deployed on the first target physical machine, the middleware services deployed on the target virtual machine and their types can be queried from the aforementioned CMDB based on the virtual machine's IP address. The specific data stored in the CMDB may include, for example, the physical machine IP address, the virtual machine IP address, the middleware service name, and the middleware service type. Of course, the specific information included can be flexibly set by those skilled in the art according to actual needs, and is not specifically limited here.
[0074] In one embodiment of this application, after determining the target virtual machine and the middleware service deployed on the target virtual machine based on the virtual machine IP address carried in the virtual machine isolation request, the method further includes: performing a pre-isolation check on the middleware service deployed on the target virtual machine; and determining whether to execute the step of determining an isolation strategy corresponding to the middleware service based on the type of the middleware service based on the result of the pre-isolation check.
[0075] As mentioned earlier, the self-healing mechanisms of some middleware services provided in the existing technology have costs such as node detection, which can cause the service to be unavailable for a short period of time. Furthermore, it is impossible to manually intervene to avoid business peaks, which can easily cause uncontrollable risks to the actual business.
[0076] Based on this, in the embodiments of this application, before isolating the middleware service deployed on the target virtual machine, a pre-isolation check can be performed on the middleware service deployed on the target virtual machine. The pre-isolation check can be understood as checking the business continuity of the middleware service to ensure that after isolating the middleware service deployed on the target virtual machine, the entire virtual machine cluster can still provide continuous and stable middleware services, thereby avoiding uncontrollable risks to actual business.
[0077] In one embodiment of this application, the pre-isolation check of the middleware service deployed on the target virtual machine includes: determining the number of available virtual machine nodes where the middleware service is located; if the number of available virtual machine nodes is greater than a preset threshold, the result of the pre-isolation check is determined to be that the pre-isolation check has passed; if the number of available virtual machine nodes is not greater than the preset threshold, the result of the pre-isolation check is determined to be that the pre-isolation check has failed, and an alarm is triggered.
[0078] In this embodiment of the application, when performing a pre-isolation check on the middleware service deployed on the target virtual machine, the number of available virtual machine nodes (i.e., the number of live nodes) where the middleware service is currently located can be determined first. If the number of available virtual machine nodes is greater than a preset threshold, the pre-isolation check is passed, indicating that even if the middleware service deployed on the target virtual machine is isolated now, it will not affect the middleware service provided by the entire virtual machine cluster, and therefore subsequent isolation operations can be performed. If the number of available virtual machine nodes is not greater than the preset threshold, the pre-isolation check is not passed, indicating that if the middleware service deployed on the target virtual machine is isolated now, it will affect the capability of the middleware service provided by the entire virtual machine cluster, thereby affecting business continuity and stability. Therefore, subsequent isolation operations cannot be performed temporarily, and an alarm can be triggered for manual intervention.
[0079] The aforementioned "preset threshold" can be understood as the minimum requirement to ensure compliance with the SLA (Service Level Agreement), representing a series of performance metrics promised externally. For example, a promised average response time of 50 seconds requires at least N nodes to be able to provide services simultaneously. Of course, the specific parameters differ depending on the type of middleware service, therefore the aforementioned "preset threshold" can be set separately for different types of middleware services.
[0080] The "preset threshold" in this embodiment is set based on the assumption that after isolating the target virtual machine, the number of remaining surviving virtual machine nodes can still provide sufficient service capacity. To facilitate understanding of the above embodiments, a further example is given: assuming a real-world application environment has 10 virtual machine nodes deployed, the threshold requires at least 6 virtual machine nodes to be running normally simultaneously. If 4 virtual machine nodes have already failed, and a 5th potentially faulty virtual machine node is discovered during inspection, continued isolation would prevent the existing virtual machine cluster from providing sufficient service capacity, thus impacting business continuity and stability. In this case, manual intervention is possible. Manual intervention could involve adding new virtual machine nodes to ensure at least 6 virtual machine nodes are operating normally.
[0081] In one embodiment of this application, the virtual machine isolation result includes an isolation success result or an isolation failure result. The isolation failure result includes a failure to pass the pre-isolation check or an operation timeout. After performing a pre-isolation check on the middleware service deployed on the target virtual machine, the method further includes: determining whether the isolation success result or the pre-isolation check failure result can be obtained within a preset time; if not, the isolation failure result is determined to be an operation timeout.
[0082] The virtual machine isolation result obtained in this application embodiment may be a successful isolation result or an isolation failure result. The isolation failure result can be further divided into the result of failure of pre-isolation check and operation timeout. The specific form of the obtained virtual machine isolation result can be predefined in the virtual machine isolation interface of this application embodiment. For example, the return value in the virtual machine isolation interface can be defined in the following form:
[0083]
[0084] If the return value is "ok", the corresponding virtual machine isolation was successful. If the return value is "not_allowed", the corresponding virtual machine isolation failed because the pre-isolation check failed. If the return value is "timeout", the corresponding virtual machine isolation failed because the operation timed out. This timeout means that neither a successful isolation result nor a failed pre-isolation check result was returned within a preset time. The preset time can be flexibly set according to the actual situation, for example, it can be set to 5 minutes. Besides the above two reasons for isolation failure, there may be other reasons, which can be represented by "other_fail_reason".
[0085] The various return values obtained above can be displayed on the front-end page provided by the middleware platform server. If the virtual machine isolation request is sent by the infrastructure operation and maintenance platform, the return value can also be sent to the infrastructure operation and maintenance platform so that relevant personnel can understand the isolation status of the virtual machine in a timely manner.
[0086] In one embodiment of this application, determining the isolation strategy corresponding to the middleware service based on the type of the middleware service includes: determining whether the middleware service is a middleware service hosted in the Supervisor process management program; if so, determining that the isolation strategy is to call the Supervisor interface to isolate the middleware service through the Supervisor interface.
[0087] Supervisor can be used to manage applications that need to run continuously in the background. It can automatically start or restart according to predefined rules. Supervisor is a general-purpose process management program developed in Python. It can turn an ordinary command line process into a background daemon, monitor the process status, and automatically restart it when it exits abnormally.
[0088] In practical applications, most middleware services are hosted in the Supervisor process management program, while a small number are other types of middleware services not hosted in Supervisor. Therefore, this embodiment can determine whether any of the middleware services to be isolated are hosted in Supervisor based on their type. If so, the isolation strategy can be to call the Supervisor interface and then isolate the middleware service through the Supervisor interface. The parameters passed in the Supervisor interface may include the middleware service name and the IP address of the virtual machine where the middleware service resides.
[0089] In one embodiment of this application, determining the isolation strategy corresponding to the middleware service based on the type of the middleware service includes: if the type of the middleware service is a Redis middleware service, then determining whether the virtual machine where the Redis middleware service is located is a master node; if so, then determining that the isolation strategy is to send an isolation instruction to the virtual machine where the Redis middleware service is located to switch the master node to a slave node and stop the Redis middleware service.
[0090] The middleware service type in this application embodiment can be a Redis (Remote Dictionary Service) middleware service. The Redis middleware service is a memory-based storage middleware, typically used for databases, caches, and message queues.
[0091] In a distributed system architecture, Redis middleware typically uses a master-slave mode to provide services. When isolating Redis middleware services, you can first determine whether the node where the current Redis middleware service is located is the master node. If it is the master node, the service isolation strategy can be to send an isolation command to the virtual machine where the Redis middleware service is located to switch the master node to a slave node before isolation, thus avoiding the direct isolation of the master node causing other slave nodes to be unable to provide services normally.
[0092] The aforementioned method of sending isolation commands can be implemented through Jedis calls. Jedis is the officially recommended Java-based client for operating Redis, providing functions such as establishing connections and sending commands. Besides using Jedis calls, custom code can be used to establish a Socket connection to send Redis isolation commands. Alternatively, the Redis-cli command-line tool can be installed locally on the server hosting the virtual machine isolation interface, and the virtual machine isolation interface can call the local Redis-cli to achieve the same purpose. Those skilled in the art can flexibly configure the specific implementation of sending Redis isolation commands according to the actual situation; no specific limitations are made here.
[0093] Specifically, the Redis middleware service can be isolated in the following ways:
[0094] (1) Pre-isolation check: Obtain Redis node information. If the current shard has less than 3 nodes, then further operation is prohibited.
[0095] (2) If the current node is a slave node, then perform the Shutdown operation;
[0096] (3) If the current node is the master node:
[0097] 1) Set the value of the Cluster-migration-barrier parameter to 2, and confirm that the setting is successful;
[0098] 2) Execute the Cluster failover command. If the execution fails, set the hz parameter of the current shard master node to 10 and retry until successful.
[0099] 3) Check and confirm that the new master node has completed the switchover;
[0100] 4) Set the Appendonly property of the new master node to No.
[0101] 5) Restore the Cluster-migration-barrier and hz parameter settings.
[0102] (4) Check the cluster status.
[0103] In one embodiment of this application, determining the isolation strategy corresponding to the middleware service based on the type of the middleware service includes: determining whether the middleware service is a service registered in the Dubbo framework; if so, determining the isolation strategy as reducing the weight of the virtual machine where the middleware service resides and taking the middleware service offline.
[0104] The middleware service type in this application embodiment can refer to a service registered in the Dubbo framework. Dubbo is a high-performance Java-based distributed service framework open-sourced by Alibaba, which can realize automatic service registration and discovery, and can configure and dynamically adjust the weight of service providers to provide a high-performance and transparent RPC remote service call solution.
[0105] In this embodiment of the application, it can be determined whether there are any services registered in the Dubbo framework among the middleware services that need to be isolated, based on the type of middleware service. If so, the service isolation strategy can be to first reduce the weight of the current virtual machine as a service provider through Dubbo, and then wait for several minutes before taking the middleware service deployed on the virtual machine offline. "Taking offline" can be understood as adjusting the status of the virtual machine node to unavailable in the Dubbo registry center and cutting off all long connections.
[0106] The aforementioned "weight" can be understood as the number of business requests a virtual machine can handle when acting as a service provider. The higher the weight, the more business requests it can handle, and the stronger its service capabilities. When it is necessary to isolate the middleware services provided by the virtual machine as a service provider, the weight of the virtual machine as a service provider can be reduced to 0 in Dubbo, thus preventing it from handling new business requests.
[0107] It should be noted that due to the latency of sending business requests and the time-consuming processing, after reducing the weight of the virtual machine as a service provider to 0, although no new business requests will be sent to the virtual machine, there will still be some requests that have been sent but have not yet reached the virtual machine, or some requests that are still being processed. In order to avoid affecting the processing of the actual business corresponding to these requests, this embodiment of the application can wait for a period of time after reducing the weight of the virtual machine before taking the middleware service provided by the virtual machine offline. This period of time can be several minutes, and the specific length of time can be flexibly adjusted by those skilled in the art according to the actual situation, and is not specifically limited here.
[0108] In one embodiment of this application, determining the isolation strategy corresponding to the middleware service based on the type of the middleware service includes: if the middleware service is not a middleware service hosted in the Supervisor process management program, and is not a Redis middleware service or a service registered in the Dubbo framework, then the isolation strategy is determined to be to remotely execute the isolation operation through a script execution platform.
[0109] If the middleware service deployed on the target virtual machine is neither a middleware service hosted in the Supervisor process management program, nor a Redis middleware service, nor a service registered in the Dubbo framework, then a script execution platform can be used to remotely execute isolation operations.
[0110] The above embodiments can adopt different isolation strategies depending on whether the middleware service is hosted in the Supervisor process management program. For middleware services hosted in the Supervisor process management program, the isolation efficiency of the middleware service can be greatly improved by calling the Supervisor interface. For other types of middleware services not hosted in Supervisor, such as Redis middleware services and services registered in the Dubbo framework, corresponding isolation strategies can be adopted according to the relevant requirements of Redis and Dubbo frameworks, making the isolation method of this application cover more comprehensive scenarios.
[0111] In one embodiment of this application, after isolating the middleware service deployed on the target virtual machine according to the isolation policy, the method further includes: checking the virtual machine isolation result according to the type of the middleware service; and determining whether the middleware service on the virtual machine has been successfully isolated based on the check result.
[0112] After isolating different types of middleware services using the service isolation strategies described in the above embodiments, in order to verify whether the isolation operation was successfully executed, different checking strategies can be used to check the virtual machine isolation results according to different types of middleware services, and then the isolation results can be used to determine whether the middleware services on the virtual machine were successfully isolated.
[0113] This application embodiment addresses the four types of middleware services mentioned in the above embodiments and can employ the following four different inspection strategies:
[0114] (1) For middleware services hosted in Supervisor, the Supervisor interface can be called to check the status of the middleware service. If the status is stop, it is considered that the isolation is successful.
[0115] (2) For Redis middleware services, you can query the number of connections to the Redis node. If the number of connections is 0, it is considered that the isolation is successful.
[0116] (3) For middleware services registered in Dubbo, the status of the middleware service can be queried in Dubbo. If the status is unavailable, it is considered that the isolation is successful.
[0117] (4) For middleware services that use a script execution platform to perform isolation operations, a script command can be executed. If the script cannot be executed, the isolation is considered successful.
[0118] like Figure 2 The diagram illustrates the virtual machine isolation process according to an embodiment of this application. First, a virtual machine isolation request is received through the virtual machine isolation interface. If the virtual machine isolation request carries multiple virtual machine IP addresses, isolation operations are performed asynchronously for each virtual machine IP address. For each virtual machine, the middleware services deployed on it and their types can be queried in the CMDB. Then, a pre-isolation check is performed on the middleware services deployed on that virtual machine. After the check passes, different service isolation strategies are invoked according to the different types of middleware services. Finally, isolation operations are performed on the corresponding middleware services using different service isolation strategies. After isolation is completed, the isolation effect is checked using the corresponding checking strategy, thus completing the virtual machine isolation process.
[0119] This application also provides a virtual machine isolation device 400, applied to a middleware platform server, such as... Figure 4 As shown, a schematic diagram of a virtual machine isolation device is provided. The device 400 includes: a receiving unit 410, a first determining unit 420, a second determining unit 430, and an isolation unit 440, wherein:
[0120] The receiving unit 410 is used to receive a virtual machine isolation request through the virtual machine isolation interface, wherein the virtual machine isolation request refers to a request to isolate the middleware service deployed on the virtual machine.
[0121] The first determining unit 420 is used to determine the target virtual machine and the middleware service deployed on the target virtual machine based on the virtual machine IP address carried in the virtual machine isolation request.
[0122] The second determining unit 430 is used to determine the isolation strategy corresponding to the middleware service based on the type of the middleware service.
[0123] Isolation unit 440 is used to isolate the middleware service deployed on the target virtual machine according to the isolation policy, and obtain the virtual machine isolation result.
[0124] In one embodiment of this application, the first determining unit 420 is specifically used to: query the middleware service deployed on the target virtual machine and the type of the middleware service in the configuration management database according to the virtual machine IP address.
[0125] In one embodiment of this application, the apparatus further includes: a pre-isolation check unit, configured to perform a pre-isolation check on the middleware service deployed on the target virtual machine; and a third determination unit, configured to determine, based on the result of the pre-isolation check, whether to execute the step of determining an isolation strategy corresponding to the middleware service based on the type of the middleware service.
[0126] In one embodiment of this application, the pre-isolation check unit is specifically used to: determine the number of available virtual machine nodes where the middleware service is located; if the number of available virtual machine nodes is greater than a preset threshold, then determine that the result of the pre-isolation check is that the pre-isolation check has passed; if the number of available virtual machine nodes is not greater than the preset threshold, then determine that the result of the pre-isolation check is that the pre-isolation check has failed, and trigger an alarm.
[0127] In one embodiment of this application, the virtual machine isolation result includes an isolation success result or an isolation failure result. The isolation failure result includes a failure to pass the pre-isolation check or an operation timeout. The device further includes: a fourth determining unit, configured to determine whether the isolation success result or the pre-isolation check failure result can be obtained within a preset time; and a fifth determining unit, configured to determine the isolation failure result as an operation timeout if it cannot be obtained.
[0128] In one embodiment of this application, the second determining unit 430 is specifically used to: determine whether the middleware service is a middleware service hosted in the Supervisor process management program; if so, determine that the isolation strategy is to call the Supervisor interface to isolate the middleware service through the Supervisor interface.
[0129] In one embodiment of this application, the second determining unit 430 is specifically used to: if the type of the middleware service is a Redis middleware service, determine whether the virtual machine where the Redis middleware service is located is a master node; if so, determine that the isolation policy is to send an isolation instruction to the virtual machine where the Redis middleware service is located to switch the master node to a slave node and stop the Redis middleware service.
[0130] In one embodiment of this application, the second determining unit 430 is specifically used to: determine whether the middleware service is a service registered in the Dubbo framework; if so, determine that the isolation strategy is to reduce the weight of the virtual machine where the middleware service is located and take the middleware service offline.
[0131] In one embodiment of this application, the second determining unit 430 is specifically used to: if the middleware service is not a middleware service hosted in the Supervisor process management program, and is not a Redis middleware service or a service registered in the Dubbo framework, then determine that the isolation strategy is to remotely execute the isolation operation through the script execution platform.
[0132] In one embodiment of this application, the apparatus further includes: a checking unit, configured to check the virtual machine isolation result according to the type of the middleware service; and a sixth determining unit, configured to determine whether the middleware service on the virtual machine has been successfully isolated based on the checking result.
[0133] It is understood that the above-mentioned virtual machine isolation device can implement each step of the virtual machine isolation method executed by the middleware platform server provided in the foregoing embodiments. The relevant explanations of the virtual machine isolation method are applicable to the virtual machine isolation device and will not be repeated here.
[0134] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Please refer to it. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for other business operations.
[0135] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0136] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0137] The processor reads the corresponding computer program from non-volatile memory into main memory and then runs it, forming a virtual machine isolation device at the logical level. The processor executes the program stored in memory and specifically performs the following operations:
[0138] The virtual machine isolation request is received through the virtual machine isolation interface, where the virtual machine isolation request refers to a request to isolate the middleware service deployed on the virtual machine.
[0139] Based on the virtual machine IP address carried in the virtual machine isolation request, determine the target virtual machine and the middleware service deployed on the target virtual machine;
[0140] Determine the isolation strategy corresponding to the middleware service based on its type;
[0141] The middleware service deployed on the target virtual machine is isolated according to the isolation policy to obtain the virtual machine isolation result.
[0142] The above is as stated in this application. Figure 4 The method executed by the virtual machine isolation device disclosed in the illustrated embodiments can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0143] The electronic device can also perform Figure 4 The method for executing virtual machine isolation devices, and the implementation of virtual machine isolation devices in... Figure 4 The functions of the embodiments shown are not described in detail here.
[0144] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by an electronic device including multiple applications, enable the electronic device to perform... Figure 3 The method executed by the virtual machine isolation device in the illustrated embodiment is specifically used to perform:
[0145] The virtual machine isolation request is received through the virtual machine isolation interface, where the virtual machine isolation request refers to a request to isolate the middleware service deployed on the virtual machine.
[0146] Based on the virtual machine IP address carried in the virtual machine isolation request, determine the target virtual machine and the middleware service deployed on the target virtual machine;
[0147] Determine the isolation strategy corresponding to the middleware service based on its type;
[0148] The middleware service deployed on the target virtual machine is isolated according to the isolation policy to obtain the virtual machine isolation result.
[0149] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0150] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0151] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0152] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0153] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0154] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0155] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0156] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0157] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0158] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of this application should be included within the scope of the claims of this application.
Claims
1. A virtual machine isolation method, executed by a middleware platform server, wherein, The method includes: The virtual machine isolation request is received through the virtual machine isolation interface, where the virtual machine isolation request refers to a request to isolate the middleware service deployed on the virtual machine. Based on the virtual machine IP address carried in the virtual machine isolation request, determine the target virtual machine and the middleware service deployed on the target virtual machine; Determine the isolation strategy corresponding to the middleware service based on its type; The middleware service deployed on the target virtual machine is isolated according to the isolation policy to obtain the virtual machine isolation result.
2. The method as described in claim 1, wherein, The step of determining the target virtual machine and the middleware service deployed on the target virtual machine based on the virtual machine IP address carried in the virtual machine isolation request includes: Based on the virtual machine IP address, query the configuration management database for the middleware services deployed on the target virtual machine and the type of the middleware services.
3. The method as described in claim 1, wherein, After determining the target virtual machine and the middleware service deployed on the target virtual machine based on the virtual machine IP address carried in the virtual machine isolation request, the method further includes: Perform pre-isolation checks on the middleware services deployed on the target virtual machine; The steps involve determining whether to execute an isolation strategy based on the type of middleware service, according to the results of the pre-isolation checks.
4. The method as described in claim 3, wherein, The pre-isolation checks on the middleware services deployed on the target virtual machine include: Determine the number of available virtual machine nodes where the middleware service resides; If the number of available virtual machine nodes is greater than a preset threshold, then the result of the pre-isolation check is determined to be that the pre-isolation check has passed. If the number of available virtual machine nodes is not greater than a preset threshold, the result of the pre-isolation check is determined to be a failure, and an alarm is triggered.
5. The method as described in claim 3, wherein, The virtual machine isolation result includes a successful isolation result or an isolation failure result. The isolation failure result includes failure of the pre-isolation check or operation timeout. After performing the pre-isolation check on the middleware service deployed on the target virtual machine, the method further includes: Determine whether the isolation can be successfully completed within a preset time or whether the pre-isolation check fails. If not, the isolation failure result is determined to be an operation timeout.
6. The method of claim 1, wherein, The step of determining the isolation strategy corresponding to the middleware service based on the type of middleware service includes: Determine whether the middleware service is a middleware service hosted in the Supervisor process management program; If so, the isolation strategy is determined to be to call the Supervisor interface to isolate the middleware service through the Supervisor interface.
7. The method of claim 1, wherein, The step of determining the isolation strategy corresponding to the middleware service based on the type of middleware service includes: If the middleware service is a Redis middleware service, then determine whether the virtual machine where the Redis middleware service resides is the master node; If so, the isolation strategy is determined to be to send an isolation command to the virtual machine where the Redis middleware service resides, in order to switch the master node to a slave node and stop the Redis middleware service.
8. The method of claim 1, wherein, The step of determining the isolation strategy corresponding to the middleware service based on the type of middleware service includes: Determine whether the middleware service is a service registered in the Dubbo framework; If so, the isolation strategy is determined to be to reduce the weight of the virtual machine where the middleware service resides and take the middleware service offline.
9. The method of claim 1, wherein, The step of determining the isolation strategy corresponding to the middleware service based on the type of middleware service includes: If the middleware service is not a middleware service hosted in the Supervisor process management program, and is neither a Redis middleware service nor a service registered in the Dubbo framework, then the isolation strategy is determined to be to remotely execute the isolation operation through a script execution platform.
10. The method of claim 1, wherein, After isolating the middleware service deployed on the target virtual machine according to the isolation policy, the method further includes: The virtual machine isolation results are checked according to the type of the middleware service; The results of the inspection determine whether the middleware service on the virtual machine has been successfully isolated.
11. A virtual machine isolation device, applied to a middleware platform server, wherein, The apparatus is used to implement the method according to any one of claims 1 to 10.
12. An electronic device, comprising: processor; as well as A memory configured to store computer-executable instructions, which, when executed, cause the processor to perform the method of any one of claims 1 to 10.
13. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of applications, cause the electronic device to perform the method of any one of claims 1 to 10.
Citation Information
Patent Citations
Fault processing method, virtual architecture management system and business management system
CN106452846A
Micro-isolation protection method and micro-isolation protection system based on OpenFlow protocol
CN110378103A