Multi-Gateway Dynamic Hot Standby Method, Apparatus, Device, and Storage Medium
By implementing a dynamic hot standby method in the multi-gateway architecture of smart home, the timely replacement problem when the main gateway is abnormal is solved, and the dynamic hot standby of multi-gateway is realized, which improves user experience and reduces costs.
Patent Information
- Application Number
- CN202211314049.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-25
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-10-25
AI Technical Summary
In the multi-gateway architecture of smart home, when the main gateway is abnormal, the existing technology is difficult to replace in time, which affects the user experience. When multiple gateways are abnormal at the same time, it is difficult to form a dynamic hot standby, making it difficult to restore the network architecture.
By implementing a dynamic hot standby method in a multi-gateway architecture, using the gateway device to broadcast its identification information, and updating the gateway list. When the main gateway is abnormal, the gateway that meets the preset conditions is automatically selected from the gateway list as the new main gateway, and a communication connection is established.
Timely replacement and dynamic hot standby of multiple gateways when the main gateway is abnormal, reducing the impact of the main gateway exception, improving user experience, and reducing R&D and maintenance costs.
Smart Images

Figure CN115664944B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the technical field of local area networks, and in particular, to a multi-gateway dynamic hot standby method, device, equipment, and storage medium. Background Art
[0002] In the application scenario of smart home, there are more and more sub-devices in the home environment, resulting in a single gateway often being unable to manage all devices. Therefore, a multi-gateway architecture is adopted for management. Under the conventional multi-gateway architecture, different gateway devices under the same network cannot communicate directly. Even with a master-slave gateway architecture, the solution in the related art is to designate a certain device as the master gateway, and the rest are slave gateways.
[0003] In the case where the master gateway is abnormal and needs to be replaced with a new master gateway, the related solutions often involve manually modifying the configuration of the slave gateway to achieve the replacement of the master gateway, or presetting a replacement gateway device in the current gateway architecture to replace the master gateway when the master gateway is abnormal.
[0004] However, in the above methods, such as the manual modification method, it cannot achieve timely replacement, resulting in a poor user experience; while the method of presetting a replacement device cannot form a multi-gateway dynamic hot standby in the case of multiple gateway abnormalities (such as both the master gateway and the replacement gateway device are abnormal), and it is difficult to effectively provide a new master gateway for the network architecture. Summary of the Invention
[0005] Embodiments of the present application provide a multi-gateway dynamic hot standby method, device, equipment, and storage medium, which can achieve multi-gateway dynamic hot standby, timely select a slave gateway for replacement when the master gateway is abnormal, and reduce the impact caused by the abnormality of the master gateway.
[0006] In a first aspect, an embodiment of the present application provides a multi-gateway dynamic hot standby method, which is applied to a first gateway device in a multi-gateway architecture, and the first gateway device stores a first gateway list therein. The first gateway list stores at least the local identification information associated with the first gateway device, and the first gateway device broadcasts the first gateway list to other gateway devices in the multi-gateway architecture. The method includes:
[0007] Updating the first gateway list according to the received second gateway list broadcast by other gateway devices to obtain a third gateway list;
[0008] Determining whether there is first identification information associated with the first master gateway device in the third gateway list;
[0009] If there is first identification information in the third gateway list, establish a communication connection between the master and slave gateways with the first master gateway device;
[0010] When the first master gateway device is abnormal, select a target gateway device that meets the preset conditions from the third gateway list as the second master gateway device, and establish a communication connection between the master and slave gateways with the second master gateway device.
[0011] In a second aspect, an embodiment of the present application provides a multi-gateway dynamic hot standby device, including:
[0012] A list acquisition module, configured to update the first gateway list according to the second gateway list broadcast by other gateway devices received, so as to obtain a third gateway list;
[0013] A list query module, configured to determine whether there is first identification information associated with the first master gateway device in the third gateway list;
[0014] A connection establishment module, configured to establish a communication connection between the master and slave gateways with the first master gateway device if there is first identification information in the third gateway list;
[0015] An exception handling module, configured to when the first master gateway device is abnormal, select a target gateway device that meets the preset conditions from the third gateway list as the second master gateway device, and establish a communication connection between the master and slave gateways with the second master gateway device.
[0016] In a third aspect, an embodiment of the present application provides a gateway device, including:
[0017] One or more processors;
[0018] A storage device for storing one or more programs,
[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the multi-gateway dynamic hot standby method of the embodiment of the present application.
[0020] In a fourth aspect, an embodiment of the present application further provides a storage medium storing computer-executable instructions, and the computer-executable instructions are used to execute the multi-gateway dynamic hot standby method of the embodiment of the present application when executed by a processor.
[0021] In this solution, multiple gateway devices in the same local area network back up each other. If the master gateway device is abnormal, multiple slave gateway devices will immediately elect the next master gateway device and resynchronize the data. This process does not require manual intervention and can quickly restore the multi-gateway architecture to normal operation, reducing the impact caused by the master gateway exception; in addition, R & D personnel do not need to customize different firmware for the master gateway and slave gateways, reducing R & D and maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a schematic diagram of a multi-gateway architecture in the related art;
[0023] Figure 2 It is a flowchart of the steps of the multi-gateway dynamic hot standby method provided by the embodiment of the present application;
[0024] Figure 3 It is a schematic diagram of the multi-gateway architecture after the main gateway fails in the embodiment of the present application;
[0025] Figure 4 It is a flowchart of the steps of the multi-gateway dynamic hot standby method provided by the embodiment of the present application;
[0026] Figure 5 It is a schematic diagram of the multi-gateway dynamic hot standby device provided by the embodiment of the present application;
[0027] Figure 6 It is a schematic diagram of the structure of a gateway device provided by the embodiment of the present application. Detailed implementation manners
[0028] The following further elaborates on the embodiments of the present application in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, rather than limiting the embodiments of the present application. Additionally, it should be noted that for the sake of description, only parts related to the embodiments of the present application are shown in the accompanying drawings, rather than all structures.
[0029] The terms "first", "second", etc. in the description and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and do not limit the number of objects. For example, the first object can be one or multiple. In the description of the specification and claims, "multiple" is expressed as the first. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / ", generally represents an "or" relationship between the associated objects before and after.
[0030] In a multi-gateway architecture constructed by multiple gateway devices, in this architecture, there is a gateway device serving as the main gateway and at least one network device serving as a slave gateway, such as Figure 1 shown Figure 1 It is a schematic diagram of a multi-gateway architecture in the related art. Among them, gateway device 101 is the main gateway in the architecture, and gateway devices 201-204 are all slave gateways in the architecture. In addition, in the figure, GW1 is used to identify the main gateway device, and GW2 is used to identify the slave gateway device.
[0031] The multi-gateway dynamic hot standby method provided by the embodiments of the present application can be applied to the above-mentioned gateway devices. In a multi-gateway architecture, each gateway device stores a gateway list, which is used to store the identification information of all gateway devices in the architecture, such as role type, IP address, system startup duration, etc. When initially accessing the network, the gateway device can join the local area network including the multi-gateway architecture as a slave gateway, and at least store the local identification information related to itself. After the gateway device accesses the network, it can broadcast the local identification information to other gateway devices in the local area network at regular intervals. Of course, the gateway device can also receive the identification information broadcast by other gateway devices.
[0032] In some embodiments, gateway devices of different role types in the architecture can broadcast messages at different broadcast intervals. For example, the broadcast interval of the master gateway device is 5s; for the slave gateway device that has joined the master gateway (i.e., a communication connection between the master gateway and the slave gateway is established), the corresponding broadcast interval is 5s, while for the slave gateway device that has not joined the master gateway, the corresponding broadcast interval is 1s.
[0033] The following is an illustration of applying the multi-gateway dynamic hot standby method in the first gateway device. The first gateway device can be a slave gateway device or a gateway device that has switched from a master gateway to a slave gateway. Corresponding to the first gateway device, a first gateway list is stored thereon, and the local identification information associated with the first gateway device is stored in the first gateway list.
[0034] Figure 2 It is a flowchart of the steps of the multi-gateway dynamic hot standby method provided by the embodiments of the present application. As shown in the figure, the multi-gateway dynamic hot standby method includes the following steps:
[0035] Step S210: Update the first gateway list according to the second gateway list broadcast by other gateway devices to obtain a third gateway list.
[0036] In the local area network, gateway devices broadcast messages to other gateway devices in the network at the predefined broadcast intervals in the devices, such as broadcasting the gateway list of the device in the local area network. Therefore, when the first gateway device receives the gateway list (i.e., the second gateway list) broadcast by other gateway devices, the first gateway device updates the first gateway list according to the second gateway list, thereby obtaining a third gateway list, that is, the updated gateway list.
[0037] For example, after the first gateway device obtains the second gateway list, it compares the first gateway list with the second gateway list and removes duplicates from the second gateway list, that is, deletes the overlapping parts between the first gateway list and the second gateway list, and then adds the remaining part of the second gateway list to the first gateway list to obtain the third gateway list. Therefore, the identification information of all gateway devices in the entire local area network, such as role type, IP address, system startup duration, etc., can be stored in the third gateway list.
[0038] Step S220: Determine whether there is first identification information associated with the first master gateway device in the third gateway list.
[0039] The first identification information can be used to indicate that the corresponding gateway device is the master gateway device. For example, it carries a first parameter item indicating the role type as the master gateway, so that the gateway device that parses the first identification information from the gateway list can learn that there is a master gateway device in the network.
[0040] After the first gateway device obtains the third gateway list, the first gateway device searches in the list to determine whether there is first identification information associated with the first master gateway device in the third gateway list, so as to determine whether there is a first master gateway device in the local area network. It should be noted that the first master gateway device can be a gateway device preset as the master gateway in the local area network.
[0041] It should be noted that the process of searching the third gateway list can be executed during the update process of the first gateway list. For example, while continuously updating the gateway list, the gateway device also continuously searches in the gateway list to determine whether there is a master gateway device in the local area network.
[0042] Step S230: If there is first identification information in the third gateway list, establish a communication connection between the master and slave gateways with the first master gateway device.
[0043] It can be understood that when there is first identification information in the third gateway list, it means that there is a first master gateway device in the local area network. Therefore, the first gateway device can obtain the IP address of the first master gateway device from the third gateway list to establish a communication connection between the master and slave gateways with the first master gateway device.
[0044] In an embodiment, the first gateway device sends a gateway join request to the first master gateway device according to the obtained IP address of the first master gateway device, such as sending it at a preset request interval, and of course, this request interval is less than the broadcast interval, such as set to 500 ms.
[0045] Moreover, the first gateway device is also set with a waiting period for determining whether to establish a connection. For example, within the waiting period, if the first gateway device receives a request response message from the first master gateway device corresponding to the join gateway request, the first gateway device will correspondingly record the connection status with the first master gateway device in the third gateway list, with the first master gateway device as the connected master gateway. For example, corresponding information can be recorded in the third gateway list to indicate the master-slave relationship between the current first master gateway device and the first gateway device. For example, a master gateway mark can be added to the third gateway list of the first gateway device to indicate the master gateway connected to the first gateway device.
[0046] It should be noted that the waiting period is longer than the request interval. Exemplarily, the waiting period can be set to 6 request intervals to facilitate waiting for the response (i.e., the request response message) from the first master gateway device. Moreover, within the waiting period, the first gateway device can continuously send join gateway requests at the request interval until it receives a response from the first master gateway device. Of course, for the request response message received after the waiting period expires, the first gateway device determines that the gateway joining fails.
[0047] The slave gateway device and the master gateway device communicate and connect with each other through information interaction, such as join gateway requests and request response messages, so as to ensure that the slave gateway device can be connected to the master gateway device.
[0048] Step S240: When the first master gateway device is abnormal, select a target gateway device that meets the preset conditions from the third gateway list as the second master gateway device, and establish a master-slave gateway communication connection with the second master gateway device.
[0049] There are various situations where the first master gateway device is abnormal, such as power failure, damage, and network connection interruption of the first master gateway device, resulting in the inability to interact with the slave gateway device. For example, if the slave gateway does not receive the broadcast or unicast message from the master gateway after multiple broadcast cycles, the slave gateway can determine that the master gateway is abnormal.
[0050] When the first master gateway device is abnormal, the first gateway device selects a target gateway device from the third gateway list as the second master gateway device. The target gateway device meets the preset conditions, such as taking the minimum system startup duration as the preset condition. Thus, the gateway device with the minimum system startup duration is found in the third gateway list as the target gateway device. Of course, in the case where the target gateway device is used as the second master gateway device, the first gateway device and other gateway devices within the local area network are all connected to the target gateway device.
[0051] It can be conceived that for other gateway devices in the local area network that do not meet the preset conditions, they wait for a new master gateway device (i.e., the second master gateway device) to broadcast the gateway list to update the locally stored gateway list, and send a gateway joining request to the second master gateway device to establish a connection.
[0052] Exemplarily, as Figure 3 shown, Figure 3 is a schematic diagram of a multi-gateway architecture after the master gateway is abnormal provided by an embodiment of the present application. In the figure, the gateway device 101 drops offline, that is, the communication connection between the master gateway and each slave gateway is interrupted (as indicated by the connection line and × in the figure to represent the communication connection interruption), and the remaining gateway devices 201-204 compete to select a latest master gateway (GW1 represents the master gateway device and GW2 represents the slave gateway device in the figure).
[0053] It can be understood that the gateway devices 201-204 respectively search the gateway lists stored locally in their own devices, and search for the device with the smallest system startup duration from them. For example, the gateway devices 201-204 all determine that the gateway device 202 is the device with the smallest startup time among all gateway devices except the offline gateway device 101. Therefore, the gateway device 202 is used as the latest master gateway, and the gateway devices 201 and 203 respectively establish a communication connection between the master and slave gateways with the gateway device 202 as the master gateway (the connection relationship indicated by the dotted line in the figure).
[0054] From the above solution, for multiple gateway devices in the same local area network, the above multi-gateway dynamic hot standby method is applied to form a dynamic backup of the multi-gateway devices. Thus, in the case of an abnormal master gateway device, a device can be re-selected from the remaining slave gateway devices as the master gateway for replacement, and the multi-gateway architecture can be quickly restored to normal operation, reducing the impact caused by the abnormal master gateway. In addition, this process does not require manual intervention for replacement, which can reduce labor costs, and there is no need to customize different firmware for the master gateway device and the slave gateway device, further saving R & D and maintenance costs.
[0055] In some embodiments, similarly, the local identification information also carries a first parameter item for identifying the role type, and the local identification information also carries a second parameter item for identifying the system startup duration.
[0056] The first gateway device acts as a slave gateway device and is connected to the first master gateway device. When the master gateway device is abnormal, if among all the slave gateway devices, the first gateway device has the minimum system startup duration as the gateway device, that is, when the first gateway device is the target gateway device, the first gateway device updates the local identification information recorded in the third gateway list, that is, changes the role type in the first parameter item from slave gateway to master gateway. After the first gateway device completes the update of the list, it broadcasts the updated third gateway list to other gateway devices within the multi-gateway architecture to inform other gateway devices within the architecture.
[0057] Similarly, for the case where other slave gateway devices act as target gateway devices, they also update the local gateway list and broadcast it. It should be noted that when a slave gateway device changes to a master gateway device, it can broadcast the updated gateway list at a faster frequency. For example, the timing broadcast interval is updated to 500 ms and lasts for 60 broadcast cycles, so that other gateway devices can receive the updated gateway list.
[0058] In the case of the master gateway device being abnormal, the first gateway device selects a gateway device as the new master gateway device by comparing the system durations corresponding to each gateway device stored in the gateway list, realizing the backup of the master gateway. Without human intervention, the multi-gateway architecture can resume working, reducing the impact caused by the abnormality of the master gateway.
[0059] In an embodiment, when the first master gateway device recovers from an abnormality, if a slave gateway device has been selected as the new master before its recovery, the two master gateways need to compete to select one as the master gateway device in the entire multi-gateway architecture. Here, taking the first gateway device as the new master gateway device (i.e., the second master gateway device) as an example for illustration.
[0060] As Figure 4 shown, the multi-gateway hot standby method applied to the first gateway device further includes the following steps:
[0061] Step S410: Obtain the number of first sub-gateway devices corresponding to the first master gateway device.
[0062] Step S420: Determine whether the number of second sub-gateway devices corresponding to the second master gateway device is less than the number of first sub-gateway devices.
[0063] Step S430: If the number of second sub-gateway devices is less than the number of first sub-gateway devices, update the role type to slave gateway and broadcast the updated third gateway list to other gateway devices within the multi-gateway architecture.
[0064] It can be understood that as the main gateway device, it will record the slave gateway devices connected to it and the corresponding quantity (i.e., the number of sub - gateways). For example, it stores them in the local gateway list. Therefore, when the first main gateway device recovers from an anomaly, such as power - off recovery, network re - connection recovery and other anomaly recovery situations, after the second main gateway device receives the gateway list broadcast by the first main gateway device, it can obtain the first sub - gateway quantity corresponding to the first main gateway device from it, and by comparing the first sub - gateway quantity and the second sub - gateway quantity, it can judge the gateway device acting as the main gateway.
[0065] In the case where the second sub - gateway quantity is less than the first sub - gateway quantity, the second main gateway device updates the role type in the first parameter item recorded in the third gateway list to a slave gateway, and broadcasts the updated gateway list to other gateway devices. It should be noted that after the first gateway device is restored to a slave gateway device, it still establishes a master - slave gateway communication connection with the first main gateway device that has recovered from the anomaly. And the slave gateway devices connected to the second main network device also establish a master - slave gateway communication connection with the first main gateway device.
[0066] It can be imagined that if the second sub - gateway quantity is greater than the first sub - gateway quantity, the first main gateway device updates the gateway list stored locally, updates the role type to a slave gateway, and broadcasts the updated gateway list to other gateway devices.
[0067] For the anomaly recovery of the main gateway device, the two main gateways also need to compete to determine the final gateway device acting as the main gateway, so as to maintain the one - master - multiple - slaves layout in the multi - gateway architecture, which is convenient for the management of multi - gateway devices.
[0068] It should be noted that for the situation of the first main gateway device recovering from an anomaly, by comparing the sub - gateway quantities of the first main gateway device and the second main gateway device, as well as the system startup durations of the two devices, to determine the gateway device acting as the main gateway finally. For example, for the case where the first sub - gateway quantity is equal to the second sub - gateway quantity, it is determined whether the second system startup duration corresponding to the second main gateway device is greater than the first system startup duration corresponding to the first main gateway device.
[0069] If the second system startup duration is greater than the first system startup duration, the second main gateway device updates the role type to a slave gateway, and broadcasts the updated gateway list to other gateway devices. It should be noted that when the second main gateway device is restored to a slave gateway, it establishes a connection with the current main gateway, that is, the first main gateway device. For example, taking the first main gateway device as the main gateway and sending a join - gateway request to it.
[0070] It is conceivable that if the startup duration of the second system is less than that of the first system, the first main gateway device updates its role type to a slave gateway, broadcasts the updated gateway list to other gateway devices, and establishes a connection with the second main gateway device. For example, it uses the second main gateway device as the main gateway and sends a gateway join request to it.
[0071] In some embodiments, the role type of the gateway device serves as the first parameter item in the identification information, while the system startup duration of the gateway device serves as the second parameter item in the identification information. Therefore, the first gateway device searches for the identification information corresponding to each gateway device in its third gateway list to determine whether there is a gateway device with the role type of main gateway.
[0072] The first identification information is the identification information corresponding to the main gateway with the role type. When the first gateway device detects that there are multiple first identification information in the third gateway list, it obtains the number of sub - gateways of the first main gateway device corresponding to each first identification information. The first gateway device determines the target main gateway device based on the number of sub - gateways of multiple first main gateway devices. For example, it uses the first main gateway device with the largest number of sub - gateways as the target main gateway device. It should be noted that after determining the target main gateway device, the other first main gateway devices update their role types to slave gateways, thus establishing a connection with the target main gateway device.
[0073] Of course, for the case where the number of sub - gateways of multiple first main gateway devices is the same, the first gateway device obtains the second parameter item corresponding to each first main gateway device to determine the target main gateway device from the system startup duration recorded in the second parameter item. For example, it uses the first main gateway device with the shortest system startup duration as the target main gateway device.
[0074] Therefore, for the situation where multiple main gateway devices appear in the local area network, not only do the main gateway devices compete with each other, but other slave gateway devices also determine the connected main gateway device according to the identification information of the main gateway device, thereby increasing the number of sub - gateways connected to the main gateway device, so as to better select the gateway device as the main gateway.
[0075] It should be noted that the gateway device can dynamically adjust its own role type, that is, the gateway device can act as either a slave gateway or a main gateway to meet the competition among multiple gateways. When the gateway device switches from a slave gateway to a main gateway, the gateway device will regularly broadcast its own gateway list, and also receive the gateway lists of the connected slave gateway devices to regularly update the locally stored gateway list. In addition, the gateway device acting as the main gateway also sends a request response message to the sender (i.e., the slave gateway device) according to the received gateway join request, so that the main gateway device and the slave gateway device establish a connection.
[0076] Figure 5 This is a schematic diagram of the multi-gateway dynamic hot standby device provided by the embodiments of the present application. This device is used to execute the multi-gateway dynamic hot standby method provided by the above embodiments, and has the corresponding functional modules and beneficial effects for executing the method. As shown in the figure, this device specifically includes: a list acquisition module 501, a list query module 502, a connection establishment module 503, and an exception handling module 504.
[0077] Among them, the list acquisition module 501 is configured to update the first gateway list according to the second gateway list broadcast by other gateway devices received, so as to obtain a third gateway list;
[0078] The list query module 502 is configured to determine whether there is first identification information associated with the first master gateway device in the third gateway list;
[0079] The connection establishment module 503 is configured to establish a communication connection between the master and slave gateways with the first master gateway device if there is first identification information in the third gateway list;
[0080] The exception handling module 504 is configured to, when the first master gateway device is abnormal, select a target gateway device that meets the preset conditions from the third gateway list as the second master gateway device, and establish a communication connection between the master and slave gateways with the second master gateway device.
[0081] On the basis of the above embodiments, the local identification information carries a first parameter item indicating the role type, and the role type includes a master gateway and a slave gateway;
[0082] The exception handling module 504 is further configured to:
[0083] In the case where the first master gateway device is abnormal and the target gateway device is the first gateway device, update the local identification information in the stored third gateway list to update the role type to the master gateway, and broadcast the updated third gateway list to other gateway devices in the multi-gateway architecture.
[0084] On the basis of the above embodiments, an exception recovery processing module is further included. In the case where the first master gateway device is abnormal and the target gateway device is the first gateway device, when the first master gateway device recovers to normal, the exception recovery processing module is configured to:
[0085] Obtain the number of first sub-gateways corresponding to the first master gateway device;
[0086] Determine whether the number of second sub-gateways corresponding to the second master gateway device is less than the number of first sub-gateways;
[0087] If the number of second sub-gateways is less than the number of first sub-gateways, update the role type to the slave gateway, and broadcast the updated third gateway list to other gateway devices in the multi-gateway architecture.
[0088] Based on the above embodiments, the abnormal recovery processing module is further configured to:
[0089] If the number of second sub - gateways is equal to the number of first sub - gateways, determine whether the second system startup duration of the second master gateway device is greater than the first system startup duration of the first master gateway device;
[0090] If the second system startup duration is greater than the first system startup duration, update the role type to a slave gateway and broadcast the updated third gateway list to other gateway devices within the multi - gateway architecture.
[0091] Based on the above embodiments, the local identification information carries a second parameter item indicating the system startup duration; the abnormal processing module 504 is further configured to:
[0092] In the case of an abnormality of the first master gateway device, select the gateway device with the minimum system startup duration as the target gateway device according to the system startup durations of all gateway devices in the third gateway list.
[0093] Based on the above embodiments, the first identification information carries a first parameter item indicating that the role type is a master gateway, and the first identification information also carries a second parameter item indicating the system startup duration.
[0094] If there are multiple first identification information in the third gateway list, determine the target master gateway device according to the number of sub - gateways of the multiple first master gateway devices corresponding to the multiple first identification information;
[0095] When the number of sub - gateways of multiple first master gateway devices is the same, the first master gateway device with the minimum system startup duration recorded by the corresponding second parameter item is used as the target master gateway device.
[0096] Based on the above embodiments, the connection establishment module 503 is further configured to:
[0097] Send a gateway joining request to the first master gateway device according to a preset request interval;
[0098] If a request response message corresponding to the gateway joining request is received within the waiting period, record the connection status with the first master gateway device in the third gateway list and use the first master gateway device as the connected master gateway.
[0099] It should be noted that in the embodiments of the above multi - gateway dynamic hot - standby device, the included functional modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional modules are only for the convenience of mutual distinction and do not limit the protection scope of the present application.
[0100] Figure 6 The following is a schematic structural diagram of a gateway device provided by an embodiment of the present application. As shown in the figure, the device includes a processor 601, a memory 602, an input device 603, and an output device 605. The number of processors 601 in the device may be one or more. In the figure, one processor 601 is taken as an example. The processor 601, the memory 602, the input device 603, and the output device 604 in the device may be connected through a bus or other means. In the figure, connection through a bus is taken as an example. The memory 602, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the multi-gateway dynamic hot standby method in the embodiment of the present application. The processor 601 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory 602, that is, implements the above multi-gateway dynamic hot standby method.
[0101] The memory 602 may mainly include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the gateway device, such as a gateway list. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some instances, the memory 602 may further include a memory remotely set relative to the processor 601, and these remote memories can be connected to the terminal device through a network. Examples of the above network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0102] The input device 603 can be used to receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the device, such as receiving a gateway list broadcast by other gateway devices. The output device 604 can be used to send or display key signal outputs related to the user settings and function controls of the device, such as broadcasting the locally stored gateway list to other gateway devices.
[0103] The embodiment of the present application also provides a storage medium storing computer-executable instructions. When the computer-executable instructions are executed by a processor, they are used to perform related operations in the multi-gateway dynamic hot standby method provided by any embodiment of the present application.
[0104] Computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0105] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0106] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A multi-gateway dynamic hot standby method, characterized in that Applied to the first gateway device in a multi-gateway architecture, and the first gateway device stores a first gateway list. The first gateway list stores at least the local identification information associated with the first gateway device, and the first gateway device broadcasts the first gateway list to other gateway devices in the multi-gateway architecture. The method includes: Updating the first gateway list according to the received second gateway list broadcast by other gateway devices to obtain a third gateway list; Determining whether there is first identification information associated with the first master gateway device in the third gateway list; If the first identification information exists in the third gateway list, establishing a communication connection between the master and slave gateways with the first master gateway device; When the first master gateway device is abnormal, selecting a target gateway device that meets the preset conditions from the third gateway list as the second master gateway device, and establishing a communication connection between the master and slave gateways with the second master gateway device, where the gateway device with the minimum system startup duration is the target gateway device that meets the preset conditions.
2. The multi-gateway dynamic hot standby method according to claim 1, wherein The local identification information carries a first parameter item indicating the role type, and the role type includes master gateway and slave gateway; The method further includes: In the case where the first master gateway device is abnormal and the target gateway device is the first gateway device, updating the local identification information in the stored third gateway list to update the role type to the master gateway, and broadcasting the updated third gateway list to other gateway devices in the multi-gateway architecture.
3. The multi-gateway dynamic hot standby method according to claim 2, wherein In the case where the first master gateway device is abnormal and the target gateway device is the first gateway device, when the first master gateway device returns to normal, the method further includes: Obtaining the number of first sub-gateway devices corresponding to the first master gateway device; Determining whether the number of second sub-gateway devices corresponding to the second master gateway device is less than the number of first sub-gateway devices; If the number of second sub-gateway devices is less than the number of first sub-gateway devices, updating the role type to the slave gateway, and broadcasting the updated third gateway list to other gateway devices in the multi-gateway architecture.
4. The multi-gateway dynamic hot standby method according to claim 3, wherein Further includes: If the number of second sub-gateway devices is equal to the number of first sub-gateway devices, determining whether the second system startup duration of the second master gateway device is greater than the first system startup duration of the first master gateway device; If the second system startup duration is greater than the first system startup duration, updating the role type to the slave gateway, and broadcasting the updated third gateway list to other gateway devices in the multi-gateway architecture.
5. The multi-gateway dynamic hot standby method according to claim 1, wherein The local identification information carries a second parameter item indicating the system startup duration; The step of when the first master gateway device is abnormal, selecting a target gateway device that meets the preset conditions from the third gateway list as the second master gateway device, and establishing a communication connection between the master and slave gateways with the second master gateway device includes: In the case where the first master gateway device is abnormal, selecting the gateway device with the minimum system startup duration as the target gateway device according to the system startup durations of all gateway devices in the third gateway list.
6. The multi-gateway dynamic hot standby method according to claim 1, wherein The first identification information carries a first parameter item identifying the role type as the main gateway, and the first identification information also carries a second parameter item identifying the system startup duration; After determining whether there is first identification information associated with the first main gateway device in the third gateway list, it further includes: If there are multiple pieces of the first identification information in the third gateway list, determine the target main gateway device according to the number of sub-gateways of the multiple first main gateway devices corresponding to the multiple pieces of the first identification information; When the number of sub-gateways of the multiple first main gateway devices is the same, the first main gateway device with the smallest system startup duration recorded by the corresponding second parameter item is the target main gateway device.
7. The multi-gateway dynamic hot standby method according to claim 1, wherein The "if there is the first identification information in the third gateway list, then establish a communication connection between the master and slave gateways with the first main gateway device" includes: Send a gateway joining request to the first main gateway device according to a preset request interval; If a request response message corresponding to the gateway joining request is received within the waiting period, record the connection status with the first main gateway device in the third gateway list, and use the first main gateway device as the connected master gateway.
8. A multi-gateway dynamic hot standby device, characterized in that, Applied to the first gateway device in a multi-gateway architecture, and the first gateway device stores a first gateway list therein. The first gateway list stores at least the local identification information associated with the first gateway device, and the first gateway device broadcasts the first gateway list to other gateway devices in the multi-gateway architecture. The multi-gateway dynamic hot standby device includes: A list acquisition module configured to update the first gateway list according to the second gateway list broadcast by other gateway devices received, so as to obtain a third gateway list; A list query module configured to determine whether there is first identification information associated with the first main gateway device in the third gateway list; A connection establishment module configured to, if there is the first identification information in the third gateway list, establish a communication connection between the master and slave gateways with the first main gateway device; An exception handling module configured to, when the first main gateway device is abnormal, select a target gateway device that meets preset conditions from the third gateway list as the second main gateway device, and establish a communication connection between the master and slave gateways with the second main gateway device, where the gateway device with the smallest system startup duration is the target gateway device that meets the preset conditions.
9. A gateway device, characterized in that, Includes: One or more processors; A storage device for storing one or more programs, which when executed by one or more of the processors, cause one or more of the processors to implement the multi-gateway dynamic hot standby method as described in any one of claims 1-7.
10. A storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are used to execute the multi-gateway dynamic hot standby method as described in any one of claims 1-7 when executed by a processor.
Citation Information
Patent Citations
Redundant gateway system and redundancy switching method
CN110879522A
Adaptive packet routing
US20040146056A1