Method, device, equipment and medium for realizing dual-machine hot standby based on virtualization scenario
By calling virtual machines, network and hot standby interfaces on a host, the creation and configuration of virtual machines is solved in the existing technology of the complexity and security risks of hot standby configuration of dual-machine virtual machines, and efficient management and Improved safety.
Patent Information
- Application Number
- CN202410993966.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-07-24
AI Technical Summary
The existing technology has high complexity and low efficiency in the hot standby configuration of virtual machines, which increases the security risks of the system and is not conducive to centralization of management.
By calling the creation of virtual machine interfaces, configuring network interfaces and configuring hot standby interfaces of the host and backup host, the creation, network configuration and hot standby configuration of virtual machines on one host is achieved, and avoiding the creation of virtual machines on the host and backup host. Switch between.
Simplifies the hot standby configuration process of dual-machine virtual machine, improves efficiency, reduces system security risks, and supports centralized management.
Smart Images

Figure CN118550769B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and medium for realizing dual-machine hot standby based on a virtualization scenario. Background Art
[0002] Hot standby is a solution applied to servers. Its construction idea is that the host and the slave are connected through the network. Under normal circumstances, the host is in working state and the slave is in monitoring state. Once the slave finds that the host is abnormal, the slave will replace the host in a very short time and fully realize the functions of the host.
[0003] When performing dual-machine hot standby configuration for virtual machines in the prior art, after the host machine is configured with dual-machine hot standby, it is necessary to create virtual machines on the host and standby machines respectively and perform network configuration for the corresponding virtual machines, and then enter the dual-machine hot standby interface of the virtual machines on the host and standby machines respectively to perform dual-machine hot standby configuration of the virtual machines, which means that the hot standby configuration of the virtual machines needs to be performed on the primary and standby machines as many times as the number of virtual machines created. The entire process is highly complex, inefficient, and not conducive to centralized management, which increases the security risk of the entire system. Summary of the invention
[0004] The embodiment of the present invention provides a method, device, equipment and medium for realizing dual-machine hot standby based on a virtualization scenario, which can simply and efficiently perform dual-machine hot standby on virtual machines.
[0005] In a first aspect, an embodiment of the present invention provides a method for implementing dual-machine hot standby based on a virtualization scenario, comprising:
[0006] In response to a virtual machine creation request sent by a user terminal, the virtual machine creation interfaces of the primary host machine and the backup host machine are respectively called, and a primary virtual machine on the primary host machine and a backup virtual machine on the backup host machine are correspondingly created, wherein the primary host machine and the backup host machine are two host devices for realizing dual-machine hot standby;
[0007] Respectively calling the configuration network interfaces of the primary host machine and the backup host machine to perform network configuration on the primary virtual machine and the backup virtual machine accordingly;
[0008] respectively calling the hot standby configuration interfaces of the primary host machine and the backup host machine, and correspondingly performing hot standby configuration of the primary virtual machine and the backup virtual machine; and
[0009] Based on the primary virtual machine and the standby virtual machine that have completed network configuration and dual-machine hot standby configuration, dual-machine hot standby of the primary virtual machine and the standby virtual machine is implemented.
[0010] In a second aspect, an embodiment of the present invention provides a dual-machine hot standby implementation device based on a virtualization scenario, comprising:
[0011] A virtual machine creation module, for responding to a virtual machine creation request sent by a user terminal, respectively calling the virtual machine creation interface of the primary host machine and the backup host machine, and correspondingly creating a primary virtual machine on the primary host machine and a backup virtual machine on the backup host machine, wherein the primary host machine and the backup host machine are two host devices for realizing dual-machine hot standby;
[0012] A network configuration module, used to call the configuration network interfaces of the primary host machine and the backup host machine respectively, and perform network configuration on the primary virtual machine and the backup virtual machine accordingly;
[0013] A dual-machine hot standby configuration module, used to call the configuration hot standby interfaces of the primary host machine and the backup host machine respectively, and perform dual-machine hot standby configuration on the primary virtual machine and the backup virtual machine accordingly; and
[0014] The dual-machine hot standby module is used to implement dual-machine hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine that have completed network configuration and dual-machine hot standby configuration.
[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a dual-machine hot standby implementation method based on a virtualization scenario as described in any one of the embodiments of the present invention is implemented.
[0016] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a dual-machine hot standby implementation method based on a virtualization scenario as described in any one of the embodiments of the present invention.
[0017] The embodiments of the present invention provide a dual-machine hot standby implementation method, device, equipment and medium based on a virtualization scenario. By calling the creation virtual machine interface, configuration network interface and configuration hot standby interface of the primary host machine and the backup host machine, the dual-machine hot standby configuration of the virtual machine can be completed on one host at one time. The creation of the virtual machine, the network configuration of the virtual machine and the hot standby configuration of the virtual machine do not need to be switched between the primary machine and the backup machine. The entire configuration process is simple and efficient, and can facilitate centralized management and reduce the security risks of the entire system. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solution of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 It is a flow chart of a method for implementing dual-machine hot standby based on a virtualization scenario provided by an embodiment of the present invention;
[0020] Figure 2 It is a schematic diagram of an interface in which a user terminal initiates a virtual machine creation request in a dual-machine hot standby implementation method based on a virtualization scenario provided by an embodiment of the present invention;
[0021] Figure 3 It is another flow chart of a method for implementing dual-machine hot standby based on a virtualization scenario provided by an embodiment of the present invention;
[0022] Figure 4 It is another flow chart of a method for implementing dual-machine hot standby based on a virtualization scenario provided by an embodiment of the present invention;
[0023] Figure 5 It is another flow chart of a method for implementing dual-machine hot standby based on a virtualization scenario provided by an embodiment of the present invention;
[0024] Figure 6 It is a schematic diagram of an interface in which a user terminal initiates a request for configuring a dual-machine hot standby in a method for implementing dual-machine hot standby based on a virtualization scenario provided by an embodiment of the present invention;
[0025] Figure 7 It is a structural schematic diagram of a dual-machine hot standby implementation device based on a virtualization scenario provided by an embodiment of the present invention;
[0026] Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Figure 1 A flowchart of a method for implementing hot standby of a virtual machine based on a virtualization scenario provided in an embodiment of the present invention is provided. This embodiment is applicable to a scenario in which hot standby of a virtual machine is performed. The method can be performed by a device for implementing hot standby of a virtual machine based on a virtualization scenario provided in an embodiment of the present invention. The device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated into an electronic device, such as a server. The following embodiments will be described by taking the device integrated into an electronic device as an example. Reference Figure 1 , the method may specifically include the following steps:
[0030] Step 101, in response to the virtual machine creation request sent by the user end, respectively call the virtual machine creation interface of the primary host and the backup host, and correspondingly create the primary virtual machine on the primary host and the backup virtual machine on the backup host, the primary host and the backup host are two host devices for realizing dual-machine hot standby. This step can complete the creation of virtual machines on the primary host and the backup host on the host, avoiding the complication of the process caused by switching the host when creating the virtual machine; and this step can facilitate further network configuration and dual-machine hot standby configuration of the virtual machine.
[0031] Specifically, the above-mentioned user terminal may be a user terminal of a web application that manages the primary host machine and the backup host machine.
[0032] Specifically, the dual-machine hot standby implementation method based on the virtualization scenario provided by the embodiment of the present invention can be executed by the primary host machine or the backup host machine, that is, the web application server that manages the primary host machine and the backup host machine can run on the primary host machine or on the backup host machine, and is preferably executed by the primary host machine.
[0033] Specifically, the primary host machine and the backup host machine that can complete the hot standby of dual machines are cloud server cryptographic machines (Cloud-Hosted Hardware - Security Module, CHSM).
[0034] Specifically, the primary host machine and the backup host machine may establish a dual-machine heartbeat connection between the primary host machine and the backup host machine through a keepalive detection mechanism (Keepalive), thereby achieving dual-machine hot standby of the primary host machine and the backup host machine.
[0035] Specifically, the virtual machine may be a virtual security module (VSM) that requires hot standby.
[0036] Specifically, the primary virtual machine may include one primary virtual machine or multiple primary virtual machines; the number of the backup virtual machines is equal to the number of primary virtual machines, and may include one backup virtual machine or multiple backup virtual machines.
[0037] Specifically, the virtual machine creation interface in the embodiment of the present invention may be created in advance.
[0038] Optionally, the above-mentioned process of respectively calling the create virtual machine interface of the primary host machine and the backup host machine, and correspondingly creating the primary virtual machine on the primary host machine and the backup virtual machine on the backup host machine includes: sending the configuration files of the primary virtual machine and the backup virtual machine to the primary virtual machine and the backup virtual machine respectively through the corresponding create virtual machine interface.
[0039] Specifically, the configuration file may include configuration information for performing system configuration, log server configuration, time configuration, etc. on the primary virtual machine and the standby virtual machine.
[0040] Specifically, in a scenario including multiple primary virtual machines and multiple backup virtual machines, the above-mentioned process of sending the configuration files of the primary virtual machine and the backup virtual machine to the primary virtual machine and the backup virtual machine respectively through the corresponding create virtual machine interface includes: for each primary virtual machine, sending the configuration file of the current primary virtual machine to the current primary virtual machine through the create virtual machine interface of the primary host machine; for each backup virtual machine, sending the configuration file of the current backup virtual machine to the current backup virtual machine through the create virtual machine interface of the backup host machine.
[0041] Optionally, the system file directory of the primary virtual machine is mounted under the system file directory of the primary host machine, and the system file directory of the standby virtual machine is mounted under the system file directory of the standby host machine.
[0042] Specifically, the system files of the virtual machine may also be saved in other ways known in the prior art.
[0043] Specifically, using the system files of the virtual machine as mount files of the host machine can facilitate subsequent network configuration, dual-machine hot standby configuration, and modification of configuration files.
[0044] Step 102, respectively call the configuration network interface of the primary host machine and the backup host machine, and perform network configuration on the primary virtual machine and the backup virtual machine. This step can complete the network configuration of the virtual machines of the primary host machine and the backup host machine on one host, and can avoid the complication of the process caused by switching the host machine when performing network configuration on the virtual machine; and this step can further facilitate the dual-machine hot standby configuration of the virtual machine.
[0045] Specifically, the configured network interface in the embodiment of the present invention may be pre-created before step 101 , or may be created before step 102 .
[0046] Optionally, the above process of respectively calling the configuration network interfaces of the primary host machine and the backup host machine and correspondingly performing network configuration on the primary virtual machine and the backup virtual machine includes: writing the IP addresses of the primary virtual machine and the backup virtual machine into corresponding configuration files through the corresponding configuration network interfaces.
[0047] Specifically, the above process of writing the IP addresses of the primary virtual machine and the standby virtual machine into the corresponding configuration files through the corresponding configured network interface may include: writing the IP address of the primary virtual machine into the configuration file of the primary virtual machine through the configured network interface of the primary host machine, and writing the IP address of the standby virtual machine into the configuration file of the standby virtual machine through the configured network interface of the standby host machine.
[0048] Optionally, the process of writing the IP addresses of the primary virtual machine and the standby virtual machine into corresponding configuration files includes: writing the IP addresses of the primary virtual machine and the standby virtual machine into configuration files under the system file directory of the primary virtual machine and the system file directory of the standby virtual machine respectively.
[0049] Specifically, the above process of writing the IP addresses of the primary virtual machine and the standby virtual machine into the configuration files under the system file directory of the primary virtual machine and the system file directory of the standby virtual machine correspondingly may include: writing the IP address of the primary virtual machine into the configuration file under the system file directory of the primary virtual machine; writing the IP address of the standby virtual machine into the configuration file under the system file directory of the standby virtual machine.
[0050] Optionally, in a scenario including multiple primary virtual machines and multiple standby virtual machines, for each primary virtual machine, the IP address of the current primary virtual machine is written into the configuration file of the current primary virtual machine; for each standby virtual machine, the IP address of the current standby virtual machine is written into the configuration file of the current standby virtual machine.
[0051] Step 103, respectively call the configuration hot standby interface of the primary host machine and the backup host machine, and perform dual-machine hot standby configuration for the primary virtual machine and the backup virtual machine. This step can complete the dual-machine hot standby configuration of the virtual machines on the primary host machine and the backup host machine on one host, and can avoid the complication of the process caused by switching the host machine when performing network configuration for the virtual machine; and this step can be conducive to the final realization of dual-machine hot standby of the primary virtual machine and the backup virtual machine.
[0052] Specifically, the hot standby configuration interface in the embodiment of the present invention may be pre-created before step 101 , or may be created before step 103 .
[0053] Optionally, the above-mentioned process of respectively calling the hot standby configuration interface of the primary host machine and the standby host machine and correspondingly performing hot standby configuration of the primary virtual machine and the standby virtual machine includes:
[0054] Through the configuration hot standby interface of the primary host machine, the virtual server IP address, virtual server routing ID and IP address of the standby virtual machine required to implement dual-machine hot standby of the primary virtual machine and the standby virtual machine are written into the configuration file of the primary virtual machine, and through the configuration hot standby interface of the standby host machine, the virtual server IP address, virtual server routing ID and IP address of the primary virtual machine are written into the configuration file of the standby virtual machine.
[0055] Specifically, the mask and gateway of the virtual server may be written into the configuration files of the primary virtual machine and the standby virtual machine by configuring the hot standby interface accordingly.
[0056] Optionally, in a scenario including multiple primary virtual machines and multiple backup virtual machines, for each primary virtual machine, the server IP address, virtual server routing ID and IP address of the backup virtual machine corresponding to the current primary virtual machine are written into the configuration file of the current primary virtual machine; for each backup virtual machine, the virtual server IP address, virtual server routing ID and IP address of the primary virtual machine corresponding to the current backup virtual machine are written into the configuration file of the current backup virtual machine.
[0057] Optionally, the above-mentioned writing of the virtual server IP address, virtual server routing ID and IP address of the standby virtual machine required for realizing dual-machine hot standby of the primary virtual machine and the standby virtual machine into the configuration file of the primary virtual machine includes: writing the virtual server IP address, virtual server routing ID and IP address of the standby virtual machine into the configuration file under the system file directory of the primary virtual machine.
[0058] Optionally, the above-mentioned writing the virtual server IP address, virtual server routing ID and IP address of the primary virtual machine into the configuration file of the standby virtual machine includes: writing the virtual server IP address, virtual server routing ID and IP address of the primary virtual machine into the configuration file under the system file directory of the standby virtual machine.
[0059] Optionally, when the configuration information of the primary virtual machine and the backup virtual machine changes, for example, when the IP address of the primary virtual machine, the IP address of the backup virtual machine and / or the IP address of the virtual machine server changes and the primary virtual machine and the backup virtual machine are in a shutdown state, the configuration information is modified and updated in a timely manner by modifying the configuration file in the corresponding system file directory.
[0060] Optionally, the IP addresses of the primary virtual machine and the backup virtual machine, the virtual server IP address, and the virtual server routing ID are all sent and provided by the user end.
[0061] Specifically, the IP addresses of the primary virtual machine and the standby virtual machine, the virtual server IP address, and the virtual server routing ID may be sent and provided at the same time when the user sends the virtual machine creation request.
[0062] In practical applications, the user can Figure 2 In the interface shown, fill in the IP addresses of the primary and backup virtual machines, the IP address of the virtual server, the routing ID of the virtual server, and the mask and gateway of the virtual server, and then click OK to initiate the virtual machine creation request.
[0063] Step 104, implement dual-machine hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine that have completed the network configuration and dual-machine hot standby configuration. This step is based on steps 101-103, and performs dual-machine hot standby configuration of the virtual machine by calling the create virtual machine interface, configure network interface, and configure hot standby interface of the primary host machine and the standby host machine. It can complete the creation of the virtual machine, the network configuration of the virtual machine, and the hot standby configuration of the virtual machine on one host at one time without switching between the host and the standby machine. The entire configuration process is simple and efficient, and can facilitate centralized management and reduce the security risks of the entire system.
[0064] Optionally, the above-mentioned process of realizing hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine that have completed the network configuration and the hot standby configuration includes: respectively calling the start virtual machine interface of the primary host machine and the standby host machine, and correspondingly starting the primary virtual machine and the standby virtual machine that have completed the network configuration and the hot standby configuration, so that the primary virtual machine and the standby virtual machine can perform hot standby.
[0065] Specifically, the above-mentioned virtual machine startup interface can be pre-created before step 101, or it can be created before calling the virtual machine startup interface of the primary host machine and the backup host machine respectively, and starting the primary virtual machine and the backup virtual machine that have completed network configuration and dual-machine hot standby configuration.
[0066] Optionally, the master virtual machine and the standby virtual machine that have completed the network configuration and the hot standby configuration have built-in network program scripts, and hot standby of the master virtual machine and the standby virtual machine is implemented based on the master virtual machine and the standby virtual machine that have completed the network configuration and the hot standby configuration, including: using the network program script to determine the IP address of the master virtual machine or the standby virtual machine based on the corresponding configuration file, and establishing a heartbeat connection between the master virtual machine and the standby virtual machine.
[0067] Optionally, the IP address of the primary virtual machine or the backup virtual machine is determined using a script file on the host machine and the above-mentioned built-in network program script.
[0068] Specifically, after starting the master virtual machine and the standby virtual machine that have completed the network configuration and dual-machine hot standby configuration by calling the corresponding startup virtual machine interface, the network program scripts in the master virtual machine and the standby virtual machine will obtain the IP address assigned to the local machine from the corresponding configuration file, and obtain the virtual server address for dual-machine hot standby and the IP address of another virtual machine from the corresponding configuration file, and establish a dual-machine heartbeat connection to achieve dual-machine hot standby.
[0069] Specifically, the primary virtual machine and the standby virtual machine can establish a dual-machine heartbeat connection through a survival detection mechanism.
[0070] The following further introduces a dual-machine hot standby implementation method based on a virtualization scenario provided by another embodiment of the present invention. Figure 3 As shown, the following steps may be included:
[0071] Step 301, in response to a virtual machine creation request sent by the user terminal, calls the primary host machine's create virtual machine interface, creates a primary virtual machine on the primary host machine by sending the primary virtual machine's configuration file to the primary virtual machine through the primary host machine's create virtual machine interface, and creates a virtual machine proxy command channel for the primary virtual machine.
[0072] Step 302, calling the virtual machine creation interface of the standby host machine, creating a standby virtual machine on the standby host machine by sending the configuration file of the standby virtual machine to the standby virtual machine through the virtual machine creation interface of the standby host machine, and creating a virtual machine proxy command channel for the standby virtual machine.
[0073] Specifically, the virtual machine agent command channel can be understood as a channel based on the virtual machine agent command (qemu-agent-command).
[0074] Step 303: Call the configuration network interfaces of the primary host machine and the backup host machine respectively, and perform network configuration on the primary virtual machine and the backup virtual machine accordingly.
[0075] Step 304 , respectively call the hot standby configuration interfaces of the primary host machine and the backup host machine, and perform hot standby configuration of the primary virtual machine and the backup virtual machine accordingly.
[0076] Step 305 : correspondingly modify the configuration files of the primary virtual machine and the backup virtual machine through the virtual machine proxy command channel of the primary virtual machine and the virtual machine proxy command channel of the backup virtual machine.
[0077] Optionally, the process of modifying the configuration files of the primary virtual machine and the backup virtual machine includes: modifying the changed IP address in the configuration files of the primary virtual machine and the backup virtual machine.
[0078] Specifically, the process of modifying the configuration files of the primary virtual machine and the backup virtual machine may further include modifying other information in the configuration files, such as modifying system configuration information.
[0079] Step 306: implement hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine for which the network configuration and hot standby configuration have been completed.
[0080] The embodiment of the present invention is suitable for timely modifying and updating the configuration files of the primary virtual machine and the standby virtual machine when the configuration information of the primary virtual machine and the standby virtual machine changes and the primary virtual machine and the standby virtual machine are in the power-on state.
[0081] The following further introduces a method for implementing dual-machine hot standby based on a virtualization scenario provided by another embodiment of the present invention.
[0082] Optionally, in a scenario executed by a primary host, the dual-machine hot standby implementation method based on a virtualization scenario provided by an embodiment of the present invention is as follows: Figure 4 As shown, it may include:
[0083] Step 401, obtaining the IP address corresponding to the virtual machine creation request sent by the user end.
[0084] Step 402, when the IP address corresponding to the virtual machine creation request is the IP address of the primary host machine or the host server IP address, the virtual machine creation interfaces of the primary host machine and the backup host machine are called respectively, and the primary virtual machine on the primary host machine and the backup virtual machine on the backup host machine are created accordingly. The host server IP address is the server IP address provided after the primary host machine and the backup host machine complete the hot standby of the dual machines.
[0085] Optionally, obtain the primary host machine IP address, the backup host machine IP address and the host server IP address from the corresponding database, and compare the primary host machine IP address, the backup host machine IP address and the host server IP address with the IP address corresponding to the virtual machine creation request to determine whether the IP address corresponding to the virtual machine creation request is the IP address of the primary host machine or the host server IP address.
[0086] Specifically, when the IP address corresponding to the virtual machine creation request is the IP address of the primary host machine or the IP address of the host server, the corresponding request is for the primary host machine, and the dual-machine hot standby implementation method provided by the embodiment of the present invention is directly executed by the primary host machine; and when the IP address corresponding to the virtual machine creation request is the IP address of the backup host machine, the corresponding request is for the backup host machine, and the primary host machine needs to call the backup host machine to execute the dual-machine hot standby implementation method provided by the embodiment of the present invention.
[0087] Optionally, when the IP address corresponding to the virtual machine creation request is the IP address of the backup host machine, an error prompt is sent to the user terminal.
[0088] Step 403: Call the configuration network interfaces of the primary host machine and the backup host machine respectively, and perform network configuration on the primary virtual machine and the backup virtual machine accordingly.
[0089] Step 404 , respectively call the hot standby configuration interfaces of the primary host machine and the backup host machine, and perform hot standby configuration of the primary virtual machine and the backup virtual machine accordingly.
[0090] Step 405 , implement hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine that have completed the network configuration and hot standby configuration.
[0091] Specifically, the dual-machine hot standby implementation method provided by the present invention is executed by the backup host machine, and the main host machine needs to call the backup host machine to start executing the dual-machine hot standby implementation method in this embodiment, and the process is relatively cumbersome. The embodiment of the present invention can ensure that the dual-machine hot standby implementation method provided by the present invention is executed by the main host machine, making the dual-machine hot standby implementation process of the virtual machine more simple and efficient.
[0092] The following further describes a method for implementing dual-machine hot standby based on a virtualization scenario provided by another embodiment of the present invention. Figure 5 As shown, the following steps may be included:
[0093] Step 501 , in response to a host dual-machine hot standby configuration request sent by a user terminal, perform dual-machine hot standby configuration on a primary host machine.
[0094] Optionally, the above process of performing hot standby configuration on the host includes: based on the IP address of the primary host, the IP address of the backup host and the IP address of the server sent by the user end.
[0095] In practical applications, the user can Figure 6 In the interface shown, after filling in the corresponding information and clicking Save Configuration and Enable, a hot standby configuration request is initiated based on the corresponding filled-in information to access the primary host machine and the backup host machine respectively, and hot standby configuration is performed on the primary host machine and the backup host machine.
[0096] Specifically, both the primary host machine and the backup host machine will store the IP address of the primary host machine, the IP address of the backup host machine, and the IP address of the server.
[0097] Step 502, calling the system configuration synchronization interface of the standby host machine that has completed the dual-machine hot standby configuration, and performing system synchronization configuration on the standby host machine to implement dual-machine hot standby of the main host machine and the standby host machine.
[0098] Specifically, the system configuration synchronization interface may be pre-created before step 101 , or may be created before step 502 .
[0099] Specifically, the process of calling the system configuration synchronization interface of the standby host machine that has completed the dual-machine hot standby configuration may include calling the system configuration synchronization interface of the standby host machine through the IP address of the standby host machine.
[0100] Specifically, the process of performing system synchronization configuration on the standby host includes: performing synchronization configuration of the log server address, configuration time and database of the standby host with those of the primary host.
[0101] Specifically, the above process of synchronously configuring the database of the standby host machine with that of the primary host machine can be implemented based on a dual-master mode of a relational database management system (My Structured Query Language, MYSQL).
[0102] Step 503, in response to the virtual machine creation request sent by the user end, respectively call the virtual machine creation interface of the primary host and the backup host, and correspondingly create a primary virtual machine on the primary host and a backup virtual machine on the backup host.
[0103] Step 504 , respectively call the configuration network interfaces of the primary host machine and the backup host machine to perform network configuration on the primary virtual machine and the backup virtual machine.
[0104] Step 505 , respectively call the hot standby configuration interfaces of the primary host machine and the backup host machine, and perform hot standby configuration of the primary virtual machine and the backup virtual machine accordingly.
[0105] Step 506: implement hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine for which the network configuration and hot standby configuration have been completed.
[0106] The embodiment of the present invention can facilitate fast and efficient dual-machine hot standby of the primary host machine and the backup host machine by calling the system configuration synchronization interface of the backup host machine, thereby facilitating efficient and fast dual-machine hot standby of the virtual machines on the primary host machine and the backup host machine.
[0107] Figure 71 is a structural diagram of a dual-machine hot standby implementation device based on a virtualization scenario provided by an embodiment of the present invention. The device is suitable for executing a dual-machine hot standby implementation method based on a virtualization scenario provided by an embodiment of the present invention. Figure 7 As shown, the device may specifically include:
[0108] The virtual machine creation module 701 is used to respond to the virtual machine creation request sent by the user end, and respectively call the virtual machine creation interface of the primary host and the backup host, and correspondingly create the primary virtual machine on the primary host and the backup virtual machine on the backup host, and the primary host and the backup host are two host devices for realizing dual-machine hot standby. The creation of virtual machines on the primary host and the backup host can be completed on the host, avoiding the complication of the process caused by switching the host when creating the virtual machine; and this step can facilitate further network configuration and dual-machine hot standby configuration of the virtual machine.
[0109] Optionally, the system file directory of the primary virtual machine is mounted under the system file directory of the primary host machine, and the system file directory of the standby virtual machine is mounted under the system file directory of the standby host machine.
[0110] Optionally, the virtual machine creation module 701 can be specifically used to send the configuration files of the primary virtual machine and the standby virtual machine to the primary virtual machine and the standby virtual machine respectively through corresponding virtual machine creation interfaces.
[0111] The network configuration module 702 is used to call the configuration network interface of the primary host machine and the backup host machine respectively, and perform network configuration on the primary virtual machine and the backup virtual machine accordingly. This can avoid the complication of the process caused by switching the host machine when performing network configuration on the virtual machine; and this step can further facilitate the dual-machine hot standby configuration of the virtual machine.
[0112] Optionally, the network configuration module 702 can be specifically used to write the IP addresses of the primary virtual machine and the backup virtual machine into corresponding configuration files by configuring the network interface accordingly.
[0113] Optionally, the network configuration module 702 can be specifically used to write the IP addresses of the primary virtual machine and the standby virtual machine into the configuration files under the system file directory of the primary virtual machine and the system file directory of the standby virtual machine respectively.
[0114] The dual-machine hot standby configuration module 703 is used to call the configuration hot standby interface of the primary host machine and the backup host machine respectively, and perform dual-machine hot standby configuration on the primary virtual machine and the backup virtual machine accordingly. The dual-machine hot standby configuration of the virtual machines on the primary host machine and the backup host machine can be completed on one host, which can avoid the complication of the process caused by switching the host machine when performing network configuration on the virtual machine; and this step can be conducive to the final realization of dual-machine hot standby of the primary virtual machine and the backup virtual machine.
[0115] Optionally, the above-mentioned dual-machine hot standby configuration module 703 can be specifically used to write the virtual server IP address, virtual server routing ID and IP address of the standby virtual machine required to realize dual-machine hot standby of the primary virtual machine and the standby virtual machine into the configuration file of the primary virtual machine through the configuration hot standby interface of the primary host machine, and write the virtual server IP address, virtual server routing ID and IP address of the primary virtual machine into the configuration file of the standby virtual machine through the configuration hot standby interface of the standby host machine.
[0116] Optionally, the above-mentioned dual-machine hot standby configuration module 703 can be specifically used to write the virtual server IP address, virtual server routing ID and the IP address of the standby virtual machine into the configuration file under the system file directory of the primary virtual machine; and to write the virtual server IP address, virtual server routing ID and the IP address of the primary virtual machine into the configuration file under the system file directory of the standby virtual machine.
[0117] Optionally, the IP addresses of the primary virtual machine and the standby virtual machine, the virtual server IP address, and the virtual server routing ID are all sent and provided by the user end.
[0118] The dual-machine hot standby module 704 is used to implement dual-machine hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine that have completed the network configuration and the dual-machine hot standby configuration. In combination with modules 701 to 704, the dual-machine hot standby configuration of the virtual machine is performed by calling the creation virtual machine interface, configuration network interface, and configuration hot standby interface of the primary host machine and the standby host machine. It is possible to complete the creation of the virtual machine, the network configuration of the virtual machine, and the hot standby configuration of the virtual machine on one host at a time without switching between the host and the standby machine. The entire configuration process is simple and efficient, and can facilitate centralized management and reduce the security risks of the entire system.
[0119] Optionally, the above-mentioned dual-machine hot standby module 704 can be specifically used to call the virtual machine startup interface of the primary host machine and the backup host machine respectively, and correspondingly start the primary virtual machine and the backup virtual machine that have completed the network configuration and dual-machine hot standby configuration, so as to enable the primary virtual machine and the backup virtual machine to perform dual-machine hot standby.
[0120] Optionally, the master virtual machine and the standby virtual machine that have completed the network configuration and the dual-machine hot standby configuration have built-in network program scripts. The dual-machine hot standby module 704 can be specifically used to determine the IP address of the master virtual machine or the standby virtual machine based on the corresponding configuration file using the network program script, and establish a heartbeat connection between the master virtual machine and the standby virtual machine.
[0121] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the functional modules described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0122] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method for implementing dual-machine hot standby based on a virtualization scenario provided in any of the above embodiments is implemented.
[0123] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method for implementing dual-machine hot standby based on a virtualization scenario provided in any of the above embodiments is implemented.
[0124] An embodiment of the present invention further provides a computer program product, including a computer program. When the computer program is executed by a processor, the method for realizing hot standby of a dual machine based on a virtualization scenario as described in any one of the embodiments of the present invention is implemented.
[0125] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 of an electronic device suitable for implementing an embodiment of the present invention. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0126] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0127] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0128] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.
[0129] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0130] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0131] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be set in a processor. For example, they may be described as follows: a processor includes a virtual machine creation module, a network configuration module, a dual-machine hot standby configuration module, and a dual-machine hot standby module. The names of these modules do not, in some cases, constitute limitations on the modules themselves.
[0132] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: in response to a virtual machine creation request sent by a user end, respectively calling the virtual machine creation interface of the primary host and the standby host, corresponding to the primary virtual machine created on the primary host and the standby virtual machine created on the standby host, the primary host and the standby host are two host devices for realizing dual-machine hot standby; respectively calling the configuration network interface of the primary host and the standby host, corresponding to the network configuration of the primary virtual machine and the standby virtual machine; respectively calling the configuration hot standby interface of the primary host and the standby host, corresponding to the dual-machine hot standby configuration of the primary virtual machine and the standby virtual machine; and realizing the dual-machine hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine that have completed the network configuration and the dual-machine hot standby configuration.
[0133] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for implementing dual-machine hot standby based on a virtualization scenario, characterized in that: include: In response to a virtual machine creation request sent by a user terminal, the virtual machine creation interfaces of the primary host machine and the backup host machine are respectively called, and a primary virtual machine on the primary host machine and a backup virtual machine on the backup host machine are correspondingly created, wherein the primary host machine and the backup host machine are two host devices for realizing dual-machine hot standby; Respectively calling the configuration network interfaces of the primary host machine and the backup host machine to perform network configuration on the primary virtual machine and the backup virtual machine accordingly; respectively calling the hot standby configuration interfaces of the primary host machine and the backup host machine, and correspondingly performing hot standby configuration of the primary virtual machine and the backup virtual machine; and Based on the primary virtual machine and the standby virtual machine that have completed network configuration and dual-machine hot standby configuration, dual-machine hot standby of the primary virtual machine and the standby virtual machine is implemented.
2. The method for implementing dual-machine hot standby based on virtualization scenario according to claim 1 is characterized in that: The calling of the create virtual machine interface of the primary host machine and the standby host machine respectively, and correspondingly creating a primary virtual machine on the primary host machine and a standby virtual machine on the standby host machine, comprises: sending the configuration files of the primary virtual machine and the standby virtual machine to the primary virtual machine and the standby virtual machine through the corresponding create virtual machine interface; The respectively calling the configuration network interfaces of the primary host machine and the backup host machine to perform network configuration on the primary virtual machine and the backup virtual machine accordingly comprises: writing the IP addresses of the primary virtual machine and the backup virtual machine into the corresponding configuration files through the corresponding configuration network interfaces; The calling of the hot standby configuration interface of the primary host machine and the standby host machine respectively to perform hot standby configuration for the primary virtual machine and the standby virtual machine accordingly includes: writing the virtual server IP address, virtual server routing ID and IP address of the standby virtual machine required for realizing hot standby of the primary virtual machine and the standby virtual machine into the configuration file of the primary virtual machine through the hot standby configuration interface of the primary host machine, and writing the virtual server IP address, virtual server routing ID and IP address of the primary virtual machine into the configuration file of the standby virtual machine through the hot standby configuration interface of the standby host machine; The IP addresses of the primary virtual machine and the standby virtual machine, the virtual server IP address and the virtual server routing ID are all sent and provided by the user terminal.
3. The method for implementing dual-machine hot standby based on virtualization scenario according to claim 2 is characterized in that: Also includes: The system file directory of the primary virtual machine is mounted under the system file directory of the primary host machine, and the system file directory of the standby virtual machine is mounted under the system file directory of the standby host machine; Writing the IP addresses of the primary virtual machine and the standby virtual machine into the corresponding configuration files comprises: writing the IP addresses of the primary virtual machine and the standby virtual machine into the configuration files under the system file directory of the primary virtual machine and the configuration files under the system file directory of the standby virtual machine, respectively; The step of writing the virtual server IP address, virtual server routing ID and IP address of the standby virtual machine required for realizing hot standby of the primary virtual machine and the standby virtual machine into the configuration file of the primary virtual machine comprises: writing the virtual server IP address, virtual server routing ID and IP address of the standby virtual machine into the configuration file under the system file directory of the primary virtual machine; Writing the virtual server IP address, the virtual server routing ID and the IP address of the primary virtual machine into the configuration file of the standby virtual machine includes: writing the virtual server IP address, the virtual server routing ID and the IP address of the primary virtual machine into the configuration file under the system file directory of the standby virtual machine.
4. The method for implementing dual-machine hot standby based on virtualization scenario according to claim 2 is characterized in that: The master virtual machine and the standby virtual machine that have completed the network configuration and the dual-machine hot standby configuration have a network program script built in; The method of implementing hot standby of the primary virtual machine and the standby virtual machine based on the completed network configuration and hot standby configuration includes: using the network program script to determine the IP address of the primary virtual machine or the standby virtual machine based on the corresponding configuration file, and establishing a heartbeat connection between the primary virtual machine and the standby virtual machine.
5. The method for implementing dual-machine hot standby based on virtualization scenario according to claim 2 is characterized in that: Also includes: After the primary virtual machine is created on the primary host machine, a virtual machine proxy command channel of the primary virtual machine is created, and after the backup virtual machine is created on the backup host machine, a virtual machine proxy command channel of the backup virtual machine is created; as well as The configuration files of the primary virtual machine and the backup virtual machine are modified correspondingly through the virtual machine proxy command channel of the primary virtual machine and the virtual machine proxy command channel of the backup virtual machine.
6. The method for implementing dual-machine hot standby based on virtualization scenario according to claim 1, characterized in that: The dual-machine hot standby implementation method is executed by the primary host machine, and the dual-machine hot standby implementation method also includes: Before respectively calling the virtual machine creation interfaces of the primary host machine and the backup host machine to correspondingly create a primary virtual machine on the primary host machine and a backup virtual machine on the backup host machine, Obtain the IP address corresponding to the virtual machine creation request. When the IP address corresponding to the virtual machine creation request is the IP address of the primary host machine or the host server IP address, start executing the virtual machine creation request sent in response to the user terminal, and call the virtual machine creation interfaces of the primary host machine and the backup host machine respectively, corresponding to the primary virtual machine on the primary host machine and the backup virtual machine on the backup host machine; the host server IP address is the server IP address provided after the primary host machine and the backup host machine complete dual-machine hot standby.
7. The method for implementing dual-machine hot standby based on virtualization scenario according to claim 1, characterized in that: The method of implementing hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine that have completed network configuration and hot standby configuration includes: The virtual machine startup interfaces of the primary host machine and the backup host machine are respectively called to correspondingly start the primary virtual machine and the backup virtual machine that have completed network configuration and hot standby configuration, so that the primary virtual machine and the backup virtual machine perform hot standby.
8. A dual-machine hot standby implementation device based on a virtualization scenario, characterized in that: include: A virtual machine creation module, for responding to a virtual machine creation request sent by a user terminal, respectively calling the virtual machine creation interface of the primary host machine and the backup host machine, and correspondingly creating a primary virtual machine on the primary host machine and a backup virtual machine on the backup host machine, wherein the primary host machine and the backup host machine are two host devices for realizing dual-machine hot standby; A network configuration module, used to call the configuration network interfaces of the primary host machine and the backup host machine respectively, and perform network configuration on the primary virtual machine and the backup virtual machine accordingly; A dual-machine hot standby configuration module, used to call the configuration hot standby interfaces of the primary host machine and the backup host machine respectively, and perform dual-machine hot standby configuration on the primary virtual machine and the backup virtual machine accordingly; as well as The dual-machine hot standby module is used to implement dual-machine hot standby of the primary virtual machine and the standby virtual machine based on the primary virtual machine and the standby virtual machine that have completed network configuration and dual-machine hot standby configuration.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the dual-machine hot standby implementation method based on the virtualization scenario as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for implementing dual-machine hot standby based on a virtualization scenario as described in any one of claims 1 to 7 is implemented.
