CN111813507A - 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 PDFInfo
- Publication number
- CN111813507A CN111813507A CN202010710359.3A CN202010710359A CN111813507A CN 111813507 A CN111813507 A CN 111813507A CN 202010710359 A CN202010710359 A CN 202010710359A CN 111813507 A CN111813507 A CN 111813507A
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- lock information
- current node
- node
- lock
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F9/526—Mutual exclusion algorithms
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/4557—Distribution of virtual machine instances; Migration and load balancing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45575—Starting, stopping, suspending or resuming virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45591—Monitoring or debugging support
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a high-availability method, a system, equipment and a storage medium of a virtual machine based on sanlock, wherein the method comprises the following steps: creating a lock space in each node, and updating lock information and 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 less than a threshold value or not based on the timestamps of the lock information and the non-lock information; acquiring a virtual machine with the highest score from nodes of which the difference value between the update time of the lock information and the non-lock information and the current time is less than a threshold value; and judging whether the virtual machine of the current node is abnormal or not, and in response to the abnormal virtual machine of the current node, migrating the virtual machine with the highest score to the current node.
Description
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 important, and virtualization has advantages of facilitating management and saving resources, and also has an advantage of being able to easily achieve high availability. The current highly available implementation scheme is generally implemented through a management platform, that is, after a virtual machine is turned off, the management platform judges that the virtual machine is down, and then the virtual machine is started again at another host, which requires intervention of the management platform.
Disclosure of Invention
In view of this, 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, where the HA process is started, the lock of sanlock is managed based on the HA process, and the state of the virtual machine is managed based on the management of the lock, so as to implement a high availability function of the virtual machine.
Based on the above purpose, an aspect of the embodiments of the present invention provides a method for making a virtual machine highly available based on sanlock, including the following steps: creating a lock space in each node, and updating lock information and 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 less than a threshold value or not based on the timestamps of the lock information and the non-lock information; acquiring a virtual machine with the highest score from nodes of which the difference value between the update time of the lock information and the non-lock information and the current time is less than a threshold value; and judging whether the virtual machine of the current node is abnormal or not, and in response to the abnormal virtual machine of the current node, 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: in response to the score of the virtual machine of the current node not being less than a second threshold, passing lease information for the lock to storage.
In some embodiments, further comprising: in response to the virtual machine of the current node being in an off state and the score of the virtual machine being greater than a third threshold, starting the virtual machine.
In another aspect of the embodiments of the present invention, a virtual machine high availability system based on sanlock is further provided, including: the creating 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; 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 updating time of the lock information and the non-lock information and the current time is less than a threshold value based on the timestamps of the lock information and the non-lock information; the acquisition module is configured to acquire a virtual machine with the highest score from nodes of which 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; and the migration module is configured to judge whether the virtual machine of the current node is abnormal or not, respond to the abnormal virtual machine of the current node, and migrate the virtual machine with the highest score to 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: a transmission module configured to transmit lease information of the lock to a storage in response to the score of the virtual machine of the current node not being less than a second threshold.
In some embodiments, further comprising: and the starting module is configured to respond to the condition that the virtual machine of the current node is in a closed state and the score of the virtual machine is greater than a third threshold value, and start the virtual machine.
In another aspect of the embodiments of the present invention, there is also provided a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method as above.
In a further aspect of the embodiments of the present invention, a computer-readable storage medium is also provided, in which a computer program for implementing the above method steps is stored when the computer program is executed by a processor.
The invention has the following beneficial technical effects: by starting the HA process, managing the lock of the sanlock based on the HA process and managing the state of the virtual machine based on the lock management, the high-availability function of the virtual machine is realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
FIG. 1 is a schematic diagram of an embodiment of a high availability method for a virtual machine based on sanlock according to the present invention;
fig. 2 is a schematic hardware structural diagram of an embodiment of a highly available computer device of a sanlock-based virtual machine according to the present invention.
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 are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
Based on the above purpose, the first aspect of the embodiment of the present invention provides an embodiment of a method for making a virtual machine highly available based on sanlock. Fig. 1 is a schematic diagram illustrating an embodiment of a high availability method for a sanlock-based virtual machine 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 less than a threshold value or not based on the time stamps of the lock information and the non-lock information;
s3, acquiring a virtual machine with the highest score from the nodes of which the difference between the update time of the lock information and the non-lock information and the current time is less than the threshold value; and
and S4, judging whether the virtual machine of the current node is abnormal or not, and in response to the abnormal virtual machine of the current node, 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. And initializing lock information and virtual machine state information. Connecting with the storage, and establishing a corresponding storage domain, which is generally established on a block storage; and (4) sanlock initializes the lock space, adds the lock space of the node, wherein the lock space of the node occupies one sector (512 bytes by default), and the non-lock information is stored on a separate leave storage block. The Ha process updates the lock and non-lock information in real time, and the lock information comprises the following steps: host number, proposal number, owner, timestamp; the non-lock information includes: the virtual machine score, the virtual machine running state and the information updating 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 less than a threshold value or not based on the timestamps of the lock information and the non-lock information. The Ha process acquires lock and non-lock information of other nodes, including the virtual machine score and the virtual machine running state; firstly, filtering the information, and judging whether the difference value between the updating time of the lock information and the non-lock information and the current time is smaller than a threshold value, for example, if the difference value between the updating time of the acquired information and the current time is too small, such as 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 over, the information is considered to be new, and information analysis is carried out.
And acquiring the virtual machine with the highest score from the nodes of which the difference value between the update time of the lock information and the non-lock information and the current time is less than the threshold value. The virtual machine score may be calculated by: 1600 minutes indicates that the gateway can ping; 1000 points represents a cpu load of less than 90%; the 600 th point represents that the management network of the host computer is in an up state; a score of 400 indicates that the host has 4GB of free memory to run the virtual machine. The subtractive rule is such that: the virtual machine fails to start once, minus 50 points. The host which runs the virtual machine and has the highest score can be obtained from the information list.
And judging whether the virtual machine of the current node is abnormal or not, and in response to the abnormal virtual machine of the current node, 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. If the virtual machine of the current node is in a running state and the score of the virtual machine of the current node is less than a second threshold value, for example less than 600 points, the host machine which has the highest score and runs the virtual machine is selected from the virtual machines which are higher than 600 points.
In some embodiments, further comprising: in response to the score of the virtual machine of the current node not being less than a second threshold, passing lease information for the lock to storage. If the score of the virtual machine is normal, the current state of the virtual machine is maintained, and lease information of the lock is submitted to the storage.
In some embodiments, further comprising: in response to the virtual machine of the current node being in an off state and the score of the virtual machine being greater than a third threshold, starting the virtual machine. If the virtual machine is in an off state and the score of the virtual machine is greater than a third threshold, which may be 700 scores, for example, the virtual machine may be started.
The state of the virtual machine among the HAs is divided into: the method comprises the following steps of running a virtual machine, starting the virtual machine, closing the virtual machine, abnormally closing the virtual machine and migrating the virtual machine. When the virtual machine is in a closed state, the score of the virtual machine is greater than a third threshold value, the virtual machine can enter a virtual machine starting state, if the virtual machine is successfully started, the virtual machine running state is entered, if the virtual machine is failed to start three times, the virtual machine enters an abnormal closed state, in the state, the virtual machine cannot be restarted, at this time, the intervention of an administrator is required, and at this time, the problem of the hardware itself may be, for example, the storage is not connected. And after the virtual machine is normally started, if the score is smaller than a second threshold value and the virtual machine with the score higher than the second threshold value runs, entering a virtual machine migration state, and entering a closing state again when the virtual machine migration fails.
The management of the virtual machine state is carried out based on sanlock, different virtual machine states carry out different processing, and finally high-availability automation and independence of the virtual machine are achieved.
It should be particularly noted that, the steps in the embodiments of the above sanlock-based virtual machine highly available method can be mutually intersected, replaced, added, and deleted, so that these reasonable permutation and combination transformations of the sanlock-based virtual machine highly available method also belong to the scope of the present invention, and the scope of the present invention should not be limited to the embodiments.
In view of the above object, a second aspect of the embodiments of the present invention provides a virtual machine high availability system based on sanlock, including: the creating 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; 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 updating time of the lock information and the non-lock information and the current time is less than a threshold value based on the timestamps of the lock information and the non-lock information; the acquisition module is configured to acquire a virtual machine with the highest score from nodes of which 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; and the migration module is configured to judge whether the virtual machine of the current node is abnormal or not, respond to the abnormal virtual machine of the current node, and migrate the virtual machine with the highest score to 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: a transmission module configured to transmit lease information of the lock to a storage in response to the score of the virtual machine of the current node not being less than a second threshold.
In some embodiments, further comprising: and the starting module is configured to respond to the condition that the virtual machine of the current node is in a closed state and the score of the virtual machine is greater than a third threshold value, and start the virtual machine.
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 less than a threshold value or not based on the time stamps of the lock information and the non-lock information; s3, acquiring a virtual machine with the highest score from the nodes of which the difference between the update time of the lock information and the non-lock information and the current time is less than the threshold value; and S4, judging whether the virtual machine of the current node is abnormal or not, and in response to the abnormal virtual machine of the current node, 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: in response to the score of the virtual machine of the current node not being less than a second threshold, passing lease information for the lock to storage.
In some embodiments, further comprising: in response to the virtual machine of the current node being in an off state and the score of the virtual machine being greater than a third threshold, starting the virtual machine.
Fig. 2 is a schematic hardware structural diagram of an embodiment of the above highly available computer device based on a sanlock virtual machine according to the present invention.
Taking the apparatus shown in fig. 2 as an example, 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, the memory 302, the input device 303 and the output device 304 may be connected by a bus or other means, and fig. 2 illustrates the connection by a bus as an example.
The memory 302 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of a highly available method of the sanlock-based virtual machine, and the like. Further, the 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 optionally includes memory located remotely from processor 301, which may be connected to a 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 information such as a user name and a password that are input. The output means 304 may comprise 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 and, when executed by processor 301, perform the sanlock-based virtual machine high availability methods of any of the method embodiments described above.
Any embodiment of a computer device executing the method for high availability of a sanlock-based virtual machine can achieve the same or similar effects as any corresponding method embodiment described above.
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 one of ordinary skill in the art can appreciate that all or part of the processes of the methods of the above embodiments can be implemented by a computer program to instruct related hardware, and a program of a method highly available for a virtual machine based on sanlock can be stored in a computer readable storage medium, and when executed, the program can include the processes of the embodiments of the methods described above. 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 embodiments of the computer program may achieve the same or similar effects as any of the above-described method embodiments.
Furthermore, the methods disclosed according to embodiments 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. Which when executed by a processor performs the above-described functions defined in the methods disclosed in embodiments of the invention.
Further, the above method steps and system elements may also be implemented using a controller and a computer readable storage medium for storing a computer program for causing the controller to implement the functions of the above steps or elements.
Further, it should be appreciated that the computer-readable storage media (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 can act as external cache memory. By way of example and not limitation, RAM is available in a variety of forms such as synchronous RAM (DRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), 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 disclosed embodiments of the present invention.
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 of these components. 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 place 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 a general-purpose or special-purpose processor. Also, 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 present 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 of the invention 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 numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits 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 instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.
Claims (10)
1. A method for high availability of a virtual machine based on sanlock is characterized by comprising the following steps:
creating a lock space in each node, and updating lock information and 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 less than a threshold value or not based on the timestamps of the lock information and the non-lock information;
acquiring a virtual machine with the highest score from nodes of which the difference value between the update time of the lock information and the non-lock information and the current time is less than a threshold value; and
and judging whether the virtual machine of the current node is abnormal or not, and in response to the abnormal virtual machine of the current node, migrating the virtual machine with the highest score to the current node.
2. The method of claim 1, wherein the determining whether the virtual machine of the current node is abnormal comprises:
and judging whether the score of the virtual machine of the current node is smaller than a second threshold value.
3. The method of claim 2, further comprising:
in response to the score of the virtual machine of the current node not being less than a second threshold, passing lease information for the lock to storage.
4. The method of claim 1, further comprising:
in response to the virtual machine of the current node being in an off state and the score of the virtual machine being greater than a third threshold, starting the virtual machine.
5. A sanlock-based virtual machine high availability system, comprising:
the creating 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;
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 updating time of the lock information and the non-lock information and the current time is less than a threshold value based on the timestamps of the lock information and the non-lock information;
the acquisition module is configured to acquire a virtual machine with the highest score from nodes of which 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; and
and the migration module is configured to judge whether the virtual machine of the current node is abnormal or not, respond to the abnormal virtual machine of the current node, and migrate the virtual machine with the highest score to 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:
a transmission module configured to transmit lease information of the lock to a storage in response to the score of the virtual machine of the current node not being less than a second threshold.
8. The system of claim 5, further comprising:
and the starting module is configured to respond to the condition that the virtual machine of the current node is in a closed state and the score of the virtual machine is greater than a third threshold value, and start the virtual machine.
9. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, the instructions when executed by the processor implementing the steps of the method of any one of claims 1 to 4.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
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 true CN111813507A (en) | 2020-10-23 |
| CN111813507B 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) |
Cited By (3)
| 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 |
| CN113238862A (en) * | 2021-05-13 | 2021-08-10 | 京东数字科技控股股份有限公司 | Distributed task scheduling method and device |
| CN113821301A (en) * | 2021-08-29 | 2021-12-21 | 济南浪潮数据技术有限公司 | Virtual machine starting method, system, storage medium and equipment |
Citations (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090007106A1 (en) * | 2007-06-29 | 2009-01-01 | Microsoft Corporation | Virtual Machine Smart Migration |
| CN104991822A (en) * | 2015-06-30 | 2015-10-21 | 浪潮(北京)电子信息产业有限公司 | Memory management method and apparatus |
| US20160077935A1 (en) * | 2014-09-12 | 2016-03-17 | Vmware, Inc. | Virtual machine network loss detection and recovery for high availability |
| US20170147399A1 (en) * | 2015-11-25 | 2017-05-25 | International Business Machines Corporation | Policy-based virtual machine selection during an optimization cycle |
| CN106777394A (en) * | 2017-02-28 | 2017-05-31 | 郑州云海信息技术有限公司 | A kind of cluster file system |
| CN106874136A (en) * | 2017-02-22 | 2017-06-20 | 郑州云海信息技术有限公司 | The fault handling method and device of a kind of storage system |
| US9792150B1 (en) * | 2013-06-28 | 2017-10-17 | Veritas Technologies Llc | Detecting site change for migrated virtual machines |
| WO2018101736A1 (en) * | 2016-11-30 | 2018-06-07 | 제주대학교 산학협력단 | Method and apparatus for migrating virtual machine |
| CN110784419A (en) * | 2019-10-22 | 2020-02-11 | 中国铁道科学研究院集团有限公司电子计算技术研究所 | Data visualization method and system for railway electric affairs |
-
2020
- 2020-07-22 CN CN202010710359.3A patent/CN111813507B/en active Active
Patent Citations (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090007106A1 (en) * | 2007-06-29 | 2009-01-01 | Microsoft Corporation | Virtual Machine Smart Migration |
| US9792150B1 (en) * | 2013-06-28 | 2017-10-17 | Veritas Technologies Llc | Detecting site change for migrated virtual machines |
| US20160077935A1 (en) * | 2014-09-12 | 2016-03-17 | 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 |
| US20170147399A1 (en) * | 2015-11-25 | 2017-05-25 | 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 |
| CN106777394A (en) * | 2017-02-28 | 2017-05-31 | 郑州云海信息技术有限公司 | A kind of cluster file system |
| CN110784419A (en) * | 2019-10-22 | 2020-02-11 | 中国铁道科学研究院集团有限公司电子计算技术研究所 | Data visualization method and system for railway electric affairs |
Cited By (4)
| 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 |
| CN113238862A (en) * | 2021-05-13 | 2021-08-10 | 京东数字科技控股股份有限公司 | Distributed task scheduling method and device |
| CN113238862B (en) * | 2021-05-13 | 2024-04-16 | 京东科技控股股份有限公司 | Distributed task scheduling method and device |
| CN113821301A (en) * | 2021-08-29 | 2021-12-21 | 济南浪潮数据技术有限公司 | Virtual machine starting method, system, storage medium and equipment |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111813507B (en) | 2023-05-02 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111177043B (en) | Method, system, apparatus and medium for expediting reading of field replaceable unit information | |
| CN107329741B (en) | Software distributed upgrading method and device based on fingerprint identification | |
| US10862741B2 (en) | Network-based IP configuration recovery | |
| CN111813507A (en) | Method, system, equipment and medium for high availability of virtual machine based on sanlock | |
| CN110427342B (en) | Method, equipment and readable medium for creating mirror library | |
| CN111708484A (en) | A method, system, device and medium for controlling data brushing speed | |
| CN110752953A (en) | A method, device and storage medium for updating the number of connections based on load balancing | |
| CN111708744B (en) | Method, system, device and medium for maintaining file lock based on stateless protocol | |
| CN110879773A (en) | CGroup-based memory monitoring method and device | |
| CN111813346A (en) | Method, system, device and medium for establishing Ceph distributed storage based on cloud platform | |
| CN111030892B (en) | A method, device and medium for testing network function in BMC NCSI adaptive mode | |
| CN110427296B (en) | A method, device and readable medium for monitoring based on hardware WDT | |
| CN111130861B (en) | Method and device for stateless automatic management of whole cabinet equipment | |
| CN111193818A (en) | Method, system, equipment and medium for obtaining IP address | |
| CN111813606A (en) | Fault-tolerant method, system, equipment and medium for double-node virtual machine | |
| CN111176904B (en) | Method, system, equipment and medium for data backup under private cloud architecture | |
| CN111309264A (en) | A method, system, device, and media for making directory quotas compatible with snapshots | |
| CN111008037A (en) | A code migration method, device and storage medium | |
| CN111090504B (en) | Method, equipment and medium for realizing timing task based on placemaker | |
| CN111355716B (en) | Method, system, equipment and medium for determining unique identifier of virtual machine | |
| CN111130976B (en) | Method, equipment and medium for configuring virtual local area network of white box switch | |
| CN110417579B (en) | A method, device and readable medium for managing a 10-gigabit network by using a gigabit network card | |
| CN111858314A (en) | A method, system, device and medium for state management of Vue | |
| CN113448512B (en) | Takeover method, device and equipment for cache partition recovery and readable medium | |
| CN111158591A (en) | Method, equipment and medium for adapting storage system to streaming media service |
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 |
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. |
|
| CB02 | Change of applicant information | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |