Permission Control Method and Device for Dual-Machine Hot Standby

By using dual-port memory as arbitration disk in a dual-machine hot standby system, low-cost authority control is achieved, the problems of high cost of arbitration nodes and low user experience are solved, and the reliability and user satisfaction of the system are improved.

CN114090348BActive Publication Date: 2025-07-22NEW H3C BIG DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111348795.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-15
Publication Date
2025-07-22
Estimated Expiration
2041-11-15

AI Technical Summary

Technical Problem

In traditional dual-machine hot standby high availability systems, the arbitration node has high hardware costs and needs to be developed and maintained, resulting in low user experience and satisfaction, and is prone to resource scrambling and data corruption due to heartbeat failure.

Method used

The dual-port memory is used as the arbitration disk. By controlling the first host and the second host to read and write the dual-port memory alternately, the control authority of the unfailed host is improved according to the fault conditions, and the dual-port USB disk is used to communicate synchronously with network cables or serial ports to avoid dependence on the third-party synchronization system.

Benefits of technology

It reduces hardware costs, reduces maintenance work, improves user experience and system reliability, and avoids resource scrambling and data corruption problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114090348B_ABST
    Figure CN114090348B_ABST
Patent Text Reader

Abstract

The present invention discloses a permission control method and device for dual - machine hot standby. The permission control method includes one or more steps as follows. Control the first host and the second host to alternately read and write a dual - port memory. The dual - port memory has two interfaces, and at most one of them can be enabled at the same time. The two interfaces are respectively connected to the first host and the second host; elevate the control permission of the second host according to a failure of the first host, or elevate the control permission of the first host according to a failure of the second host. The present invention can greatly reduce the hardware cost based on the way of using the dual - port memory as an arbitration disk, and reduce the work of separately developing and maintaining the internal program of the arbitration disk by virtue of the characteristic that the two interfaces of the dual - port memory are not used simultaneously, with good user experience and high satisfaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of dual - machine hot standby. More specifically, the present invention can provide a permission control method and device for dual - machine hot standby. Background Art

[0002] Currently, in a dual - machine hot standby high - availability system, if the heartbeat line connecting the two nodes fails, causing the dual - machine hot standby high - availability system to split into two isolated nodes, serious consequences such as the two nodes competing for shared resources and application services will occur, resulting in a significant decline in the performance of the high - availability system; moreover, it will also lead to data corruption problems, such as errors in the online logs polled by the database. Therefore, an arbitration node needs to be equipped for the dual - machine hot standby high - availability system. Traditional arbitration nodes are generally thin clients, with very high hardware costs, and require separate development and maintenance, further increasing the cost, and the user experience and satisfaction are relatively low. Summary of the Invention

[0003] To solve the problems of high hardware costs, the need for development and maintenance, and relatively low user experience and satisfaction existing in traditional arbitration nodes, the present invention can provide a permission control method and device for dual - machine hot standby to achieve the purposes of reducing the cost of the arbitration node and improving user satisfaction.

[0004] To achieve the above - mentioned technical objectives, the present invention can specifically provide a permission control method for dual - machine hot standby, and the permission control method may include, but is not limited to, one or more of the following steps.

[0005] Control the first host and the second host to alternately read and write a dual - port memory. The dual - port memory has two interfaces, and at most one of them can be enabled at the same time. The two interfaces are respectively connected to the first host and the second host.

[0006] Elevate the control authority of the second host according to the failure of the first host, or elevate the control authority of the first host according to the failure of the second host.

[0007] Further, the control of the first host and the second host to alternately read and write the dual - port memory includes: controlling the first host and the second host to alternately write heartbeat signals to the dual - port memory.

[0008] The elevation of the control authority of the second host according to the failure of the first host includes:

[0009] Based on the release of the interface occupation by the first host, the second host obtains the heartbeat signal count of the first host from the dual - port memory.

[0010] If the heartbeat signal count does not increase, it is determined that the first host has failed, and the control authority of the second host is elevated.

[0011] Further, the second host obtaining the heartbeat signal count of the first host from the dual-port memory includes:

[0012] The second host sends an arbitration disk release request to the first host through a synchronization line; the synchronization line is used for interactive communication between the first host and the second host.

[0013] If the response sent by the first host is not received within a preset time, the second host obtains the heartbeat signal access right.

[0014] Based on the heartbeat signal access right, the second host obtains the heartbeat signal count of the first host from the dual-port memory.

[0015] Further, the synchronization line is at least one of a serial port line and a crossover network cable.

[0016] Further, within one cycle, controlling the first host and the second host to alternately read and write the dual-port memory includes: after controlling the first host to read and write the dual-port memory, disconnecting the connection between the first host and the dual-port memory; after controlling the second host to read and write the dual-port memory, disconnecting the connection between the second host and the dual-port memory, and returning to the step of controlling the first host to read and write the dual-port memory to repeat the next cycle.

[0017] The promoting the control authority of the second host according to the failure of the first host includes:

[0018] The second host obtains the heartbeat signal count of the first host from the dual-port memory.

[0019] If the heartbeat signal count does not increase, it is determined that the first host has failed; and the control authority of the second host is promoted.

[0020] Further, controlling the first host and the second host to alternately read and write the dual-port memory includes: controlling the first host and the second host to alternately write host status quantities to the dual-port memory.

[0021] The promoting the control authority of the second host according to the failure of the first host includes:

[0022] The second host obtains the host status quantity of the first host from the dual-port memory.

[0023] If the host status quantity indicates that the current state of the first host is abnormal, it is determined that the first host has failed, and the control authority of the second host is promoted.

[0024] Further, the dual-port memory is a dual-port USB flash drive.

[0025] To achieve the above technical objectives, the present invention can also provide an authority control device for dual - machine hot standby, which includes, but is not limited to, a data reading and writing module and an authority control module.

[0026] The data reading and writing module is used to control the first host and the second host to alternately read and write a dual - port memory. The dual - port memory has two interfaces, and at most one of them can be enabled at the same time. The two interfaces are respectively connected to the first host and the second host.

[0027] The authority control module is used to elevate the control authority of the second host according to the failure of the first host, or elevate the control authority of the first host according to the failure of the second host.

[0028] Further, the data reading and writing module is used to control the first host and the second host to alternately write heartbeat signals to the dual - port memory.

[0029] The authority control module is used to enable the second host to obtain the heartbeat signal count of the first host from the dual - port memory based on the release of the interface occupation by the first host, and is used to determine that the first host has failed according to the non - increase of the heartbeat signal count, and elevate the control authority of the second host.

[0030] Further, the authority control module is used to enable the second host to send an arbitration disk release request to the first host through a synchronization line; the synchronization line is used for the interactive communication between the first host and the second host; the authority control module is used to enable the second host to obtain the heartbeat signal access right according to the non - receipt of the response sent by the first host within a preset time; and is used to enable the second host to obtain the heartbeat signal count of the first host from the dual - port memory based on the heartbeat signal access right.

[0031] Further, the data reading and writing module is used to disconnect the connection between the first host and the dual - port memory after controlling the first host to read and write the dual - port memory; and is used to disconnect the connection between the second host and the dual - port memory after controlling the second host to read and write the dual - port memory, and is used to return to the step of controlling the first host to read and write the dual - port memory, repeating the next cycle.

[0032] The authority control module is used to enable the second host to obtain the heartbeat signal count of the first host from the dual - port memory, and is used to determine that the first host has failed according to the non - increase of the heartbeat signal count, and elevate the control authority of the second host.

[0033] Further, the data reading and writing module is used to control the first host and the second host to alternately write host status variables to the dual - port memory.

[0034] The permission control module is used to determine that the first host has a fault according to the fact that the current state of the first host characterized by the host status quantity is abnormal, and elevate the control permission of the second host.

[0035] To achieve the above technical objectives, the present invention can also specifically provide a computer device, which includes a memory and a processor. Computer-readable instructions are stored in the memory. When the computer-readable instructions are executed by the processor, the processor executes the steps of the permission control method for dual-machine hot standby according to any embodiment of the present invention.

[0036] To achieve the above technical objectives, the present invention can also provide a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the permission control method for dual-machine hot standby according to any embodiment of the present invention.

[0037] The beneficial effects of the present invention are as follows: Based on the way of using a dual-port memory as an arbitration disk, the present invention greatly reduces the hardware cost. Moreover, by virtue of the characteristic that the two interfaces of the dual-port memory are not used simultaneously, the work of separately developing and maintaining the internal program of the arbitration disk is reduced, and the user experience is good and the satisfaction is relatively high. The present invention uses a dual-port USB flash drive in combination with a network cable or a serial port cable used as a synchronization line, which can greatly reduce the hardware cost and has the advantages of small size and easy placement. The present invention innovatively uses a dual-port USB flash drive as a shared disk carrier, and does not require the development and maintenance of a third-party software system, further reducing the cost. The present invention synchronizes the arbitration-related data of the first host and the second host through an interconnection line, avoiding the dependence on a third-party synchronization system such as an NTP server in the conventional manner and improving the reliability. In addition, the present invention can also avoid the problem that the other party cannot access the USB flash drive due to the abnormal arbitration program of one party by regularly closing the USB port. Description of the Drawings

[0038] Figure 1 The flowchart of the permission control method for dual-machine hot standby according to one or more embodiments of the present invention is shown.

[0039] Figure 2 The schematic diagram of the networking architecture for dual-machine hot standby according to one or more embodiments of the present invention is shown.

[0040] Figure 3 The schematic diagram of the internal structure composition of the computer device according to one or more embodiments of the present invention is shown. Detailed Embodiments

[0041] The following combines the specification drawings to give a detailed explanation and description of a permission control method and device for dual-machine hot standby provided by the present invention.

[0042] As Figure 1 shown, and in combination with Figure 2 , one or more embodiments of the present invention can provide a permission control method for dual-machine hot standby. The permission control method may include, but is not limited to, one or more of the following steps, which are specifically described as follows.

[0043] Step 100: Control the first host and the second host to alternately read and write a dual-port memory. The dual-port memory has two interfaces, and at most one of them can be enabled at the same time. The two interfaces are respectively connected to the first host and the second host. Among them, the dual-port memory in one or more embodiments of the present invention is a dual-port USB flash drive. It can be seen from this that the present invention provides a solution for the arbitration disk of dual-machine hot standby, specifically using a dual-port USB flash drive as the arbitration disk.

[0044] The dual-port USB flash drive used in the present invention has the characteristic of low cost. One end of the dual-port USB flash drive can be, for example, a standard USB interface, that is, type-A, and the other end can be a type-C interface or a micro usb interface, as Figure 2 shown. It should be understood that when the dual-port USB flash drive is used for computer devices, the type-A interface of the dual-port USB flash drive can be connected to the computer device respectively by using a standard USB cable. At this time, the computer device is used as the host, and the dual-port USB flash drive is used as the device; when the dual-port USB flash drive is used for mobile phones, the type-C interface of the dual-port USB flash drive and the mobile phone can be connected respectively by using an OTG cable, and the ability of the host can be coordinated through the OTG cable. The mobile phone is used as the host, and the dual-port USB flash drive is used as the device. The dual-port USB flash drive has the characteristic that its two ports cannot be used simultaneously, that is, the type-A port and the type-C port cannot be used simultaneously, because the host accessing the device must be a one-to-one relationship, and the multi-to-one situation cannot work properly.

[0045] As Figure 2As shown in the figure, the dual - machine hot - standby system of the embodiment of the present invention is networked based on a dual - port USB flash drive. The first host (Server 1) is connected to the type - A interface of the dual - port USB flash drive using a standard USB cable, and the second host (Server 2) is connected to the type - C interface of the USB flash drive through a USB - to - type - C cable. The first host and the second host are interconnected through a synchronization cable, which can be called an interconnection cable, to achieve interactive communication between the first host and the second host. The synchronization cable can be, for example, a crossover network cable or a serial port cable. The serial port cable in the embodiment of the present invention can be, for example, an RS232 serial port cable. For the software part, the dual - machine hot - standby system that implements dual - machine services in the present invention can run on the Linux system. On the first host, a first service module, a first arbitration module, and a first USB timing module are equipped. The first service module is used to notify the first arbitration module of the host status. The first arbitration module is used to receive the host status of the first service module of this host. The first USB timing module is used to power off the USB port (u1 port) regularly. And on the second host, a second service module, a second arbitration module, and a second USB timing module are equipped. The second service module is used to notify the second arbitration module of the host status. The second arbitration module is used to receive the host status of the second service module of this host. The second USB timing module is used to power off the USB port (u2 port) regularly.

[0046] Specifically, in one cycle, the present invention controls the first host and the second host to alternately read and write the dual - port memory, including: after controlling the first host to read and write the dual - port memory, disconnecting the connection between the first host and the dual - port memory; then controlling the second host to read and write the dual - port memory. After controlling the second host to read and write the dual - port memory, disconnecting the connection between the second host and the dual - port memory, and returning to the step of controlling the first host to read and write the dual - port memory, repeating the next cycle, and the above process repeats cyclically under normal conditions. Next, the detailed execution process is described by taking one cycle as an example.

[0047]

[0048] As shown in the above table, one cycle of the embodiment of the present invention can specifically include four time periods: t0, t1, t2, and t3.

[0049] In the t0 time period, the first arbitration module synchronizes with the second arbitration module to calibrate the timers in each timing module. The first USB timing module periodically closes the u1 port and the second USB timing module periodically closes the u2 port. The first arbitration module obtains the status of the first service module from the first service module. The first arbitration module sends a notice to release the USB flash drive to the second arbitration module and waits for the reply of the second arbitration module. After receiving the notice, the second arbitration module determines that the u2 port is closed and sends a reply message agreeing to release the USB flash drive to the first arbitration module.

[0050] In the t1 time period, the first arbitration module opens the u1 port after receiving the reply message from the second arbitration module agreeing to release the USB flash drive. Specifically, the u1 port can be powered on by controlling the driver. After the USB driver detects the USB flash drive, it automatically enters the USB enumeration and loads the USB flash drive to form a block device; the first arbitration module reads the current heartbeat count a from the preset position of the USB flash drive (for example, the 1M position) through a block operation command (for example, the dd command used for reading and writing disks in the Linux system); the first arbitration module then writes the host heartbeat count a+1 and the host service program status normal to the preset position of the USB flash drive (for example, the 1M position) through a block operation command.

[0051] In the t2 time period, the first USB timing module closes the u1 port and the second USB timing module closes the u2 port. The second arbitration module notifies the first arbitration module through the synchronization line of a notification message to release the USB flash drive and waits for a reply from the first arbitration module. After receiving the notification message, the first arbitration module checks and confirms that the u1 port is closed, and then sends a reply message to the second arbitration module agreeing to release the USB flash drive.

[0052] In the t3 time period, the second arbitration module opens the u2 port after receiving the reply message from the first arbitration module agreeing to release the USB flash drive. Specifically, the u2 port can be powered on by the driver control, and the USB enumeration and loading of the USB flash drive are automatically entered after the USB driver detects the USB flash drive to form a block device; the second arbitration module reads the current heartbeat count b from the preset position of the USB flash drive (for example, the 2M position) through a quick operation command (for example, the dd command used for reading and writing disks in the Linux system); the second arbitration module writes the host heartbeat count b+1 and the host service program status normal to the preset position of the USB flash drive (for example, the 2M position) through a block operation command.

[0053] It can be known from this that in the normal periodic synchronization process of the embodiment of the present invention, the first host and the second host interact and confirm, and each controls the dual-port U disk in a time-sharing manner. The specific addresses on the U disk respectively record the heartbeat counts of host 1 and host 2 and the status of the host. Therefore, the embodiment of the present invention controls the first host and the second host to alternately read and write the dual-port memory, which may include: controlling the first host and the second host to alternately write heartbeat signals, such as a+1 or b+1, to the dual-port memory. The embodiment of the present invention controls the first host and the second host to alternately read and write the dual-port memory, which may also include: controlling the first host and the second host to alternately write host status quantities, such as normal, to the dual-port memory.

[0054] Step 110: Determine whether any host fails. Figure 2Schematic diagram of the system architecture. In the embodiments of the present invention, the dual-machine service system can be used as the execution entity to determine whether a host has failed. If neither the first host nor the second host has failed, return to step 100, that is, return to the step of controlling the two hosts to alternately read and write the dual-port memory; if one of the hosts has failed, execute step 120 for further judgment.

[0055] Step 120: Determine whether the first host has failed. It can be understood that in the embodiments of the present invention, it can first determine whether the first host has a fault, and of course, it can also first determine whether the second host has a fault; for the convenience of understanding and explanation of the solution, in step 120 of this embodiment, it first determines whether the first host has a fault.

[0056] Step 130: Elevate the control authority of the second host according to the failure of the first host. The present invention realizes the arbitration of dual-machine hot standby based on the dual-port memory as the arbitration disk, and can enable the second host to perform a preemptive action when the first host fails, so as to improve the control authority of the second host.

[0057] Step 140: If the first host has no fault, it can be determined that the second host has failed. The above implementation process of this embodiment should be understood as a feasible way or means to implement the present invention. On the basis that the dual-port memory has been disclosed as the arbitration disk in the present invention, a similar judgment logic can also be adopted.

[0058] Step 150: Elevate the control authority of the first host according to the failure of the second host; it can be seen that when the present invention is implemented, it can improve the control authority of the non-failed host in the case of the failure of any host in the dual-machine hot standby. It can be understood that elevating the control authority of the second host in the case of the failure of the first host is the same as elevating the control authority of the first host in the case of the failure of the second host in terms of the implementation process and working principle. Therefore, the embodiments of the present invention will elaborate on the specific content related to elevating the control authority of the second host according to the failure of the first host, and will not repeat the content related to elevating the control authority of the first host according to the failure of the second host.

[0059] Enhancing the control authority of the second host based on the failure of the first host includes: the second host obtains the heartbeat signal count of the first host from the dual-port memory. If the heartbeat signal count does not increase, it can be determined that the first host has failed, and the control authority of the second host can be enhanced based on the failure of the first host. This method is applicable to the situation where the failure of the first host is severe, such as the power-off problem. At this time, both the first service module and the first arbitration module in the first host are abnormal. During the specific execution process, if the first host is powered off, the u1 port will also lose power, the first arbitration module cannot work properly, and the first host cannot send a synchronization command to the second host, nor will it update the heartbeat count. The second arbitration module sends a notice message to release the USB flash drive to the first arbitration module through the synchronization line. Since the first host has been powered off and cannot reply, the second arbitration module obtains the access right to the USB flash drive and reads and writes the heartbeat data under the condition of no reply within the timeout period, and determines that the first host has failed based on the non-increase of the heartbeat count of the first host. Then the second arbitration module notifies the second service module to perform a switching active operation to make the second host the host with higher control authority.

[0060] Similarly, for the exceptions of the first service module and the first arbitration module caused by software exceptions in the normal power-on state of the first host, the above process is also executed: the second host obtains the heartbeat signal count of the first host from the dual-port memory. If the heartbeat signal count does not increase, it is determined that the first host has failed, and the control authority of the second host is enhanced based on the failure of the first host. Specifically, the u1 port is periodically closed through the first USB timing module to prevent problems that the second host cannot access the USB flash drive due to abnormal u1 port after the first arbitration module is turned on. The second arbitration module sends a notice message to release the USB flash drive to the first arbitration module through the synchronization line. Since the first arbitration module cannot reply due to system software exceptions, the second arbitration module obtains the access right to the USB flash drive and reads and writes the heartbeat data under the condition of no reply within the timeout period, and determines that the first host has failed based on the non-increase of the heartbeat count of the first host. Then the second arbitration module notifies the second service module to perform a switching active operation to make the second host the host with higher control authority.

[0061] The embodiment of the present invention for promoting the control authority of the second host according to the failure of the first host includes: based on the release of the interface occupation by the first host, the second host obtains the heartbeat signal count of the first host from the dual-port memory. If the heartbeat signal count does not increase, it is determined that the first host has failed, and the control authority of the second host is promoted according to the failure of the first host. Specifically, the embodiment of the present invention for the second host to obtain the heartbeat signal count of the first host from the dual-port memory may include: the second host sends an arbitration disk release request to the first host through a synchronization line, and the synchronization line is used for the interactive communication between the first host and the second host; if the second host does not receive the response sent by the first host within a preset time, that is, the first host times out without replying to the release request, the second host obtains the heartbeat signal access right; based on the heartbeat signal access right, the second host obtains the heartbeat signal count of the first host from the dual-port memory. Among them, the synchronization line in the embodiment of the present invention is at least one of a serial port line and a crossover network cable.

[0062] Optionally, the embodiment of the present invention for promoting the control authority of the second host according to the failure of the first host includes: the second host can obtain the host status quantity of the first host from the dual-port memory. If the host status quantity characterizes that the current state of the first host is abnormal, for example, the host status quantity is abnormal, it is determined that the first host has failed, and the control authority of the second host is promoted according to the failure of the first host. This method is applicable to the situation where the failure of the first host is relatively minor. For example, the first service module of the first host fails and the first arbitration module is normal. In the specific execution process, the first arbitration module obtains the status of the first service module from the first service module, and at this time it is abnormal. The first arbitration module writes the disk heartbeat, and the status value of the heartbeat is that the first host is abnormal. Both the first arbitration module and the second arbitration module can interactively read and write the disk heartbeat count. The second arbitration module reads the host status quantity of the first host on the USB flash drive as abnormal, then the second arbitration module notifies the second service module to perform a switching active operation to make the second host the host with higher control authority.

[0063] As Figure 2 shown, the service request sent by the user device enters the dual-machine service system after passing through the switch. Under normal circumstances, at least one of the first host and the second host responds to the service request. Under fault conditions, the host with higher control authority responds to the service request.

[0064] In summary, the present invention can adopt a dual - port USB flash drive combined with a network cable or a serial port cable used as a synchronization cable, which can greatly reduce the hardware cost and has the advantages of small size and easy installation. The present invention innovatively uses a dual - port USB flash drive as a shared disk carrier, eliminating the need to develop and maintain a third - party software system, further reducing the cost. The present invention can synchronize the arbitration - related data between the first host and the second host through an interconnection line, avoiding the dependence on a third - party synchronization system such as an NTP server in the conventional method and improving the reliability. In addition, the present invention can also avoid the problem that the other party cannot access the USB flash drive due to an abnormal arbitration program on one side by periodically closing the USB port. It can be seen that the present invention completely solves the problems existing in the conventional dual - machine hot - standby system, such as high cost of the arbitration disk and excessive dependence on the third - party system, and significantly improves the user experience and satisfaction.

[0065] Based on the same inventive technical concept as the permission control method for dual - machine hot - standby, an embodiment of the present invention can also provide a permission control device for dual - machine hot - standby, which may include, but is not limited to, a data reading and writing module and a permission control module.

[0066] The data reading and writing module is used to control the first host and the second host to alternately read and write a dual - port memory. The dual - port memory has two interfaces, and at most one of them can be enabled at the same time. The two interfaces are respectively connected to the first host and the second host. Among them, the dual - port memory in the embodiment of the present invention is a dual - port USB flash drive.

[0067] Specifically, the data reading and writing module in the embodiment of the present invention is used to control the first host to read and write the dual - port memory and then disconnect the connection between the first host and the dual - port memory within one cycle. The data reading and writing module is used to control the second host to read and write the dual - port memory and then disconnect the connection between the second host and the dual - port memory. After disconnecting the connection between the second host and the dual - port memory, the data reading and writing module is used to re - control the first host to read and write the dual - port memory, repeating the next cycle.

[0068] Optionally, the data reading and writing module can be used to control the first host and the second host to alternately write heartbeat signals to the dual - port memory.

[0069] Optionally, the data reading and writing module can be used to control the first host and the second host to alternately write host status variables to the dual - port memory.

[0070] The permission control module is used to elevate the control permission of the second host according to the failure of the first host, or elevate the control permission of the first host according to the failure of the second host.

[0071] Optionally, the permission control module is used to obtain the heartbeat signal count of the first host from the dual-port memory through the second host based on the release of the interface occupation by the first host, and is used to determine that the first host has failed according to the non-increase of the heartbeat signal count, and is used to elevate the control permission of the second host according to the failure of the first host. Specifically, the permission control module is used to control the second host to send an arbitration disk release request to the first host through a synchronization line, and the synchronization line is used for the interactive communication between the first host and the second host; the permission control module is used to enable the second host to obtain the heartbeat signal access permission according to the non-receipt of the response sent by the first host within a preset time, and is used to control the second host to obtain the heartbeat signal count of the first host from the dual-port memory based on the heartbeat signal access permission. Among them, the synchronization line is at least one of a serial port line and a crossover network cable.

[0072] Optionally, the permission control module can be used to obtain the heartbeat signal count of the first host from the dual-port memory through the second host based on the disconnection of the connection between the first host and the dual-port memory, and is used to determine that the first host has failed according to the non-increase of the heartbeat signal count, and is used to elevate the control permission of the second host according to the failure of the first host.

[0073] Optionally, the permission control module can be used to obtain the host status quantity of the first host from the dual-port memory through the second host, and can be used to determine that the first host has failed according to the host status quantity indicating that the current state of the first host is abnormal, and is used to elevate the control permission of the second host according to the failure of the first host.

[0074] As Figure 3 shown, based on the same inventive technical concept as the permission control method for dual-machine hot standby, the present invention can also specifically provide a computer device, which includes a memory and a processor. A computer-readable instruction is stored in the memory. When the computer-readable instruction is executed by the processor, the processor is caused to execute the steps of the permission control method for dual-machine hot standby in any embodiment of the present invention. Among them, the specific process of the permission control method for dual-machine hot standby has been described in detail in this specification, and will not be elaborated here.

[0075] As Figure 3 shown, based on the same inventive technical concept as the permission control method for dual-machine hot standby, the present invention can also provide a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors are caused to execute the steps of the permission control method for dual-machine hot standby in any embodiment of the present invention. Among them, the specific implementation process of the permission control method for dual-machine hot standby in the present invention has been described in detail in this specification, and will not be elaborated here.

[0076] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a definable sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in conjunction with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable storage medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable storage medium include the following: an electrical connection part with one or more wirings (electronic device), a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM, or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable storage medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or other appropriate processing when necessary, and then storing it in a computer memory.

[0077] It should be understood that various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well-known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application-specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGA), field programmable gate arrays (FPGA), etc.

[0078] In the description of this specification, the descriptions referring to terms such as "this embodiment", "one embodiment", "some embodiments", "examples", "specific examples", or "some examples", etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0079] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In the description of the present invention, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise specifically and clearly defined.

[0080] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, and simple improvements made to the substantial content of the present invention shall be included within the protection scope of the present invention.

Claims

1. A privilege control method for dual-machine hot standby, characterized in that The method includes: Controlling a first host and a second host to alternately read and write a dual-port memory, the dual-port memory having two interfaces that can be enabled at most one at a time, and the two interfaces are respectively connected to the first host and the second host; Within one cycle, the controlling the first host and the second host to alternately read and write the dual-port memory includes: after controlling the first host to read and write the dual-port memory, disconnecting the connection between the first host and the dual-port memory; after controlling the second host to read and write the dual-port memory, disconnecting the connection between the second host and the dual-port memory, and returning to the step of controlling the first host to read and write the dual-port memory, repeating the next cycle; Increasing the control authority of the second host according to a failure of the first host, or increasing the control authority of the first host according to a failure of the second host.

2. The authority control method for dual-machine hot standby according to claim 1, wherein The controlling the first host and the second host to alternately read and write the dual-port memory includes: controlling the first host and the second host to alternately write heartbeat signals to the dual-port memory; The increasing the control authority of the second host according to a failure of the first host includes: Based on the first host releasing the interface occupation, the second host obtains the heartbeat signal count of the first host from the dual-port memory; If the heartbeat signal count does not increase, it is determined that the first host has failed, and the control authority of the second host is increased.

3. The privilege control method for dual-machine hot standby according to claim 2, wherein The second host obtaining the heartbeat signal count of the first host from the dual-port memory includes: The second host sends an arbitration disk release request to the first host through a synchronization line; the synchronization line is used for interactive communication between the first host and the second host; If the response sent by the first host is not received within a preset time, the second host obtains the heartbeat signal access right; Based on the heartbeat signal access right, the second host obtains the heartbeat signal count of the first host from the dual-port memory.

4. The authority control method for dual-machine hot standby according to claim 1, wherein The increasing the control authority of the second host according to a failure of the first host includes: The second host obtains the heartbeat signal count of the first host from the dual-port memory; If the heartbeat signal count does not increase, it is determined that the first host has failed, and the control authority of the second host is increased.

5. The authority control method for dual-machine hot standby according to claim 1, wherein The controlling the first host and the second host to alternately read and write the dual-port memory includes: controlling the first host and the second host to alternately write host status quantities to the dual-port memory; The increasing the control authority of the second host according to a failure of the first host includes: The second host obtains the host status quantity of the first host from the dual-port memory; If the host status quantity indicates that the current state of the first host is abnormal, it is determined that the first host has failed, and the control authority of the second host is increased.

6. An authority control device for dual-machine hot standby, characterized in that, The device includes: A data reading and writing module, configured to control a first host and a second host to alternately read and write a dual-port memory, where the dual-port memory has two interfaces, and at most one of them can be enabled at the same time, and the two interfaces are respectively connected to the first host and the second host; The data reading and writing module is configured to disconnect the connection between the first host and the dual-port memory after controlling the first host to read and write the dual-port memory; and is configured to disconnect the connection between the second host and the dual-port memory after controlling the second host to read and write the dual-port memory, and is configured to return to the step of controlling the first host to read and write the dual-port memory, and repeat the next cycle; An authority control module, configured to elevate the control authority of the second host according to a failure of the first host, or elevate the control authority of the first host according to a failure of the second host.

7. The authority control device for dual-machine hot standby according to claim 6, wherein The data reading and writing module is configured to control the first host and the second host to alternately write heartbeat signals to the dual-port memory; The authority control module is configured to enable the second host to obtain the heartbeat signal count of the first host from the dual-port memory based on the release of the interface occupation by the first host, and is configured to determine that the first host has failed according to the non-increase of the heartbeat signal count, and elevate the control authority of the second host.

8. The authority control device for dual-machine hot standby according to claim 7, wherein The authority control module is configured to enable the second host to send an arbitration disk release request to the first host through a synchronization line; the synchronization line is used for interactive communication between the first host and the second host; The authority control module is configured to enable the second host to obtain the heartbeat signal access authority according to the non-receipt of the response sent by the first host within a preset time; and is configured to enable the second host to obtain the heartbeat signal count of the first host from the dual-port memory based on the heartbeat signal access authority.

9. The authority control device for dual-machine hot standby according to claim 6, wherein The authority control module is configured to enable the second host to obtain the heartbeat signal count of the first host from the dual-port memory, and is configured to determine that the first host has failed according to the non-increase of the heartbeat signal count, and elevate the control authority of the second host.

10. The authority control device for dual-machine hot standby according to claim 6, wherein The data reading and writing module is configured to control the first host and the second host to alternately write host status variables to the dual-port memory; The authority control module is configured to determine that the first host has failed according to the host status variable indicating that the current state of the first host is abnormal, and elevate the control authority of the second host.

Citation Information

Patent Citations

  • ot standby method based on arbitration disk mechanism

    CN103593266A

  • Disk lock arbitration method and device for double-control split brain, equipment and medium

    CN111737063A