A real-time detection method for virtual machine status based on ETCD

Through ETCD cluster monitoring of virtual machine state changes, real-time detection and active recovery of virtual machine state is achieved, which solves the problem of uncontrollable virtual machine state in cloud computing systems and improves the high availability and detection efficiency of services.

CN115981792BActive Publication Date: 2025-08-19UNICLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310057854.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-16
Publication Date
2025-08-19
Estimated Expiration
2043-01-16

AI Technical Summary

Technical Problem

In cloud computing systems, the state of virtual machines is uncontrollable, resulting in short-term unavailability of services, and the pressure to execute detection and keep-alive tasks is high, especially when there are many virtual machines, the detection time is long, which affects business availability.

Method used

The real-time detection method of virtual machine status based on ETCD is adopted, and the ETCD cluster is connected through monitoring services, and the event changes are monitored, and the virtual machine status is obtained regularly. It also actively recovers and reports when abnormalities are detected to reduce invalid detection requests and improve topological convergence capabilities.

Benefits of technology

Reduce network communication delay, improve topological convergence capabilities, promptly restore virtual machine abnormal state, maintain high service availability, reduce detection task pressure, and achieve high availability and rapid recovery of business services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115981792B_ABST
    Figure CN115981792B_ABST
Patent Text Reader

Abstract

The present invention provides a real-time virtual machine status detection method based on ETCD, comprising the following steps: monitoring service startup; business service registration information; obtaining ETCD cluster connection information and establishing cluster connection; obtaining specified CVK information, registering ETCD monitoring events, and monitoring event monitoring directories; issuing ETCD-related connection information and business types, and creating monitoring directories; starting scheduled tasks; obtaining virtual machine status; triggering watch notifications, parsing the data in the notifications; and obtaining the previous virtual machine status in MySQL. The present invention has the following beneficial effects: network communication delays can be reduced, topology convergence capabilities can be improved, and virtual machine information can be reported to an upper control layer in a timely manner through ETCD temporary node and watch event change notifications; virtual machine status detection can be performed through event notifications, virtual machine abnormality recovery can be performed, and service high availability can be maintained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of basic capabilities - cloud computing technology, and in particular relates to a real-time detection method for virtual machine status based on ETCD. Background Art

[0002] In cloud computing systems, more and more businesses use virtual machines as backend service providers. Since virtual machines are affected by basic resources such as the network, disk, and CPU, in order to prevent virtual machines from reaching thresholds due to related resource restrictions, causing problems such as system brain splits, downtime, and extended response times, it is necessary to detect and keep alive the virtual machines that carry backend services. This prevents abnormalities in the backend virtual machines from having a serious impact on the overall business. Due to the complexity of cloud computing services, long links, and network request delays, the state of virtual machines can become uncontrollable, potentially leading to temporary business unavailability. Therefore, the execution cycle and requirements for virtual machine detection and keep alive tasks are relatively high. When the number of virtual machine resources carrying backend services is large, the execution time of detection and keep alive tasks will be longer. As the number of virtual machines increases, the service pressure to execute detection tasks will be very high. Summary of the Invention

[0003] In view of this, the present invention aims to propose a real-time detection method for virtual machine status based on ETCD to solve the problems existing in the above-mentioned prior art.

[0004] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0005] A method for real-time detection of virtual machine status based on ETCD, comprising the following steps:

[0006] S1, monitoring service starts;

[0007] S2, business service registration local IP, business type, business recovery interface;

[0008] S3. The monitoring service obtains the ETCD cluster connection information and connects to the cluster;

[0009] S4. The monitoring service obtains the specified CVK information according to the received business type, registers ETCD related monitoring events, and monitors the event monitoring directory;

[0010] S5. The monitoring service connects to the agent service on CVK based on the obtained CVK information, sends ETCD-related connection information and service types, triggers CVK-agent to connect to the ETCD cluster, and creates the monitoring directory of step S3.

[0011] S6. After CVK-agent connects to the ETCD cluster, it starts the scheduled task, obtains information from CVK, and writes the node corresponding to the virtual machine ID in the monitoring directory;

[0012] S7, CVK-agent regularly obtains the virtual machine status and writes the virtual machine status to the ETCD node in step S6;

[0013] S8. The monitoring service receives a watch notification triggered by a data change on a specified node in the ETCD cluster, parses the data in the notification, obtains the VM ID, service type, and VM status, and updates the data.

[0014] S9. Get the last virtual machine status in Mysql. If the virtual machine status is down, determine whether the detected virtual machine status has changed to up. If yes, execute the first process and enter the end state; otherwise, execute the second process and enter the end state.

[0015] Furthermore, the service types in step S2 include DPVS, SLB, and DANOS.

[0016] Furthermore, the business type in step S2 obtains CVK information from the Mysql database.

[0017] Furthermore, the node format corresponding to the virtual machine ID in step S6 is: / node / cvkip / business type / virtual machine ID.

[0018] Furthermore, in step S7, when the CVK-agent periodically obtains the virtual machine status, it is necessary to poll the CVK for the virtual machine status every 5 seconds.

[0019] Furthermore, the data in the notification in step S8 includes a key and a value.

[0020] Furthermore, the first process in step S9 is to obtain a specified business recovery interface from MySQL to trigger business recovery.

[0021] Furthermore, the second process in step S9 includes the following steps:

[0022] S91. If the VM status is down, perform 10 detection operations to determine whether it cannot be restored.

[0023] S92: If yes, trigger the virtual machine migration to resume the service and delete the data on the old node on ETCD, resume the service, and enter the end state;

[0024] S93: No, mark the virtual machine status as abnormal, write to MySQL record, and enter the end state.

[0025] Compared with the existing technology, the real-time detection method of virtual machine status based on ETCD described in the present invention has the following advantages:

[0026] (1) The real-time detection method of virtual machine status based on ETCD described in the present invention can reduce network communication delay, improve topology convergence capability, and report virtual machine information to the upper control layer in time through ETCD's temporary node and watch event change notification; by detecting virtual machine status through event notification, the abnormal state of the virtual machine can be recovered to maintain high service availability; by adopting the active reporting method, the number of abnormal virtual machines can be effectively diverted, the pressure of detection tasks can be relieved, and the sending of invalid detection requests can be reduced.

[0027] (2) The present invention discloses a method for real-time detection of virtual machine status based on ETCD. After the business service virtualization is realized, the service-carrying virtual machine status can be migrated, expanded, and other operations can be performed to ensure high availability of the business service. The reporting mechanism can be customized for abnormal status. Alarm emails of abnormal operations can be used to immediately report and send alarms, so that operation and maintenance personnel can be notified in advance to handle the fault. The business can be restored in a timely and effective manner to avoid the business being stagnant for a long time, thereby providing a better user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings, which constitute part of the present invention, are provided to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are provided to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings:

[0029] Figure 1 Schematic diagram of the overall method described in an embodiment of the present invention. DETAILED DESCRIPTION

[0030] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0031] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, features defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.

[0032] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed, detachable, or integral connections; mechanical or electrical connections; direct or indirect connections through an intermediate medium; and internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on specific circumstances.

[0033] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0034] like Figure 1 As shown, a real-time detection method for virtual machine status based on ETCD includes the following steps:

[0035] 1.1. Actively detect virtual machine status

[0036] By detecting the status of virtual machines through event notifications, abnormal virtual machine status can be restored to maintain high service availability.

[0037] 1.2. Reduce the number of detection tasks executed

[0038] The use of active reporting and business aggregation can effectively reduce the number of status reports and virtual machine reports, and alleviate the pressure of detection tasks.

[0039] 1.3. Restoring related services without any perception

[0040] For business virtual machines with abnormal health status, they can be flexibly restored and related business recovery can be completed to ensure high business availability.

[0041] 1.4. Improve business service fault tolerance and scalability

[0042] After business service virtualization is implemented, operations such as migration and expansion can be performed on the service-bearing virtual machine status to ensure high availability of business services. At the same time, operations such as recovery and migration of business virtual machine processes can be performed.

[0043] 1.5. Improving the high availability of detection methods

[0044] The ETCD cluster is used as the task triggering center to ensure high fault tolerance of detection tasks through the high availability of the cluster, avoid single point failures, and restore detection tasks and core businesses on abnormal virtual machines as soon as possible.

[0045] 1.6 Dynamically expand the business that needs to be detected

[0046] Dynamic registration can be used to dynamically add new detection services, ensuring that the new service detection and activation mechanism can be launched in real time.

[0047] This application can reduce the number of execution tasks, adopt the event notification reporting method, complete the detection task as soon as possible within the specified execution task time scenario, reduce the cycle of sensing the business virtual machine status, reduce the load of the detection service, and restore related services as soon as possible.

[0048] Example 1

[0049] The virtual machine status detection method based on ETCD is as follows:

[0050] 1. Monitoring service starts;

[0051] 2. Business service registration local IP, business type, and business recovery interface;

[0052] 3. The monitoring service obtains the ETCD cluster connection information and connects to the cluster;

[0053] 4. The monitoring service obtains the specified CVK information according to the received business type, registers ETCD related monitoring events, and monitors the event monitoring directory;

[0054] / node / cvkip / business type / ;

[0055] 5. The monitoring service connects to the agent service on CVK based on the obtained CVK information, sends ETCD-related connection information and business types, triggers CVK-agent to connect to the ETCD cluster, and creates the monitoring directory in step 3;

[0056] 6. After CVK-agent connects to the ETCD cluster, it starts the scheduled task, obtains information on CVK, and writes the node corresponding to the virtual machine ID in the monitoring directory;

[0057] That is, / node / cvkip / business type / virtual machine ID;

[0058] 7. CVK-agent periodically obtains the virtual machine status (through the virsh command and monitors whether the virtual machine business network card status is up), and writes the virtual machine status to the ETCD node in step 6;

[0059] 8. The monitoring service receives a watch notification triggered by a data change on a specified node in the ETCD cluster, parses the data in the notification (parses the key and value), parses the data to obtain the virtual machine ID, business type, virtual machine status, and updates the data;

[0060] The following is an example of valid data in the received notification: type = PUT, key = / node / 127.0.0.1 / danos / ecs-ggf8ey4xddxm, value = up;

[0061] 9. Get the last virtual machine status in Mysql. If the virtual machine status is down, detect that the virtual machine status has changed to up, obtain the specified business recovery interface from MySQL, and trigger business recovery; if the virtual machine status is down, cut the detection operation 10 times, trigger the virtual machine migration to restore business and delete the data on the old node on ETCD, and restore business. Otherwise, mark the virtual machine status as abnormal and write a record to MySQL.

[0062] Advantages of the present invention:

[0063] The ETCD-based virtual machine status detection method can reduce network communication delays, improve topology convergence capabilities, and report virtual machine information to the upper control layer in a timely manner through ETCD's temporary nodes and watch event change notifications.

[0064] 1. Detect virtual machine status through event notification, recover from abnormal virtual machine status and maintain high service availability.

[0065] 2. The active reporting method can effectively divert the number of abnormal virtual machines, alleviate the pressure of detection tasks, and reduce the sending of invalid detection requests.

[0066] 3. After business service virtualization is implemented, operations such as migration and expansion can be performed based on the status of the service-carrying virtual machine to ensure high availability of business services. A reporting mechanism can be customized for abnormal status. Alarm emails for abnormal operations can be used to immediately report alarms and send emails, notifying operation and maintenance personnel in advance to handle faults.

[0067] 4. It can restore business in a timely and effective manner, avoid business stagnation for a long time, and provide better user experience.

[0068] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A real-time detection method for virtual machine status based on ETCD, characterized by: The following steps are involved: S1, monitoring service starts; S2, business service registration local IP, business type, business recovery interface; S3. The monitoring service obtains the ETCD cluster connection information and connects to the cluster; S4. The monitoring service obtains the specified CVK information according to the received business type, registers the ETCD monitoring event, and monitors the event monitoring directory; S5. The monitoring service connects to the agent service on CVK based on the obtained CVK information, sends the ETCD connection information and service type, triggers the CVK-agent to connect to the ETCD cluster, and creates the monitoring directory of step S3. S6. After CVK-agent connects to the ETCD cluster, it starts the scheduled task, obtains information from CVK, and writes the node corresponding to the virtual machine ID in the monitoring directory; S7, CVK-agent regularly obtains the virtual machine status and writes the virtual machine status to the ETCD node in step S6; S8. The monitoring service receives a watch notification triggered by a data change on a specified node in the ETCD cluster, parses the data in the notification, obtains the VM ID, service type, and VM status, and updates the data. S9. Get the last virtual machine status in MySQL. If the virtual machine status is down, determine whether the detected virtual machine status has changed to up. If yes, execute the first process and enter the end state. If not, the second process is executed and the process enters the end state.

2. The method for real-time detection of virtual machine status based on ETCD according to claim 1, characterized in that: The service types in step S2 include DPVS, SLB, and DANOS.

3. The method for real-time detection of virtual machine status based on ETCD according to claim 1, characterized in that: The business type in step S2 obtains CVK information from the MySQL database.

4. The method for real-time detection of virtual machine status based on ETCD according to claim 1, characterized in that: The node format corresponding to the virtual machine ID in step S6 is: / node / cvkip / service type / virtual machine ID.

5. The method for real-time detection of virtual machine status based on ETCD according to claim 1 is characterized in that: In step S7, when the CVK-agent periodically obtains the virtual machine status, it is necessary to poll the CVK for the virtual machine status every 5 seconds.

6. The method for real-time detection of virtual machine status based on ETCD according to claim 1, characterized in that: The data in the notification in step S8 includes a key and a value.

7. The method for real-time detection of virtual machine status based on ETCD according to claim 1, characterized in that: The first process in step S9 is to obtain a specified business recovery interface from MySQL to trigger business recovery; The second process in step S9 includes the following steps: S91. If the VM status is down, perform 10 detection operations to determine whether it cannot be restored. S92: If yes, trigger the virtual machine migration to resume the service and delete the data on the old node on ETCD, resume the service, and enter the end state; S93: No, mark the virtual machine status as abnormal, write to MySQL record, and enter the end state.

8. An electronic device comprising a processor and a memory in communication with the processor and configured to store instructions executable by the processor, wherein: The processor is used to execute the real-time detection method of virtual machine status based on ETCD as described in any one of claims 1 to 7.

9. A server, characterized in that: The system comprises at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the processor so that the at least one processor executes a real-time detection method for virtual machine status based on ETCD as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for real-time detection of virtual machine status based on ETCD according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Anti-split-brain virtual machine high-availability management device and method

    CN110806917A

  • Operational health of an integrated application orchestration and virtualized computing system

    US20210311765A1