WO2016026071A1 - 虚拟机数据的同步方法和装置 - Google Patents

虚拟机数据的同步方法和装置 Download PDF

Info

Publication number
WO2016026071A1
WO2016026071A1 PCT/CN2014/084651 CN2014084651W WO2016026071A1 WO 2016026071 A1 WO2016026071 A1 WO 2016026071A1 CN 2014084651 W CN2014084651 W CN 2014084651W WO 2016026071 A1 WO2016026071 A1 WO 2016026071A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
data stream
standby
data
output data
Prior art date
Application number
PCT/CN2014/084651
Other languages
English (en)
French (fr)
Inventor
徐向阳
文刘飞
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201480038268.2A priority Critical patent/CN105531678A/zh
Priority to PCT/CN2014/084651 priority patent/WO2016026071A1/zh
Publication of WO2016026071A1 publication Critical patent/WO2016026071A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation

Definitions

  • Embodiments of the present invention relate to computer technology, and in particular, to a method and apparatus for virtual machine data. Background technique
  • Virtualization technology allows multiple virtual machines (VMs) to run on a single physical machine at the same time, sharing the underlying physical resources of the computer, greatly improving the utilization of physical resources.
  • the virtualization technology is implemented by using a general hardware plus software, and the reliability of the virtual machine is considered when implementing the virtualization technology by using a general hardware plus software.
  • the primary and backup virtual machines are used. When the primary virtual machine fails, the virtual machine is switched to the standby virtual machine to ensure uninterrupted service. To switch between the primary and backup virtual machines, you need to ensure that the primary and backup virtual machines are switched. All the virtual machines are in the same state, such as the Central Processing Unit (Central Processing Unit).
  • Central Processing Unit Central Processing Unit
  • the active and standby VMs receive the same input packets, and independently process the input packets in parallel. If the output packets of the active and standby VMs are the same, if the output packets of the active and standby VMs are the same, the status of the active and standby VMs is the same.
  • the output of the primary virtual machine is selected as the output of the system. If the output of the virtual machine is different, the status of the active and standby VMs is inconsistent.
  • the status of the primary and backup virtual machines is the same, and the output of the primary virtual machine is used as the output of the system.
  • the prior art method can only be applied to the network service based on the packet protocol, and is not applicable to the data packet based on the flow protocol.
  • the data flow based on the flow protocol after processing by the protocol stack of the virtual machine, each piece The length of multiple data packets included in the data stream may be different, so it is not possible to directly compare the messages in the output data stream.
  • the length of each packet of the primary and secondary output data streams is equal by modifying the manner of the virtual machine protocol stack. Therefore, the packets in the primary and secondary output data streams can be directly compared.
  • Embodiments of the present invention provide a peer-to-peer method and apparatus for virtual machine data, which implements the first flow of the output data stream based on the flow protocol without modifying and customizing the protocol stack of the virtual machine. Aspects provide a peer-to-peer method for virtual machine data, including:
  • the comparison data of the primary output data stream or the comparison data of the standby output data stream is output as an output result;
  • the data of the machine is different from the data of the standby virtual machine, and the comparison data of the main output data stream and the comparison data of the standby output data stream are compared, and the compared data of the same output is used as an output.
  • the result is output.
  • the reading lengths are equal from the main output data stream and the standby output data stream respectively in the order of data streams
  • the comparison data is compared to determine whether the data of the primary virtual machine is the same as the data of the standby virtual machine, including:
  • the data of the primary virtual machine is the same as the data of the standby virtual machine.
  • the data of the primary virtual machine is different from the data of the standby virtual machine, if the hash value of the comparison data of the primary output data stream is different from the hash value of the comparison data of the standby output data stream.
  • the read lengths are equal from the main output data stream and the standby output data stream respectively in the order of data streams
  • the comparison data is compared to determine whether the data of the primary virtual machine is the same as the data of the standby virtual machine, including:
  • the initial hash value of the standby virtual machine is the hash value of the data synchronization between the primary virtual machine and the standby virtual machine, and each time the primary virtual machine is The initial hash value of the primary virtual machine is the same as the initial hash value of the standby virtual machine after the standby virtual machine performs data synchronization;
  • the data of the primary virtual machine is the same as the data of the standby virtual machine, if the hash value of the historical data of the primary virtual machine is different from the hash value of the historical data of the standby virtual machine, and the data of the primary virtual machine is different from the data of the standby virtual machine.
  • the length of the comparison data is preset, and the The order of the data streams respectively reads the comparative data of equal length from the main output data stream and the standby output data stream, including:
  • Preset length comparison data is read from the main output data stream and the standby output data stream, respectively, in the order of the data stream.
  • the reading, by the data output, the length of the comparison data from the main output data stream and the standby output data stream respectively including: Determining, by the machine, data of the main output data stream as comparison data of the main output data stream, determining a length of the comparison data of the main output data stream;
  • the comparison data of the standby output data stream having the same length as the comparison data of the main output data stream is read from the standby output data stream in the order of the data stream.
  • the data of the standby output data stream received by the standby virtual machine is used as the comparison data of the standby output data stream, and determining the preparation The length of the comparison data of the output data stream;
  • the comparison data of the main output data stream having the same length as the comparison data of the standby output data stream is read from the main output data stream in the order of the data stream.
  • the method further includes: updating the primary virtual The initial hash value of the machine and the initial hash value of the standby virtual machine.
  • the main output data stream of the machine and the standby output data stream of the standby virtual machine including:
  • the identification parameter is input The quintuple information of the data stream;
  • comparing the comparison data and the comparison data of the standby output data stream comprising: assigning comparison data of the standby output data stream to comparison data of the main output data stream;
  • the comparison data after the peer is output as an output result including:
  • the comparison data of the main output data stream is output as an output result.
  • the main output data stream is And comparing the comparison data and the comparison data of the standby output data stream, comprising: assigning comparison data of the main output data stream to comparison data of the standby output data stream;
  • the output data of the peer output data is output as the output result.
  • the method before the acquiring the main output data stream of the primary virtual machine to be synchronized and the standby output data stream of the standby virtual machine, the method further includes:
  • Receiving an input data stream distributing the input data stream to the primary virtual machine and the standby virtual machine, so that the primary virtual machine and the standby virtual machine respectively process the input data stream to obtain an output data flow.
  • a second aspect of the present invention provides a peer device for virtual machine data, including: The obtaining module is configured to obtain a primary output data stream of the primary virtual machine to be peered and a standby output data stream of the standby virtual machine;
  • a comparison module configured to compare lengthwise comparison data from the main output data stream and the standby output data stream according to a sequence of data streams, to determine the primary virtual machine Whether the data is the same as the data of the standby virtual machine;
  • an output module configured to output, when the data of the primary virtual machine and the data of the standby virtual machine are the same, output the comparison data of the primary output data stream or the comparison data of the standby output data stream;
  • a peer module configured to: if the data of the primary virtual machine is different from the data of the standby virtual machine, compare the comparison data of the primary output data stream with the comparison data of the standby output data stream;
  • the output module is further configured to: output the compared data after the peer as an output result.
  • the comparing module includes:
  • a reading unit configured to respectively read comparative data of equal length from the main output data stream and the standby output data stream in an order of data streams
  • a calculating unit configured to separately calculate a hash value of the comparison data of the primary output data stream and a hash value of the comparison data of the standby output data stream;
  • a determining unit configured to determine whether a hash value of the comparison data of the main output data stream is the same as a hash value of the comparison data of the standby output data stream, if a hash value of the comparison data of the main output data stream If the hash value of the comparison data of the standby output data stream is the same, the data of the primary virtual machine is the same as the data of the standby virtual machine, if the hash value of the comparison data of the primary output data stream is The hash value of the comparison data of the standby output data stream is different, and the data of the primary virtual machine is different from the data of the standby virtual machine.
  • the comparing module includes:
  • a reading unit configured to respectively read comparative data of equal length from the main output data stream and the standby output data stream in an order of data streams
  • a calculating unit configured to calculate, according to an initial hash value of the primary virtual machine and comparison data of the primary output data stream, a hash value of historical data of the primary virtual machine, and according to the standby virtual
  • the initial hash value of the machine and the comparison data of the standby output data stream are used to calculate a hash value of the historical data of the standby virtual machine, where the initial hash value of the primary virtual machine is the last time the primary virtual machine
  • the hash value after the data is synchronized with the standby virtual machine, and the initial hash value of the standby virtual machine is a hash value after the data of the primary virtual machine and the standby virtual machine are the same.
  • the initial hash value of the primary virtual machine is the same as the initial hash value of the standby virtual machine after the data is synchronized by the primary virtual machine and the standby virtual machine;
  • a determining unit configured to determine whether a hash value of the historical data of the primary virtual machine is the same as a hash value of historical data of the standby virtual machine, if a hash value of the historical data of the primary virtual machine is If the hash value of the historical data of the standby virtual machine is the same, the data of the primary virtual machine is the same as the data of the standby virtual machine, if the hash value of the historical data of the primary virtual machine is the same as the standby virtual machine.
  • the hash value of the historical data is different, and the data of the primary virtual machine is different from the data of the standby virtual machine.
  • the length of the comparison data is preset, and the reading is The unit is specifically used for:
  • Preset length comparison data is read from the main output data stream and the standby output data stream, respectively, in the order of the data stream.
  • the reading unit is specifically configured to:
  • the comparison data of the standby output data stream having the same length as the comparison data of the main output data stream is read from the standby output data stream in the order of the data stream.
  • the reading unit is specifically configured to:
  • the comparison data of the main output data stream having the same length as the comparison data of the standby output data stream is read from the main output data stream in the order of the data stream.
  • the sixth possible implementation method also includes:
  • an update module configured to update an initial hash value of the primary virtual machine and an initial hash value of the standby virtual machine.
  • the acquiring module includes:
  • An acquiring unit configured to acquire multiple output data streams of the primary virtual machine and multiple output data streams of the standby virtual machine
  • a parsing unit configured to parse the plurality of output data streams of the primary virtual machine to obtain an identification parameter of each output data stream of the primary virtual machine, and parse the multiple output data streams of the standby virtual machine Obtaining an identification parameter of each output data stream of the standby virtual machine;
  • An identifying unit configured to identify, according to an identification parameter of each output data stream of the primary virtual machine and an identification parameter of each output data stream of the standby virtual machine, the primary output data stream to be processed and the standby Output data stream.
  • the identification parameter is quintuple information of the output data stream
  • the identification unit is specifically used to:
  • the peer module is specifically configured to:
  • the output module is specifically used to: The comparison data of the main output data stream is output as an output result.
  • the peer module is specifically configured to:
  • the output module is specifically used to:
  • the comparison data of the standby output data stream is output as an output result.
  • An input module configured to receive an input data stream, and distribute the input data stream to the primary virtual machine and the standby virtual machine, so that the primary virtual machine and the standby virtual machine respectively input the input data stream Processing is performed to obtain an output data stream.
  • a third aspect of the present invention provides a peer device for virtual machine data, including:
  • processors a processor, a memory, and a system bus, wherein the processor and the memory are connected by the system bus and complete communication with each other;
  • the memory is configured to store a computer execution instruction
  • the processor configured to execute the computer to execute instructions, to cause the peer device to perform any of the first to eleventh possible implementations of the first aspect of the present invention and the first aspect of the present invention Said method.
  • Embodiments of the present invention provide a peer-to-peer method and apparatus for virtual machine data.
  • a peer device of virtual machine data arrives at the same time, the length is read from the main output data stream and the standby output data stream in the order of the data stream.
  • the comparison data is compared to determine whether the data of the primary virtual machine is the same as the data of the standby virtual machine. If the data is the same, the peer does not perform the same operation, and the result is directly output. If the data is different, the data of the primary virtual machine is first The data of the standby virtual machine is peered, and then the result is output.
  • FIG. 1 is a schematic structural diagram of a system according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of another system architecture to which an embodiment of the present invention is applied;
  • FIG. 3 is a flowchart of a method for synchronizing virtual machine data according to Embodiment 1 of the present invention
  • FIG. 4 is a schematic diagram of a main output data stream and a backup output data stream
  • FIG. 5 is a flowchart of a method for synchronizing virtual machine data according to Embodiment 2 of the present invention
  • FIG. 6 is a schematic diagram of another main output data stream and a backup output data stream
  • FIG. 7 is a flowchart of a method for synchronizing virtual machine data according to Embodiment 3 of the present invention
  • FIG. 8 is a schematic diagram of still another main output data stream and a backup output data stream
  • FIG. 9 is a schematic structural diagram of a peer device of virtual machine data according to Embodiment 4 of the present invention
  • FIG. 10 is a schematic structural diagram of a peer device of virtual machine data according to Embodiment 5 of the present invention
  • the primary virtual machine and the standby virtual machine are used to form a service externally, and the initial configurations of the primary virtual machine and the standby virtual machine are identical.
  • states include: Internal state and status of the output data.
  • the internal states include: CPU state, memory. Device status such as status and software status, the status of the output data is the same, that is, the same input data is processed. The output data needs to be consistent.
  • the internal state of the primary virtual machine and the standby virtual machine are the same as the prior art. The description of the output data of the primary virtual machine and the standby virtual machine is mainly described herein.
  • the virtual machine data peer device copies the input data stream into two copies and submits them to the primary virtual machine and the standby virtual machine for independent parallel processing.
  • the primary virtual machine provides services to the outside of the system, and the output of the primary virtual machine is used as the system output.
  • the standby virtual machine provides services to the outside of the system.
  • the output of the virtual machine is output as a system. In order to ensure that the services of the primary virtual machine and the standby virtual machine output data streams when the primary virtual machine and the standby virtual machine are switched, the data of the primary virtual machine and the standby virtual machine are timely matched in the embodiment of the present invention.
  • the data of the primary virtual machine and the standby virtual machine are the same when switching.
  • the primary virtual machine and the standby virtual machine are relative and should not be regarded as absolute virtual machine role assignment.
  • virtual machine A is the primary virtual machine
  • virtual machine B is the standby virtual machine.
  • virtual machine A is the standby virtual machine
  • virtual machine B is the primary virtual machine.
  • a primary virtual machine may have multiple standby virtual machines.
  • the embodiment of the present invention does not limit the number of standby virtual machines corresponding to the primary virtual machine.
  • a standby virtual machine is taken as an example. Be explained.
  • FIG. 1 is a schematic diagram of an embodiment of the present invention.
  • a schematic diagram of the system architecture, the primary virtual machine 11 and the standby virtual machine 21 are located in two different physical servers 100 and 200, respectively, and those skilled in the art can understand that the primary virtual machine 11 and the standby virtual machine 21 can also be located in the same
  • the output data streams of the primary virtual machine 11 and the standby virtual machine 21 are respectively sent to the peer device 300 of the virtual machine data, and the peer device 300 of the virtual machine data is output from the primary output data stream and the standby output data stream.
  • the comparison data of the same length is read for comparison, and it is determined whether the data of the primary virtual machine 11 and the data of the standby virtual machine 21 are the same.
  • the peer device 300 of virtual machine data can also be integrated into other network devices, such as switches.
  • FIG. 2 is a schematic diagram of another system architecture applicable to the embodiment of the present invention. As shown in FIG. 2, the primary virtual machine 41 and the standby virtual machine 51 are respectively located in two different physical servers 400 and 500, and virtual machine data is included. Peer device 600 is hosted by a virtual machine monitor on server 400
  • the hypervisor 42 and the virtual machine monitor 52 on the server 500 are implemented in a distributed manner.
  • Hypervisors are commonly used to allocate, manage, and schedule physical resources of a computer, and provide multiple complete virtual computer resources by encapsulating or simulating physical hardware.
  • the virtual machine monitor 42 of the primary virtual machine 41 and the virtual machine monitor 52 of the standby virtual machine 51 independently read comparative data of equal length from the primary output data stream and the standby output data stream, respectively.
  • the hash operation is performed, and then the virtual machine monitor 52 sends the hash calculation result to the virtual machine monitor 42, and the virtual machine monitor 42 determines the data of the primary virtual machine 41 and the standby virtual machine 51 based on the hash calculation result. Is the data the same?
  • the virtual machine monitor 42 transmits the hash calculation result to the virtual machine monitor 52, and the virtual machine monitor 52 determines whether the data of the primary virtual machine 41 and the data of the standby virtual machine 51 are identical based on the hash calculation result.
  • the virtual machine data peer device can be implemented in hardware, or implemented in software, or combined in software and hardware.
  • FIG. 3 is a flowchart of a method for synchronizing virtual machine data according to Embodiment 1 of the present invention.
  • the method in this embodiment is performed by a virtual machine data peer device.
  • the method in this embodiment may include the following: Step:
  • Step 101 Obtain a primary output data stream of the primary virtual machine to be concurrently and a standby output data flow of the standby virtual machine, and when the same time arrives, output the data stream and the secondary output data stream respectively according to the order of the data flow.
  • the comparison data with the same length is read for comparison, and it is determined whether the data of the primary virtual machine and the data of the standby virtual machine are the same.
  • the primary output data stream and the standby output data stream may be any stream protocol based data, such as a Transmission Control Protocol (TCP) or a Real-time Transport Protocol (RTT).
  • TCP Transmission Control Protocol
  • RTT Real-time Transport Protocol
  • the primary virtual machine and the standby virtual machine may output multiple output data streams. Some of the output data streams are mutually active and standby, and some are independent output data streams. Therefore, it is necessary to identify the output data of the mutual active/standby relationship. flow.
  • the identification parameters of the stream identify the primary output data stream and the standby output data stream to be processed.
  • Parsing the output data stream can get the header information of each output data stream, and the number of outputs can be According to some parameters in the header information of the stream, as the identification parameter, for example, when the multiple output data streams of the primary virtual machine and the multiple output data streams of the standby virtual machine are TCP data streams, the quintuple of the output data stream may be The information is used as the identification parameter, and the quintuple information is specifically: Source Network Interconnection Protocol
  • IP Internet Protocol
  • Address Address, source port, destination IP address, destination port, and transport layer protocol number.
  • Identifying the primary output data stream and the standby output data stream according to the identification parameter specifically: comparing the identification parameter of each output data stream of the primary virtual machine with the identification parameter of each output data stream of the standby virtual machine, when the primary virtual machine is When the identification parameter of an output data stream is the same as the identification parameter of an output data stream of the standby virtual machine, the output data stream of the primary virtual machine is used as the main output data stream, and the output of the primary virtual machine is outputted.
  • the output data stream of the standby virtual machine whose identification parameters of the data stream are equal is used as the standby output data stream.
  • the quintuple information of each output data stream of the virtual machine and the quintuple information of each data stream of the standby virtual machine are compared, and the quintuple information and the preparation of the output data stream of the primary virtual machine are compared.
  • the quintuple information of the output data stream of the virtual machine is the same, the output data stream of the primary virtual machine is regarded as the primary output data stream of the peer to be processed, and the output data stream of the standby virtual machine is used as the standby output data of the peer to be processed. flow.
  • comparison data of the same length is read from the main output data stream and the standby output data stream in the order of the data stream for comparison, from the main output.
  • the comparison data read in the data stream is referred to as comparison data of the main output data stream
  • the comparison data read from the backup output data stream is referred to as comparison data of the standby output data stream.
  • the comparison data of the main output data stream is the same as the comparison data of the standby output data stream
  • step 102 is performed.
  • step 103 is performed.
  • the reading of the comparison data in the order of the data stream in the patent means that the order is read in the order of the messages in the data stream.
  • the data based on the message protocol is the protection boundary. That is, the transmission protocol transmits the data as an independent message on the network.
  • the receiving end can only receive independent messages, that is, there is a protection message boundary, and the receiving end can only receive and send at a time.
  • a data message sent by the terminal For a data stream based on a streaming protocol, the message boundary is not protected, and the transmitting end continuously transmits data, and the receiving end has a Two or more data messages can be received in one receiving action, and the length of each data message may be different.
  • the length of the output data stream output by the primary virtual machine and the standby virtual machine at the same time may be different, and the primary output data stream may include two
  • the packet output data stream may include three packets, and the length of each packet may be different. Therefore, the packets output by the primary virtual machine cannot be directly compared with the packets output by the standby virtual machine.
  • comparison data of equal length are read from the main output data stream and the standby output data stream for comparison, thereby ensuring the same granularity.
  • the comparison data of equal length is read from the main output data stream and the standby output data stream respectively in the order of the data stream; and then, the hash value and the standby output of the comparison data of the main output data stream are respectively calculated.
  • the hash value of the comparison data of the data stream is judged whether the hash value of the comparison data of the main output data stream is the same as the hash value of the comparison data of the standby output data stream.
  • the main virtual machine The data is the same as the data of the standby virtual machine. If the hash value of the comparison data of the main output data stream is different from the hash value of the comparison data of the standby output data stream, the comparison data of the main output data stream and the standby output data stream are illustrated. The comparison data is different, then the data of the primary virtual machine is different from the data of the standby virtual machine.
  • the second method first, reads the equal length comparison data from the main output data stream and the standby output data stream in the order of the data stream; and then, according to the comparison between the initial hash value of the main virtual machine and the main output data stream
  • the data calculates a hash value of the historical data of the primary virtual machine, and calculates a hash value of the historical data of the standby virtual machine according to the initial hash value of the standby virtual machine and the comparison data of the standby output data stream, where the initial virtual machine is initialized.
  • the hash value is the hash value of the data of the primary virtual machine and the standby virtual machine.
  • the initial hash value of the standby virtual machine is the hash value of the data of the last primary virtual machine and the standby virtual machine.
  • the initial hash value of the primary virtual machine is the same as the initial hash value of the standby virtual machine.
  • the hash value of the historical data of the primary virtual machine is determined. Whether the hash value of the history data of the virtual machine is the same. If the hash value of the historical data of the primary virtual machine is the same as the hash value of the historical data of the standby virtual machine, the main loss is indicated.
  • the comparison data of the outgoing data stream is the same as the comparison data of the standby output data stream, then the data of the primary virtual machine and the data of the standby virtual machine are the same, if the hash value of the historical data of the primary virtual machine and the historical data of the standby virtual machine The hash value is different, indicating that the comparison data of the main output data stream is different from the comparison data of the standby output data stream, and the data of the primary virtual machine is different from the data of the standby virtual machine.
  • the hash value of the historical data is calculated according to the initial hash value and the comparison data, and the hash value of the historical data of the primary virtual machine and the hash value of the historical data of the standby virtual machine are compared, where the historical data refers to this time. The sum of all the data before ⁇ and the comparison data of this peer.
  • Figure 4 is a schematic diagram of a main output data stream and a backup output data stream. As shown in Figure 4, the main output data stream of the output of the main virtual machine and the standby output data output by the standby virtual machine. The total amount of data and the content of the stream are exactly the same, but the number of packets included in the main output data stream and the standby output data stream are different from the packet length.
  • the main output data stream contains three messages: ⁇ , ⁇ ⁇ 3
  • the standby output data stream contains two messages: and, the main output data stream and the standby output data stream contain the same data content.
  • ABCDEFGH the message P1 in the main output data stream contains ABC
  • the message p 2 contains DE
  • the message contains FGH
  • the message in the output data stream 3 ⁇ 4 contains ABCD
  • the message r 2 contains EFGH.
  • Step 102 Output comparison data of the main output data stream or comparison data of the standby output data stream as an output result.
  • Step 103 Perform comparison data of the comparison data of the main output data stream and the comparison data of the standby output data stream, and output the comparison data after the same as the output result. This step is performed when the data of the primary virtual machine is different from the data of the standby virtual machine.
  • the specific data may be: the comparison data of the standby output data stream is assigned to the comparison data of the main output data stream, or the main output data is The comparison data of the stream is assigned to the comparison data of the standby output data stream.
  • the comparison data of the standby output data stream is assigned to the comparison data of the main output data stream, the comparison data after the same output is output as the output result, specifically: the comparison data of the main output data stream is output as an output result. If the comparison data of the main output data stream is assigned to the comparison data of the standby output data stream, the comparison data after the same is output as the output result, specifically: the comparison data of the standby output data stream is output as the output result.
  • compare data of equal length are read from the main output data stream and the backup output data stream according to the order of the data stream, and the data of the main virtual machine and the standby virtual machine are determined. If the data of the primary virtual machine is the same as the data of the standby virtual machine, the same operation is not performed, and the comparison data of the main output data stream or the comparison data of the standby output data stream is directly output as the output result.
  • the data of the main output data stream is different from the data of the standby output data stream, the data of the main virtual machine and the data of the standby virtual machine are first compared, and the comparative data after the same is output as the output result.
  • the output data streams of the primary and backup virtual machines are directly compared, and the protocol stack of the virtual machine is not required. Make modifications and customizations. Moreover, only when the comparison data of the main output data stream and the comparison data of the backup output data stream are not equal, the data is compared, the number of peers is reduced, and the data of the primary virtual machine and the standby virtual machine are reduced. System performance degradation.
  • the virtual machine data peer device before executing step 101, performs the following operations: receiving the input data stream, and distributing the input data stream to the primary virtual machine and the standby virtual machine, so that the primary virtual machine and the standby virtual machine The virtual machine processes the input data stream separately to obtain an output data stream.
  • the input data stream and the virtual machine data peer device copy the received input data stream into two copies and submit them to the primary virtual machine and the standby virtual machine respectively to ensure input of the primary virtual machine and the standby virtual machine.
  • the data flow is the same, the primary virtual machine and the standby virtual machine operate independently, and the input data stream is processed. Then, the primary virtual machine and the standby virtual machine respectively output the processed output data streams.
  • the step 101 of the first embodiment is described in detail.
  • the length of the comparison data is preset, and the data stream is sequentially output from the main output data stream and the standby output data stream.
  • the comparison data with the same length is read as follows:
  • the preset length comparison data is read from the main output data stream and the standby output data stream in the order of the data stream.
  • the hash value of the historical data of the primary virtual machine and the standby virtual machine is determined.
  • FIG. 5 is a flowchart of a method for synchronizing virtual machine data according to Embodiment 2 of the present invention. As shown in FIG. 5, the method in this embodiment may include the following steps:
  • Step 201 Read preset data of the preset length from the main output data stream and the standby output data stream in the order of the data stream.
  • Step 202 Calculate a hash value of the historical data of the primary virtual machine according to the initial hash value of the primary virtual machine and the comparison data of the primary output data stream, and compare the initial hash value and the standby output data stream according to the standby virtual machine.
  • the data calculates the hash value of the historical data of the standby virtual machine.
  • the initial hash value of the primary virtual machine is the hash value of the data of the primary virtual machine and the standby virtual machine.
  • the initial hash value of the standby virtual machine is the data of the last primary virtual machine and the standby virtual machine.
  • the initial hash value of the primary virtual machine is the same as the initial hash value of the standby virtual machine after each primary virtual machine and the standby virtual machine perform data homogeneity, and therefore, the primary virtual
  • the initial hash of the machine is the same as the initial hash of the standby virtual machine.
  • Step 203 Determine whether the hash value of the historical data of the primary virtual machine is the same as the hash value of the historical data of the standby virtual machine.
  • step 204 is performed, if the hash value of the historical data of the primary virtual machine and the historical data of the standby virtual machine are If the Greek values are different, step 205 is performed.
  • Step 204 Determine the data of the primary virtual machine and the data of the standby virtual machine.
  • Step 205 Determine that the data of the primary virtual machine is different from the data of the standby virtual machine.
  • FIG. 6 is a schematic diagram of another main output data stream and a backup output data stream.
  • the main output data stream and the backup output data stream in FIG. 6 are TCP data streams.
  • a TCP connection needs to be established through a three-way handshake.
  • the SYN (synchronous) packet is the first packet sent after the TCP connection is established.
  • the SYN packet is very short.
  • the user data packet is sent after the SYN packet.
  • the preset length of the comparison data is 512 bytes (Bite), which is calculated every 512 bytes except for the SYN message.
  • the hash value of the historical data of the standby virtual machine is calculated in parallel at the moment.
  • H; h(H Q , standby SYN) and the hash value of the historical data of the primary virtual machine, the primary SYN), H Q is the initial hash value of the virtual machine and the standby virtual machine at the moment, and compares ⁇ ⁇ ⁇ Whether the same, if the same, the main SYN message or the standby SYN message is output as the output result, if ⁇ ⁇ ⁇ ; not the same, then the primary SYN is assigned to the standby SYN, or the standby SYN is assigned to the primary SYN, The data of the primary virtual machine and the data of the standby virtual machine are synchronized, and then the primary SYN packet or the standby SYN packet is output as an output result.
  • H 2 h(H;, b ⁇ 512 bytes) and the hash value of the historical data of the primary virtual machine ⁇ ,, ⁇ ,), where ⁇ ; is the initial hash of the virtual machine at time t 2 Value, the initial hash value of the primary virtual machine at time t 2 , H
  • H l 0
  • the preset length of the comparison data is 512 bytes, therefore, the main output data stream is read when calculating ⁇ of! ⁇
  • the first 512 bytes of the message, the 512 bytes of the standby output data stream are also read when calculating H 2 , and the length of the P1 message is just 512 bytes.
  • the comparison is the same whether If the sum is the same, the first 512 bytes of the message or the message are output as the output result. If the sum is not the same, the first 512 bytes of the message ⁇ are assigned, or the first 512 bytes are assigned to the message. ⁇ , the hash value, the data of the primary virtual machine and the data of the standby virtual machine are realized, and then the first 512 bytes of the message or 1 ⁇ are output as the output result.
  • the hash value of the historical data of the virtual machine at time t 3 ! ! ⁇ ! ⁇ ,! ⁇ bytes), the hash value of the historical data of the primary virtual machine is 1 ( ⁇ 2 # ⁇ 384 bytes), where H 2 is the primary virtual machine at time 1 3
  • the initial hash value, H 2 is the initial hash value of the standby virtual machine at time t 3 , H 2 H 2 , # indicates the splicing operation, and 2 2 # 384 bytes represent the message 2 2 and the message p
  • the first 384 bytes of 3 are stitched together. After the sum is calculated, the comparison is the same. If the sum is the same, the result is directly output. If the sum is not the same, the result is the same, then the result is output, and the subsequent output data stream is processed in the same manner.
  • the SYN packet is separately calculated to calculate the hash value of the historical data of the virtual machine.
  • the SYN packet and the user data packet may be used together as the output data stream to calculate the hash value of the historical data of the virtual machine.
  • the comparison data used each time the peer is used The preset lengths are the same.
  • the preset length of the comparison data used by the peers may be different.
  • the preset length is 512 bytes at the time of ⁇ , and the preset length at the time is 256 bytes.
  • the preset length at time t 3 is 1024 bytes.
  • the third embodiment of the present invention provides a detailed description of the step 101 in the first embodiment.
  • the length of the comparison data is determined in real time, and the following two determination methods are common:
  • the data of the main output data stream received by the primary virtual machine is used as comparison data to determine the length of the comparison data of the main output data stream; and then, the read data stream is read from the standby output data stream according to the order of the data flow.
  • the data of the standby output data stream received by the standby virtual machine is used as comparison data to determine the length of the comparison data of the standby output data stream. Then, the data is read and prepared from the main output data stream in the order of the data stream. The comparison data of the main output data stream of the output data stream whose comparison data length is equal.
  • FIG. 7 is a flowchart of a method for synchronizing virtual machine data according to Embodiment 3 of the present invention. As shown in FIG. 7, the method in this embodiment may include the following steps:
  • Step 301 Determine, as the comparison data of the standby output data stream, the data of the standby output data stream received by the standby virtual machine, and determine the length of the comparison data of the standby output data stream.
  • Step 302 Read, from the main output data stream, the comparison data of the main output data stream with the comparison data length of the standby virtual machine in the order of the data flow.
  • Step 303 Calculate a hash value of the historical data of the primary virtual machine according to the initial hash value of the primary virtual machine and the comparison data of the primary output data stream, and compare the initial hash value and the standby output data stream according to the standby virtual machine.
  • the data calculates the hash value of the historical data of the standby virtual machine.
  • the initial hash value of the primary virtual machine is the hash value of the data of the primary virtual machine and the standby virtual machine.
  • the initial hash value of the standby virtual machine is the data of the last primary virtual machine and the standby virtual machine.
  • the initial hash value of the primary virtual machine is the same as the initial hash value of the standby virtual machine after each primary virtual machine and the standby virtual machine perform data homogeneity, and therefore, the primary virtual
  • the initial hash of the machine is the same as the initial hash of the standby virtual machine.
  • Step 304 Determine whether the hash value of the historical data of the primary virtual machine is the same as the hash value of the historical data of the standby virtual machine.
  • step 305 is performed, if the hash value of the historical data of the primary virtual machine and the historical data of the standby virtual machine are If the Greek values are not the same, then step 306 is performed.
  • Step 305 Determine the data of the primary virtual machine and the data of the standby virtual machine.
  • Step 306 Determine that the data of the primary virtual machine is different from the data of the standby virtual machine.
  • FIG. 8 is a schematic diagram of still another main output data stream and a backup output data stream, and the hash value H of the historical data of the standby virtual machine is calculated in parallel at time; (H Q , standby SYN) and the hash value of the historical data of the primary virtual machine, the primary SYN), the initial hash value of the H Q primary virtual machine and the standby virtual machine at the moment, and then compare ⁇ ⁇ ⁇ ; whether they are the same, Data is compared or directly output based on the comparison results.
  • the length of ⁇ is 1024 bytes
  • the hash value H 3 h(H 2 , b 2 ) of the historical data of the standby virtual machine is first calculated, which is the initial hash value of the standby virtual machine, and the message b 2 is the standby virtual machine from time t 2 to Received comparison data, message at time t 3 !
  • the length of ⁇ is 1440 bytes.
  • the hash value of the historical data of the primary virtual machine is calculated according to the length of the calculated length of the standby virtual machine.
  • the comparison data of the primary output data stream includes the second half of the packet and the packet P 4 , therefore, the hash of the historical data of the primary virtual machine
  • the subsequent output data stream is processed in the same manner.
  • the data received by the standby virtual machine from the last peer time to the current time is used as the backup output.
  • the comparison data of the data stream is then read from the main output data stream as equal data of the main output data stream. If the total amount of data received by the primary virtual machine when the peer time arrives is less than the length of the comparison data received by the standby virtual machine, how many times can the hash value of the historical data of the primary virtual machine be calculated?
  • the calculation result of the primary virtual machine is not directly compared with the hash value of the historical data of the standby virtual machine, but waiting for receiving data of equal length, and calculating the equivalent amount of comparison After the data, the hash value of the historical data of the primary virtual machine and the hash value of the historical data of the standby virtual machine are compared.
  • the comparison data of the main output data stream of the data received by the primary virtual machine from the last peer time to the current time is, and then read from the standby output data stream.
  • the length data is used as comparison data for the output data stream. If the total amount of data received by the standby virtual machine at the time of arrival is less than the length of the comparison data of the primary output data stream, how much data can be calculated when calculating the hash value of the historical data of the standby virtual machine How much, however, after the calculation is completed, the calculation result of the standby virtual machine is not directly compared with the hash value of the historical data of the primary virtual machine, but waiting to receive data of equal length, after calculating the equivalent amount of comparison data Then compare the hash value of the historical data of the primary virtual machine with the hash value of the historical data of the standby virtual machine.
  • the initial hash value of the primary virtual machine and the initial hash value of the standby virtual machine need to be updated, and the hash value of the primary virtual machine and the standby virtual machine after each update.
  • the hash value is the same.
  • the peer device of the virtual machine data provided by the implementation may include: an obtaining module 61, a comparing module 62, and the same Module 63 and output module 64.
  • the obtaining module 61 is configured to obtain a primary output data stream of the primary virtual machine to be synchronized and a standby output data stream of the standby virtual machine.
  • the comparing module 62 is configured to compare the lengthwise comparison data from the main output data stream and the standby output data stream according to the order of the data streams, and determine the primary virtual machine. Whether the data is the same as the data of the standby virtual machine;
  • the output module 64 is configured to output, when the data of the primary virtual machine and the data of the standby virtual machine are the same, the comparison data of the primary output data stream or the comparison data of the standby output data stream ;
  • the peer module 63 is configured to: if the data of the primary virtual machine is different from the data of the standby virtual machine, compare the comparison data of the primary output data stream with the comparison data of the standby output data stream ;
  • the output module 64 is further configured to: output the compared data of the peer as an output result.
  • the peer module 63 can perform data homogeneity in the following two ways: The first manner assigns the comparison data of the standby output data stream to the comparison data of the main output data stream; The comparison data of the main output data stream is assigned to the comparison data of the standby output data stream. If the peer module 63 performs the same manner in the first manner, the output module 64 outputs the comparison data of the main output data stream as an output result. If the peer module 63 performs the second method in the same manner, the output module 64 outputs the comparison data of the standby output data stream as an output result.
  • the device of the virtual machine data of the present embodiment can be used to perform the technical solutions of the first embodiment to the third embodiment.
  • the specific implementation and technical effects are similar, and details are not described herein again.
  • the device in this embodiment further includes: an input module 65, configured to: Receiving an input data stream, distributing the input data stream to the primary virtual machine and the standby virtual machine, so that the primary virtual machine and the standby virtual machine respectively process the input data stream to obtain an output data flow.
  • an input module 65 configured to: Receiving an input data stream, distributing the input data stream to the primary virtual machine and the standby virtual machine, so that the primary virtual machine and the standby virtual machine respectively process the input data stream to obtain an output data flow.
  • the obtaining module 61 includes: an obtaining unit 611, a parsing unit 612, and an identifying unit 613.
  • the obtaining unit 611 is configured to acquire multiple output data streams of the primary virtual machine and multiple output data streams of the standby virtual machine.
  • the parsing unit 612 is configured to parse the plurality of output data streams of the primary virtual machine to obtain an identification parameter of each output data stream of the primary virtual machine, and parse the multiple output data of the standby virtual machine
  • the stream acquires identification parameters of each output data stream of the standby virtual machine.
  • the identifying unit 613 is configured to identify, according to the identification parameter of each output data stream of the primary virtual machine and the identification parameter of each output data stream of the standby virtual machine, the primary output data stream to be processed and the Prepare the output data stream.
  • the identification parameter is quintuple information of the output data stream.
  • the identifying unit 613 is specifically configured to: compare each output data stream of the primary virtual machine The quintuple information and the quintuple information of each data stream of the standby virtual machine, when the quintuple information of the output data stream of the primary virtual machine and the output data stream of the standby virtual machine are five yuan
  • the group information is the same, the output data stream of the primary virtual machine is used as the primary output data stream to be the same, and the output data stream of the standby virtual machine is used as the standby output data stream to be synchronized.
  • the comparison module 62 includes: a reading unit 621, a calculating unit 622, and a judging unit 623.
  • the reading unit 621 is configured to read the comparative data of equal length from the main output data stream and the standby output data stream respectively in the order of the data stream.
  • the calculating unit 622 is configured to separately calculate a hash value of the comparison data of the primary output data stream and a hash value of the comparison data of the standby output data stream; or, for initial hashing according to the primary virtual machine Calculating a hash value of the historical data of the primary virtual machine with the comparison data of the primary output data stream, and calculating the initial hash value of the standby virtual machine and the comparison data of the standby output data stream a hash value of the historical data of the standby virtual machine, where the initial hash value of the primary virtual machine is a hash value of the data of the primary virtual machine and the standby virtual machine.
  • the initial hash value of the virtual machine is the hash value of the data synchronization between the primary virtual machine and the standby virtual machine, and the data is synchronized between the primary virtual machine and the standby virtual machine.
  • the initial hash value of the primary virtual machine is the same as the initial hash value of the standby virtual machine.
  • the determining unit 623 is configured to determine a hash value of the comparison data of the main output data stream. Whether the hash value of the comparison data of the standby output data stream is the same, and if the hash value of the comparison data of the primary output data stream is the same as the hash value of the comparison data of the standby output data stream, the primary The data of the virtual machine is the same as the data of the standby virtual machine. If the hash value of the comparison data of the primary output data stream is different from the hash value of the comparison data of the standby output data stream, the primary The data of the virtual machine is different from the data of the standby virtual machine.
  • the determining unit 623 is configured to determine a hash value of the historical data of the primary virtual machine. Whether the hash value of the historical data of the standby virtual machine is the same, and if the hash value of the historical data of the primary virtual machine is the same as the hash value of the historical data of the standby virtual machine, the primary virtual machine The data is the same as the data of the standby virtual machine. If the hash value of the historical data of the primary virtual machine is different from the hash value of the historical data of the standby virtual machine, the primary virtual machine The data is different from the data of the standby virtual machine.
  • the length of the comparison data is preset, and the reading unit 621 is specifically configured to: read the comparison data of the preset length from the main output data stream and the standby output data stream respectively in the order of the data stream .
  • the length of the comparison data is determined according to the length of the data received by the primary virtual machine, and the reading unit 121 is specifically configured to: use the data of the primary output data stream received by the primary virtual machine as the primary output Comparing data of the data stream, determining a length of the comparison data of the main output data stream; and then reading, from the standby output data stream, the length of the comparison data length of the main output data stream in the order of the data stream Describe the comparison data of the output data stream.
  • the length of the comparison data is determined according to the length of the data received by the standby virtual machine, and the reading unit 121 is specifically configured to: use the data of the standby output data stream received by the standby virtual machine as the standby output. Comparing data of the data stream, determining a length of the comparison data of the standby output data stream; and then reading, from the main output data stream, the length of the comparison data length of the standby output data stream in the order of the data stream The comparison data of the main output data stream.
  • the peer device of the virtual machine data of this embodiment further includes: an update module, configured to update an initial hash value of the primary virtual machine and an initial hash value of the standby virtual machine.
  • the device of the virtual machine data of the present embodiment can be used to perform the technical solutions of the first embodiment to the third embodiment.
  • the specific implementation and technical effects are similar, and details are not described herein again.
  • the peer device 700 for virtual machine data of this embodiment includes: a processor 71, a memory 72, and a system bus. 73, the processor 71 and the memory 72 are connected through the system bus 23 and complete communication with each other; the memory 72 is configured to store a computer execution instruction 721; the processor 71 is configured to run The computer executes the instruction 721 to cause the peer device 700 of the virtual machine data to perform the method as described below:
  • the primary output is Comparing data of the data stream or comparison data of the standby output data stream as an output result; if the data of the primary virtual machine is different from the data of the standby virtual machine, comparing data of the primary output data stream The comparison data of the standby output data stream is compared, and the compared data after the same is output as an output result.
  • the processor 71 can determine whether the data of the primary virtual machine and the data of the standby virtual machine are the same in two ways:
  • comparison data of equal length is read from the main output data stream and the standby output data stream, respectively, in the order of data streams. Then, a hash value of the comparison data of the main output data stream and a hash value of the comparison data of the standby output data stream are separately calculated.
  • comparison data of equal length is read from the main output data stream and the standby output data stream, respectively, in the order of the data stream. Then, calculating a hash value of the historical data of the primary virtual machine according to the initial hash value of the primary virtual machine and the comparison data of the primary output data stream, and according to an initial hash value of the standby virtual machine
  • the comparison data of the standby output data stream calculates a hash value of the historical data of the standby virtual machine, where an initial hash value of the primary virtual machine is performed by the primary virtual machine and the standby virtual machine last time.
  • the hash value of the data backup, the initial hash value of the standby virtual machine is the hash value of the data synchronization between the primary virtual machine and the standby virtual machine, and the primary virtual After the data is synchronized with the standby virtual machine, the initial hash value of the primary virtual machine is the same as the initial hash value of the standby virtual machine.
  • the processor 71 is further configured to: update an initial hash of the primary virtual machine The value and the initial hash value of the standby virtual machine.
  • the comparison data is determined in the following three ways:
  • the length of the comparison data is preset, and the processor 71 reads the comparison data of the same length from the main output data stream and the standby output data stream respectively according to the order of the data stream, specifically: according to the data
  • the order of the streams reads the comparison data of the preset length from the main output data stream and the standby output data stream, respectively.
  • the length of the comparison data is determined according to the length of the data received by the primary virtual machine, and the processor 71 reads the equal length comparisons from the primary output data stream and the standby output data stream respectively in the order of the data stream.
  • Data specifically: determining, by using data of the main output data stream received by the primary virtual machine as comparison data of the primary output data stream, determining a length of comparison data of the primary output data stream; The comparison data of the standby output data stream having the same length as the comparison data of the main output data stream is sequentially read from the standby output data stream.
  • the length of the comparison data is determined according to the length of the data received by the standby virtual machine, and the processor 71 reads the equal length comparisons from the main output data stream and the standby output data stream respectively in the order of the data stream.
  • the data is specifically: the data of the standby output data stream received by the standby virtual machine is used as comparison data of the standby output data stream, and the length of the comparison data of the standby output data stream is determined; according to the data flow
  • the comparison data of the main output data stream having the same length as the comparison data of the standby output data stream is sequentially read from the main output data stream.
  • the processor 71 obtains the primary output data stream of the primary virtual machine to be the same as the standby output data stream of the standby virtual machine, and specifically: first, acquiring multiple output data streams of the primary virtual machine and the And a plurality of output data streams of the virtual machine; and then parsing the plurality of output data streams of the primary virtual machine to obtain identification parameters of each output data stream of the primary virtual machine, and parsing the standby virtual machine And acquiring, by the plurality of output data streams, an identification parameter of each output data stream of the standby virtual machine; and finally, identifying, according to each of the output data streams of the primary virtual machine, each output of the standby virtual machine
  • the identification parameters of the data stream identify the primary output data stream to be processed and the standby output data stream.
  • the identification parameter is quintuple information of the output data stream.
  • the processor 71 is specifically configured to: compare the quintuple information of each output data stream of the primary virtual machine with the quintuple information of each data flow of the standby virtual machine, when the primary virtual machine loses
  • the quintuple information of the outgoing data stream is the same as the quintuple information of the output data stream of the standby virtual machine
  • the output data stream of the primary virtual machine is regarded as the primary output data stream to be peered
  • the output data stream of the virtual machine is described as the standby output data stream to be compared.
  • the processor 71 compares the comparison data of the main output data stream with the comparison data of the standby output data stream in the following two manners:
  • the processor 71 before acquiring the primary output data stream of the primary virtual machine to be synchronized and the standby output data stream of the standby virtual machine, the processor 71 is further configured to: receive the input data stream, and distribute the input data stream to The primary virtual machine and the standby virtual machine, so that the primary virtual machine and the standby virtual machine respectively process the input data stream to obtain an output data stream.
  • the device of the virtual machine data provided in this embodiment can be used to perform the technical solutions of the first embodiment to the third embodiment.
  • the specific implementation manners and technical effects are similar, and details are not described herein again.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种虚拟机数据的同步方法和装置,包括:在同步时间到达时,分别从主输出数据流和备输出数据流中读取长度相等的比较数据进行比较,根据比较数据确定主虚拟机的数据与备虚拟机的数据是否同步,若不同步,则先将主虚拟机的数据和备虚拟机的数据进行同步,然后输出结果。上述方法中,通过从主输出数据流和备输出数据流中读取长度相等的比较数据进行比较,实现了对主、备虚拟机的输出数据流直接进行比较,不需要对虚拟机的协议栈进行修改和定制化。并且,只在主输出数据流的比较数据与备输出数据流的比较数据不相等时,才进行数据同步,减少了同步次数,减轻了数据同步引起的系统性能降级。

Description

虚拟机数据的同步方法和装置
技术领域
本发明实施例涉及计算机技术, 尤其涉及一种虚拟机数据的同歩方法和 装置。 背景技术
虚拟化技术允许多个虚拟机 (Virtual Machine , 简称 VM) 同时运行在 一个物理机器上, 分享计算机底层物理资源, 极大的提高了物理资源利用率。 现有技术中, 采用通用硬件加软件的方式实现虚拟化技术, 在采用通用硬件 加软件的方式实现虚拟化技术时要考虑虚拟机的可靠性问题。 为了保证虚拟 机的可靠性, 采用主、 备虚拟机的方式, 当主虚拟机故障时, 马上切换到备 虚拟机, 以保证服务的不间断, 要实现主、 备虚拟机的切换, 需要保证主、 备虚拟机的全部状态一致, 诸如中央处理器 (Central Processing Unit, 简称
CPU) 状态、 内存状态等设备状态, 以及软件状态等完全一致。
为了保证主、 备虚拟机的状态一致, 现有技术中采用以下方法确定主、 备虚拟机的状态一致: 主、 备虚拟机接收相同的输入报文, 各自独立并行运 行处理该输入报文, 比较主、 备虚拟机的输出报文是否相同, 若主、 备虚拟 机的输出报文相同, 则认为主、 备虚拟机的状态一致, 选择主虚拟的输出报 文作为系统的输出, 若主、 备虚拟机的输出报文不相同, 则认为主备虚拟机 的状态不一致, 先将主、 备虚拟机的状态同歩, 再将主虚拟机的输出报文作 为系统的输出, 通过上述方法保证主、 备虚拟机的状态一致。 现有技术的方 法只能适用于基于报文协议的网络服务,并不适用于基于流协议的数据报文, 对于基于流协议的数据流来说, 经过虚拟机的协议栈处理后, 每条数据流中 包括的多个数据报文的长度可能不同, 因此, 无法直接比较输出数据流中的 报文。 现有技术中, 通过修改虚拟机协议栈的方式, 使得主、 备输出数据流的 每个报文长度相等, 因此, 能够直接比较主、 备输出数据流中的报文。 但是 修改主、 备虚拟机协议栈的方式, 一方面是破坏了标准协议, 另外在很多情 况下修改虚拟机内部实现是不实际的, 例如虚拟机和物理资源分属不同的商 业实体。 所以, 现有技术中, 不能很好地实现对基于流协议的虚拟机数据的 同歩。 发明内容 本发明实施例提供一种虚拟机数据的同歩方法和装置, 在不对虚拟机的 协议栈进行修改和定制化的情况下实现了对基于流协议的输出数据流的同 本发明第一方面提供一种虚拟机数据的同歩方法, 包括:
获取待同歩的主虚拟机的主输出数据流和备虚拟机的备输出数据流, 在同歩时间到达时, 按照数据流的顺序分别从所述主输出数据流和所述备 输出数据流中读取长度相等的比较数据进行比较, 确定所述主虚拟机的数 据与所述备虚拟机的数据是否同歩;
若所述主虚拟机的数据与所述备虚拟机的数据同歩, 则将所述主输出 数据流的比较数据或所述备输出数据流的比较数据作为输出结果输出; 若所述主虚拟机的数据与所述备虚拟机的数据不同歩, 则将所述主输 出数据流的比较数据和所述备输出数据流的比较数据进行同歩, 将所述同 歩后的比较数据作为输出结果输出。
结合本发明第一方面, 在本发明第一方面的第一种可能的实现方式 中, 所述按照数据流的顺序分别从所述主输出数据流和所述备输出数据流 中读取长度相等的比较数据进行比较, 确定所述主虚拟机的数据与所述备 虚拟机的数据是否同歩, 包括:
按照数据流的顺序分别从所述主输出数据流和所述备输出数据流中 读取长度相等的比较数据;
分别计算所述主输出数据流的比较数据的哈希值和所述备输出数据 流的比较数据的哈希值;
判断所述主输出数据流的比较数据的哈希值与所述备输出数据流的 比较数据的哈希值是否相同;
若所述主输出数据流的比较数据的哈希值与所述备输出数据流的比 较数据的哈希值相同, 则所述主虚拟机的数据与所述备虚拟机的数据同 歩, 若所述主输出数据流的比较数据的哈希值与所述备输出数据流的比较 数据的哈希值不相同, 则所述主虚拟机的数据与所述备虚拟机的数据不同 结合本发明第一方面, 在本发明第一方面的第二种可能的实现方式 中, 所述按照数据流的顺序分别从所述主输出数据流和所述备输出数据流 中读取长度相等的比较数据进行比较, 确定所述主虚拟机的数据与所述备 虚拟机的数据是否同歩, 包括:
按照数据流的顺序分别从所述主输出数据流和所述备输出数据流中 读取长度相等的比较数据;
根据所述主虚拟机的初始哈希值和所述主输出数据流的比较数据计 算所述主虚拟机的历史数据的哈希值, 以及根据所述备虚拟机的初始哈希 值和所述备输出数据流的比较数据计算所述备虚拟机的历史数据的哈希 值, 其中, 所述主虚拟机的初始哈希值为上次所述主虚拟机与所述备虚拟 机进行数据同歩后的哈希值, 所述备虚拟机的初始哈希值为上次所述主虚 拟机与所述备虚拟机进行数据同歩后的哈希值, 在每次所述主虚拟机与所 述备虚拟机进行数据同歩后所述主虚拟机的初始哈希值与所述备虚拟机 的初始哈希值相同;
判断所述主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据 的哈希值是否相同;
若所述主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据的 哈希值相同, 则所述主虚拟机的数据与所述备虚拟机的数据同歩, 若所述 主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据的哈希值不相 同, 则所述主虚拟机的数据与所述备虚拟机的数据不同歩。
结合本发明第一方面的第一种和第二种可能的实现方式, 在本发明第 一方面的第三种可能的实现方式中, 所述比较数据的长度为预先设置的, 则所述按照数据流的顺序分别从所述主输出数据流和所述备输出数据流 中读取长度相等的比较数据, 包括:
按照数据流的顺序分别从所述主输出数据流和所述备输出数据流中 读取预设长度的比较数据。
结合本发明第一方面的第一种和第二种可能的实现方式, 在本发明第 一方面的第四种可能的实现方式中, 所述按照数据流的顺序分别从所述主 输出数据流和所述备输出数据流中读取长度相等的比较数据, 包括: 将所述主虚拟机接收到的所述主输出数据流的数据作为所述主输出 数据流的比较数据, 确定所述主输出数据流的比较数据的长度;
按照数据流的顺序从所述备输出数据流中读取与所述主输出数据流 的比较数据长度相等的所述备输出数据流的比较数据。
结合本发明第一方面的第一种和第二种可能的实现方式, 在本发明第 一方面的第五种可能的实现方式中, 所述按照数据流的顺序分别从所述主 输出数据流和所述备输出数据流中读取长度相等的比较数据, 包括: 将所述备虚拟机接收到的所述备输出数据流的数据作为所述备输出 数据流的比较数据, 确定所述备输出数据流的比较数据的长度;
按照数据流的顺序从所述主输出数据流中读取与所述备输出数据流 的比较数据长度相等的所述主输出数据流的比较数据。
结合本发明第一方面的第二种可能的实现方式, 在本发明第一方面的 第六种可能的实现方式中, 在输出所述输出结果后, 所述方法还包括: 更新所述主虚拟机的初始哈希值和所述备虚拟机的初始哈希值。 结合本发明第一方面以及本发明第一方面的第一种至第六种可能的 实现方式, 在本发明第一方面的第七种可能的实现方式中, 所述获取待同 歩的主虚拟机的主输出数据流和备虚拟机的备输出数据流, 包括:
获取所述主虚拟机的多条输出数据流和所述备虚拟机的多条输出数 据流;
解析所述主虚拟机的所述多条输出数据流获取所述主虚拟机的每条 输出数据流的识别参数, 以及解析所述备虚拟机的所述多条输出数据流获 取所述备虚拟机的每条输出数据流的识别参数;
根据所述主虚拟机的每条输出数据流的识别参数和所述备虚拟机的 每条输出数据流的识别参数识别出待处理的所述主输出数据流和所述备 输出数据流。
结合本发明第一方面的第七种可能的实现方式, 在本发明第一方面的 第八种可能的实现方式中, 当所述主虚拟机的多条输出数据流和所述备虚 拟机的多条输出数据流为传输控制协议 TCP数据流时,所述识别参数为输 出数据流的五元组信息;
则所述根据所述主虚拟机的每条输出数据流的识别参数和所述备虚 拟机的每条输出数据流的识别参数识别出待处理的所述主输出数据流和 所述备输出数据流, 包括:
比较所述主虚拟机的每条输出数据流的五元组信息与所述备虚拟机 的每条数据流的五元组信息, 当所述主虚拟机的输出数据流的五元组信息 与所述备虚拟机的输出数据流的五元组信息相同时, 将所述主虚拟机的输 出数据流作为待同歩的所述主输出数据流, 将所述备虚拟机的输出数据流 作为待同歩的所述备输出数据流。
结合本发明第一方面以及本发明第一方面的第一种至第八种可能的 实现方式, 在本发明第一方面的第九种可能的实现方式中, 所述将所述主 输出数据流的比较数据和所述备输出数据流的比较数据进行同歩, 包括: 将所述备输出数据流的比较数据赋值给所述主输出数据流的比较数 据;
则所述将所述同歩后的比较数据作为输出结果输出, 包括:
将所述主输出数据流的比较数据作为输出结果输出。
结合本发明第一方面以及本发明第一方面的第一种至第八种可能的 实现方式, 在本发明第一方面的第十种可能的实现方式中, 所述将所述主 输出数据流的比较数据和所述备输出数据流的比较数据进行同歩, 包括: 将所述主输出数据流的比较数据赋值给所述备输出数据流的比较数 据;
贝 |J, 所述将所述同歩后的比较数据作为输出结果输出, 包括: 将所述备输出数据流的比较数据作为输出结果输出。
结合本发明第一方面, 在本发明第一方面的第十一种可能的实现方式 中, 所述获取待同歩的主虚拟机的主输出数据流和备虚拟机的备输出数据 流之前, 所述方法还包括:
接收输入数据流, 将所述输入数据流分发给所述主虚拟机和所述备虚 拟机, 以使所述主虚拟机和所述备虚拟机分别对所述输入数据流进行处 理, 得到输出数据流。
本发明第二方面提供一种虚拟机数据的同歩装置, 包括: 获取模块, 用于获取待同歩的主虚拟机的主输出数据流和备虚拟机的 备输出数据流;
比较模块, 用于在同歩时间到达时, 按照数据流的顺序分别从所述主 输出数据流和所述备输出数据流中读取长度相等的比较数据进行比较, 确 定所述主虚拟机的数据与所述备虚拟机的数据是否同歩;
输出模块, 用于若所述主虚拟机的数据与所述备虚拟机的数据同歩, 则将所述主输出数据流的比较数据或所述备输出数据流的比较数据作为 输出结果输出;
同歩模块, 用于若所述主虚拟机的数据与所述备虚拟机的数据不同 歩, 则将所述主输出数据流的比较数据和所述备输出数据流的比较数据进 行同歩;
所述输出模块还用于: 将所述同歩后的比较数据作为输出结果输出。 结合本发明第二方面, 在本发明第一方面的第一种可能的实现方式 中, 所述比较模块包括:
读取单元, 用于按照数据流的顺序分别从所述主输出数据流和所述备 输出数据流中读取长度相等的比较数据;
计算单元, 用于分别计算所述主输出数据流的比较数据的哈希值和所 述备输出数据流的比较数据的哈希值;
判断单元, 用于判断所述主输出数据流的比较数据的哈希值与所述备 输出数据流的比较数据的哈希值是否相同, 若所述主输出数据流的比较数 据的哈希值与所述备输出数据流的比较数据的哈希值相同, 则所述主虚拟 机的数据与所述备虚拟机的数据同歩, 若所述主输出数据流的比较数据的 哈希值与所述备输出数据流的比较数据的哈希值不相同, 则所述主虚拟机 的数据与所述备虚拟机的数据不同歩。
结合本发明第二方面, 在本发明第二方面的第二种可能的实现方式 中, 所述比较模块包括:
读取单元, 用于按照数据流的顺序分别从所述主输出数据流和所述备 输出数据流中读取长度相等的比较数据;
计算单元, 用于根据所述主虚拟机的初始哈希值和所述主输出数据流 的比较数据计算所述主虚拟机的历史数据的哈希值, 以及根据所述备虚拟 机的初始哈希值和所述备输出数据流的比较数据计算所述备虚拟机的历 史数据的哈希值, 其中, 所述主虚拟机的初始哈希值为上次所述主虚拟机 与所述备虚拟机进行数据同歩后的哈希值, 所述备虚拟机的初始哈希值为 上次所述主虚拟机与所述备虚拟机进行数据同歩后的哈希值, 在每次所述 主虚拟机与所述备虚拟机进行数据同歩后所述主虚拟机的初始哈希值与 所述备虚拟机的初始哈希值相同;
判断单元, 用于判断所述主虚拟机的历史数据的哈希值与所述备虚拟 机的历史数据的哈希值是否相同, 若所述主虚拟机的历史数据的哈希值与 所述备虚拟机的历史数据的哈希值相同, 则所述主虚拟机的数据与所述备 虚拟机的数据同歩, 若所述主虚拟机的历史数据的哈希值与所述备虚拟机 的历史数据的哈希值不相同, 则所述主虚拟机的数据与所述备虚拟机的数 据不同歩。
结合本发明第二方面的第一种和第二种可能的实现方式, 在本发明第 二方面的第三种可能的实现方式中, 所述比较数据的长度为预先设置的, 则所述读取单元具体用于:
按照数据流的顺序分别从所述主输出数据流和所述备输出数据流中 读取预设长度的比较数据。
结合本发明第二方面的第一种和第二种可能的实现方式, 在本发明第 二方面的第四种可能的实现方式中, 所述读取单元具体用于:
将所述主虚拟机接收到的所述主输出数据流的数据作为所述主输出 数据流的比较数据, 确定所述主输出数据流的比较数据的长度;
按照数据流的顺序从所述备输出数据流中读取与所述主输出数据流 的比较数据长度相等的所述备输出数据流的比较数据。
结合本发明第二方面的第一种和第二种可能的实现方式, 在本发明第 二方面的第五种可能的实现方式中, 所述读取单元具体用于:
将所述备虚拟机接收到的所述备输出数据流的数据作为所述备输出 数据流的比较数据, 确定所述备输出数据流的比较数据的长度;
按照数据流的顺序从所述主输出数据流中读取与所述备输出数据流 的比较数据长度相等的所述主输出数据流的比较数据。
结合本发明第二方面的第二种可能的实现方式, 在本发明第二方面的 第六种可能的实现方式中, 还包括:
更新模块, 用于更新所述主虚拟机的初始哈希值和所述备虚拟机的初 始哈希值。
结合本发明第二方面以及本发明第二方面的第一种至第六种可能的 实现方式, 在本发明第二方面的第七种可能的实现方式中, 所述获取模块 包括:
获取单元, 用于获取所述主虚拟机的多条输出数据流和所述备虚拟机 的多条输出数据流;
解析单元, 用于解析所述主虚拟机的所述多条输出数据流获取所述主 虚拟机的每条输出数据流的识别参数, 以及解析所述备虚拟机的所述多条 输出数据流获取所述备虚拟机的每条输出数据流的识别参数;
识别单元, 用于根据所述主虚拟机的每条输出数据流的识别参数和所 述备虚拟机的每条输出数据流的识别参数识别出待处理的所述主输出数 据流和所述备输出数据流。
结合本发明第二方面的第七种可能的实现方式, 在本发明第二方面的 第八种可能的实现方式中, 当所述主虚拟机的多条输出数据流和所述备虚 拟机的多条输出数据流为传输控制协议 TCP数据流时,所述识别参数为输 出数据流的五元组信息;
则所述识别单元具体用于:
比较所述主虚拟机的每条输出数据流的五元组信息与所述备虚拟机 的每条数据流的五元组信息, 当所述主虚拟机的输出数据流的五元组信息 与所述备虚拟机的输出数据流的五元组信息相同时, 将所述主虚拟机的输 出数据流作为待同歩的所述主输出数据流, 将所述备虚拟机的输出数据流 作为待同歩的所述备输出数据流。
结合本发明第二方面以及本发明第二方面的第一种至第八种可能的 实现方式, 在本发明第二方面的第九种可能的实现方式中, 所述同歩模块 具体用于:
将所述备输出数据流的比较数据赋值给所述主输出数据流的比较数 据;
则所述输出模块具体用于: 将所述主输出数据流的比较数据作为输出结果输出。
结合本发明第二方面以及本发明第二方面的第一种至第八种可能的 实现方式, 在本发明第二方面的第十种可能的实现方式中, 所述同歩模块 具体用于:
将所述主输出数据流的比较数据赋值给所述备输出数据流的比较数 据;
则所述输出模块具体用于:
将所述备输出数据流的比较数据作为输出结果输出。
结合本发明第二方面, 在本发明第二方面的第十一种可能的实现方式 中, 还包括:
输入模块, 用于接收输入数据流, 将所述输入数据流分发给所述主虚 拟机和所述备虚拟机, 以使所述主虚拟机和所述备虚拟机分别对所述输入 数据流进行处理, 得到输出数据流。
本发明第三方面提供一种虚拟机数据的同歩装置, 包括:
处理器、 存储器和系统总线, 所述处理器和所述存储器之间通过所述 系统总线连接并完成相互间的通信;
所述存储器, 用于存储计算机执行指令;
所述处理器, 用于运行所述计算机执行指令, 使所述同歩装置执行如 本发明第一方面以及本发明第一方面的第一种至第十一种可能的实现方 式提供的任一所述的方法。
本发明实施例提供虚拟机数据的同歩方法和装置, 虚拟机数据的同歩装 置通过在同歩时间到达时, 按照数据流的顺序分别从主输出数据流和备输 出数据流中读取长度相等的比较数据进行比较, 确定主虚拟机的数据与备 虚拟机的数据是否同歩, 若同歩则不执行同歩操作, 直接输出结果, 若不 同歩,则先将主虚拟机的数据和备虚拟机的数据进行同歩,然后输出结果。 上述方法中, 通过从主输出数据流和备输出数据流中读取长度相等的比较 数据进行比较, 实现了对主、 备虚拟机的输出数据流直接进行比较, 不需 要对虚拟机的协议栈进行修改和定制化。 并且, 只在主输出数据流的比较 数据与备输出数据流的比较数据不相等时, 才进行数据同歩, 减少了同歩 次数, 减轻了数据同歩引起的系统性能降级。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对 实施例或现有技术描述中所需要使用的附图作一简单地介绍, 显而易见 地, 下面描述中的附图是本发明的一些实施例, 对于本领域普通技术人员 来讲, 在不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的 附图。
图 1为本发明实施例所适用的一种系统架构示意图;
图 2为本发明实施例所适用的另一种系统架构的示意图;
图 3为本发明实施例一提供的虚拟机数据的同歩方法的流程图; 图 4为一种主输出数据流和备输出数据流的示意图;
图 5为本发明实施例二提供的虚拟机数据的同歩方法的流程图; 图 6为另一种主输出数据流和备输出数据流的示意图;
图 7为本发明实施例三提供的虚拟机数据的同歩方法的流程图; 图 8为又一种主输出数据流和备输出数据流的示意图;
图 9为本发明实施例四提供的虚拟机数据的同歩装置的结构示意图; 图 10为本发明实施例五提供的虚拟机数据的同歩装置的结构示意图; 图 11为本发明实施例六提供的虚拟机数据的同歩装置的结构示意图。 具体实施方式 为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本 发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描 述, 显然,所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提 下所获得的所有其他实施例, 都属于本发明保护的范围。
本发明各实施例中采用主虚拟机和备虚拟机构成系统对外提供服务, 主虚拟机和备虚拟机的初始配置完全相同。 为了实现虚拟机和备虚拟机在 切换时服务不间断, 需要保证主虚拟机和备虚拟机的全部状态一致, 这些状 态包括: 内部状态和输出数据的状态, 内部状态主要包括: CPU状态、 内存 状态等设备状态和软件状态, 输出数据的状态一致即对相同的输入数据处理 后输出的数据需要保持一致。 主虚拟机和备虚拟机的内部状态的同歩为现有 技术, 这里不做过多的描述, 本实施例主要介绍主虚拟机和备虚拟机的输出 数据的同歩。
本发明实施例中, 虚拟机数据同歩装置接收到输入数据流后, 将输入 数据流复制为两份, 分别提交给主虚拟机和备虚拟机独立并行处理。 在主 虚拟机健康正常工作时, 由主虚拟机对系统外部提供服务, 将主虚拟机的 输出结果作为系统输出; 在主虚拟机发生故障时, 由备虚拟机对系统外部 提供服务, 将备虚拟机的输出结果作为系统输出。 为了保证主虚拟机和备 虚拟机切换时服务不中断, 本发明实施例中采用比较主虚拟机和备虚拟机 输出数据流的方式, 适时同歩主虚拟机和备虚拟机的数据, 保证在切换时 主虚拟机和备虚拟机的数据一致。 本实施例中的, 主虚拟机和备虚拟机是 相对的, 不应看作绝对的虚拟机角色分配, 比如对某些客户端来说虚拟机 A是主虚拟机, 虚拟机 B是备虚拟机, 而对另外一些客户端来说虚拟机 A 是备虚拟机, 虚拟机 B是主虚拟机。 另外, 一个主虚拟机可以有多个备虚 拟机, 本发明实施例并不对主虚拟机对应的备虚拟机的个数进行限制, 为 了描述方便以下各实施例中都以一个备虚拟机为例进行说明。
本发明各实施例的方法由虚拟机数据的同歩装置执行, 该虚拟机数据 的同歩装置可以作为一个独立的设备实现, 如图 1所示, 图 1为本发明实 施例所适用的一种系统架构示意图, 主虚拟机 11和备虚拟机 21分别位于 两个不同的物理服务器 100和服务器 200中, 本领域技术人员可以理解的 是, 主虚拟机 11和备虚拟机 21也可以位于同一个物理服务器上, 主虚拟 机 11和备虚拟机 21的输出数据流分别发送到虚拟机数据的同歩装置 300, 由虚拟机数据的同歩装置 300从主输出数据流和备输出数据流中读取长度 相等的比较数据进行比较, 确定主虚拟机 11的数据与备虚拟机 21的数据 是否同歩。 虚拟机数据的同歩装置 300也可以集成在其他网络设备中, 例 如交换机中。
图 2为本发明实施例所适用的另一种系统架构的示意图,如图 2所示, 主虚拟机 41和备虚拟机 51分别位于两个不同的物理服务器 400和服务器 500中, 虚拟机数据的同歩装置 600由服务器 400上的虚拟机监视器
( Hypervisor)42和服务器 500上的虚拟机监视器 52以分布式的方式实现, 现有技术中, Hypervisor通常用来分配、 管理和调度计算机的物理资源, 通过封装或者模拟物理硬件来提供多个完整的虚拟计算机资源。 本发明实 施例的方案中, 主虚拟机 41的虚拟机监视器 42和备虚拟机 51的虚拟机 监视器 52分别独立的从主输出数据流和备输出数据流中读取长度相等的 比较数据进行哈希运算, 然后, 虚拟机监视器 52将哈希计算结果发送给 虚拟机监视器 42, 由虚拟机监视器 42根据哈希计算结果确定主虚拟机 41 的数据与所述备虚拟机 51的数据是否同歩。 或者, 虚拟机监视器 42将哈 希计算结果发送给虚拟机监视器 52, 由虚拟机监视器 52根据哈希计算结 果确定主虚拟机 41的数据与备虚拟机 51的数据是否同歩。在上述两种架 构中, 虚拟机数据同歩装置可以以硬件的方式实现, 或者以软件的方式实 现, 或者软硬件结合的方式实现。
图 3为本发明实施例一提供的虚拟机数据的同歩方法的流程图, 本实 施例的方法由虚拟机数据同歩装置执行, 如图 3所示, 本实施例的方法可 以包括以下歩骤:
歩骤 101、 获取待同歩的主虚拟机的主输出数据流和备虚拟机的备输 出数据流, 在同歩时间到达时, 按照数据流的顺序分别从主输出数据流和 备输出数据流中读取长度相等的比较数据进行比较, 确定主虚拟机的数据 与备虚拟机的数据是否同歩。
主输出数据流和备输出数据流可以是任何基于流协议的数据, 例如传 输控制协议 (Transmission Control Protocol, 简称 TCP ) 或实时传输协议 ( Real-time Transport Protocol, 简称 RTP) 。 主虚拟机和备虚拟机可能输 出多条输出数据流, 这些输出数据流中有些是互为主备关系, 而有些是独 立的输出数据流, 因此, 需要识别出互为主备关系的输出数据流。具体地: 首先, 获取主虚拟机的多条输出数据流和备虚拟机的多条输出数据流; 然 后, 解析主虚拟的多条输出数据流获取主虚拟机的每条输出数据流的识别 参数, 以及解析备虚拟机的多条输出数据流获取备虚拟机的每条输出数据 流的识别参数; 最后, 根据主虚拟机的每条输出数据流的识别参数和备虚 拟机的每条输出数据流的识别参数识别出待处理的主输出数据流和备输 出数据流。
解析输出数据流可以获得每条输出数据流的包头信息, 可以将输出数 据流的包头信息中的某些参数作为识别参数, 例如, 当主虚拟机的多条输 出数据流和备虚拟机的多条输出数据流为 TCP数据流时,可以将输出数据 流的五元组信息作为识别参数, 五元组信息具体为: 源网络互联协议
( Internet Protocol, 简称 IP ) 地址, 源端口, 目的 IP地址, 目的端口, 和传输层协议号。
根据识别参数识别主输出数据流和备输出数据流, 具体为: 将主虚拟 机的每条输出数据流的识别参数和备虚拟机的每条输出数据流的识别参 数进行比较, 当主虚拟机的某一条输出数据流的识别参数与备虚拟机的某 一条输出数据流的识别参数相同时, 则将主虚拟机的该条输出数据流作为 主输出数据流, 将与主虚拟机的该条输出数据流的识别参数相等的备虚拟 机的输出数据流作为备输出数据流。 以 TCP数据流为例, 比较虚拟机的每 条输出数据流的五元组信息与备虚拟机的每条数据流的五元组信息, 当主 虚拟机的输出数据流的五元组信息与备虚拟机的输出数据流的五元组信 息相同时, 将主虚拟机的输出数据流作为待处理同歩的主输出数据流, 将 备虚拟机的输出数据流作为待处理同歩的备输出数据流。
在获取主输出数据流和备输出数据流之后, 当同歩时间到达时, 按照 数据流的顺序分别从主输出数据流和备输出数据流中读取长度相等的比 较数据进行比较, 从主输出数据流中读取的比较数据称为主输出数据流的 比较数据, 从备输出数据流中读取的比较数据称为备输出数据流的比较数 据。 当主输出数据流的比较数据与备输出数据流的比较数据相同时, 则确 定主虚拟机的数据与备虚拟机的数据同歩, 当主输出数据流的比较数据与 备输出数据流的比较数据不相同时, 则确定主虚拟机的数据与备虚拟机的 数据不同歩。 当主虚拟机的数据与备虚拟机的数据同歩时, 执行歩骤 102, 当主虚拟机的数据与备虚拟机的数据不同歩时, 执行歩骤 103。 本专利中 所说的按照数据流的顺序读取比较数据, 是指按照该数据流中报文的先后 顺序来读取顺序。
基于报文协议的数据是保护边界的, 即传输协议把数据当作一条独立 的消息在网上传输, 接收端只能接收独立的消息, 也就是说存在保护消息 边界, 接收端一次只能接收发送端发出的一个数据报文。 对于基于流协议 的数据流来说, 是不保护消息边界的, 发送端连续发送数据, 接收端有可 能在一次接收动作中, 会接收两个或者更多的数据报文, 而且每个数据报 文的长度可能不相同。 对于主虚拟机和备虚拟机来说, 在对相同的输入数 据流进行处理后, 主虚拟机和备虚拟机在同一时刻输出的输出数据流的长 度可能不同, 主输出数据流中可能包括两个报文, 而备输出数据流中可能 包括三个报文, 并且每个报文的长度可能不同, 因此, 不能直接将主虚拟 机输出的报文与备虚拟机输出的报文进行比较。 本实施例中, 从主输出数 据流中和备输出数据流中读取长度相等的比较数据进行比较, 从而保证比 较粒度相同。
在确定主虚拟机的数据与备虚拟机的数据是否同歩时, 可以有多种方 法, 以下将列举两种常用的方法:
第一种方法, 首先, 按照数据流的顺序分别从主输出数据流和备输出 数据流中读取长度相等的比较数据; 然后, 分别计算主输出数据流的比较 数据的哈希值和备输出数据流的比较数据的哈希值; 最后, 判断主输出数 据流的比较数据的哈希值与备输出数据流的比较数据的哈希值是否相同。 若主输出数据流的比较数据的哈希值与备输出数据流的比较数据的哈希 值相同, 则说明主输出数据流的比较数据与备输出数据流的比较数据相 同, 那么主虚拟机的数据与备虚拟机的数据同歩, 若主输出数据流的比较 数据的哈希值与备输出数据流的比较数据的哈希值不相同, 说明主输出数 据流的比较数据与备输出数据流的比较数据不相同, 那么主虚拟机的数据 与备虚拟机的数据不同歩。
第二种方法, 首先, 按照数据流的顺序分别从主输出数据流和备输出 数据流中读取长度相等的比较数据; 然后, 根据主虚拟机的初始哈希值和 主输出数据流的比较数据计算主虚拟机的历史数据的哈希值, 以及根据备 虚拟机的初始哈希值和备输出数据流的比较数据计算备虚拟机的历史数 据的哈希值, 其中, 主虚拟机的初始哈希值为上次主虚拟机和备虚拟机进 行数据同歩后的哈希值, 备虚拟机的初始哈希值为上次主虚拟机和备虚拟 机进行数据同歩后的哈希值, 在每次主虚拟机和备虚拟机进行数据同歩后 主虚拟机的初始哈希值与备虚拟机的初始哈希值相同; 最后, 判断主虚拟 机的历史数据的哈希值与备虚拟机的历史数据的哈希值是否相同。 若主虚 拟机的历史数据的哈希值与备虚拟机的历史数据的哈希值相同, 说明主输 出数据流的比较数据与备输出数据流的比较数据相同, 那么主虚拟机的数 据与备虚拟机的数据同歩, 若主虚拟机的历史数据的哈希值与备虚拟机的 历史数据的哈希值不相同, 说明主输出数据流的比较数据与备输出数据流 的比较数据不相同, 那么主虚拟机的数据与备虚拟机的数据不同歩。
第一种方法中, 通过比较主输出数据流的比较数据的哈希值和备输出 数据流的比较数据的哈希值, 确定主虚拟机的数据与备虚拟机的数据是否 同歩,第二种方法中,根据初始哈希值和比较数据计算历史数据的哈希值, 比较主虚拟机的历史数据的哈希值和备虚拟机的历史数据的哈希值, 这里 历史数据指本次同歩之前的所有数据与本次同歩的比较数据之和。
需说明的是, 在第二种方式中, 哈希算法应该满足以下条件: h H^ ^h h H^P^P , 其中, HQ表示初始哈希值, Pl , p2分别表示两个 报文, #表示顺序拼接两个报文。 举例说明哈希计算的效果: 图 4为一种 主输出数据流和备输出数据流的示意图, 如图 4所示, 主虚拟机的输出的 主输出数据流与备虚拟机输出的备输出数据流的数据总量和内容完全一 致, 但是主输出数据流和备输出数据流包括的报文个数和报文长度不相 同。 图 4中, 主输出数据流包含三个报文: Ρι、 ρ^Π ρ3, 备输出数据流包 含两个报文: 和 , 主输出数据流和备输出数据流包含的数据内容相同 均为 ABCDEFGH, 主输出数据流中报文 Pl包含 ABC, 报文 p2包含 DE, 报 文 包含 FGH, 备输出数据流中报文 ¾包含 ABCD, 报文 r2包含 EFGH。
假设 tl时刻主虚拟机和备虚拟机的初始哈希值相等均为 , 则在 t2时 亥 IJ , 主虚拟机的历史数据的哈希值 =1 (1 (1 (^^ ) ,p2) ,p3), 备虚拟机的历 史数据的哈希值^^^!^, ri,),r2), 由哈希算法的特性容易证明
Η^Η Η,,ρ^ρ^ρ^ΐ!^,!^!· ), 即正确判断出主虚拟机的历史数据和备虚 拟机的历史数据是一致的。
歩骤 102、 将主输出数据流的比较数据或备输出数据流的比较数据作 为输出结果输出。
当主虚拟机的数据与备虚拟机的数据同歩时, 执行本歩骤, 将主输出 数据流的比较数据或备输出数据流的比较数据作为输出结果输出。
歩骤 103、 将主输出数据流的比较数据和备输出数据流的比较数据进 行同歩, 将同歩后的比较数据作为输出结果输出。 当主虚拟机的数据与备虚拟机的数据不同歩时, 执行本歩骤。 在将主 输出数据流的比较数据和备输出数据流的比较数据进行同歩时, 具体可以 为: 将备输出数据流的比较数据赋值给主输出数据流的比较数据, 或者, 将主输出数据流的比较数据赋值给备输出数据流的比较数据。 若将备输出 数据流的比较数据赋值给主输出数据流的比较数据, 那么将同歩后的比较 数据作为输出结果输出, 具体为: 将主输出数据流的比较数据作为输出结 果输出。 若将主输出数据流的比较数据赋值给备输出数据流的比较数据, 那么将同歩后的比较数据作为输出结果输出, 具体为: 将备输出数据流的 比较数据作为输出结果输出。
本实施例中, 在同歩时间到达时, 按照数据流的顺序分别从主输出数 据流和备输出数据流中读取长度相等的比较数据进行比较, 确定主虚拟机 的数据与备虚拟机的数据是否同歩, 若主虚拟机的数据与备虚拟机的数据 同歩, 则不执行同歩操作, 直接将主输出数据流的比较数据或备输出数据 流的比较数据作为输出结果输出, 若主输出数据流的数据与备输出数据流 的数据不同歩, 则先将主虚拟机的数据和备虚拟机的数据进行同歩, 将同 歩后的比较数据作为输出结果输出。 上述方法中, 通过从主输出数据流和 备输出数据流中读取长度相等的比较数据进行比较, 实现了对主、 备虚拟 机的输出数据流直接进行比较, 不需要对虚拟机的协议栈进行修改和定制 化。 并且, 只在主输出数据流的比较数据与备输出数据流的比较数据不相 等时, 才进行数据同歩, 减少了同歩次数, 减轻了保持主虚拟机和备虚拟 机数据同歩引起的系统性能降级。
在实施例一中, 执行歩骤 101之前, 虚拟机数据同歩装置还要执行以 下操作: 接收输入数据流, 将输入数据流分发给主虚拟机和备虚拟机, 以 使主虚拟机和备虚拟机分别对输入数据流进行处理, 得到输出数据流。
本发明实施例中的, 输入数据流和虚拟机数据同歩装置将接收到的输 入数据流复制为两份, 分别提交给主虚拟机和备虚拟机, 保证主虚拟机和 备虚拟机的输入数据流相同, 主虚拟机和备虚拟机各自独立运行, 对输入 数据流进行处理, 然后, 主虚拟机和备虚拟机分别输出各自处理后的输出 数据流。
下面采用几个具体的实施例, 对实施例一的技术方案进行详细说明。 本发明实施例二对实施例一中歩骤 101进行详细说明, 本实施例中, 比较数据的长度为预先设置的, 所述按照数据流的顺序分别从主输出数据 流和备输出数据流中读取长度相等的比较数据, 具体为: 按照数据流的顺 序分别从主输出数据流和备输出数据流中读取预设长度的比较数据。 并 且, 在确定主输出数据流的比较数据与备输出数据流的比较数据是否相等 时, 通过计算主虚拟机和备虚拟机的历史数据的哈希值确定。 图 5为本发 明实施例二提供的虚拟机数据的同歩方法的流程图, 如图 5所示, 本实施 例的方法可以包括以下歩骤:
歩骤 201、 按照数据流的顺序分别从主输出数据流和备输出数据流中 读取预设长度的比较数据。
歩骤 202、 根据主虚拟机的初始哈希值和主输出数据流的比较数据计 算主虚拟机的历史数据的哈希值, 以及根据备虚拟机的初始哈希值和备输 出数据流的比较数据计算备虚拟机的历史数据的哈希值。
其中, 主虚拟机的初始哈希值为上次主虚拟机和备虚拟机进行数据同 歩后的哈希值, 备虚拟机的初始哈希值为上次主虚拟机和备虚拟机进行数 据同歩后的哈希值, 在每次主虚拟机和备虚拟机进行数据同歩后所述主虚 拟机的初始哈希值与所述备虚拟机的初始哈希值相同, 因此, 主虚拟机的 初始哈希值和备虚拟机的初始哈希值相同。
歩骤 203、 判断主虚拟机的历史数据的哈希值与备虚拟机的历史数据 的哈希值是否相同。
若主虚拟机的历史数据的哈希值与备虚拟机的历史数据的哈希值相 同, 则执行歩骤 204, 若主虚拟机的历史数据的哈希值与备虚拟机的历史 数据的哈希值不相同, 则执行歩骤 205。
歩骤 204、 确定主虚拟机的数据与备虚拟机的数据同歩。
歩骤 205、 确定主虚拟机的数据与备虚拟机的数据不同歩。
以下通过具体的例子说明, 如图 6所示, 图 6为另一种主输出数据流 和备输出数据流的示意图, 图 6中的主输出数据流和备输出数据流为 TCP 数据流, 在 TCP 流发送前需要通过三次握手建立一个 TCP 连接, SYN ( synchronous ) 报文是 TCP连接建立后发送的第一个报文, SYN报文非 常短, 在 SYN报文之后开始发送用户数据报文。 本实施例中, 假设主虚 拟机和备初始哈希值均为 H。, 比较数据的预设长度为 512字节 (Bite ) , 除 SYN报文外, 每隔 512字节计算一次。
如图 6所示, 在 时刻并行地计算备虚拟机的历史数据的哈希值
H;=h(HQ,备 SYN)和主虚拟机的历史数据的哈希值 ,主 SYN) , HQ为主虚 拟机和备虚拟机在 时刻的初始哈希值, 并比较 Η Π Η;是否相同, 若 和 相同, 则将主 SYN报文或备 SYN报文作为输出结果输出, 若 Η Π Η;不 相同, 则将主 SYN赋值给备 SYN, 或将备 SYN赋值给主 SYN, 实现主 虚拟机的数据和备虚拟机的数据同歩, 然后, 将主 SYN报文或备 SYN报 文作为输出结果输出。
^时刻继续并行地计算备虚拟机的历史数据的哈希值
H2=h(H;,b^512字节)和主虚拟机的历史数据的哈希值 Η^ΜΗ,,ρ,),其中, Η;为 备虚拟机在 t2时刻的初始哈希值, 为主虚拟机在 t2时刻的初始哈希值, H|=Hl 0本实施例中, 比较数据的预设长度为 512字节, 因此, 在计算 ^时 读取主输出数据流的!^报文的前 512字节, 在计算 H2时也要读取备输出数 据流的 512字节, Pl报文的长度刚好为 512字节,在计算得到 和 之后, 比较 和 是否相同, 若 和 相同, 则将报文^或报文 的前 512字 节作为输出结果输出, 若 和 不相同, 则将报文^赋值给 的前 512字 节, 或将 的前 512字节赋值给报文^,的 hash值, 实现主虚拟机的数据 和备虚拟机的数据同歩, 然后, 将报文 或1^的前 512字节作为输出结果 输出。
t3时刻备虚拟机的历史数据的哈希值为!!^^!^,!^^^^字节), 主虚拟机 的历史数据的哈希值为 =1 ( ^2# 前384字节),其中, H2为主虚拟机在 13时 刻的初始哈希值, H2为备虚拟机在 t3时刻的初始哈希值, H2=H2, #表示拼 接操作, 22# 前 384字节表示将报文22和报文 p3的前 384字节拼接在一起。 在计算得到 和 之后, 比较 和 是否相同, 若 和 相同, 则直接 输出结果, 若 和 不相同, 则先同歩然后输出结果, 用同样的方式继续 处理后续输出数据流。
本实施例中, 将 SYN报文单独出来计算虚拟机的历史数据的哈希值, 当然也可以将 SYN报文和用户数据报文一起作为输出数据流计算虚拟机 的历史数据的哈希值。 另外, 本实施例中, 每次同歩时采用的比较数据的 预设长度都相同, 可选地, 每次同歩采用的比较数据的预设长度也可以不 同, 例如, 在 ^时刻预设长度为 512字节, 在^时刻的预设长度为 256字 节, t3时刻的预设长度为 1024字节。
本发明实施例三对实施例一中歩骤 101进行详细说明, 本实施例中, 比较数据的长度为实时确定的, 共有以下两种确定方式:
第一种方式, 将主虚拟机接收到的主输出数据流的数据作为比较数 据, 确定主输出数据流的比较数据的长度; 然后, 按照数据流的顺序从备 输出数据流中读取与所述主输出数据流的比较数据长度相等的备输出数 据流的比较数据。
第二种方式, 将备虚拟机接收到的备输出数据流的数据作为比较数 据, 确定备输出数据流的比较数据的长度; 然后, 按照数据流的顺序从主 输出数据流中读取与备输出数据流的比较数据长度相等的主输出数据流 的比较数据。
本实施例中, 以上述第二种方式为例进行说明, 并且, 在确定主输出 数据流的比较数据与备输出数据流的比较数据是否相等时, 通过计算主虚 拟机和备虚拟机的历史数据的哈希值确定。 图 7为本发明实施例三提供的 虚拟机数据的同歩方法的流程图, 如图 7所示, 本实施例的方法可以包括 以下歩骤:
歩骤 301、 将备虚拟机接收到的备输出数据流的数据作为备输出数据 流的比较数据, 确定备输出数据流的比较数据的长度。
歩骤 302、 按照数据流的顺序从主输出数据流中读取与备虚拟机的比 较数据长度相等的主输出数据流的比较数据。
歩骤 303、 根据主虚拟机的初始哈希值和主输出数据流的比较数据计 算主虚拟机的历史数据的哈希值, 以及根据备虚拟机的初始哈希值和备输 出数据流的比较数据计算备虚拟机的历史数据的哈希值。
其中, 主虚拟机的初始哈希值为上次主虚拟机和备虚拟机进行数据同 歩后的哈希值, 备虚拟机的初始哈希值为上次主虚拟机和备虚拟机进行数 据同歩后的哈希值, 在每次主虚拟机和备虚拟机进行数据同歩后所述主虚 拟机的初始哈希值与所述备虚拟机的初始哈希值相同, 因此, 主虚拟机的 初始哈希值和备虚拟机的初始哈希值相同。 歩骤 304、 判断主虚拟机的历史数据的哈希值与备虚拟机的历史数据 的哈希值是否相同。
若主虚拟机的历史数据的哈希值与备虚拟机的历史数据的哈希值相 同, 则执行歩骤 305, 若主虚拟机的历史数据的哈希值与备虚拟机的历史 数据的哈希值不相同, 则执行歩骤 306。
歩骤 305、 确定主虚拟机的数据与备虚拟机的数据同歩。
歩骤 306、 确定主虚拟机的数据与备虚拟机的数据不同歩。
以下通过具体的例子说明, 如图 8所示, 图 8为又一种主输出数据流 和备输出数据流的示意图, 在 时刻并行地计算备虚拟机的历史数据的哈 希值 H;=h(HQ,备 SYN)和主虚拟机的历史数据的哈希值 ,主 SYN), HQ主 虚拟机和备虚拟机在 时刻的初始哈希值, 然后, 比较 Η Π Η;是否相同, 根据比较结果进行数据同歩或直接输出结果。
12时刻首先计算备虚拟机的历史数据的哈希值 H^IKH ,) , 为备虚拟 机在 t2时刻的初始哈希值, 为备虚拟机在 tl时刻到 t2时刻内接收到的数 据, 将备虚拟机在 tl时刻到 t2时刻内接收到的数据作为备输出数据的比较 数据, !^的长度为 1024字节, 然后, 根据备输出数据流的比较数据的长 度(1024字节)计算主虚拟机的历史数据的哈希值, 主输出数据流的比较 数据包括报文 Pl , p2以及 的前半部分总共 1024字节数据, 主虚拟机的历 史数据的哈希值^=1^1^ 2# 前384字节), 为主虚拟机在 t2时刻的初始哈 希值, H;=Hl, 比较 Η^Π Η2是否相同, 根据比较结果进行数据同歩或直接 输出结果。
t3时刻先计算备虚拟机的历史数据的哈希值 H3=h(H2,b2), 为备虚拟 机的初始哈希值, 报文 b2为备虚拟机从 t2时刻到 t3时刻内接收到比较数据, 报文!^的长度为 1440字节, 然后, 根据备虚拟机已经计算长度的长度计 算主虚拟机的历史数据的哈希值, 主输出数据流的比较数据包括报文 的 后半部分和报文 P4, 因此, 主虚拟机的历史数据的哈希值
H3=h(H2,p^384字节 #p4), H2为主虚拟机的初始哈希值, H2=H2,比较 H;和 H3是 否相同, 根据比较结果进行数据同歩或直接输出结果。
用同样的方式处理后续输出数据流, 本实施例中, 在第二种方式中, 将上次同歩时间到本次同歩时间内备虚拟机接收到的数据的作为备输出 数据流的比较数据, 然后, 从主输出数据流中读取相等长度的数据作为主 输出数据流的比较数据。 若主虚拟机在本次同歩时间到达时接收到的数据 总量小于备虚拟机的接收到的比较数据的长度, 那么, 在计算主虚拟机的 历史数据的哈希值时, 可以有多少数据计算多少, 但是, 在计算完成之后, 并不直接将主虚拟机的计算结果与备虚拟机的历史数据的哈希值进行比 较, 而是等待接收到相等长度的数据, 计算等量的比较数据之后, 再比较 主虚拟机的历史数据的哈希值与备虚拟机的历史数据的哈希值。
同理, 在第一种方式中, 将上次同歩时间到本次同歩时间内主虚拟机 接收到的数据的主输出数据流的比较数据, 然后, 从备输出数据流中读取 相等长度的数据作为备输出数据流的比较数据。 若备虚拟机在本次同歩时 间到达时接收到的数据总量小于主输出数据流的比较数据的长度, 那么, 在计算备虚拟机的历史数据的哈希值时,可以有多少数据计算多少,但是, 在计算完成之后, 并不直接将备虚拟机的计算结果与主虚拟机的历史数据 的哈希值进行比较, 而是等待接收到相等长度的数据, 计算等量的比较数 据之后, 再比较主虚拟机的历史数据的哈希值与备虚拟机的历史数据的哈 希值。
实施例二和实施例三中, 在输出结果后, 还需要更新主虚拟机的初始 哈希值和备虚拟机的初始哈希值, 每次更新后主虚拟机的哈希值和备虚拟 机的哈希值相同。
图 9为本发明实施例四提供的虚拟机数据的同歩装置的结构示意图,如 图 9所示, 本实施提供的虚拟机数据的同歩装置可以包括: 获取模块 61、 比 较模块 62、 同歩模块 63和输出模块 64。
其中, 获取模块 61, 用于获取待同歩的主虚拟机的主输出数据流和备 虚拟机的备输出数据流;
比较模块 62, 用于在同歩时间到达时, 按照数据流的顺序分别从所述 主输出数据流和所述备输出数据流中读取长度相等的比较数据进行比较, 确定所述主虚拟机的数据与所述备虚拟机的数据是否同歩;
输出模块 64, 用于若所述主虚拟机的数据与所述备虚拟机的数据同 歩, 则将所述主输出数据流的比较数据或所述备输出数据流的比较数据作 为输出结果输出; 同歩模块 63,用于若所述主虚拟机的数据与所述备虚拟机的数据不同 歩, 则将所述主输出数据流的比较数据和所述备输出数据流的比较数据进 行同歩;
所述输出模块 64还用于: 将所述同歩后的比较数据作为输出结果输 出。
同歩模块 63 具体可以通过以下两种方式进行数据同歩: 第一种方式 将所述备输出数据流的比较数据赋值给所述主输出数据流的比较数据; 第 二种方式, 将所述主输出数据流的比较数据赋值给所述备输出数据流的比 较数据。 若同歩模块 63以第一种方式进行同歩, 则输出模块 64将所述主 输出数据流的比较数据作为输出结果输出。 若同歩模块 63 以第二种方式 进行同歩, 则输出模块 64将所述备输出数据流的比较数据作为输出结果 输出。
本实施例的虚拟机数据的同歩装置可用于执行实施例一至实施例三的技 术方案, 具体实现方式和技术效果类似, 这里不再赘述。
图 10为本发明实施例五提供的虚拟机数据的同歩装置的结构示意图, 如图 10所示, 本实施例的装置在图 9所示装置的基础上还包括: 输入模块 65, 用于接收输入数据流, 将所述输入数据流分发给所述主虚拟机和所述 备虚拟机, 以使所述主虚拟机和所述备虚拟机分别对所述输入数据流进行 处理, 得到输出数据流。
本实施例中, 获取模块 61包括: 获取单元 611、 解析单元 612和识别 单元 613。 其中, 获取单元 611, 用于获取所述主虚拟机的多条输出数据 流和所述备虚拟机的多条输出数据流。 解析单元 612, 用于解析所述主虚 拟机的所述多条输出数据流获取所述主虚拟机的每条输出数据流的识别 参数, 以及解析所述备虚拟机的所述多条输出数据流获取所述备虚拟机的 每条输出数据流的识别参数。 识别单元 613, 用于根据所述主虚拟机的每 条输出数据流的识别参数和所述备虚拟机的每条输出数据流的识别参数 识别出待处理的所述主输出数据流和所述备输出数据流。
当所述主虚拟机的多条输出数据流和所述备虚拟机的多条输出数据 流为传输控制协议 TCP数据流时,所述识别参数为输出数据流的五元组信 息。 则所述识别单元 613具体用于: 比较所述主虚拟机的每条输出数据流 的五元组信息与所述备虚拟机的每条数据流的五元组信息, 当所述主虚拟 机的输出数据流的五元组信息与所述备虚拟机的输出数据流的五元组信 息相同时, 将所述主虚拟机的输出数据流作为待同歩的所述主输出数据 流, 将所述备虚拟机的输出数据流作为待同歩的所述备输出数据流。
本实施例中, 比较模块 62包括: 读取单元 621、 计算单元 622和判断 单元 623。
其中, 读取单元 621, 用于按照数据流的顺序分别从所述主输出数据 流和所述备输出数据流中读取长度相等的比较数据。
计算单元 622, 用于分别计算所述主输出数据流的比较数据的哈希值 和所述备输出数据流的比较数据的哈希值; 或者, 用于根据所述主虚拟机 的初始哈希值和所述主输出数据流的比较数据计算所述主虚拟机的历史 数据的哈希值, 以及根据所述备虚拟机的初始哈希值和所述备输出数据流 的比较数据计算所述备虚拟机的历史数据的哈希值, 其中, 所述主虚拟机 的初始哈希值为上次所述主虚拟机与所述备虚拟机进行数据同歩后的哈 希值, 所述备虚拟机的初始哈希值为上次所述主虚拟机与所述备虚拟机进 行数据同歩后的哈希值, 在每次所述主虚拟机与所述备虚拟机进行数据同 歩后所述主虚拟机的初始哈希值与所述备虚拟机的初始哈希值相同。
当计算单元 622计算结果为主输出数据流的比较数据的哈希值和备输 出数据流的哈希值时, 判断单元 623, 用于判断所述主输出数据流的比较 数据的哈希值与所述备输出数据流的比较数据的哈希值是否相同, 若所述 主输出数据流的比较数据的哈希值与所述备输出数据流的比较数据的哈 希值相同, 则所述主虚拟机的数据与所述备虚拟机的数据同歩, 若所述主 输出数据流的比较数据的哈希值与所述备输出数据流的比较数据的哈希 值不相同, 则所述主虚拟机的数据与所述备虚拟机的数据不同歩。
当计算单元 622的计算结果为主虚拟机的历史数据的哈希值和备虚拟 机的历史数据的哈希值时, 判断单元 623, 用于判断所述主虚拟机的历史 数据的哈希值与所述备虚拟机的历史数据的哈希值是否相同, 若所述主虚 拟机的历史数据的哈希值与所述备虚拟机的历史数据的哈希值相同, 则所 述主虚拟机的数据与所述备虚拟机的数据同歩, 若所述主虚拟机的历史数 据的哈希值与所述备虚拟机的历史数据的哈希值不相同, 则所述主虚拟机 的数据与所述备虚拟机的数据不同歩。
本实施例中, 比较数据的长度有三种确定方法:
( 1 ) 比较数据的长度为预先设置的, 则读取单元 621 具体用于: 按 照数据流的顺序分别从所述主输出数据流和所述备输出数据流中读取预 设长度的比较数据。
( 2 ) 比较数据的长度根据主虚拟机接收到的数据的长度确定, 则读 取单元 121具体用于: 将所述主虚拟机接收到的所述主输出数据流的数据 作为所述主输出数据流的比较数据, 确定所述主输出数据流的比较数据的 长度; 然后, 按照数据流的顺序从所述备输出数据流中读取与所述主输出 数据流的比较数据长度相等的所述备输出数据流的比较数据。
( 3 ) 比较数据的长度根据备虚拟机接收到的数据的长度确定, 则读 取单元 121具体用于: 将所述备虚拟机接收到的所述备输出数据流的数据 作为所述备输出数据流的比较数据, 确定所述备输出数据流的比较数据的 长度; 然后, 按照数据流的顺序从所述主输出数据流中读取与所述备输出 数据流的比较数据长度相等的所述主输出数据流的比较数据。
进一歩地, 本实施例的虚拟机数据的同歩装置还包括: 更新模块, 用 于更新所述主虚拟机的初始哈希值和所述备虚拟机的初始哈希值。
本实施例的虚拟机数据的同歩装置可用于执行实施例一至实施例三 的技术方案, 具体实现方式和技术效果类似, 这里不再赘述。
图 11为本发明实施例六提供的虚拟机数据的同歩装置的结构示意图, 如图 11所示, 本实施例的虚拟机数据的同歩装置 700包括: 处理器 71、 存储器 72和系统总线 73, 所述处理器 71和所述存储器 72之间通过所述 系统总线 23连接并完成相互间的通信; 所述存储器 72, 用于存储计算机 执行指令 721 ; 所述处理器 71, 用于运行所述计算机执行指令 721, 使所 述虚拟机数据的同歩装置 700执行如下所述的方法:
获取待同歩的主虚拟机的主输出数据流和备虚拟机的备输出数据流, 在同歩时间到达时, 按照数据流的顺序分别从所述主输出数据流和所述备 输出数据流中读取长度相等的比较数据进行比较, 确定所述主虚拟机的数 据与所述备虚拟机的数据是否同歩;
若所述主虚拟机的数据与所述备虚拟机的数据同歩, 则将所述主输出 数据流的比较数据或所述备输出数据流的比较数据作为输出结果输出; 若所述主虚拟机的数据与所述备虚拟机的数据不同歩, 则将所述主输 出数据流的比较数据和所述备输出数据流的比较数据进行同歩, 将所述同 歩后的比较数据作为输出结果输出。
处理器 71 可以通过以下两种方式确定所述主虚拟机的数据与所述备 虚拟机的数据是否同歩:
( 1 ) 首先, 按照数据流的顺序分别从所述主输出数据流和所述备输 出数据流中读取长度相等的比较数据。 然后, 分别计算所述主输出数据流 的比较数据的哈希值和所述备输出数据流的比较数据的哈希值。 最后, 判 断所述主输出数据流的比较数据的哈希值与所述备输出数据流的比较数 据的哈希值是否相同; 若所述主输出数据流的比较数据的哈希值与所述备 输出数据流的比较数据的哈希值相同, 则所述主虚拟机的数据与所述备虚 拟机的数据同歩, 若所述主输出数据流的比较数据的哈希值与所述备输出 数据流的比较数据的哈希值不相同, 则所述主虚拟机的数据与所述备虚拟 机的数据不同歩。
( 2 ) 首先, 按照数据流的顺序分别从所述主输出数据流和所述备输 出数据流中读取长度相等的比较数据。 然后, 根据所述主虚拟机的初始哈 希值和所述主输出数据流的比较数据计算所述主虚拟机的历史数据的哈 希值, 以及根据所述备虚拟机的初始哈希值和所述备输出数据流的比较数 据计算所述备虚拟机的历史数据的哈希值, 其中, 所述主虚拟机的初始哈 希值为上次所述主虚拟机与所述备虚拟机进行数据同歩后的哈希值, 所述 备虚拟机的初始哈希值为上次所述主虚拟机与所述备虚拟机进行数据同 歩后的哈希值, 在每次所述主虚拟机与所述备虚拟机进行数据同歩后所述 主虚拟机的初始哈希值与所述备虚拟机的初始哈希值相同。 最后, 判断所 述主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据的哈希值是 否相同; 若所述主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据 的哈希值相同, 则所述主虚拟机的数据与所述备虚拟机的数据同歩, 若所 述主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据的哈希值不 相同, 则所述主虚拟机的数据与所述备虚拟机的数据不同歩。 相应地, 处 理器 71 在输出所述输出结果后, 还用于: 更新所述主虚拟机的初始哈希 值和所述备虚拟机的初始哈希值。
本实施例中, 比较数据的确定方式有以下三种:
( 1 ) 比较数据的长度为预先设置的, 则处理器 71按照数据流的顺序 分别从所述主输出数据流和所述备输出数据流中读取长度相等的比较数 据, 具体为: 按照数据流的顺序分别从所述主输出数据流和所述备输出数 据流中读取预设长度的比较数据。
( 2 ) 比较数据的长度根据主虚拟机接收到的数据的长度确定, 则处 理器 71 按照数据流的顺序分别从所述主输出数据流和所述备输出数据流 中读取长度相等的比较数据, 具体为: 将所述主虚拟机接收到的所述主输 出数据流的数据作为所述主输出数据流的比较数据, 确定所述主输出数据 流的比较数据的长度; 按照数据流的顺序从所述备输出数据流中读取与所 述主输出数据流的比较数据长度相等的所述备输出数据流的比较数据。
( 3 ) 比较数据的长度根据备虚拟机接收到的数据的长度确定, 则处 理器 71 按照数据流的顺序分别从所述主输出数据流和所述备输出数据流 中读取长度相等的比较数据, 具体为: 将所述备虚拟机接收到的所述备输 出数据流的数据作为所述备输出数据流的比较数据, 确定所述备输出数据 流的比较数据的长度; 按照数据流的顺序从所述主输出数据流中读取与所 述备输出数据流的比较数据长度相等的所述主输出数据流的比较数据。
可选地, 处理器 71 获取待同歩的主虚拟机的主输出数据流和备虚拟 机的备输出数据流, 具体为: 首先, 获取所述主虚拟机的多条输出数据流 和所述备虚拟机的多条输出数据流; 然后, 解析所述主虚拟机的所述多条 输出数据流获取所述主虚拟机的每条输出数据流的识别参数, 以及解析所 述备虚拟机的所述多条输出数据流获取所述备虚拟机的每条输出数据流 的识别参数; 最后, 根据所述主虚拟机的每条输出数据流的识别参数和所 述备虚拟机的每条输出数据流的识别参数识别出待处理的所述主输出数 据流和所述备输出数据流。
当所述主虚拟机的多条输出数据流和所述备虚拟机的多条输出数据 流为传输控制协议 TCP数据流时,所述识别参数为输出数据流的五元组信 息。 则处理器 71 具体用于: 比较所述主虚拟机的每条输出数据流的五元 组信息与所述备虚拟机的每条数据流的五元组信息, 当所述主虚拟机的输 出数据流的五元组信息与所述备虚拟机的输出数据流的五元组信息相同 时, 将所述主虚拟机的输出数据流作为待同歩的所述主输出数据流, 将所 述备虚拟机的输出数据流作为待同歩的所述备输出数据流。
本实施例中, 处理器 71 将所述主输出数据流的比较数据和所述备输 出数据流的比较数据进行同歩可以采用如下两种方式:
( 1 ) 将所述备输出数据流的比较数据赋值给所述主输出数据流的比 较数据。 相应地, 处理器 71 将所述主输出数据流的比较数据作为输出结 果输出。
( 2 ) 将所述主输出数据流的比较数据赋值给所述备输出数据流的比 较数据; 相应地, 处理器 71 将所述备输出数据流的比较数据作为输出结 果输出。
本实施例中, 处理器 71 在获取待同歩的主虚拟机的主输出数据流和 备虚拟机的备输出数据流之前, 还用于: 接收输入数据流, 将所述输入数 据流分发给所述主虚拟机和所述备虚拟机, 以使所述主虚拟机和所述备虚 拟机分别对所述输入数据流进行处理, 得到输出数据流。
本实施例提供的虚拟机数据的同歩装置, 可用于执行实施例一至实施例 三的技术方案, 具体实现方式和技术效果类似, 这里不再赘述。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分歩骤 可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计算机可读 取存储介质中, 该程序在执行时, 执行包括上述方法实施例的歩骤; 而前述 的存储介质包括: ROM、 RAM,磁碟或者光盘等各种可以存储程序代码的介 质。
最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这些修改或者替换, 并 不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims

权 利 要 求 书
1、 一种虚拟机数据的同歩方法, 其特征在于, 包括:
获取待同歩的主虚拟机的主输出数据流和备虚拟机的备输出数据流, 在同歩时间到达时, 按照数据流的顺序分别从所述主输出数据流和所述备 输出数据流中读取长度相等的比较数据进行比较, 确定所述主虚拟机的数 据与所述备虚拟机的数据是否同歩;
若所述主虚拟机的数据与所述备虚拟机的数据同歩, 则将所述主输出 数据流的比较数据或所述备输出数据流的比较数据作为输出结果输出; 若所述主虚拟机的数据与所述备虚拟机的数据不同歩, 则将所述主输 出数据流的比较数据和所述备输出数据流的比较数据进行同歩, 将所述同 歩后的比较数据作为输出结果输出。
2、 根据权利要求 1 所述的方法, 其特征在于, 所述按照数据流的顺 序分别从所述主输出数据流和所述备输出数据流中读取长度相等的比较 数据进行比较, 确定所述主虚拟机的数据与所述备虚拟机的数据是否同 歩, 包括:
按照数据流的顺序分别从所述主输出数据流和所述备输出数据流中 读取长度相等的比较数据;
分别计算所述主输出数据流的比较数据的哈希值和所述备输出数据 流的比较数据的哈希值;
判断所述主输出数据流的比较数据的哈希值与所述备输出数据流的 比较数据的哈希值是否相同;
若所述主输出数据流的比较数据的哈希值与所述备输出数据流的比 较数据的哈希值相同, 则所述主虚拟机的数据与所述备虚拟机的数据同 歩, 若所述主输出数据流的比较数据的哈希值与所述备输出数据流的比较 数据的哈希值不相同, 则所述主虚拟机的数据与所述备虚拟机的数据不同
3、 根据权利要求 1 所述的方法, 其特征在于, 所述按照数据流的顺 序分别从所述主输出数据流和所述备输出数据流中读取长度相等的比较 数据进行比较, 确定所述主虚拟机的数据与所述备虚拟机的数据是否同 歩, 包括: 按照数据流的顺序分别从所述主输出数据流和所述备输出数据流中 读取长度相等的比较数据;
根据所述主虚拟机的初始哈希值和所述主输出数据流的比较数据计 算所述主虚拟机的历史数据的哈希值, 以及根据所述备虚拟机的初始哈希 值和所述备输出数据流的比较数据计算所述备虚拟机的历史数据的哈希 值, 其中, 所述主虚拟机的初始哈希值为上次所述主虚拟机与所述备虚拟 机进行数据同歩后的哈希值, 所述备虚拟机的初始哈希值为上次所述主虚 拟机与所述备虚拟机进行数据同歩后的哈希值, 在每次所述主虚拟机与所 述备虚拟机进行数据同歩后所述主虚拟机的初始哈希值与所述备虚拟机 的初始哈希值相同;
判断所述主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据 的哈希值是否相同;
若所述主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据的 哈希值相同, 则所述主虚拟机的数据与所述备虚拟机的数据同歩, 若所述 主虚拟机的历史数据的哈希值与所述备虚拟机的历史数据的哈希值不相 同, 则所述主虚拟机的数据与所述备虚拟机的数据不同歩。
4、 根据权利要求 2或 3所述的方法, 其特征在于, 所述比较数据的 长度为预先设置的, 则所述按照数据流的顺序分别从所述主输出数据流和 所述备输出数据流中读取长度相等的比较数据, 包括:
按照数据流的顺序分别从所述主输出数据流和所述备输出数据流中 读取预设长度的比较数据。
5、 根据权利要求 2或 3所述的方法, 其特征在于, 所述按照数据流 的顺序分别从所述主输出数据流和所述备输出数据流中读取长度相等的 比较数据, 包括:
将所述主虚拟机接收到的所述主输出数据流的数据作为所述主输出 数据流的比较数据, 确定所述主输出数据流的比较数据的长度;
按照数据流的顺序从所述备输出数据流中读取与所述主输出数据流 的比较数据长度相等的所述备输出数据流的比较数据。
6、 根据权利要求 2或 3所述的方法, 其特征在于, 所述按照数据流 的顺序分别从所述主输出数据流和所述备输出数据流中读取长度相等的 比较数据, 包括:
将所述备虚拟机接收到的所述备输出数据流的数据作为所述备输出 数据流的比较数据, 确定所述备输出数据流的比较数据的长度;
按照数据流的顺序从所述主输出数据流中读取与所述备输出数据流 的比较数据长度相等的所述主输出数据流的比较数据。
7、 根据权利要求 3 所述的方法, 其特征在于, 在输出所述输出结果 后, 所述方法还包括:
更新所述主虚拟机的初始哈希值和所述备虚拟机的初始哈希值。
8、 根据权利要求 1-7中任一项所述的方法, 其特征在于, 所述获取待 同歩的主虚拟机的主输出数据流和备虚拟机的备输出数据流, 包括: 获取所述主虚拟机的多条输出数据流和所述备虚拟机的多条输出数 据流;
解析所述主虚拟机的所述多条输出数据流获取所述主虚拟机的每条 输出数据流的识别参数, 以及解析所述备虚拟机的所述多条输出数据流获 取所述备虚拟机的每条输出数据流的识别参数;
根据所述主虚拟机的每条输出数据流的识别参数和所述备虚拟机的 每条输出数据流的识别参数识别出待处理的所述主输出数据流和所述备 输出数据流。
9、 根据权利要求 8所述的方法, 其特征在于, 当所述主虚拟机的多 条输出数据流和所述备虚拟机的多条输出数据流为传输控制协议 TCP 数 据流时, 所述识别参数为输出数据流的五元组信息;
则所述根据所述主虚拟机的每条输出数据流的识别参数和所述备虚 拟机的每条输出数据流的识别参数识别出待处理的所述主输出数据流和 所述备输出数据流, 包括:
比较所述主虚拟机的每条输出数据流的五元组信息与所述备虚拟机 的每条数据流的五元组信息, 当所述主虚拟机的输出数据流的五元组信息 与所述备虚拟机的输出数据流的五元组信息相同时, 将所述主虚拟机的输 出数据流作为待同歩的所述主输出数据流, 将所述备虚拟机的输出数据流 作为待同歩的所述备输出数据流。
10、 根据权利要求 1-9中任一项所述的方法, 其特征在于, 所述将所 述主输出数据流的比较数据和所述备输出数据流的比较数据进行同歩, 包 括:
将所述备输出数据流的比较数据赋值给所述主输出数据流的比较数 据;
则所述将所述同歩后的比较数据作为输出结果输出, 包括:
将所述主输出数据流的比较数据作为输出结果输出。
11、 根据权利要求 1-9中任一项所述的方法, 其特征在于, 所述将所 述主输出数据流的比较数据和所述备输出数据流的比较数据进行同歩, 包 括:
将所述主输出数据流的比较数据赋值给所述备输出数据流的比较数 据;
贝 |J, 所述将所述同歩后的比较数据作为输出结果输出, 包括: 将所述备输出数据流的比较数据作为输出结果输出。
12、 根据权利要求 1所述的方法, 其特征在于, 所述获取待同歩的主 虚拟机的主输出数据流和备虚拟机的备输出数据流之前, 所述方法还包 括:
接收输入数据流, 将所述输入数据流分发给所述主虚拟机和所述备虚 拟机, 以使所述主虚拟机和所述备虚拟机分别对所述输入数据流进行处 理, 得到输出数据流。
13、 一种虚拟机数据的同歩装置, 其特征在于, 包括:
获取模块, 用于获取待同歩的主虚拟机的主输出数据流和备虚拟机的 备输出数据流;
比较模块, 用于在同歩时间到达时, 按照数据流的顺序分别从所述主 输出数据流和所述备输出数据流中读取长度相等的比较数据进行比较, 确 定所述主虚拟机的数据与所述备虚拟机的数据是否同歩;
输出模块, 用于若所述主虚拟机的数据与所述备虚拟机的数据同歩, 则将所述主输出数据流的比较数据或所述备输出数据流的比较数据作为 输出结果输出;
同歩模块, 用于若所述主虚拟机的数据与所述备虚拟机的数据不同 歩, 则将所述主输出数据流的比较数据和所述备输出数据流的比较数据进 所述输出模块还用于: 将所述同歩后的比较数据作为输出结果输出。
14、 根据权利要求 13所述的装置, 其特征在于, 所述比较模块包括: 读取单元, 用于按照数据流的顺序分别从所述主输出数据流和所述备 输出数据流中读取长度相等的比较数据;
计算单元, 用于分别计算所述主输出数据流的比较数据的哈希值和所 述备输出数据流的比较数据的哈希值;
判断单元, 用于判断所述主输出数据流的比较数据的哈希值与所述备 输出数据流的比较数据的哈希值是否相同, 若所述主输出数据流的比较数 据的哈希值与所述备输出数据流的比较数据的哈希值相同, 则所述主虚拟 机的数据与所述备虚拟机的数据同歩, 若所述主输出数据流的比较数据的 哈希值与所述备输出数据流的比较数据的哈希值不相同, 则所述主虚拟机 的数据与所述备虚拟机的数据不同歩。
15、 根据权利要求 13所述的装置, 其特征在于, 所述比较模块包括: 读取单元, 用于按照数据流的顺序分别从所述主输出数据流和所述备 输出数据流中读取长度相等的比较数据;
计算单元, 用于根据所述主虚拟机的初始哈希值和所述主输出数据流 的比较数据计算所述主虚拟机的历史数据的哈希值, 以及根据所述备虚拟 机的初始哈希值和所述备输出数据流的比较数据计算所述备虚拟机的历 史数据的哈希值, 其中, 所述主虚拟机的初始哈希值为上次所述主虚拟机 与所述备虚拟机进行数据同歩后的哈希值, 所述备虚拟机的初始哈希值为 上次所述主虚拟机与所述备虚拟机进行数据同歩后的哈希值, 在每次所述 主虚拟机与所述备虚拟机进行数据同歩后所述主虚拟机的初始哈希值与 所述备虚拟机的初始哈希值相同;
判断单元, 用于判断所述主虚拟机的历史数据的哈希值与所述备虚拟 机的历史数据的哈希值是否相同, 若所述主虚拟机的历史数据的哈希值与 所述备虚拟机的历史数据的哈希值相同, 则所述主虚拟机的数据与所述备 虚拟机的数据同歩, 若所述主虚拟机的历史数据的哈希值与所述备虚拟机 的历史数据的哈希值不相同, 则所述主虚拟机的数据与所述备虚拟机的数 据不同歩。
16、 根据权利要求 14或 15所述的装置, 其特征在于, 所述比较数据 的长度为预先设置的, 则所述读取单元具体用于:
按照数据流的顺序分别从所述主输出数据流和所述备输出数据流中 读取预设长度的比较数据。
17、 根据权利要求 14或 15所述的装置, 其特征在于, 所述读取单元 具体用于:
将所述主虚拟机接收到的所述主输出数据流的数据作为所述主输出 数据流的比较数据, 确定所述主输出数据流的比较数据的长度;
按照数据流的顺序从所述备输出数据流中读取与所述主输出数据流 的比较数据长度相等的所述备输出数据流的比较数据。
18、 根据权利要求 14或 15所述的装置, 其特征在于, 所述读取单元 具体用于:
将所述备虚拟机接收到的所述备输出数据流的数据作为所述备输出 数据流的比较数据, 确定所述备输出数据流的比较数据的长度;
按照数据流的顺序从所述主输出数据流中读取与所述备输出数据流 的比较数据长度相等的所述主输出数据流的比较数据。
19、 根据权利要求 15所述的装置, 其特征在于, 所述装置还包括: 更新模块, 用于更新所述主虚拟机的初始哈希值和所述备虚拟机的初 始哈希值。
20、 根据权利要求 13-19中任一项所述的装置, 其特征在于, 所述获 取模块包括:
获取单元, 用于获取所述主虚拟机的多条输出数据流和所述备虚拟机 的多条输出数据流;
解析单元, 用于解析所述主虚拟机的所述多条输出数据流获取所述主 虚拟机的每条输出数据流的识别参数, 以及解析所述备虚拟机的所述多条 输出数据流获取所述备虚拟机的每条输出数据流的识别参数;
识别单元, 用于根据所述主虚拟机的每条输出数据流的识别参数和所 述备虚拟机的每条输出数据流的识别参数识别出待处理的所述主输出数 据流和所述备输出数据流。
21、 根据权利要求 20所述的装置, 其特征在于, 当所述主虚拟机的 多条输出数据流和所述备虚拟机的多条输出数据流为传输控制协议 TCP 数据流时, 所述识别参数为输出数据流的五元组信息;
则所述识别单元具体用于:
比较所述主虚拟机的每条输出数据流的五元组信息与所述备虚拟机 的每条数据流的五元组信息, 当所述主虚拟机的输出数据流的五元组信息 与所述备虚拟机的输出数据流的五元组信息相同时, 将所述主虚拟机的输 出数据流作为待同歩的所述主输出数据流, 将所述备虚拟机的输出数据流 作为待同歩的所述备输出数据流。
22、 根据权利要求 13-21中任一项所述的装置, 其特征在于, 所述同 歩模块具体用于:
将所述备输出数据流的比较数据赋值给所述主输出数据流的比较数 据;
则所述输出模块具体用于:
将所述主输出数据流的比较数据作为输出结果输出。
23、 根据权利要求 13-21中任一项所述的装置, 其特征在于, 所述同 歩模块具体用于:
将所述主输出数据流的比较数据赋值给所述备输出数据流的比较数 据;
则所述输出模块具体用于:
将所述备输出数据流的比较数据作为输出结果输出。
24、 根据权利要求 13所述的装置, 其特征在于, 还包括:
输入模块, 用于接收输入数据流, 将所述输入数据流分发给所述主虚 拟机和所述备虚拟机, 以使所述主虚拟机和所述备虚拟机分别对所述输入 数据流进行处理, 得到输出数据流。
25、 一种虚拟机数据的同歩装置, 其特征在于, 包括:
处理器、 存储器和系统总线, 所述处理器和所述存储器之间通过所述 系统总线连接并完成相互间的通信;
所述存储器, 用于存储计算机执行指令;
所述处理器, 用于运行所述计算机执行指令, 使所述同歩装置执行如 权利要求 1至 12任一所述的方法。
PCT/CN2014/084651 2014-08-18 2014-08-18 虚拟机数据的同步方法和装置 WO2016026071A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201480038268.2A CN105531678A (zh) 2014-08-18 2014-08-18 虚拟机数据的同步方法和装置
PCT/CN2014/084651 WO2016026071A1 (zh) 2014-08-18 2014-08-18 虚拟机数据的同步方法和装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/084651 WO2016026071A1 (zh) 2014-08-18 2014-08-18 虚拟机数据的同步方法和装置

Publications (1)

Publication Number Publication Date
WO2016026071A1 true WO2016026071A1 (zh) 2016-02-25

Family

ID=55350064

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/084651 WO2016026071A1 (zh) 2014-08-18 2014-08-18 虚拟机数据的同步方法和装置

Country Status (2)

Country Link
CN (1) CN105531678A (zh)
WO (1) WO2016026071A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112380069B (zh) * 2020-12-04 2022-05-17 海光信息技术股份有限公司 一种虚拟机容错系统及其容错方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110191389A1 (en) * 2005-07-28 2011-08-04 Vmware, Inc. Distributed data management system
JP2013065259A (ja) * 2011-09-20 2013-04-11 Hitachi Solutions Ltd データ転送システム、転送元システム及び転送先システム並びにプログラム
US20130283092A1 (en) * 2012-04-24 2013-10-24 Microsoft Corporation Data consistency between virtual machines

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103501290B (zh) * 2013-09-18 2017-10-24 万达信息股份有限公司 一种基于动态备份虚拟机的高可靠服务系统构建方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110191389A1 (en) * 2005-07-28 2011-08-04 Vmware, Inc. Distributed data management system
JP2013065259A (ja) * 2011-09-20 2013-04-11 Hitachi Solutions Ltd データ転送システム、転送元システム及び転送先システム並びにプログラム
US20130283092A1 (en) * 2012-04-24 2013-10-24 Microsoft Corporation Data consistency between virtual machines

Also Published As

Publication number Publication date
CN105531678A (zh) 2016-04-27

Similar Documents

Publication Publication Date Title
US9413830B2 (en) Application streaming service
US10250496B2 (en) Router based maximum transmission unit and data frame optimization for virtualized environments
US9417921B2 (en) Method and system for a graph based video streaming platform
US9826011B2 (en) Method and system for coordinating stream processing at a video streaming platform
US9912707B2 (en) Method and system for ensuring reliability of unicast video streaming at a video streaming platform
CN108401492B (zh) 一种基于混合资源的路由选路方法、装置和服务器
US9578074B2 (en) Adaptive content transmission
US20160380966A1 (en) Media Relay Server
WO2020001442A1 (zh) 一种数据处理方法及相关设备
US10476992B1 (en) Methods for providing MPTCP proxy options and devices thereof
US11258680B2 (en) Real-time scalable virtual session and network analytics
JP2017529793A5 (zh)
US10097462B2 (en) Throughput resilience during link failover
US10944646B2 (en) Enabling multiple provider software defined network programming using blockchain distributed ledgers
US10205663B1 (en) Managing host computing devices
US20160380789A1 (en) Media Relay Server
WO2017166136A1 (zh) 一种vnf的资源分配方法及装置
US20150188824A1 (en) Link aggregation (lag) information exchange protocol
US10516599B1 (en) Link priority for loop-protect
EP3142306A1 (en) Openflow communication method, system, controller, and service gateway
US9864856B2 (en) Efficient hardware trust verification in data communication systems that comprise network interface cards, central processing units, and data memory buffers
CN113225252B (zh) 双向转发检测bfd会话的建立方法、处理方法以及相关设备
WO2013097234A1 (zh) 处理业务的方法和系统
WO2016026071A1 (zh) 虚拟机数据的同步方法和装置
CN112217735A (zh) 信息同步方法与负载均衡系统

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201480038268.2

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14900220

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14900220

Country of ref document: EP

Kind code of ref document: A1