CN116016641A - Virtual machine connection method and device, electronic equipment and storage medium - Google Patents
Virtual machine connection method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN116016641A CN116016641A CN202211711819.XA CN202211711819A CN116016641A CN 116016641 A CN116016641 A CN 116016641A CN 202211711819 A CN202211711819 A CN 202211711819A CN 116016641 A CN116016641 A CN 116016641A
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- identifier
- connection
- client
- identified
- 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.)
- Pending
Links
Images
Landscapes
- Computer And Data Communications (AREA)
Abstract
本申请实施例公开了一种虚拟机的连接方法、装置、电子设备及存储介质,包括:获取客户端的远程桌面协议的连接请求;将连接请求发送至第一标识的虚拟机,建立客户端与第一标识的虚拟机之间的连接,以通过客户端显示第一标识的虚拟机的远程桌面;在与第一标识的虚拟机连接中断的情况下,获取第二标识的虚拟机的连接信息;其中,第一标识的虚拟机中存储的数据与第二标识的虚拟机中存储的数据相对应;基于连接信息,将连接请求发送至第二标识的虚拟机,建立客户端与第二标识的虚拟机之间的连接,以使得客户端通过访问第二标识的虚拟机中存储的数据,显示第一标识的虚拟机的远程桌面。
The embodiment of the present application discloses a virtual machine connection method, device, electronic device, and storage medium, including: obtaining a client remote desktop protocol connection request; sending the connection request to the first identified virtual machine, and establishing the client and A connection between the first identified virtual machine, to display the remote desktop of the first identified virtual machine through the client; when the connection with the first identified virtual machine is interrupted, obtain the connection information of the second identified virtual machine ; Wherein, the data stored in the virtual machine of the first identification corresponds to the data stored in the virtual machine of the second identification; based on the connection information, the connection request is sent to the virtual machine of the second identification, and the client and the second identification are established The connection between the virtual machines, so that the client displays the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine.
Description
技术领域technical field
本申请涉及电子设备技术领域,涉及但不限定于一种虚拟机的连接方法及装置、电子设备、存储介质。The present application relates to the technical field of electronic equipment, and relates to but not limited to a virtual machine connection method and device, electronic equipment, and storage media.
背景技术Background technique
相关技术中,通过在宿主服务器上建立虚拟机实现远程桌面。虚拟机的稳定性依赖宿主服务器的稳定性。当宿主服务器出现故障时,虚拟机的远程桌面不可用。可以通过定时为虚拟机制作快照,在宿主服务器恢复后应用快照恢复虚拟机中数据的方法,恢复远程桌面的连接。然而,上述方法需要等待宿主服务器恢复运行,在宿主服务器故障的情况下,虚拟机不可用,客户端断开虚拟机的连接。In the related technology, the remote desktop is implemented by establishing a virtual machine on a host server. The stability of the virtual machine depends on the stability of the host server. When the host server fails, the remote desktop of the virtual machine is unavailable. It is possible to restore the connection of the remote desktop by regularly making snapshots for the virtual machine, and applying the snapshot to recover the data in the virtual machine after the host server recovers. However, the above method needs to wait for the host server to resume operation. In the case of host server failure, the virtual machine is unavailable, and the client disconnects the virtual machine.
发明内容Contents of the invention
本申请实施例提供一种虚拟机的连接方法及装置、电子设备、存储介质。Embodiments of the present application provide a virtual machine connection method and device, electronic equipment, and a storage medium.
本申请实施例的技术方案是这样实现的:The technical scheme of the embodiment of the application is realized in this way:
本申请实施例提供一种虚拟机的连接方法,所述方法包括:获取客户端的远程桌面协议的连接请求;将所述连接请求发送至第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接,以通过所述客户端显示所述第一标识的虚拟机的远程桌面;在与所述第一标识的虚拟机连接中断的情况下,获取第二标识的虚拟机的连接信息;其中,所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应;基于所述连接信息,将所述连接请求发送至所述第二标识的虚拟机,建立所述客户端与所述第二标识的虚拟机之间的连接,以使得所述客户端通过访问所述第二标识的虚拟机中存储的数据,显示所述第一标识的虚拟机的远程桌面。An embodiment of the present application provides a method for connecting a virtual machine, the method comprising: obtaining a remote desktop protocol connection request of a client; sending the connection request to the first identified virtual machine, and establishing the connection between the client and the A connection between the first identified virtual machine, so as to display the remote desktop of the first identified virtual machine through the client; when the connection with the first identified virtual machine is interrupted, obtain a second identification The connection information of the virtual machine; wherein, the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine; based on the connection information, the connection request is sent to The second identified virtual machine establishes a connection between the client and the second identified virtual machine, so that the client accesses the data stored in the second identified virtual machine to display A remote desktop of the first identified virtual machine.
本申请实施例提供一种虚拟机的连接装置,所述装置包括:第一获取模块,用于获取客户端的远程桌面协议的连接请求;第一连接模块,用于将所述连接请求发送至第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接,以通过所述客户端显示所述第一标识的虚拟机的远程桌面;第二获取模块,用于在与所述第一标识的虚拟机连接中断的情况下,获取第二标识的虚拟机的连接信息;其中,所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应;第二连接模块,用于基于所述连接信息,将所述连接请求发送至所述第二标识的虚拟机,建立所述客户端与所述第二标识的虚拟机之间的连接,以使得所述客户端通过访问所述第二标识的虚拟机中存储的数据,显示所述第一标识的虚拟机的远程桌面。An embodiment of the present application provides a connection device for a virtual machine, the device comprising: a first obtaining module, configured to obtain a client remote desktop protocol connection request; a first connection module, configured to send the connection request to the second An identified virtual machine, establishing a connection between the client and the first identified virtual machine, so as to display the remote desktop of the first identified virtual machine through the client; the second obtaining module uses Obtaining connection information of the second identified virtual machine when the connection with the first identified virtual machine is interrupted; wherein, the data stored in the first identified virtual machine is the same as the second identified virtual machine corresponding to the data stored in the machine; the second connection module is configured to send the connection request to the virtual machine of the second identification based on the connection information, and establish a virtual connection between the client and the second identification connection between machines, so that the client displays the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine.
本申请实施例提供一种电子设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述方法中的步骤。An embodiment of the present application provides an electronic device, including a memory and a processor, the memory stores a computer program that can run on the processor, and the processor implements the steps in the above method when executing the program.
本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述方法中的步骤。An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above method are implemented.
本申请实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by the embodiments of the present application at least include:
在本申请实施例中,在与所述第一标识的虚拟机连接中断的情况下,获取第二标识的虚拟机的连接信息;其中,所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应;基于所述连接信息,将所述连接请求发送至所述第二标识的虚拟机,建立所述客户端与所述第二标识的虚拟机之间的连接,以使得所述客户端通过访问所述第二标识的虚拟机中存储的数据,显示所述第一标识的虚拟机的远程桌面。这样,在客户端连接虚拟机时不直接连接,而是通过代理服务设备代理连接。当代理服务设备感知到第一标识的虚拟机故障或网络故障导致不可用时,与第二标识的虚拟机建立连接,替代第一标识的虚拟机,使得代理服务设备替换与虚拟机连接,但是不断开与客户端的连接,实现客户端对虚拟机的切换无感知。In this embodiment of the present application, when the connection with the first identified virtual machine is interrupted, the connection information of the second identified virtual machine is acquired; wherein, the data stored in the first identified virtual machine is the same as the corresponding to the data stored in the second identified virtual machine; based on the connection information, send the connection request to the second identified virtual machine, and establish the connection between the client and the second identified virtual machine connection, so that the client displays the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine. In this way, when the client connects to the virtual machine, it does not connect directly, but connects through a proxy service device. When the proxy service device perceives that the first identified virtual machine is faulty or the network is unavailable, it establishes a connection with the second identified virtual machine to replace the first identified virtual machine, so that the proxy service device replaces the connection with the virtual machine, but keeps Open the connection with the client, so that the client is not aware of the switching of the virtual machine.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图,其中:In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative work, wherein:
图1为本申请实施例提供的一种虚拟机的连接方法的流程示意图;FIG. 1 is a schematic flowchart of a method for connecting a virtual machine provided in an embodiment of the present application;
图2为本申请实施例提供的一种虚拟机的连接方法的流程示意图;FIG. 2 is a schematic flowchart of a method for connecting a virtual machine provided in an embodiment of the present application;
图3为本申请实施例提供的一种虚拟机的连接方法的流程示意图;FIG. 3 is a schematic flowchart of a method for connecting a virtual machine provided in an embodiment of the present application;
图4为本申请实施例提供的一种虚拟机的连接方法的流程示意图;FIG. 4 is a schematic flowchart of a method for connecting a virtual machine provided in an embodiment of the present application;
图5为本申请实施例提供的一种虚拟机的连接装置的组成结构示意图;FIG. 5 is a schematic diagram of the composition and structure of a connection device for a virtual machine provided in an embodiment of the present application;
图6为本申请实施例提供的一种电子设备的硬件实体示意图。FIG. 6 is a schematic diagram of a hardware entity of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。以下实施例用于说明本申请,但不用来限制本申请的范围。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments It is a part of the embodiments of this application, not all of them. The following examples are used to illustrate the present application, but not to limit the scope of the present application. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。In the following description, references to "some embodiments" describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or a different subset of all possible embodiments, and Can be combined with each other without conflict.
需要指出,本申请实施例所涉及的术语“第一\第二\第三”仅仅是是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。It should be pointed out that the term "first\second\third" involved in the embodiment of the present application is only to distinguish similar objects, and does not represent a specific ordering of objects. Understandably, "first\second\third Where permitted, the specific order or sequence may be interchanged such that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein.
本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本申请实施例所属领域中的普通技术人员的一般理解相同的意义。还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非像这里一样被特定定义,否则不会用理想化或过于正式的含义来解释。Those skilled in the art can understand that unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those of ordinary skill in the art to which the embodiments of the present application belong. It should also be understood that terms, such as those defined in commonly used dictionaries, should be understood to have meanings consistent with their meaning in the context of the prior art, and unless specifically defined as herein, are not intended to be idealized or overly Formal meaning to explain.
为帮助理解本申请实施例的技术方案,下面对本申请实施例中涉及到的概念进行介绍:In order to help understand the technical solutions of the embodiments of the present application, the following introduces the concepts involved in the embodiments of the present application:
网络文件系统(NFS,Network File System)是一种目录共享机制,挂载相同的文件目录的不同虚拟机,通过对网络文件系统的支持,可以在虚拟机上像操作本地分区一样对共享分区(目录)进行操作。Network File System (NFS, Network File System) is a directory sharing mechanism. Different virtual machines that mount the same file directory, through the support of the network file system, can operate the shared partition on the virtual machine like a local partition ( directory) to operate.
为了解决上述问题,本申请提供了一种虚拟机的连接方法,应用于代理服务设备,图1为本申请实施例提供的一种虚拟机的连接方法的流程示意图,如图1所示,所述方法至少包括以下步骤:In order to solve the above problems, this application provides a virtual machine connection method, which is applied to proxy service equipment. Figure 1 is a schematic flow diagram of a virtual machine connection method provided by an embodiment of this application. As shown in Figure 1, the Said method comprises the following steps at least:
步骤S101,获取客户端的远程桌面协议的连接请求;Step S101, obtaining the connection request of the remote desktop protocol of the client;
这里,所述代理服务设备至少可以为以下之一:网关(Gateway)和后台服务(Backend Service)。这里,所述网关能够实现代理连接的功能。在实现代理连接的过程中,当网关检测到客户端连接的虚拟机不可用时,将建立另一虚拟机与客户端的连接。这样,可以降低异常访问的概率。在实现后台服务的过程中,代理服务设备至少可以实现以下功能之一:检测虚拟机的运行状态、控制虚拟机的开关机和修改虚拟机的标识。Here, the proxy service device can be at least one of the following: a gateway (Gateway) and a background service (Backend Service). Here, the gateway can implement the function of proxy connection. In the process of realizing the proxy connection, when the gateway detects that the virtual machine connected by the client is unavailable, it will establish another connection between the virtual machine and the client. In this way, the probability of abnormal access can be reduced. In the process of realizing the background service, the proxy service device can at least realize one of the following functions: detecting the running state of the virtual machine, controlling the virtual machine's power on and off, and modifying the identity of the virtual machine.
这里,所述客户端通过远程桌面协议(Remote Desktop Protocol,RDP)访问虚拟机,在客户端显示虚拟机的远程桌面。Here, the client accesses the virtual machine through the Remote Desktop Protocol (Remote Desktop Protocol, RDP), and displays the remote desktop of the virtual machine on the client.
步骤S102,将所述连接请求发送至第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接,以通过所述客户端显示所述第一标识的虚拟机的远程桌面;Step S102, sending the connection request to the first identified virtual machine, establishing a connection between the client and the first identified virtual machine, so as to display the first identified virtual machine through the client machine's remote desktop;
这里,所述第一标识的虚拟机可以为使用网络文件系统(NFS)磁盘创建的,另一虚拟机使用相同的NFS磁盘,可以挂载相同的文件目录,以使得所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应。Here, the first identified virtual machine can be created using a network file system (NFS) disk, and another virtual machine can use the same NFS disk to mount the same file directory, so that the first identified virtual machine The data stored in the virtual machine corresponds to the data stored in the second identified virtual machine.
步骤S103,在与所述第一标识的虚拟机连接中断的情况下,获取第二标识的虚拟机的连接信息;其中,所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应;Step S103, when the connection with the first identified virtual machine is interrupted, obtain the connection information of the second identified virtual machine; wherein, the data stored in the first identified virtual machine is the same as the second identified virtual machine corresponding to the data stored in the virtual machine;
这里,所述第二标识的虚拟机可以为多台宿主服务器的虚拟机,也可以为一台宿主服务器中的多个虚拟机。Here, the second identified virtual machine may be a virtual machine of multiple host servers, or may be multiple virtual machines in one host server.
在虚拟机故障的情况下,可以使用一台宿主服务器中的另一个虚拟机与客户端连接。在宿主服务器故障的情况下,可以使用另一台宿主服务器中的虚拟机与客户端建立连接。In the event of a virtual machine failure, another virtual machine on one host server can be used to connect to the client. In the event of a host server failure, a virtual machine on another host server can be used to establish a connection to the client.
这里,所述连接信息可以为第二标识的虚拟机的网际协议(IP)地址。这里,当代理服务设备感知到与第一标识的虚拟机的连接中断时,查询第二标识的虚拟机的连接信息,与第二标识的虚拟机建立连接,继续为客户端提供服务。这里,可以为通过客户端与代理服务设备的网关与第一标识的虚拟机建立远程桌面连接。Here, the connection information may be an Internet Protocol (IP) address of the second identified virtual machine. Here, when the proxy service device senses that the connection with the first-identified virtual machine is interrupted, it queries the connection information of the second-identified virtual machine, establishes a connection with the second-identified virtual machine, and continues to provide services for the client. Here, a remote desktop connection may be established with the first identified virtual machine through a gateway between the client and the proxy service device.
步骤S104,基于所述连接信息,将所述连接请求发送至所述第二标识的虚拟机,建立所述客户端与所述第二标识的虚拟机之间的连接,以使得所述客户端通过访问所述第二标识的虚拟机中存储的数据,显示所述第一标识的虚拟机的远程桌面。Step S104, based on the connection information, send the connection request to the second identified virtual machine, and establish a connection between the client and the second identified virtual machine, so that the client By accessing the data stored in the second identified virtual machine, the remote desktop of the first identified virtual machine is displayed.
在上述实施例中,在与所述第一标识的虚拟机连接中断的情况下,获取第二标识的虚拟机的连接信息;其中,所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应;基于所述连接信息,将所述连接请求发送至所述第二标识的虚拟机,建立所述客户端与所述第二标识的虚拟机之间的连接,以使得所述客户端通过访问所述第二标识的虚拟机中存储的数据,显示所述第一标识的虚拟机的远程桌面。这样,在客户端连接虚拟机时不直接连接,而是通过代理服务设备代理连接。当代理服务设备感知到第一标识的虚拟机故障或网络故障导致不可用时,与第二标识的虚拟机建立连接,替代第一标识的虚拟机,使得代理服务设备替换与虚拟机连接,但是不断开与客户端的连接,实现客户端对虚拟机的切换无感知。In the above embodiment, when the connection with the first identified virtual machine is interrupted, the connection information of the second identified virtual machine is obtained; wherein, the data stored in the first identified virtual machine is the same as the Corresponding to the data stored in the second identified virtual machine; based on the connection information, sending the connection request to the second identified virtual machine, establishing a connection between the client and the second identified virtual machine connection, so that the client displays the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine. In this way, when the client connects to the virtual machine, it does not connect directly, but connects through a proxy service device. When the proxy service device perceives that the first identified virtual machine is faulty or the network is unavailable, it establishes a connection with the second identified virtual machine to replace the first identified virtual machine, so that the proxy service device replaces the connection with the virtual machine, but keeps Open the connection with the client, so that the client is not aware of the switching of the virtual machine.
本申请提供了一种虚拟机的连接方法,应用于代理服务设备,图2为本申请实施例提供的一种虚拟机的连接方法的流程示意图,如图2所示,所述方法至少包括以下步骤:The present application provides a method for connecting a virtual machine, which is applied to a proxy service device. FIG. 2 is a schematic flowchart of a method for connecting a virtual machine provided in an embodiment of the present application. As shown in FIG. 2 , the method at least includes the following step:
步骤S201,获取客户端的远程桌面协议的连接请求;Step S201, obtaining the connection request of the remote desktop protocol of the client;
步骤S202,将所述连接请求发送至第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接,以通过所述客户端显示所述第一标识的虚拟机的远程桌面;Step S202, sending the connection request to the first identified virtual machine, establishing a connection between the client and the first identified virtual machine, so as to display the first identified virtual machine through the client machine's remote desktop;
步骤S203,在与所述第一标识的虚拟机连接中断的情况下,获取第二标识的虚拟机的连接信息;其中,所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应;Step S203, when the connection with the first identified virtual machine is interrupted, obtain the connection information of the second identified virtual machine; wherein, the data stored in the first identified virtual machine is the same as the second identified virtual machine corresponding to the data stored in the virtual machine;
在一种可以实现的方式中,所述第一标识的虚拟机所在的宿主服务器与所述第二标识的虚拟机所在的宿主服务器不同;In a practicable manner, the host server where the first identified virtual machine resides is different from the host server where the second identified virtual machine resides;
所述第一标识的虚拟机与所述第二标识的虚拟机通过网络文件系统挂载相同的文件目录,以使得所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应。The first identified virtual machine and the second identified virtual machine mount the same file directory through the network file system, so that the data stored in the first identified virtual machine and the second identified virtual machine corresponding to the data stored in the machine.
这里,所述第二标识的虚拟机可以为:在另一个宿主服务器使用与所述第一标识的虚拟机相同的镜像创建的。这里,所述第二标识的虚拟机挂载所述第一标识的虚拟机的NFS磁盘。这里,创建成功后让第二标识的虚拟机处于休眠状态以节约资源。这里,所述宿主服务器可以为用于存储数据的数据中心。Here, the second identified virtual machine may be: created on another host server using the same image as the first identified virtual machine. Here, the second identified virtual machine mounts the NFS disk of the first identified virtual machine. Here, after the creation is successful, the second-identified virtual machine is placed in a dormant state to save resources. Here, the host server may be a data center for storing data.
这里,第二标识的虚拟机在处于休眠状态时不占用CPU和内存资源,只会在磁盘上建立内存镜像。示例性地,按照10%故障率计算,一台8核16G内存的宿主服务器可以为20台4核8G的虚拟机做备份。备份期间需要占用160G的磁盘空间。Here, the second-identified virtual machine does not occupy CPU and memory resources when it is in a dormant state, and only creates a memory image on the disk. For example, based on a 10% failure rate calculation, a host server with 8 cores and 16G memory can back up 20 virtual machines with 4 cores and 8G memory. 160G of disk space is required during backup.
在上述实施例中,一方面,所述第一标识的虚拟机所在的宿主服务器与所述第二标识的虚拟机所在的宿主服务器不同。这样,第一标识的虚拟机的宿主服务器故障不会影响到第二标识的虚拟机,不需要等待第一标识虚拟机所在的宿主服务器故障恢复就可以继续使用。另一方面,所述第一标识的虚拟机与所述第二标识的虚拟机通过网络文件系统挂载相同的文件目录,以使得所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应。这样。通过网络文件系统挂载相同的文件目录,保证数据一致性。In the foregoing embodiment, on the one hand, the host server where the first identified virtual machine resides is different from the host server where the second identified virtual machine resides. In this way, the failure of the host server of the first-identified virtual machine will not affect the second-identified virtual machine, and the virtual machine can continue to be used without waiting for the recovery of the failure of the host server where the first-identified virtual machine is located. On the other hand, the first identified virtual machine and the second identified virtual machine mount the same file directory through the network file system, so that the data stored in the first identified virtual machine is the same as the second identified virtual machine Corresponds to the data stored in the two identified virtual machines. so. Mount the same file directory through the network file system to ensure data consistency.
步骤S204,基于所述连接信息,将所述连接请求发送至所述第二标识的虚拟机,建立所述客户端与所述第二标识的虚拟机之间的连接,以使得所述客户端通过访问所述第二标识的虚拟机中存储的数据,显示所述第一标识的虚拟机的远程桌面。Step S204, based on the connection information, send the connection request to the second identified virtual machine, and establish a connection between the client and the second identified virtual machine, so that the client By accessing the data stored in the second identified virtual machine, the remote desktop of the first identified virtual machine is displayed.
在一种可以实现的方式中,在所述步骤S202,建立所述客户端与所述第一标识的虚拟机之间的连接之后,所述方法还包括:获取所述第一标识的虚拟机的输入输出事件流;将所述输入输出事件流应用到所述第二标识的虚拟机,使得所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应。In a practicable manner, after the step S202, after establishing the connection between the client and the first identified virtual machine, the method further includes: acquiring the first identified virtual machine an input-output event stream; applying the input-output event stream to the second identified virtual machine, so that the data stored in the first identified virtual machine is the same as the data stored in the second identified virtual machine Corresponding.
这里,所述将所述输入输出事件流应用到所述第二标识的虚拟机,包括:将所述输入输出事件流转发至所述第二标识的虚拟机的宿主服务器,以通过所述第二标识的虚拟机的宿主服务器将所述输入输出事件流应用到所述第二标识的虚拟机,使得所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相同。Here, the applying the input-output event flow to the second identified virtual machine includes: forwarding the input-output event flow to the host server of the second identified virtual machine, so as to pass the second identified virtual machine The host server of the second identified virtual machine applies the input and output event stream to the second identified virtual machine, so that the data stored in the first identified virtual machine is different from the data stored in the second identified virtual machine data are the same.
在一种可以实现的方式中,在所述步骤S202,在所述建立所述客户端与所述第一标识的虚拟机之间的连接之后,所述方法还包括:按照预设时长检测所述第一标识的虚拟机的运行状态;在检测到所述第一标识的虚拟机的运行状态异常的情况下,确定与所述第一标识的虚拟机连接中断。In a practicable manner, in the step S202, after the connection between the client and the first identified virtual machine is established, the method further includes: detecting the The running state of the virtual machine identified by the first identification; when it is detected that the operating state of the virtual machine identified by the first identification is abnormal, it is determined that the connection with the virtual machine identified by the first identification is interrupted.
在上述实施例中,一方面,获取所述第一标识的虚拟机的输入输出事件流;将所述输入输出事件流应用到所述第二标识的虚拟机,使得所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应。这样,能够实时同步不同虚拟机之间的数据,提高数据一致性。另一方面,按照预设时长检测所述第一标识的虚拟机的运行状态;在检测到所述第一标识的虚拟机的运行状态异常的情况下,确定与所述第一标识的虚拟机连接中断。这样,通过定时检测第一标识的虚拟机的运行状态,能够及时确定因为虚拟机异常产生的连接中断问题。In the above embodiment, on the one hand, the input and output event flow of the first identified virtual machine is acquired; the input and output event flow is applied to the second identified virtual machine, so that the first identified virtual machine The data stored in the virtual machine corresponds to the data stored in the second identified virtual machine. In this way, data between different virtual machines can be synchronized in real time, improving data consistency. On the other hand, detecting the running state of the first identified virtual machine according to a preset duration; Connection lost. In this way, by periodically detecting the running state of the first identified virtual machine, it is possible to timely determine the connection interruption problem caused by the abnormality of the virtual machine.
本申请提供了一种虚拟机的连接方法,应用于代理服务设备,图3为本申请实施例提供的一种虚拟机的连接方法的流程示意图,如图3所示,所述方法至少包括以下步骤:The present application provides a method for connecting a virtual machine, which is applied to a proxy service device. FIG. 3 is a schematic flowchart of a method for connecting a virtual machine provided in an embodiment of the present application. As shown in FIG. 3 , the method at least includes the following step:
步骤S301,获取客户端的远程桌面协议的连接请求;Step S301, obtaining the connection request of the remote desktop protocol of the client;
步骤S302,将所述连接请求发送至第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接,以通过所述客户端显示所述第一标识的虚拟机的远程桌面;Step S302, sending the connection request to the first identified virtual machine, establishing a connection between the client and the first identified virtual machine, so as to display the first identified virtual machine through the client machine's remote desktop;
步骤S303,在与所述第一标识的虚拟机连接中断的情况下,控制所述第二标识的虚拟机开机,获取所述第二标识的虚拟机的连接信息,将所述虚拟机的标识从第二标识改为第一标识,以在再次获取客户端的远程桌面协议的连接请求的情况下,将所述连接请求发送至修改标识后的第一标识的虚拟机;其中,所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应;Step S303, when the connection with the virtual machine with the first identification is interrupted, control the virtual machine with the second identification to start up, obtain the connection information of the virtual machine with the second identification, and set the identification of the virtual machine to Change from the second identification to the first identification, so that when the connection request of the remote desktop protocol of the client is obtained again, the connection request is sent to the virtual machine with the modified identification of the first identification; wherein, the first The data stored in the identified virtual machine corresponds to the data stored in the second identified virtual machine;
步骤S304,基于所述连接信息,将所述连接请求发送至所述第二标识的虚拟机,建立所述客户端与所述第二标识的虚拟机之间的连接,以使得所述客户端通过访问所述第二标识的虚拟机中存储的数据,显示所述第一标识的虚拟机的远程桌面。Step S304, based on the connection information, send the connection request to the second identified virtual machine, and establish a connection between the client and the second identified virtual machine, so that the client By accessing the data stored in the second identified virtual machine, the remote desktop of the first identified virtual machine is displayed.
在一种可以实现的方式中,所述方法还包括:获取从所述第二标识改为第一标识的虚拟机的连接信息;基于所述连接信息,将所述连接请求发送至从第二标识修改为第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接,以通过所述客户端显示所述第一标识的虚拟机的远程桌面。In a practicable manner, the method further includes: acquiring connection information of the virtual machine whose identity is changed from the second identity to the first identity; based on the connection information, sending the connection request to the virtual machine from the second The identification is changed to the virtual machine with the first identification, and a connection between the client and the virtual machine with the first identification is established, so as to display the remote desktop of the virtual machine with the first identification through the client.
这里,可以将虚拟机的标识从第二标识修改为第一标识,实现与第一标识虚拟机建立连接。通过修改虚拟机的标识,在建立客户端与虚拟机连接过程中,首先与客户端连接的虚拟机,在所述虚拟机运行状态异常的情况下,将另一虚拟机作为首先与客户端连接的虚拟机。Here, the identifier of the virtual machine may be changed from the second identifier to the first identifier, so as to establish a connection with the virtual machine with the first identifier. By modifying the identity of the virtual machine, in the process of establishing a connection between the client and the virtual machine, the virtual machine that is first connected to the client, in the case of an abnormal running state of the virtual machine, uses another virtual machine as the first to connect to the client virtual machine.
在一种可以实现的方式中,在所述将所述连接请求发送至从第二标识修改为第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接之5后,所述方法还包括:获取所述从第二标识修改为第一标识的虚拟机的输入输In a practicable manner, when the connection request is sent to the virtual machine whose identity is changed from the second identity to the virtual machine with the first identity, the connection between the client and the virtual machine with the first identity is established Afterwards, the method further includes: acquiring the input input of the virtual machine modified from the second identifier to the first identifier
出事件流;在检测到所述运行状态异常的虚拟机恢复正常的情况下,将所述虚拟机的标识从第一标识改为第二标识,并将所述输入输出事件流应用在所述从第一标识修改为第二标识的虚拟机中;将所述从第一标识修改为第二标识的虚output event flow; when it is detected that the virtual machine with an abnormal running state returns to normal, change the identification of the virtual machine from the first identification to the second identification, and apply the input and output event flow to the In the virtual machine modified from the first identification to the second identification; the virtual machine modified from the first identification to the second identification
拟机的运行状态从开机状态修改为休眠状态,以在与所述从第二标识修改为第0一标识的虚拟机连接中断的情况下,建立所述客户端与所述从第一标识修改为第二标识的虚拟机之间的连接。The operating state of the virtual machine is changed from the power-on state to the dormant state, so that when the connection with the virtual machine whose identity is changed from the second identity to the 0th first identity is interrupted, the client and the virtual machine whose identity is changed from the first identity are established. for the connection between the virtual machines identified by the second.
这里,第二标识的虚拟机将内存输入输出事件流发送到代理服务设备。当代理服务设备感知到第一标识的虚拟机恢复时,将第一标识的虚拟机的标识改Here, the second identified virtual machine sends the memory input and output event stream to the proxy service device. When the proxy service device senses that the virtual machine with the first identification is restored, it changes the identification of the virtual machine with the first identification to
为第二标识,应用故障期间第二标识虚拟机发送的输入输出事件流,然后让第5一标识的虚拟机休眠。For the second identification, apply the I/O event flow sent by the virtual machine of the second identification during the failure period, and then make the virtual machine of the fifth identification dormant.
在上述实施例中,将所述从第一标识修改为第二标识的虚拟机的运行状态从开机状态修改为休眠状态,以在与所述从第二标识修改为第一标识的虚拟机连接中断的情况下,建立所述客户端与所述从第一标识修改为第二标识的虚拟In the above embodiment, the running state of the virtual machine whose identity is changed from the first identity to the second identity is changed from the power-on state to the dormant state, so as to connect to the virtual machine whose identity is changed from the second identity to the first identity. In case of interruption, establish the client and the virtual ID modified from the first ID to the second ID
机之间的连接。这样,虚拟机处于休眠状态只占用硬盘资源,成本可控。并且,0第二标识的虚拟机可以短时间从休眠状态开机,代理服务设备自动切换到第二标识的虚拟机,使用过程中感知不到故障。connection between machines. In this way, when the virtual machine is in a dormant state, only hard disk resources are occupied, and the cost is controllable. In addition, the virtual machine with the second identification can be powered on from the dormant state for a short time, and the proxy service device automatically switches to the virtual machine with the second identification, and no fault can be sensed during use.
通过在宿主服务器上建立虚拟机实现远程桌面。虚拟机的稳定性依赖宿主服务器的稳定性。当宿主服务器出现故障时,虚拟机的远程桌面不可用。可以5通过定时为虚拟机制作快照,在宿主服务器恢复后应用快照恢复虚拟机中数据的方法,恢复远程桌面的连接。然而,上述方法需要等待宿主服务器恢复运行,在宿主服务器故障的情况下,虚拟机不可用;并且,为虚拟机制作快照时,快照制作时间点之后的虚拟机数据会丢失,发生远程桌面使用故障的问题。Realize remote desktop by establishing a virtual machine on the host server. The stability of the virtual machine depends on the stability of the host server. When the host server fails, the remote desktop of the virtual machine is unavailable. It is possible to restore the connection of the remote desktop by regularly making snapshots for the virtual machine, and applying the snapshot to restore the data in the virtual machine after the host server recovers. However, the above method needs to wait for the host server to resume operation. In the case of a host server failure, the virtual machine is unavailable; and, when making a snapshot for the virtual machine, the data of the virtual machine after the snapshot creation time point will be lost, and remote desktop failures will occur. The problem.
为了解决上述问题,本申请提供了一种虚拟机的连接方法,图4为本申请实施例提供的一种虚拟机的连接方法的流程示意图,如图4所示,所述方法至少包括以下步骤:In order to solve the above problems, the present application provides a method for connecting a virtual machine. FIG. 4 is a schematic flowchart of a method for connecting a virtual machine provided in an embodiment of the present application. As shown in FIG. 4 , the method includes at least the following steps :
步骤S401,创建第一标识的虚拟机41。Step S401, creating a first identified virtual machine 41.
这里,所述第一标识的虚拟机是使用网络文件系统(NFS)45磁盘创建的。Here, the first identified virtual machine is created using a Network File System (NFS) 45 disk.
步骤S402,创建第二标识的虚拟机42。Step S402, creating a second identified virtual machine 42.
这里,所述第二标识的虚拟机可以为:在另一个宿主服务器使用与所述第一标识的虚拟机相同的镜像创建的。这里,所述第二标识的虚拟机挂载所述第一标识的虚拟机的NFS磁盘。这里,创建成功后让第二标识的虚拟机处于休眠状态以节约资源。这里,所述宿主服务器可以为数据中心。Here, the second identified virtual machine may be: created on another host server using the same image as the first identified virtual machine. Here, the second identified virtual machine mounts the NFS disk of the first identified virtual machine. Here, after the creation is successful, the second-identified virtual machine is placed in a dormant state to save resources. Here, the host server may be a data center.
步骤S403,第一标识的虚拟机41将输入输出事件流发送到代理服务设备43中。Step S403 , the first identified virtual machine 41 sends the input/output event stream to the proxy service device 43 .
这里,所述步骤S403可以在第一标识的虚拟机处于开机状态的情况下执行。这里,所述输入输出事件流可以为存储在内存的事件流。这里,所述代理服务设备可以包括:网关431(Gateway)+后台服务432(Backend Service),所述代理服务设备,可以实现网关的代理功能和/或后台服务的功能。Here, the step S403 may be performed when the first identified virtual machine is in a power-on state. Here, the input and output event stream may be an event stream stored in memory. Here, the proxy service device can include: gateway 431 (Gateway)+backend service 432 (Backend Service), the proxy service device can realize the proxy function of the gateway and/or the function of the background service.
步骤S404,代理服务设备43将输入输出事件流转发给第二标识的虚拟机42所在的宿主服务器;第二标识的虚拟机所在的宿主服务器将输入输出事件流应用到第二标识的虚拟机。Step S404, the proxy service device 43 forwards the I/O event stream to the host server where the second identified virtual machine 42 is located; the host server where the second identified virtual machine is located applies the input/output event stream to the second identified virtual machine.
步骤S405,代理服务设备定时检测第一标识的虚拟机的健康状况,当感知到第一标识的虚拟机不可用时,将第二标识的虚拟机开机,并改为第一标识。In step S405, the proxy service device periodically detects the health status of the first-identified virtual machine, and when it senses that the first-identified virtual machine is unavailable, starts the second-identified virtual machine and changes it to the first-identified virtual machine.
这里,定时探测第一标识的虚拟机的健康状况可以通过代理服务设备中的后台服务实现。Here, periodically detecting the health status of the first identified virtual machine may be implemented through a background service in the proxy service device.
步骤S406,客户端44通过代理服务设备43与第一标识的虚拟机41建立远程桌面连接。当代理服务设备43感知到与第一标识的虚拟机41的连接中断时,查询第二标识的虚拟机42的连接信息,与第二标识的虚拟机42建立连接,继续为客户端44提供服务。Step S406 , the client 44 establishes a remote desktop connection with the first identified virtual machine 41 through the proxy service device 43 . When the proxy service device 43 perceives that the connection with the virtual machine 41 of the first identification is interrupted, it queries the connection information of the virtual machine 42 of the second identification, establishes a connection with the virtual machine 42 of the second identification, and continues to provide services for the client 44 .
这里,可以为通过客户端与代理服务设备的网关431与第一标识的虚拟机建立远程桌面连接。这里,所述连接信息可以为第二标识的虚拟机的网际协议(IP)地址。Here, a remote desktop connection may be established with the first identified virtual machine through the gateway 431 of the client and proxy service device. Here, the connection information may be an Internet Protocol (IP) address of the second identified virtual machine.
步骤S407,第二标识的虚拟机将内存输入输出事件流发送到代理服务设备。当代理服务设备感知到第一标识的虚拟机恢复时,将第一标识的虚拟机的标识改为第二标识,应用故障期间第二标识虚拟机发送的输入输出事件流,然后让第一标识的虚拟机休眠。Step S407, the second identified virtual machine sends the memory input and output event stream to the proxy service device. When the proxy service device perceives that the virtual machine with the first identification is restored, it changes the identification of the virtual machine with the first identification to the second identification, applies the input and output event flow sent by the virtual machine with the second identification during the failure period, and then lets the first identification The virtual machine hibernates.
这里,第二标识的虚拟机在处于休眠状态时不占用CPU和内存资源,只会在磁盘上建立内存镜像。示例性地,按照10%故障率计算,一台8核16G内存的宿主服务器可以为20台4核8G的虚拟机做备份。备份期间需要占用160G的磁盘空间。Here, the second-identified virtual machine does not occupy CPU and memory resources when it is in a dormant state, and only creates a memory image on the disk. For example, based on a 10% failure rate calculation, a host server with 8 cores and 16G memory can back up 20 virtual machines with 4 cores and 8G memory. 160G of disk space is required during backup.
在上述实施例中,一方面,创建第二标识的虚拟机,在另一个宿主服务器使用与所述第一标识的虚拟机相同的镜像创建的,第二标识的虚拟机挂载所述第一标识的虚拟机的NFS磁盘。这样,通过nfs挂载相同磁盘,保证磁盘数据一致。第二标识的虚拟机可以实时同步第一标识的虚拟机的内存数据到第二标识的虚拟机,内存使用实时数据流同步,避免了用户丢失数据。此外,第一标识和第二标识的虚拟机不在同一个宿主服务器,第一标识的虚拟机的宿主服务器故障不会影响到第二标识的虚拟机,不需要等待第一标识虚拟机所在的宿主服务器故障恢复就可以继续使用。In the above-mentioned embodiment, on the one hand, the second-identified virtual machine is created, which is created on another host server using the same image as the first-identified virtual machine, and the second-identified virtual machine mounts the first The NFS disk of the identified virtual machine. In this way, the same disk is mounted through nfs to ensure that the disk data is consistent. The second-identified virtual machine can synchronize the memory data of the first-identified virtual machine to the second-identified virtual machine in real time, and the memory is synchronized using real-time data streams, which prevents users from losing data. In addition, the virtual machine with the first identification and the second identification are not in the same host server, the failure of the host server of the virtual machine with the first identification will not affect the virtual machine with the second identification, and there is no need to wait for the host server where the virtual machine with the first identification is located. Server failure recovery can continue to use.
另一方面,客户端通过代理服务设备与第一标识的虚拟机建立远程桌面连接。这样,在连接虚拟机时不直接连接,而是通过代理服务设备代理连接。当代理服务设备感知到第一标识的虚拟机故障或网络故障导致不可用时,与第二标识的虚拟机建立连接,替代第一标识的虚拟机,使得代理服务设备替换与虚拟机连接,但是不断开与客户端的连接,实现客户端对虚拟机的切换无感知。On the other hand, the client establishes a remote desktop connection with the first identified virtual machine through the proxy service device. In this way, when connecting to the virtual machine, the virtual machine is not directly connected, but is connected through a proxy service device. When the proxy service device perceives that the first identified virtual machine is faulty or the network is unavailable, it establishes a connection with the second identified virtual machine to replace the first identified virtual machine, so that the proxy service device replaces the connection with the virtual machine, but keeps Open the connection with the client, so that the client is not aware of the switching of the virtual machine.
再一方面,第二标识的虚拟机可以短时间从休眠状态开机,代理服务设备自动切换到第二标识的虚拟机,使用过程中感知不到故障。此外,第二标识的虚拟机处于休眠状态只占用硬盘资源,成本可控。On the other hand, the virtual machine with the second identifier can be turned on from the dormant state for a short time, and the proxy service device automatically switches to the virtual machine with the second identifier, and no fault is detected during use. In addition, the virtual machine of the second identification only occupies hard disk resources in a dormant state, and the cost is controllable.
基于前述的实施例,本申请实施例再提供一种虚拟机的连接装置,所述控制装置包括所包括的各模块,可以通过电子设备中的处理器来实现;当然也可通过具体的逻辑电路实现;在实施的过程中,处理器可以为中央处理器(Central Processing Unit,CPU)、微处理器(Micro Processing Unit,MPU)、数字信号处理器(Digital Signal Processor,DSP)或现场可编程门阵列(Field Programmable Gate Array,FPGA)等。Based on the foregoing embodiments, this embodiment of the present application further provides a connection device for a virtual machine, the control device includes various modules included, which can be implemented by a processor in an electronic device; of course, it can also be implemented by a specific logic circuit Implementation; in the process of implementation, the processor can be a central processing unit (Central Processing Unit, CPU), a microprocessor (Micro Processing Unit, MPU), a digital signal processor (Digital Signal Processor, DSP) or a field programmable gate Array (Field Programmable Gate Array, FPGA), etc.
图5为本申请实施例提供的一种虚拟机的连接装置的组成结构示意图,如图5所示,所述装置500包括第一获取模块501、第一连接模块502、第二获取模块503和第二连接模块504,其中:FIG. 5 is a schematic diagram of the composition and structure of a virtual machine connection device provided in an embodiment of the present application. As shown in FIG. The second connection module 504, wherein:
第一获取模块501,用于获取客户端的远程桌面协议的连接请求;The first acquiring module 501 is configured to acquire the connection request of the remote desktop protocol of the client;
第一连接模块502,用于将所述连接请求发送至第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接,以通过所述客户端显示所述第一标识的虚拟机的远程桌面;The first connection module 502 is configured to send the connection request to the first identified virtual machine, establish a connection between the client and the first identified virtual machine, and display the a remote desktop of the first identified virtual machine;
第二获取模块503,用于在与所述第一标识的虚拟机连接中断的情况下,获取第二标识的虚拟机的连接信息;其中,所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应;The second acquiring module 503 is configured to acquire the connection information of the second identified virtual machine when the connection with the first identified virtual machine is interrupted; wherein, the data stored in the first identified virtual machine is the same as Corresponding to the data stored in the second identified virtual machine;
第二连接模块504,用于基于所述连接信息,将所述连接请求发送至所述第二标识的虚拟机,建立所述客户端与所述第二标识的虚拟机之间的连接,以使得所述客户端通过访问所述第二标识的虚拟机中存储的数据,显示所述第一标识的虚拟机的远程桌面。The second connection module 504 is configured to send the connection request to the second identified virtual machine based on the connection information, and establish a connection between the client and the second identified virtual machine, to enabling the client to display the remote desktop of the first identified virtual machine by accessing the data stored in the second identified virtual machine.
在一种可以实现的方式中,所述第一标识的虚拟机所在的宿主服务器与所述第二标识的虚拟机所在的宿主服务器不同;所述第一标识的虚拟机与所述第二标识的虚拟机通过网络文件系统挂载相同的文件目录,以使得所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应。In a manner that can be implemented, the host server where the first identified virtual machine is located is different from the host server where the second identified virtual machine is located; the first identified virtual machine is different from the second identified virtual machine mount the same file directory through the network file system, so that the data stored in the first identified virtual machine corresponds to the data stored in the second identified virtual machine.
在一种可以实现的方式中,所述装置500还包括:第三获取模块,用于获取所述第一标识的虚拟机的输入输出事件流;第一处理模块,用于将所述输入输出事件流应用到所述第二标识的虚拟机,使得所述第一标识的虚拟机中存储的数据与所述第二标识的虚拟机中存储的数据相对应。In a practicable manner, the apparatus 500 further includes: a third acquisition module, configured to acquire the input and output event stream of the first identified virtual machine; a first processing module, configured to convert the input and output An event stream is applied to the second identified virtual machine such that data stored in the first identified virtual machine corresponds to data stored in the second identified virtual machine.
在一种可以实现的方式中,所述装置500还包括:检测模块,用于按照预设时长检测所述第一标识的虚拟机的运行状态;确定模块,用于在检测到所述第一标识的虚拟机的运行状态异常的情况下,确定与所述第一标识的虚拟机连接中断。In a practicable manner, the apparatus 500 further includes: a detection module, configured to detect the running state of the first identified virtual machine according to a preset duration; a determination module, configured to detect the first If the running state of the identified virtual machine is abnormal, it is determined that the connection with the first identified virtual machine is interrupted.
在一种可以实现的方式中,所述装置500还包括:控制模块,用于在与所述第一标识的虚拟机连接中断的情况下,控制所述第二标识的虚拟机开机,将所述虚拟机的标识从第二标识改为第一标识,以在再次获取客户端的远程桌面协议的连接请求的情况下,将所述连接请求发送至修改标识后的第一标识的虚拟机。In a practicable manner, the apparatus 500 further includes: a control module, configured to control the second-identified virtual machine to start up when the connection with the first-identified virtual machine is interrupted, and The identification of the virtual machine is changed from the second identification to the first identification, so that when the remote desktop protocol connection request of the client is obtained again, the connection request is sent to the virtual machine with the modified identification of the first identification.
在一种可以实现的方式中,所述装置500还包括:第四获取模块,用于在与所述第一标识的虚拟机连接中断的情况下,获取从所述第二标识改为第一标识的虚拟机的连接信息;第二处理模块,用于基于所述连接信息,将所述连接请求发送至从第二标识修改为第一标识的虚拟机,建立所述客户端与所述第一标识的虚拟机之间的连接,以通过所述客户端显示所述第一标识的虚拟机的远程桌面。In a practicable manner, the apparatus 500 further includes: a fourth acquiring module, configured to acquire the information changed from the second identifier to the first one when the connection with the virtual machine with the first identifier is interrupted. The connection information of the identified virtual machine; the second processing module is configured to send the connection request to the virtual machine whose second identification is changed to the first identification based on the connection information, and establish the relationship between the client and the first identification A connection between the identified virtual machines to display the remote desktop of the first identified virtual machine via the client.
在一种可以实现的方式中,所述装置500还包括:第五获取模块,用于获取所述从第二标识修改为第一标识的虚拟机的输入输出事件流;第三处理模块,用于在检测到所述运行状态异常的虚拟机恢复正常的情况下,将所述虚拟机的标识从第一标识改为第二标识,并将所述输入输出事件流应用在所述从第一标识修改为第二标识的虚拟机中;将所述从第一标识修改为第二标识的虚拟机的运行状态从开机状态修改为休眠状态,以在与所述从第二标识修改为第一标识的虚拟机连接中断的情况下,建立所述客户端与所述从第一标识修改为第二标识的虚拟机之间的连接。In a practicable manner, the apparatus 500 further includes: a fifth acquiring module, configured to acquire the input and output event flow of the virtual machine modified from the second identifier to the first identifier; a third processing module, configured to When it is detected that the virtual machine with an abnormal running state returns to normal, change the identifier of the virtual machine from the first identifier to the second identifier, and apply the input and output event flow to the In the virtual machine whose identity is changed to the second identity; modify the operating state of the virtual machine whose identity is changed from the first identity to the second identity from the power-on state to the dormant state, so as to be compatible with the modification from the second identity to the first When the connection of the identified virtual machine is interrupted, a connection between the client and the virtual machine whose identification is changed from the first identification to the second identification is established.
这里需要指出的是:以上装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。It should be pointed out here that: the description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
需要说明的是,本申请实施例中,如果以软件功能模块的形式实现上述方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得电子设备执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本申请实施例不限制于任何特定的硬件和软件结合。It should be noted that, in the embodiment of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solutions of the embodiments of the present application or the part that contributes to related technologies can be embodied in the form of software products. The computer software products are stored in a storage medium and include several instructions to make The electronic device executes all or part of the methods described in the various embodiments of the present application. The aforementioned storage media include: various media that can store program codes such as U disk, mobile hard disk, read-only memory (Read Only Memory, ROM), magnetic disk or optical disk. Thus, embodiments of the present application are not limited to any specific combination of hardware and software.
对应地,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述实施例中任一所述方法中的步骤。Correspondingly, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in any one of the methods described in the foregoing embodiments are implemented.
对应地,本申请实施例中,还提供了一种芯片,所述芯片包括可编程逻辑电路和/或程序指令,当所述芯片运行时,用于实现上述实施例中任一所述方法中的步骤。Correspondingly, in the embodiment of the present application, a chip is also provided, the chip includes a programmable logic circuit and/or program instructions, and when the chip is running, it is used to implement any of the methods in the above embodiments A step of.
对应地,本申请实施例中,还提供了一种计算机程序产品,当该计算机程序产品被电子设备的处理器执行时,其用于实现上述实施例中任一所述方法中的步骤。Correspondingly, an embodiment of the present application further provides a computer program product, which is used to implement the steps in any one of the methods described in the foregoing embodiments when the computer program product is executed by a processor of an electronic device.
基于同一技术构思,本申请实施例提供一种电子设备,用于实施上述方法实施例记载的虚拟机的连接方法。图6为本申请实施例提供的一种电子设备的硬件实体示意图,如图6所示,所述电子设备600包括存储器610和处理器620,所述存储器610存储有可在处理器620上运行的计算机程序,所述处理器620执行所述程序时实现本申请实施例任一所述方法中的步骤。Based on the same technical concept, an embodiment of the present application provides an electronic device for implementing the method for connecting a virtual machine described in the above method embodiment. FIG. 6 is a schematic diagram of a hardware entity of an electronic device provided in an embodiment of the present application. As shown in FIG. A computer program, the processor 620 implements the steps in any one of the methods in the embodiments of the present application when executing the program.
存储器610配置为存储由处理器620可执行的指令和应用,还可以缓存待处理器620以及电子设备中各模块待处理或已经处理的数据(例如,图像数据、音频数据、语音通信数据和视频通信数据),可以通过闪存(FLASH)或随机访问存储器(Random Access Memory,RAM)实现。The memory 610 is configured to store instructions and applications executable by the processor 620, and also cache data to be processed or processed by the processor 620 and various modules in the electronic device (for example, image data, audio data, voice communication data and video data) Communication data), which can be realized by flash memory (FLASH) or random access memory (Random Access Memory, RAM).
处理器620执行程序时实现上述任一项的虚拟机的连接方法的步骤。处理器620通常控制电子设备600的总体操作。When the processor 620 executes the program, the steps of any one of the virtual machine connection methods described above are implemented. The processor 620 generally controls the overall operation of the electronic device 600 .
上述处理器可以为特定用途集成电路(应用程序Application SpecificIntegrated Circuit,ASIC)、数字信号处理器(Digital Signal Processor,DSP)、数字信号处理装置(Digital Signal Processing Device,DSPD)、可编程逻辑装置(ProgrammableLogic Device,PLD)、现场可编程门阵列(Field Programmable Gate Array,FPGA)、中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器中的至少一种。可以理解地,实现上述处理器功能的电子器件还可以为其它,本申请实施例不作具体限定。The above-mentioned processor can be a specific application integrated circuit (Application Specific Integrated Circuit, ASIC), digital signal processor (Digital Signal Processor, DSP), digital signal processing device (Digital Signal Processing Device, DSPD), programmable logic device (ProgrammableLogic At least one of Device, PLD), Field Programmable Gate Array (Field Programmable Gate Array, FPGA), Central Processing Unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor. It can be understood that the electronic device implementing the above processor function may also be other, which is not specifically limited in this embodiment of the present application.
上述计算机存储介质/存储器可以是只读存储器(Read Only Memory,ROM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性随机存取存储器(Ferromagnetic Random Access Memory,FRAM)、快闪存储器(Flash Memory)、磁表面存储器、光盘、或只读光盘(Compact Disc Read-Only Memory,CD-ROM)等存储器;也可以是包括上述存储器之一或任意组合的各种电子设备,如移动电话、计算机、平板设备、个人数字助理等。The above-mentioned computer storage medium/memory can be read-only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), Magnetic Random Access Memory (Ferromagnetic Random Access Memory, FRAM), Flash Memory (Flash Memory), Magnetic Surface Memory, CD-ROM, or CD-ROM (Compact Disc Read-Only Memory, CD-ROM) and other memories; it can also be various electronic devices including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants wait.
这里需要指出的是:以上存储介质和设备实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请存储介质和设备实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。It should be pointed out here that: the descriptions of the above storage medium and device embodiments are similar to the descriptions of the above method embodiments, and have similar beneficial effects to those of the method embodiments. For technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。It should be understood that reference throughout the specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Thus, appearances of "in one embodiment" or "in an embodiment" in various places throughout the specification are not necessarily referring to the same embodiment. Furthermore, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present application, the sequence numbers of the above-mentioned processes do not mean the order of execution, and the execution order of the processes should be determined by their functions and internal logic, and should not be used in the embodiments of the present application. The implementation process constitutes any limitation. The serial numbers of the above embodiments of the present application are for description only, and do not represent the advantages and disadvantages of the embodiments.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed devices and methods may be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or May be integrated into another system, or some features may be ignored, or not implemented. In addition, the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms of.
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元;既可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本申请实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed to multiple network units; Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present application.
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can be used as a single unit, or two or more units can be integrated into one unit; the above-mentioned integration The unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得设备自动测试线执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated units of the present application are realized in the form of software function modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solutions of the embodiments of the present application or the part that contributes to the related technologies can be embodied in the form of software products. The computer software products are stored in a storage medium and include several instructions to make The equipment automatic test line executes all or part of the methods described in the various embodiments of the present application. The aforementioned storage medium includes various media capable of storing program codes such as removable storage devices, ROMs, magnetic disks or optical disks.
本申请所提供的几个方法实施例中所揭露的方法,在不冲突的情况下可以任意组合,得到新的方法实施例。The methods disclosed in several method embodiments provided in this application can be combined arbitrarily to obtain new method embodiments under the condition of no conflict.
本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。The features disclosed in several method or device embodiments provided in this application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.
以上所述,仅为本申请的实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only the embodiment of the present application, but the scope of protection of the present application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, and should covered within the scope of protection of this application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211711819.XA CN116016641A (en) | 2022-12-29 | 2022-12-29 | Virtual machine connection method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211711819.XA CN116016641A (en) | 2022-12-29 | 2022-12-29 | Virtual machine connection method and device, electronic equipment and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116016641A true CN116016641A (en) | 2023-04-25 |
Family
ID=86024364
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211711819.XA Pending CN116016641A (en) | 2022-12-29 | 2022-12-29 | Virtual machine connection method and device, electronic equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116016641A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025010635A1 (en) * | 2023-07-12 | 2025-01-16 | Lenovo Enterprise Solutions (Singapore) Pte. Ltd. | Composable processing system and control method thereof |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105579960A (en) * | 2013-06-26 | 2016-05-11 | 亚马逊技术有限公司 | Management of computing sessions |
| CN105637481A (en) * | 2013-06-26 | 2016-06-01 | 亚马逊技术有限公司 | Management of computing sessions |
| CN112181593A (en) * | 2020-09-27 | 2021-01-05 | 北京首都在线科技股份有限公司 | Virtual machine scheduling method, device, equipment and storage medium |
| CN113467873A (en) * | 2021-06-29 | 2021-10-01 | 深信服科技股份有限公司 | Virtual machine scheduling method and device, electronic equipment and storage medium |
-
2022
- 2022-12-29 CN CN202211711819.XA patent/CN116016641A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105579960A (en) * | 2013-06-26 | 2016-05-11 | 亚马逊技术有限公司 | Management of computing sessions |
| CN105637481A (en) * | 2013-06-26 | 2016-06-01 | 亚马逊技术有限公司 | Management of computing sessions |
| CN112181593A (en) * | 2020-09-27 | 2021-01-05 | 北京首都在线科技股份有限公司 | Virtual machine scheduling method, device, equipment and storage medium |
| CN113467873A (en) * | 2021-06-29 | 2021-10-01 | 深信服科技股份有限公司 | Virtual machine scheduling method and device, electronic equipment and storage medium |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2025010635A1 (en) * | 2023-07-12 | 2025-01-16 | Lenovo Enterprise Solutions (Singapore) Pte. Ltd. | Composable processing system and control method thereof |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8266472B2 (en) | Method and system to provide high availability of shared data | |
| US7240122B2 (en) | File sharing device and inter-file sharing device data migration method | |
| CN103838593B (en) | Method, system and controller for recovering virtual machine, server and hosting host | |
| CN111459749B (en) | Prometheus-based private cloud monitoring method and device, computer equipment and storage medium | |
| CN103618627B (en) | A kind of manage the method for virtual machine, Apparatus and system | |
| CN113169895A (en) | N+1 redundancy for virtualized services with low-latency failover | |
| WO2024022409A1 (en) | Access processing methods and computer device | |
| KR20180087278A (en) | Method, apparatus and system for quick restoration of virtual machines | |
| US20200133515A1 (en) | Identifying an availability of a system | |
| CN110908723A (en) | Main/standby switching method and device of operating system and related equipment | |
| CN116126457A (en) | Container migration method and server cluster | |
| CN112612769A (en) | File processing method, device and storage medium | |
| CN116016641A (en) | Virtual machine connection method and device, electronic equipment and storage medium | |
| CN115277375B (en) | A switching method, system, device and storage medium for active and standby servers | |
| CN116560904A (en) | NAS data backup disaster recovery method, system, terminal and storage medium | |
| CN116302352A (en) | Cluster disaster recovery processing method and device, electronic equipment and storage medium | |
| CN113377702B (en) | Method and device for starting two-node cluster, electronic equipment and storage medium | |
| JP6773345B1 (en) | Fault-tolerant systems, servers, and how they operate | |
| JP2013161266A (en) | Redundant control system for call processing information, and backup maintenance server for the same | |
| WO2024198629A1 (en) | Computer device, data processor, processing system, and switching method | |
| CN117675834A (en) | A high-availability switching method for image warehouse based on Xinchuang Cloud Platform | |
| CN116996174A (en) | Disaster recovery methods, devices, equipment and media based on multi-availability zone IoT platform | |
| CN111209145A (en) | A service self-healing method, device and storage medium based on virtual machine disaster tolerance | |
| JP6954693B2 (en) | Fault-tolerant systems, servers, how they operate, and programs | |
| JP2009278436A (en) | Communication system and redundant configuration management method |
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 |
