CN111813507B - Method, system, equipment and medium for high availability of virtual machine based on sanlock - Google Patents

Method, system, equipment and medium for high availability of virtual machine based on sanlock Download PDF

Info

Publication number
CN111813507B
CN111813507B CN202010710359.3A CN202010710359A CN111813507B CN 111813507 B CN111813507 B CN 111813507B CN 202010710359 A CN202010710359 A CN 202010710359A CN 111813507 B CN111813507 B CN 111813507B
Authority
CN
China
Prior art keywords
virtual machine
lock information
node
lock
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010710359.3A
Other languages
Chinese (zh)
Other versions
CN111813507A (en
Inventor
于治楼
毛可绪
梁记斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chaoyue Technology Co Ltd
Original Assignee
Chaoyue Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chaoyue Technology Co Ltd filed Critical Chaoyue Technology Co Ltd
Priority to CN202010710359.3A priority Critical patent/CN111813507B/en
Publication of CN111813507A publication Critical patent/CN111813507A/en
Application granted granted Critical
Publication of CN111813507B publication Critical patent/CN111813507B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a method, a system, equipment and a storage medium for high availability of a virtual machine based on sanlock, wherein the method comprises the following steps: creating a lock space in each node, and updating the lock information and the non-lock information corresponding to each node in real time; acquiring lock information and non-lock information of each node except the current node, and judging whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information; obtaining the virtual machine with the highest score from the nodes of which the difference value between the updating time of the locking information and the unlocking information and the current time is smaller than a threshold value; judging whether the virtual machine of the current node is abnormal or not, and migrating the virtual machine with the highest score to the current node in response to the abnormal virtual machine of the current node.

Description

Method, system, equipment and medium for high availability of virtual machine based on sanlock
Technical Field
The present invention relates to the field of virtual machines, and in particular, to a method, a system, a computer device, and a readable medium for high availability of a virtual machine based on sanlock.
Background
In recent years, management in the field of virtualization has become more and more important, and virtualization has an advantage of convenient management and resource saving, and has an advantage of convenient realization of high availability. The current high-availability implementation scheme is generally implemented through a management platform, namely after the virtual machine is closed, the management platform judges that the virtual machine is down, and then the virtual machine is restarted in another host machine, wherein the process needs the intervention of the management platform, and naturally, some scenes exist in the condition that the management platform is not connected, and in the abnormal condition that the network is broken, the situation that the disk of the virtual machine is split can occur, and the situation is serious, so that the whole virtual machine is not available.
Disclosure of Invention
In view of the above, an object of the embodiments of the present invention is to provide a method, a system, a computer device and a computer readable storage medium for high availability of a virtual machine based on sanlock, which implement a function of high availability of the virtual machine by starting an HA process and managing locks of sanlock based on the HA process, and managing states of the virtual machine based on the lock management.
Based on the above object, an aspect of the embodiments of the present invention provides a method for high availability of a virtual machine based on sanlock, including the following steps: creating a lock space in each node, and updating the lock information and the non-lock information corresponding to each node in real time; acquiring lock information and non-lock information of each node except the current node, and judging whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information; obtaining the virtual machine with the highest score from the nodes of which the difference value between the updating time of the locking information and the unlocking information and the current time is smaller than a threshold value; judging whether the virtual machine of the current node is abnormal or not, and migrating the virtual machine with the highest score to the current node in response to the abnormal virtual machine of the current node.
In some embodiments, the determining whether the virtual machine of the current node is abnormal includes: and judging whether the score of the virtual machine of the current node is smaller than a second threshold value.
In some embodiments, further comprising: and transmitting lease information of the lock to a storage in response to the score of the virtual machine of the current node being not less than a second threshold.
In some embodiments, further comprising: and starting the virtual machine of the current node in response to the virtual machine being in a closed state and the score of the virtual machine being greater than a third threshold.
In another aspect of the embodiment of the present invention, there is also provided a virtual machine high availability system based on sanlock, including: the creation module is configured to create a lock space in each node and update the lock information and the non-lock information corresponding to each node in real time; the judging module is configured to acquire lock information and non-lock information of each node except the current node, and judge whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information; the acquisition module is configured to acquire the virtual machine with the highest score from the node with the difference value between the update time and the current time of the lock information and the non-lock information smaller than the threshold value; and the migration module is configured to determine whether the virtual machine of the current node is abnormal, and migrate the virtual machine with the highest score to the current node in response to the occurrence of the abnormality of the virtual machine of the current node.
In some embodiments, the migration module is configured to: and judging whether the score of the virtual machine of the current node is smaller than a second threshold value.
In some embodiments, further comprising: and the transmission module is configured to transmit lease information of the lock to a storage in response to the score of the virtual machine of the current node being not less than a second threshold.
In some embodiments, further comprising: and the starting module is configured to start the virtual machine in response to the virtual machine of the current node being in a closed state and the score of the virtual machine being greater than a third threshold.
In yet another aspect of the embodiment of the present invention, there is also provided a computer apparatus, including: at least one processor; and a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method as above.
In yet another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium storing a computer program which, when executed by a processor, implements the method steps as described above.
The invention has the following beneficial technical effects: by starting the HA process and managing the lock of the sanlock based on the HA process, the state of the virtual machine is managed based on the lock management, so that the high-availability function of the virtual machine is realized.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are necessary for the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention and that other embodiments may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an embodiment of a method for providing a high availability of a sanlock-based virtual machine according to the present invention;
fig. 2 is a schematic hardware structure of an embodiment of a high-availability computer device based on a sanlock.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention will be described in further detail with reference to the accompanying drawings.
It should be noted that, in the embodiments of the present invention, all the expressions "first" and "second" are used to distinguish two entities with the same name but different entities or different parameters, and it is noted that the "first" and "second" are only used for convenience of expression, and should not be construed as limiting the embodiments of the present invention, and the following embodiments are not described one by one.
Based on the above object, in a first aspect of the embodiment of the present invention, an embodiment of a method for high availability of a virtual machine based on sanlock is provided. Fig. 1 is a schematic diagram of an embodiment of a method for providing high availability of a virtual machine based on sanlock according to the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
s1, creating a lock space in each node, and updating lock information and non-lock information corresponding to each node in real time;
s2, acquiring lock information and non-lock information of each node except the current node, and judging whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information;
s3, obtaining the virtual machine with the highest score from the node with the difference value between the update time and the current time of the lock information and the non-lock information smaller than the threshold value; and
and S4, judging whether the virtual machine of the current node is abnormal, and responding to the abnormal virtual machine of the current node, and migrating the virtual machine with the highest score to the current node.
And creating a lock space in each node, and updating the lock information and the non-lock information corresponding to each node in real time. Initializing lock information and virtual machine state information. The corresponding storage domain is established with the storage connection, and is generally established on the block storage; the sanlock initializes the lock space, adds the lock space of the node, occupies a sector (default 512 bytes), and the non-lock information is stored in a separate release memory block. The Ha process updates lock and non-lock information in real time, the lock information comprising: host number, proposal number, owner, timestamp; the non-lock information includes: virtual machine score, virtual machine running state, information update time.
And acquiring the lock information and the non-lock information of each node except the current node, and judging whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information. The Ha process acquires lock and non-lock information of other nodes, including virtual machine scores and virtual machine running states; firstly, filtering information, judging whether the difference value between the update time of lock information and non-lock information and the current time is smaller than a threshold value, for example, if the difference between the update time of acquired information and the current time is too small, for example, smaller than 2 seconds, the time is considered to be too short, analysis is not needed, and the information is directly discarded; if the time is exceeded, the information is considered to be new and information analysis is performed.
And obtaining the virtual machine with the highest score from the nodes of which the difference value between the updating time and the current time of the lock information and the non-lock information is smaller than the threshold value. The virtual machine score may be calculated as follows: 1600 minutes represents that the gateway can ping; 1000 minutes indicates that the load of cpu is less than 90%;600 denotes that the management network of the host is in an up state; the 400 th partition indicates that the host has 4GB of free memory to run the virtual machine. The subtractive rule is as follows: the virtual machine fails to start once, and the number is reduced by 50. The host running the virtual machine and having the highest score can be obtained from the information list.
Judging whether the virtual machine of the current node is abnormal or not, and migrating the virtual machine with the highest score to the current node in response to the abnormal virtual machine of the current node. In some embodiments, the determining whether the virtual machine of the current node is abnormal includes: and judging whether the score of the virtual machine of the current node is smaller than a second threshold value. If the virtual machine of the current node is in an operating state, and the score of the virtual machine of the current node is less than a second threshold, for example less than 600 points, the host with the highest score and operating the virtual machine is selected from the virtual machines above 600 points.
In some embodiments, further comprising: and transmitting lease information of the lock to a storage in response to the score of the virtual machine of the current node being not less than a second threshold. If the score of the virtual machine is normal, the current state of the virtual machine is maintained, and the lease information of the lock is submitted to the storage.
In some embodiments, further comprising: and starting the virtual machine of the current node in response to the virtual machine being in a closed state and the score of the virtual machine being greater than a third threshold. If the virtual machine is in a closed state and the score of the virtual machine is greater than a third threshold, which may be 700 minutes, for example, the virtual machine may be started.
The states of the virtual machines in the HA are divided into: virtual machine running state, virtual machine starting state, virtual machine closing state, virtual machine abnormal closing state and virtual machine migration state. When the virtual machine is in a closed state, the score of the virtual machine is larger than a third threshold value, the virtual machine can enter a virtual machine starting state, if the starting is successful, the virtual machine enters a virtual machine running state, if the starting fails three times, the virtual machine enters an abnormal closed state, the virtual machine cannot be restarted in the state, the manager is required to intervene, and the problem can be that the hardware is not connected, for example, the storage is not connected. After the virtual machine is normally started, if the score is smaller than the second threshold value and the virtual machine with the score higher than the second threshold value is running, the virtual machine enters a virtual machine migration state, and when the virtual machine fails to migrate, the virtual machine enters a closing state again.
And the virtual machine state management is performed based on the sanlock, and different virtual machine states are processed differently, so that high-availability automation and independence of the virtual machine are finally realized.
It should be noted that, in the embodiments of the method for high availability of virtual machines based on sanlock, the steps may be intersected, replaced, added and deleted, so that the method for high availability of virtual machines based on sanlock by using these reasonable permutation and combination is also included in the protection scope of the present invention, and the protection scope of the present invention should not be limited to the embodiments.
Based on the above object, a second aspect of the embodiment of the present invention provides a high availability system of a virtual machine based on sanlock, including: the creation module is configured to create a lock space in each node and update the lock information and the non-lock information corresponding to each node in real time; the judging module is configured to acquire lock information and non-lock information of each node except the current node, and judge whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information; the acquisition module is configured to acquire the virtual machine with the highest score from the node with the difference value between the update time and the current time of the lock information and the non-lock information smaller than the threshold value; and the migration module is configured to determine whether the virtual machine of the current node is abnormal, and migrate the virtual machine with the highest score to the current node in response to the occurrence of the abnormality of the virtual machine of the current node.
In some embodiments, the migration module is configured to: and judging whether the score of the virtual machine of the current node is smaller than a second threshold value.
In some embodiments, further comprising: and the transmission module is configured to transmit lease information of the lock to a storage in response to the score of the virtual machine of the current node being not less than a second threshold.
In some embodiments, further comprising: and the starting module is configured to start the virtual machine in response to the virtual machine of the current node being in a closed state and the score of the virtual machine being greater than a third threshold.
In view of the above object, a third aspect of the embodiments of the present invention provides a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executable by the processor to perform the steps of: s1, creating a lock space in each node, and updating lock information and non-lock information corresponding to each node in real time; s2, acquiring lock information and non-lock information of each node except the current node, and judging whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information; s3, obtaining the virtual machine with the highest score from the node with the difference value between the update time and the current time of the lock information and the non-lock information smaller than the threshold value; s4, judging whether the virtual machine of the current node is abnormal, and responding to the abnormal virtual machine of the current node, and migrating the virtual machine with the highest score to the current node.
In some embodiments, the determining whether the virtual machine of the current node is abnormal includes: and judging whether the score of the virtual machine of the current node is smaller than a second threshold value.
In some embodiments, further comprising: and transmitting lease information of the lock to a storage in response to the score of the virtual machine of the current node being not less than a second threshold.
In some embodiments, further comprising: and starting the virtual machine of the current node in response to the virtual machine being in a closed state and the score of the virtual machine being greater than a third threshold.
As shown in fig. 2, a hardware structure diagram of an embodiment of the above-mentioned virtual machine based on sanlock according to the present invention is shown.
Taking the example of the apparatus shown in fig. 2, the apparatus includes a processor 301 and a memory 302, and may further include: an input device 303 and an output device 304.
The processor 301, memory 302, input device 303, and output device 304 may be connected by a bus or other means, for example in fig. 2.
The memory 302 is used as a non-volatile computer readable storage medium, and may be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as program instructions/modules corresponding to the method for high availability of the virtual machine based on sanlock in the embodiments of the present application. The processor 301 executes various functional applications of the server and data processing, i.e., a method for realizing the high availability of the sanlock-based virtual machine of the above-described method embodiment, by running nonvolatile software programs, instructions, and modules stored in the memory 302.
Memory 302 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of a method highly available to the sanlock-based virtual machine, etc. In addition, memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 302 may optionally include memory located remotely from processor 301, which may be connected to the local module via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 303 may receive input information such as a user name and a password. The output device 304 may include a display device such as a display screen.
Program instructions/modules corresponding to one or more sanlock-based virtual machine high availability methods are stored in memory 302 that, when executed by processor 301, perform the sanlock-based virtual machine high availability method of any of the method embodiments described above.
Any one embodiment of a computer device that performs the above-described method for high availability of a sanlock-based virtual machine may achieve the same or similar effects as any of the previously described method embodiments corresponding thereto.
The invention also provides a computer readable storage medium storing a computer program which when executed by a processor performs the method as above.
Finally, it should be noted that, as will be appreciated by those skilled in the art, implementing all or part of the above-described embodiments of the method, the implementation of the method may be accomplished by a computer program to instruct related hardware, and the program of the method for high availability of a virtual machine based on sanlock may be stored in a computer readable storage medium, where the program may include the steps of the embodiments of the methods described above when executed. The storage medium of the program may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (RAM), or the like. The computer program embodiments described above may achieve the same or similar effects as any of the method embodiments described above.
Furthermore, the method disclosed according to the embodiment of the present invention may also be implemented as a computer program executed by a processor, which may be stored in a computer-readable storage medium. The above-described functions defined in the methods disclosed in the embodiments of the present invention are performed when the computer program is executed by a processor.
Furthermore, the above-described method steps and system units may also be implemented using a controller and a computer-readable storage medium storing a computer program for causing the controller to implement the above-described steps or unit functions.
Further, it should be appreciated that the computer-readable storage medium (e.g., memory) herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of example, and not limitation, RAM may be available in a variety of forms such as synchronous RAM (DRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
The various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein may be implemented or performed with the following components designed to perform the functions herein: a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP and/or any other such configuration.
The steps of a method or algorithm described in connection with the disclosure herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal.
In one or more exemplary designs, the functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one location to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general purpose or special purpose computer or general purpose or special purpose processor. Further, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk, blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that as used herein, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The foregoing embodiment of the present invention has been disclosed with reference to the number of embodiments for the purpose of description only, and does not represent the advantages or disadvantages of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, and the program may be stored in a computer readable storage medium, where the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will appreciate that: the above discussion of any embodiment is merely exemplary and is not intended to imply that the scope of the disclosure of embodiments of the invention, including the claims, is limited to such examples; combinations of features of the above embodiments or in different embodiments are also possible within the idea of an embodiment of the invention, and many other variations of the different aspects of the embodiments of the invention as described above exist, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. of the embodiments should be included in the protection scope of the embodiments of the present invention.

Claims (10)

1. A method for high availability of a virtual machine based on sanlock, comprising the steps of:
creating a lock space in each node, and updating lock information and non-lock information corresponding to each node in real time, wherein the lock information comprises: host number, proposal number, owner, timestamp; the non-lock information includes: virtual machine score, virtual machine running state, information update time;
acquiring lock information and non-lock information of each node except the current node, and judging whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information;
obtaining the virtual machine with the highest score from the nodes of which the difference value between the updating time of the locking information and the unlocking information and the current time is smaller than a threshold value; and
judging whether the virtual machine of the current node is abnormal or not, and migrating the virtual machine with the highest score to the current node in response to the abnormal virtual machine of the current node.
2. The method of claim 1, wherein determining whether an exception occurred to the virtual machine of the current node comprises:
and judging whether the score of the virtual machine of the current node is smaller than a second threshold value.
3. The method as recited in claim 2, further comprising:
and transmitting lease information of the lock to a storage in response to the score of the virtual machine of the current node being not less than a second threshold.
4. The method as recited in claim 1, further comprising:
and starting the virtual machine of the current node in response to the virtual machine being in a closed state and the score of the virtual machine being greater than a third threshold.
5. A system for high availability of virtual machines based on sanlock, comprising:
the creation module is configured to create a lock space in each node, and update lock information and non-lock information corresponding to each node in real time, where the lock information includes: host number, proposal number, owner, timestamp; the non-lock information includes: virtual machine score, virtual machine running state, information update time;
the judging module is configured to acquire lock information and non-lock information of each node except the current node, and judge whether the difference value between the update time of the lock information and the non-lock information and the current time is smaller than a threshold value or not based on the time stamps of the lock information and the non-lock information;
the acquisition module is configured to acquire the virtual machine with the highest score from the node with the difference value between the update time and the current time of the lock information and the non-lock information smaller than the threshold value; and
and the migration module is configured to determine whether the virtual machine of the current node is abnormal, and migrate the virtual machine with the highest score to the current node in response to the occurrence of the abnormality of the virtual machine of the current node.
6. The system of claim 5, wherein the migration module is configured to:
and judging whether the score of the virtual machine of the current node is smaller than a second threshold value.
7. The system of claim 6, further comprising:
and the transmission module is configured to transmit lease information of the lock to a storage in response to the score of the virtual machine of the current node being not less than a second threshold.
8. The system of claim 5, further comprising:
and the starting module is configured to start the virtual machine in response to the virtual machine of the current node being in a closed state and the score of the virtual machine being greater than a third threshold.
9. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method of any one of claims 1-4.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method of any of claims 1-4.
CN202010710359.3A 2020-07-22 2020-07-22 Method, system, equipment and medium for high availability of virtual machine based on sanlock Active CN111813507B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010710359.3A CN111813507B (en) 2020-07-22 2020-07-22 Method, system, equipment and medium for high availability of virtual machine based on sanlock

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010710359.3A CN111813507B (en) 2020-07-22 2020-07-22 Method, system, equipment and medium for high availability of virtual machine based on sanlock

Publications (2)

Publication Number Publication Date
CN111813507A CN111813507A (en) 2020-10-23
CN111813507B true CN111813507B (en) 2023-05-02

Family

ID=72862150

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010710359.3A Active CN111813507B (en) 2020-07-22 2020-07-22 Method, system, equipment and medium for high availability of virtual machine based on sanlock

Country Status (1)

Country Link
CN (1) CN111813507B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597635A (en) * 2020-12-09 2021-04-02 北京智联友道科技有限公司 Method, device and equipment for generating virtual clock system based on CBTC (communication based train control) simulation system
CN113238862B (en) * 2021-05-13 2024-04-16 京东科技控股股份有限公司 Distributed task scheduling method and device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8806480B2 (en) * 2007-06-29 2014-08-12 Microsoft Corporation Virtual machine smart migration
US9792150B1 (en) * 2013-06-28 2017-10-17 Veritas Technologies Llc Detecting site change for migrated virtual machines
US9971660B2 (en) * 2014-09-12 2018-05-15 Vmware, Inc. Virtual machine network loss detection and recovery for high availability
CN104991822A (en) * 2015-06-30 2015-10-21 浪潮(北京)电子信息产业有限公司 Memory management method and apparatus
US10067803B2 (en) * 2015-11-25 2018-09-04 International Business Machines Corporation Policy based virtual machine selection during an optimization cycle
WO2018101736A1 (en) * 2016-11-30 2018-06-07 제주대학교 산학협력단 Method and apparatus for migrating virtual machine
CN106874136A (en) * 2017-02-22 2017-06-20 郑州云海信息技术有限公司 The fault handling method and device of a kind of storage system
CN106777394B (en) * 2017-02-28 2020-09-18 苏州浪潮智能科技有限公司 Cluster file system
CN110784419B (en) * 2019-10-22 2023-02-28 中国铁道科学研究院集团有限公司电子计算技术研究所 Method and system for visualizing professional railway electric service data

Also Published As

Publication number Publication date
CN111813507A (en) 2020-10-23

Similar Documents

Publication Publication Date Title
CN111813507B (en) Method, system, equipment and medium for high availability of virtual machine based on sanlock
US11159376B2 (en) System and method for network infrastructure analysis and convergence
CN109976822B (en) Configuration method and device of distributed application and distributed system
CN110597825B (en) Data processing method and device based on block chain and node equipment
US9413610B2 (en) Network-based DHCP server recovery
US11461267B2 (en) Method, device and computer readable medium for accessing files
CN111708744B (en) Method, system, device and medium for maintaining file lock based on stateless protocol
CN108255542B (en) Serial port and parallel port control method and device of virtual machine
CN114979158B (en) Resource monitoring method, system, equipment and computer readable storage medium
CN110427296B (en) Hardware WDT-based monitoring method, hardware WDT-based monitoring equipment and readable medium
CN111176904B (en) Method, system, equipment and medium for data backup under private cloud architecture
CN111309264B (en) Method, system, device and medium for making directory quota compatible with snapshot
CN110417579B (en) Method, equipment and readable medium for managing gigabit network by using gigabit network card
CN107341203A (en) The access control and optimiged index method and apparatus of a kind of distributed search engine
CN110875930A (en) Method, equipment and medium for monitoring trusted state
CN111858538B (en) Method, device, equipment and medium for configuring BeeGFS quota by cluster
CN111884919B (en) Method, device, equipment and readable medium for clearing invalid virtual IP
CN111090504B (en) Method, equipment and medium for realizing timing task based on placemaker
CN115756304A (en) Method, device, equipment and readable medium for realizing configuration data consistency
CN114048443A (en) User identity verification method and device and computer storage medium
US11138078B2 (en) Repairing partially completed transactions in fast consensus protocol
CN113448512A (en) Takeover method, device and equipment for cache partition recovery and readable medium
CN111125678A (en) Method, device and medium for managing Option ROM loading
CN110752953A (en) Load balancing-based connection number updating method and device and storage medium
CN110059125B (en) Method for invoking proxy contract and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 250104 No. 2877 Kehang Road, Sun Village Town, Jinan High-tech Zone, Shandong Province

Applicant after: Chaoyue Technology Co.,Ltd.

Address before: 250104 No. 2877 Kehang Road, Sun Village Town, Jinan High-tech Zone, Shandong Province

Applicant before: SHANDONG CHAOYUE DATA CONTROL ELECTRONICS Co.,Ltd.

GR01 Patent grant
GR01 Patent grant