Data transmission method and device for HA equipment
By using group IDs to associate service data within HA device groups, the problem of data loss caused by switching of the primary HA device was solved, and lossless data transmission was achieved.
Patent Information
- Application Number
- CN202310024679.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-09
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2043-01-09
AI Technical Summary
During the switching of the primary HA device in an HA device group, existing technologies cause business data to fail to be transmitted, resulting in data loss.
By obtaining the group ID of the HA device group and associating it with business data to replace the device identifier, it is ensured that the transmission of business data is not lost when the primary HA device is switched over.
In the event of a primary HA device switchover, business data loss should be avoided, and lossless data migration should be achieved.
Smart Images

Figure CN116016530B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, specifically to a data transmission method and apparatus for a high-availability (HA) device. Background Technology
[0002] HA (Highly Available) devices refer to the devices that make up a dual-machine trunking system. A dual-machine trunking system has at least two HA devices that are peers to each other. One of these HA devices is the primary HA device, used to receive service data and execute corresponding services, and the other is a standby HA device. The primary and standby HA devices form an HA device group. To enable the primary HA device in the HA device group to receive service data, related technologies associate the device identifier of the primary HA device with the service data. Based on the device identifier of the primary HA device, the service data corresponding to the primary HA device is sent to that primary HA device.
[0003] However, during the operation of an HA (High Availability) device group, the primary HA device may be switched over. For example, the original primary HA device may be switched to a backup HA device or directly replaced by other devices due to the need for HA group reorganization or device failure. Since service data is associated with device identifiers, when the original primary HA device is switched over, the new primary HA device will have a different device identifier than the original primary HA device. This can cause the service data that was supposed to be sent to fail to be transmitted to the primary HA device of the HA group, resulting in data loss. Summary of the Invention
[0004] This application aims to address at least one of the technical problems existing in related technologies. To this end, this application proposes a data transmission method for HA (High Availability) devices, which can prevent the loss of service data in the event of a switchover of the primary HA device in an HA device group.
[0005] This application also proposes a data transmission device for HA equipment.
[0006] This application also proposes an electronic device.
[0007] This application also proposes a computer-readable storage medium.
[0008] The data transmission method of the HA device according to the first aspect of this application includes:
[0009] Once it is determined that a primary HA device switchover has occurred in the HA device group, the group ID of the HA device group is obtained.
[0010] Based on the group ID, obtain the service data corresponding to the group ID and send it to the current primary HA device in the HA device group.
[0011] The data transmission method for HA devices provided in this application obtains the group ID of the HA device group when a primary HA device switchover occurs. Using this group ID, the method retrieves the service data corresponding to the group ID and sends it to the current primary HA device in the HA device group. By associating the service data with the group ID of the HA device group, rather than associating the service data with the device identifier of the primary HA device, the method ensures that the service data to be sent can still be retrieved using the group ID of the HA device group when a primary HA device switchover occurs. This prevents the loss of service data in the event of a primary HA device switchover.
[0012] According to one embodiment of this application, determining that a primary HA device switchover has occurred in an HA device group and obtaining the group ID of the HA device group includes:
[0013] Determine the primary HA device and the backup HA device that are peer devices in the HA device group and perform primary / backup switchover. Obtain the group ID of the HA device group based on the device identifier of the current primary HA device or the device identifier of the current backup HA device.
[0014] Among them, the device identifiers of two HA devices that are peer devices correspond to the same set of IDs.
[0015] According to one embodiment of this application, determining that a primary HA device switchover has occurred in an HA device group and obtaining the group ID of the HA device group includes:
[0016] Once it is determined that the primary HA device in the HA device group is switched to an external device, based on the device identifier of the current standby HA device in the HA device group that is the peer device of the primary HA device before the switch, the first set of IDs corresponding to the device identifier of the current standby HA device is obtained.
[0017] The first group of IDs is determined as the group ID of the HA device group;
[0018] The external device is any HA device other than the backup HA device in the HA device group.
[0019] According to one embodiment of this application, determining the first group ID as the group ID of the HA device group includes:
[0020] If it is determined that there is no second group ID corresponding to the device identifier of the external device, the first group ID is determined as the group ID of the HA device group.
[0021] According to one embodiment of this application, it also includes:
[0022] Determine that there exists a second group ID corresponding to the device identifier of the external device, and obtain the group ID of the HA device group based on the first group ID and the second group ID.
[0023] According to one embodiment of this application, obtaining the group ID of the HA device group based on the first group ID and the second group ID includes:
[0024] If the business data corresponding to the first group ID is determined to have no data conflict with the business data corresponding to the second group ID, the first group ID and the second group ID are combined to obtain the group ID of the HA device group including the first group ID and the second group ID.
[0025] According to one embodiment of this application, obtaining the group ID of the HA device group based on the first group ID and the second group ID includes:
[0026] If the business data corresponding to the first group ID is found to conflict with the business data corresponding to the second group ID, the first group ID and the selected group ID from the second group ID are determined as the group ID of the HA device group.
[0027] The data transmission apparatus of the HA device according to the second aspect of this application includes:
[0028] The identifier acquisition module is used to determine when a primary HA device switch occurs in an HA device group and to acquire the group ID of the HA device group.
[0029] The data transmission module is used to obtain the service data corresponding to the group ID and send it to the current main HA device in the HA device group.
[0030] An electronic device according to a third aspect of this application includes a processor and a memory storing a computer program, wherein the processor executes the computer program to implement the data transmission method of the HA device described in any of the above embodiments.
[0031] A computer-readable storage medium according to a fourth aspect of this application stores a computer program thereon, which, when executed by a processor, implements the data transmission method of the HA device described in any of the above embodiments.
[0032] A computer program product according to a fifth aspect of this application includes: when the computer program is executed by a processor, it implements a data transmission method for an HA device as described in any of the above embodiments.
[0033] The above-described one or more technical solutions in the embodiments of this application have at least one of the following technical effects:
[0034] By obtaining the group ID of an HA device group when a primary HA device switchover occurs, and then using this group ID to retrieve the corresponding service data and send it to the current primary HA device in the HA device group, the service data is associated with the group ID of the HA device group instead of the device identifier of the primary HA device. This ensures that the service data can still be retrieved using the group ID of the HA device group when a primary HA device switchover occurs, thus preventing the loss of service data in the event of a primary HA device switchover. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 This is a schematic flowchart of the data transmission method for the HA device provided in the embodiments of this application;
[0037] Figure 2 This is a schematic diagram of the equipment information of each HA device in the HA equipment group after the primary / standby switchover;
[0038] Figure 3 Yes Figure 1 The flowchart for obtaining the group ID in the data transmission method of HA equipment is further refined;
[0039] Figure 4 This is a schematic diagram of the device information of each HA device in the HA device group after the main HA device is switched to an external device.
[0040] Figure 5 This is a schematic diagram of the data transmission device of the HA equipment provided in the embodiments of this application;
[0041] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0043] The data transmission method and apparatus for the HA device provided in this application will be described in detail below through several specific embodiments.
[0044] In one embodiment, a data transmission method for HA devices is provided. This method is applied to a terminal device for transmitting data to a group of HA devices undergoing a master HA device switchover. The terminal device can be a user terminal or a server. The user terminal can be a desktop or portable terminal, such as a desktop computer or a laptop. The server can be a standalone server or a server cluster composed of multiple servers. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence sampling point devices.
[0045] like Figure 1 As shown, the data transmission method for an HA device provided in this embodiment includes:
[0046] Step 101: Determine that a primary HA device switch has occurred in the HA device group, and obtain the group ID of the HA device group;
[0047] Step 102: Based on the group ID, obtain the service data corresponding to the group ID and send it to the current primary HA device in the HA device group.
[0048] By obtaining the group ID of an HA device group when a primary HA device switchover occurs, and then using this group ID to retrieve the corresponding service data and send it to the current primary HA device in the HA device group, the service data is associated with the group ID of the HA device group instead of the device identifier of the primary HA device. This ensures that the service data can still be retrieved using the group ID of the HA device group when a primary HA device switchover occurs, thus preventing the loss of service data in the event of a primary HA device switchover.
[0049] In one embodiment, the HA device group includes a group of HA devices that are peer devices. The device identifiers of the peer HA devices correspond to the same group ID, which is the group ID of the HA device group. The group ID is pre-associated with corresponding service data. The device identifier...
[0050] The identification includes the device ID and / or the SN identifier of the HA device. For example, if the HA device group is device group A, this device group A includes device 1 and device 2, where device 1 is the peer device of device 2.
[0051] If device 2 is the peer device of device 1, and the group ID corresponding to the device identifier of device 1 and the device identifier of device 2 is 1, then the group ID corresponding to device group A is 1.
[0052] Because the device identifiers of the HA devices in the HA device group that are peers to each other correspond to the same...
[0053] Each group has an ID, so when a primary HA device switch occurs in the HA device group (i.e., the standby HA device in HA device group 0 is switched to the primary HA device), it can be detected through the ID in that HA device group.
[0054] The group ID of the HA device group can be obtained by using the device identifier of any HA device that is a peer device, i.e., the device identifier of the current primary HA device or the device identifier of the current standby HA device.
[0055] For example, such as Figure 2 As shown, assume the HA device group includes device 1 and device 2.
[0056] Before the primary / standby switchover, device 1 was marked as adminMaster=1, i.e., marked as the primary HA device, and device 2 was marked as adminMaster=0, i.e., marked as the standby HA device.
[0057] Device 1 and Device 2 are peer devices. Device 1 has a device ID of 1, a corresponding group ID of 1, and an SN identifier of 123456. Its peer device, Device 2, has an SN identifier of 654321. Device 2 has a device ID of 2, a corresponding group ID of 1, and an SN identifier of 654321.
[0058] Its peer device, i.e., device 1, has an SN identifier of 123456. After the primary / standby switchover occurs, device 2 is marked with adminMaster=0, meaning it is marked as a standby HA device. Device 2 is...
[0059] The device is marked as adminMaster=1, meaning it is designated as the primary HA device. Since the two devices have the same group ID, the group ID that is the same as the HA device group when no primary / standby switchover occurred can be found by using the device ID of the current primary HA device (device 2) or the device ID of the current standby HA device (device 1).
[0060] Since the group ID is associated with corresponding business data, and the group ID of the HA device group after the primary / standby switch is the same as the group ID before the primary / standby switch, the business data to be sent subsequently will be consistent with that before the primary / standby switch, thus achieving lossless migration of business data.
[0061] Considering that switching the primary HA device may also involve replacing the primary HA device with an external device, that is, replacing the original primary HA device in the HA device group with a backup HA device other than the one in the HA device group.
[0062] Any HA device outside the backup. When the primary HA device in the HA device group is switched to an external device, to ensure that the obtained group ID of the HA device group is the same as the group ID when the primary HA device switch did not occur, and to avoid changes in the group ID that could lead to changes in the subsequently obtained service data.
[0063] In one embodiment, the variation is as follows: Figure 2 As shown, to determine if a primary HA device switchover has occurred in the HA device group, the group ID of the HA device group is obtained, including:
[0064] Step 201: Determine that the primary HA device in the HA device group has been switched to an external device. Based on the device identifier of the current standby HA device in the HA device group that is the peer device of the primary HA device before the switchover, obtain the first device identifier corresponding to the device identifier of the current standby HA device.
[0065] A set of IDs;
[0066] Step 202: Determine the first group ID as the group ID of the HA device group.
[0067] In one embodiment, when the primary HA device in the HA device group is switched to an external device, since the current standby HA device in the HA device group and the primary HA device before the switchover are peer devices, their corresponding group IDs are the same. Therefore, the device can be used through the current standby HA device.
[0068] The device identifier is used to find the group ID corresponding to the device identifier of the current standby HA device. This group ID is set to 0 as the first group ID, and then the first group ID is used as the group ID of the HA device group.
[0069] After setting the first group ID as the group ID of the HA device group, the group ID can be associated with the device identifier of the external device, and the peer device of the current standby HA device can be updated to the external device. At the same time, the current standby HA device can be marked as the peer device of the external device.
[0070] For example, such as Figure 3As shown, assuming that before the primary HA device switchover, the HA device group includes device 1 and device 2, with device 3 as the external device. Device 1 is marked as adminMaster=1, i.e., it is marked as the primary HA device, and device 2 is marked as adminMaster=0, i.e., it is marked as the standby HA device. Devices 1 and 2 are peer devices. Device 1 has a device ID (neid) of 1, a corresponding group ID (groupid) of 1, and a serial number (SN) of 123456. Its peer device, device 2, has a serial number (SN) of 654321. Device 2 has a device ID of 2, a corresponding group ID of 1, and a serial number (SN) of 654321. Its peer device, device 1, has a serial number (SN) of 123456. Device 3 has a device ID of 3 and a serial number (SN) of 66666. When device 1 is replaced by device 3, device 3 is marked as adminMaster=1, i.e., it is marked as the primary HA device, while device 2 remains marked as adminMaster=0, i.e., it remains the standby HA device. Since device 2 and device 1 share the same group ID, the corresponding group ID can be obtained through device 2's device identifier and used as the first group ID. This first group ID is then used as the group ID of the HA device group, thus reusing the original group ID of the HA device group. After reusing the original group ID of the HA device group, the group ID corresponding to device 3 can be set to 1. At the same time, device 2 is marked as the peer device of device 3, and the peer device of device 2 is changed to device 3.
[0071] When the primary HA device in an HA device group is detected to be switched to an external device, the system obtains the first group ID corresponding to the device ID of the current standby HA device that is the peer of the primary HA device before the switch, based on the device ID of the current standby HA device in the HA device group. This first group ID is then used as the group ID of the HA device group, ensuring that when the primary HA device in the HA device group is switched to an external device, the same group ID as when the primary HA device was not switched can still be obtained, thus avoiding changes in the group ID that could affect the delivery of subsequent service data.
[0072] Considering that an external device may be the primary HA device in another HA device group, meaning that the external device may also have corresponding service data to receive, when it is determined that the primary HA device in the HA device group is switched to an external device, directly using the first group ID corresponding to the device identifier of the current standby HA device as the group ID of the HA device group may cause the service data that originally needed to be transmitted to the external device to be lost due to the inability to transmit. Therefore, in one embodiment, after obtaining the first group ID corresponding to the device identifier of the current standby HA device, the device identifier of the external device can be obtained first, and the existence of a group ID corresponding to the device identifier of the external device can be checked based on the device identifier of the external device. If it is detected that the group ID corresponding to the device identifier of the external device is empty, that is, there is no group ID corresponding to the device identifier of the external device, it indicates that the external device is not an HA device in any other HA device group before being switched to the primary HA device. When an external device is not an HA device in another HA device group, it will certainly not be the primary HA device in another HA device group. Therefore, there is no service data to be transmitted before the external device is switched to the primary HA device. In this case, the first group ID is determined as the group ID of the HA device group, thereby reducing the possibility of subsequent loss of service data when the first group ID is determined as the group ID of the HA device group.
[0073] In one embodiment, if a group ID corresponding to the device identifier of the external device is detected, this group ID can be used as the second group ID. Then, the group ID of the HA device group can be obtained based on the first group ID and the second group ID. Obtaining the group ID of the HA device group based on the first group ID and the second group ID can be achieved by using either the first group ID or the second group ID as the group ID of the HA device group. Alternatively, to further reduce the loss of service data, obtaining the group ID of the HA device group based on the first group ID and the second group ID can be achieved by combining the first group ID and the second group ID as the group ID of the HA device group.
[0074] For example, assuming the first group ID is 1 and the second group ID is 2, the group ID obtained by combining the first group ID and the second group ID is the set of IDs (1,2) that includes both the first group ID and the second group ID. This set of IDs (1,2) is the group ID of the HA device group.
[0075] In this way, since the group ID of the HA device group includes the first group ID and the second group ID, when obtaining service data, the service data corresponding to the first group ID and the service data corresponding to the second group ID can be obtained simultaneously. Therefore, when the primary HA device in the HA device group is switched to an external device, if there is a second group ID corresponding to the device identifier of the external device, the service data that originally needed to be sent to the primary HA device of the HA device group and the service data that originally needed to be sent to the external device can be obtained through the group ID of the HA device group that includes the first group ID and the second group ID, thereby reducing the loss of service data.
[0076] Considering that business data to be sent to external devices may conflict with business data to be sent to the HA device group, combining the first set of IDs and the second set of IDs to form the group ID of the HA device group would cause subsequent data conflicts due to received business data, leading to the HA device group's inability to function properly. For example, suppose the business data to be sent to external devices includes Policy 1 and Route 1, while the business data to be sent to the HA device group includes Policy 2 and Route 2. Policy 2 differs from Policy 1, and Route 2 differs from Route 1. If the first set of IDs and the second set of IDs are combined to form the group ID of the HA device group, the primary HA device in the HA device group will be configured with two policies and two routes, thus preventing normal operation.
[0077] Therefore, to minimize the occurrence of business data loss while ensuring the normal operation of the primary HA device in the HA device group, in one embodiment, since each group ID is assigned its corresponding business data, after obtaining the second group ID corresponding to the device identifier of the external device, the business data corresponding to the first group ID can be compared with the business data corresponding to the second group ID to determine whether there is a data conflict. If there is no data conflict, the first group ID and the second group ID can be combined to obtain the group ID of the HA device group, which includes the first group ID and the second group ID. This ensures that when subsequent business data is sent to the primary HA device in the HA device group, the primary HA device will not fail to operate due to data conflicts.
[0078] If data conflicts exist, a group ID can be selected from the first group ID and the second group ID. This can be done either by the user manually selecting a group ID from the first group ID and the second group ID, or by randomly selecting a group ID from the first group ID and the second group ID. The selected group ID is then used as the group ID for the HA device group. Since the group ID for the HA device group is only one of the first group ID and the second group ID, the subsequently acquired business data will also correspond to only one of the first group ID and the second group ID, preventing data conflicts. This also ensures that business data corresponding to one of the first group ID and the second group ID will not be lost.
[0079] After obtaining the group ID of the HA device group where the primary HA device switchover occurred, the corresponding service data can be retrieved based on that group ID. After retrieving the service data, it can first check whether the current primary HA device in the HA device group has already configured the service data. If it has, there is no need to send the service data; otherwise, the service data is sent to the current primary HA device in that HA device group.
[0080] After the business data is sent to the current primary HA device in the HA device group, the business data in the current primary HA device can also be synchronized to the current standby HA device in the HA device group. This allows the business data of the primary HA device to be retrieved from the standby HA device even if the business data of the primary HA device is lost.
[0081] The data transmission apparatus of the HA device provided in this application is described below. The data transmission apparatus of the HA device described below can be referred to in correspondence with the data transmission method of the HA device described above.
[0082] In one embodiment, such as Figure 5 As shown, a data transmission device for an HA (High Availability) device is provided, comprising:
[0083] The identifier acquisition module 210 is used to determine that a master HA device switch has occurred in the HA device group and to acquire the group ID of the HA device group.
[0084] The data transmission module 220 is used to obtain the service data corresponding to the group ID and send it to the current main HA device in the HA device group according to the group ID.
[0085] By obtaining the group ID of an HA device group when a primary HA device switchover occurs, and then using this group ID to retrieve the corresponding service data and send it to the current primary HA device in the HA device group, the service data is associated with the group ID of the HA device group instead of the device identifier of the primary HA device. This ensures that the service data can still be retrieved using the group ID of the HA device group when a primary HA device switchover occurs, thus preventing the loss of service data in the event of a primary HA device switchover.
[0086] In one embodiment, an HA device group includes a set of HA devices that are peer devices. The device identifiers of the peer HA devices correspond to the same group ID, which is the group ID of the HA device group. The group ID is pre-associated with corresponding service data. The device identifier includes the device ID and / or the SN identifier of the HA device. For example, if the HA device group is device group A, which includes device 1 and device 2, where device 1 is the peer device of device 2 and device 2 is the peer device of device 1, and the group ID corresponding to the device identifiers of device 1 and device 2 is 1, then the group ID corresponding to device group A is 1.
[0087] In one embodiment, the identifier acquisition module 210 is specifically used for:
[0088] Determine the primary HA device and the backup HA device that are peer devices in the HA device group and perform primary / backup switchover. Obtain the group ID of the HA device group based on the device identifier of the current primary HA device or the device identifier of the current backup HA device.
[0089] Among them, the device identifiers of the primary HA device and the backup HA device, which are peer devices, correspond to the same set of IDs.
[0090] Since the device identifiers of HA devices that are peer devices in an HA device group correspond to the same group ID, when a primary HA device switch occurs in the HA device group, that is, when the standby HA device in the HA device group is switched to the primary HA device, the group ID of the HA device group can be obtained through the device identifier of any HA device that is a peer device in the HA device group, that is, the device identifier of the current primary HA device or the device identifier of the current standby HA device.
[0091] For example, such as Figure 2As shown, assuming the HA device group includes device 1 and device 2, before the primary / standby switchover, device 1 is marked as adminMaster=1, i.e., it is marked as the primary HA device, and device 2 is marked as adminMaster=0, i.e., it is marked as the standby HA device. Devices 1 and 2 are peer devices. Device 1 has a device ID of 1, a corresponding group ID of 1, and a serial number (SN) of 123456. Its peer device, device 2, has a serial number (SN) of 654321. Device 2 has a device ID of 2, a corresponding group ID of 1, and a serial number (SN) of 654321. Its peer device, device 1, has a serial number (SN) of 123456. After the primary / standby switchover, device 2 is marked as adminMaster=0, i.e., it is marked as the standby HA device, and device 2 is marked as adminMaster=1, i.e., it is marked as the primary HA device. Since both devices have the same group ID, the same group ID as the HA device group before the primary / standby switchover can be found by either the device ID of the current primary HA device (device 2) or the device ID of the current standby HA device (device 1).
[0092] Since the group ID is associated with corresponding business data, and the group ID of the HA device group after the primary / standby switch is the same as the group ID before the primary / standby switch, the business data to be sent subsequently will be consistent with that before the primary / standby switch, thus achieving lossless migration of business data.
[0093] Considering that primary HA device switching may also involve switching the primary HA device to an external device, that is, replacing the original primary HA device in the HA device group with any HA device other than the standby HA device in the same HA device group, when the primary HA device in the HA device group is switched to an external device, in order to ensure that the group ID of the HA device group obtained is the same as the group ID when the primary HA device switching did not occur, and to avoid changes in the group ID that would lead to changes in the subsequently obtained service data, in one embodiment, the identifier acquisition module 210 is specifically used for:
[0094] Once it is determined that the primary HA device in the HA device group is switched to an external device, based on the device identifier of the current standby HA device in the HA device group that is the peer device of the primary HA device before the switch, the first set of IDs corresponding to the device identifier of the current standby HA device is obtained.
[0095] The first group of IDs is determined as the group ID of the HA device group;
[0096] The external device is any HA device other than the backup HA device in the HA device group.
[0097] In one embodiment, when the primary HA device in the HA device group is switched to an external device, since the current standby HA device in the HA device group and the primary HA device before the switch are peer devices, their corresponding group IDs are the same. At this time, the group ID corresponding to the device ID of the current standby HA device can be found through the device identifier of the current standby HA device as the first group ID, and then the first group ID is used as the group ID of the HA device group.
[0098] After setting the first group ID as the group ID of the HA device group, the group ID can be associated with the device identifier of the external device, and the peer device of the current standby HA device can be updated to the external device. At the same time, the current standby HA device can be marked as the peer device of the external device.
[0099] For example, such as Figure 3 As shown, assuming that before the primary HA device switchover, the HA device group includes device 1 and device 2, with device 3 as the external device. Device 1 is marked as adminMaster=1, i.e., it is marked as the primary HA device, and device 2 is marked as adminMaster=0, i.e., it is marked as the standby HA device. Devices 1 and 2 are peer devices. Device 1 has a device ID of 1, a corresponding group ID of 1, and a serial number (SN) of 123456. Its peer device, device 2, has a serial number (SN) of 654321. Device 2 has a device ID of 2, a corresponding group ID of 1, and a serial number (SN) of 654321. Its peer device, device 1, has a serial number (SN) of 123456. Device 3 has a device ID of 3 and a serial number (SN) of 66666. When device 1 is replaced by device 3, device 3 is marked as adminMaster=1, i.e., it is marked as the primary HA device, while device 2 remains marked as adminMaster=0, i.e., it remains the standby HA device. Since device 2 and device 1 share the same group ID, the corresponding group ID can be obtained through device 2's device identifier and used as the first group ID. This first group ID is then used as the group ID of the HA device group, thus reusing the original group ID of the HA device group. After reusing the original group ID of the HA device group, the group ID corresponding to device 3 can be set to 1. At the same time, device 2 is marked as the peer device of device 3, and the peer device of device 2 is changed to device 3.
[0100] When the primary HA device in an HA device group is detected to be switched to an external device, the system obtains the first group ID corresponding to the device ID of the current standby HA device that is the peer of the primary HA device before the switch, based on the device ID of the current standby HA device in the HA device group. This first group ID is then used as the group ID of the HA device group, ensuring that when the primary HA device in the HA device group is switched to an external device, the same group ID as when the primary HA device was not switched can still be obtained, thus avoiding changes in the group ID that could affect the delivery of subsequent service data.
[0101] Considering that the external device may be the primary HA device in another HA device group, meaning that the external device may also have corresponding service data to receive, when it is determined that the primary HA device in the HA device group is switched to an external device, if the first group ID corresponding to the device identifier of the current standby HA device is directly used as the group ID of the HA device group, it may cause the service data that originally needed to be transmitted to the external device to be lost due to the inability to transmit. Therefore, in one embodiment, the identifier acquisition module 210 is specifically used for:
[0102] If it is determined that there is no second group ID corresponding to the device identifier of the external device, the first group ID is determined as the group ID of the HA device group.
[0103] In one embodiment, after obtaining the first group ID corresponding to the device identifier of the current standby HA device, the device identifier of the external device can be obtained first. Based on the device identifier of the external device, it can be checked whether a group ID corresponding to the device identifier of the external device exists. If the group ID corresponding to the device identifier of the external device is found to be empty, i.e., no group ID exists, it indicates that the external device is not an HA device in any other HA device group before being switched to the primary HA device. Since the external device is not an HA device in any other HA device group, it will certainly not be the primary HA device in any other HA device group. Therefore, the external device does not have any service data to be transmitted before being switched to the primary HA device. In this case, the first group ID is then determined as the group ID of the HA device group, thereby reducing the possibility of subsequent service data loss when the first group ID is determined as the group ID of the HA device group.
[0104] In one embodiment, the identifier acquisition module 210 is further configured to:
[0105] Determine that there exists a second group ID corresponding to the device identifier of the external device, and obtain the group ID of the HA device group based on the first group ID and the second group ID.
[0106] In one embodiment, if a group ID corresponding to the device identifier of the external device is detected, this group ID can be used as the second group ID. Then, the group ID of the HA device group can be obtained based on the first group ID and the second group ID. Obtaining the group ID of the HA device group based on the first group ID and the second group ID can be achieved by using either the first group ID or the second group ID as the group ID of the HA device group. Alternatively, to further reduce the loss of service data, obtaining the group ID of the HA device group based on the first group ID and the second group ID can be achieved by combining the first group ID and the second group ID as the group ID of the HA device group.
[0107] For example, assuming the first group ID is 1 and the second group ID is 2, the group ID obtained by combining the first group ID and the second group ID is the set of IDs (1,2) that includes both the first group ID and the second group ID. This set of IDs (1,2) is the group ID of the HA device group.
[0108] In this way, since the group ID of the HA device group includes the first group ID and the second group ID, when obtaining service data, the service data corresponding to the first group ID and the service data corresponding to the second group ID can be obtained simultaneously. Therefore, when the primary HA device in the HA device group is switched to an external device, if there is a second group ID corresponding to the device identifier of the external device, the service data that originally needed to be sent to the primary HA device of the HA device group and the service data that originally needed to be sent to the external device can be obtained through the group ID of the HA device group that includes the first group ID and the second group ID, thereby reducing the loss of service data.
[0109] Considering that business data to be sent to external devices may conflict with business data to be sent to the HA device group, combining the first set of IDs and the second set of IDs to form the group ID of the HA device group would cause subsequent data conflicts due to received business data, leading to the HA device group's inability to function properly. For example, suppose the business data to be sent to external devices includes Policy 1 and Route 1, while the business data to be sent to the HA device group includes Policy 2 and Route 2. Policy 2 differs from Policy 1, and Route 2 differs from Route 1. If the first set of IDs and the second set of IDs are combined to form the group ID of the HA device group, the primary HA device in the HA device group will be configured with two policies and two routes, thus preventing normal operation.
[0110] Therefore, in order to reduce the occurrence of business data loss while ensuring the normal operation of the main HA device in the HA device group, in one embodiment, the identifier acquisition module 210 is specifically used for:
[0111] If the business data corresponding to the first group ID is determined to have no data conflict with the business data corresponding to the second group ID, the first group ID and the second group ID are combined to obtain the group ID of the HA device group including the first group ID and the second group ID.
[0112] In one embodiment, since each group ID is configured with its corresponding service data, after obtaining the second group ID corresponding to the device identifier of the external device, the identifier acquisition module 210 can compare the service data corresponding to the first group ID with the service data corresponding to the second group ID to determine whether there is a data conflict. If there is no data conflict, the first group ID and the second group ID can be combined to obtain the group ID of the HA device group including the first group ID and the second group ID, thereby ensuring that when subsequent service data is sent to the main HA device in the HA device group, the main HA device will not fail to operate due to data conflict.
[0113] In one embodiment, the identifier acquisition module 210 is specifically used for:
[0114] If the business data corresponding to the first group ID is found to conflict with the business data corresponding to the second group ID, the first group ID and the selected group ID from the second group ID are determined as the group ID of the HA device group.
[0115] In one embodiment, if a data conflict exists, a group ID can be selected from the first group ID and the second group ID. This can be done either by the user manually selecting a group ID from the first group ID and the second group ID, or by randomly selecting a group ID from the first group ID and the second group ID. The selected group ID is then used as the group ID of the HA device group. Since the group ID of the HA device group is only one of the first group ID and the second group ID, the subsequently acquired service data will also correspond only to one of the first group ID and the second group ID, preventing data conflicts. This also ensures that the service data corresponding to one of the first group ID and the second group ID will not be lost.
[0116] After obtaining the group ID of the HA device group where the primary HA device switchover occurred, the data transmission module 220 can retrieve the service data corresponding to that group ID. After retrieving the service data, it can first check whether the current primary HA device in the HA device group has configured the service data. If it has, there is no need to send the service data; otherwise, the service data is sent to the current primary HA device in the HA device group.
[0117] After the business data is sent to the current primary HA device in the HA device group, the data transmission module 220 can also be used to synchronize the business data in the current primary HA device to the current standby HA device in the HA device group, so that when the business data of the primary HA device is lost, the business data of the primary HA device can still be obtained from the standby HA device.
[0118] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other via the communication bus 840. The processor 810 can call a computer program in the memory 830 to execute the data transmission method of the HA device, such as including:
[0119] Once it is determined that a primary HA device switchover has occurred in the HA device group, the group ID of the HA device group is obtained.
[0120] Based on the group ID, obtain the service data corresponding to the group ID and send it to the current primary HA device in the HA device group.
[0121] Furthermore, the logical instructions in the aforementioned memory 830 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0122] On the other hand, embodiments of this application also provide a storage medium, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the data transmission method of the HA device provided in the above embodiments, for example including:
[0123] Once it is determined that a primary HA device switchover has occurred in the HA device group, the group ID of the HA device group is obtained.
[0124] Based on the group ID, obtain the service data corresponding to the group ID and send it to the current primary HA device in the HA device group.
[0125] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0126] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A data transmission method for an HA (High Availability) device, characterized in that, include: Once it is determined that a primary HA device switchover has occurred in the HA device group, the group ID of the HA device group is obtained. Based on the group ID, the service data corresponding to the group ID is obtained and sent to the current primary HA device in the HA device group; Upon determining that a primary HA device switchover has occurred in the HA device group, the group ID of the HA device group is obtained, including: If the primary HA device in the HA device group is switched to an external device, based on the device identifier of the current standby HA device in the HA device group that is the peer device of the primary HA device before the switch, obtain the first group ID corresponding to the device identifier of the current standby HA device, and determine the first group ID as the group ID of the HA device group. The external devices referred to are HA devices other than the backup HA devices in the HA device group.
2. The data transmission method for HA equipment according to claim 1, characterized in that, Upon determining that a primary HA device switchover has occurred in the HA device group, the group ID of the HA device group is obtained, including: Determine the primary HA device and the backup HA device that are peer devices in the HA device group and perform primary / backup switchover. Obtain the group ID of the HA device group based on the device identifier of the current primary HA device or the device identifier of the current backup HA device. Among them, the device identifiers of two HA devices that are peer devices correspond to the same set of IDs.
3. The data transmission method for HA equipment according to claim 1, characterized in that, The first group ID is determined as the group ID of the HA device group, including: If it is determined that there is no second group ID corresponding to the device identifier of the external device, the first group ID is determined as the group ID of the HA device group.
4. The data transmission method for HA equipment according to claim 3, characterized in that, Also includes: Determine that there exists a second group ID corresponding to the device identifier of the external device, and obtain the group ID of the HA device group based on the first group ID and the second group ID.
5. The data transmission method for HA equipment according to claim 4, characterized in that, Based on the first group ID and the second group ID, obtain the group ID of the HA device group, including: If the business data corresponding to the first group ID is determined to have no data conflict with the business data corresponding to the second group ID, the first group ID and the second group ID are combined to obtain the group ID of the HA device group including the first group ID and the second group ID.
6. The data transmission method for the HA device according to claim 4 or 5, characterized in that, Based on the first group ID and the second group ID, obtain the group ID of the HA device group, including: If the business data corresponding to the first group ID is found to conflict with the business data corresponding to the second group ID, then the first group ID or the second group ID is determined as the group ID of the HA device group.
7. A data transmission device for an HA (High Availability) device, characterized in that, include: The identifier acquisition module is used to determine when a master HA device switch occurs in an HA device group and to acquire the group ID of the HA device group. The data transmission module is used to obtain the service data corresponding to the group ID and send it to the current master HA device in the HA device group according to the group ID; The identifier acquisition module is specifically used for: If the primary HA device in the HA device group is switched to an external device, based on the device identifier of the current standby HA device in the HA device group that is the peer device of the primary HA device before the switch, obtain the first group ID corresponding to the device identifier of the current standby HA device, and determine the first group ID as the group ID of the HA device group. The external devices referred to are HA devices other than the backup HA devices in the HA device group.
8. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the data transmission method of the HA device according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the data transmission method of the HA device according to any one of claims 1 to 6.
Citation Information
Patent Citations
Fault switching method, device and system
CN108011737A
Container switching method and node equipment
CN114760192A
Equipment switching method and device, earth station and readable storage medium
CN114978296A