Information storage method and device for gateway cluster
By determining the target gateway device based on network messages in the gateway cluster to back up network connection information, the problem of information synchronization pressure in the gateway device cluster is solved, and the efficiency of information storage and load reduction are achieved.
Patent Information
- Application Number
- CN202411231201.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-10
AI Technical Summary
In a gateway device cluster, as the number of clusters increases, the number of network connection information increases exponentially, resulting in full synchronization of information between devices, increasing the equipment load and storage pressure.
By responding to network messages in the gateway cluster, the first gateway device determines the second gateway device based on network connection information, and saves and backs up the network connection information to the target gateway device by the second gateway device, avoids full synchronization and reduces the number of backups. Reduce equipment load.
It realizes efficient storage and backup of network connection information, reduces the amount of information transmission between devices, and reduces the load and storage pressure of gateway devices.
Smart Images

Figure CN119109939A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an information storage method and device for a gateway cluster. Background Art
[0002] A typical NAT (Network Address Translation) gateway device clustering solution is implemented through the following two technologies: VIP (Virtual IP Address) deployment and full synchronization of network connection information between devices.
[0003] The implementation method based on the above technology requires that each device stores the full amount of network connection information in the cluster. As the number of clusters increases, the amount of network connection information also increases exponentially. Summary of the invention
[0004] Embodiments of the present application provide a method, apparatus, device, and storage medium for storing information in a gateway cluster.
[0005] According to a first aspect, an embodiment of the present application provides an information storage method for a gateway cluster. The method includes: a first gateway device in the gateway cluster, in response to receiving a network message, determines a second gateway device from the gateway cluster based on network connection information of the network message; and the second gateway device, in response to receiving a network message sent by the first gateway device and determining that the network connection information is not saved locally, saves the network connection information locally and backs it up to a target gateway device in the gateway cluster.
[0006] According to a second aspect, an embodiment of the present application provides a gateway cluster. The gateway cluster includes multiple gateway devices, and the gateway devices are used to implement the information storage method for the gateway cluster as described in any embodiment of the first aspect.
[0007] According to the third aspect, an embodiment of the present application provides an electronic device, which includes one or more processors; a storage device, on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement an information storage method for a gateway cluster as in any embodiment of the first aspect.
[0008] According to a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements an information storage method for a gateway cluster as in any embodiment of the first aspect.
[0009] The present application has the first gateway device in the gateway cluster respond to receiving a network message, determine the second gateway device from the gateway cluster based on the network connection information of the network message; and the second gateway device responds to receiving the network message sent by the first gateway device and determines that the network connection information is not saved locally, saves the network connection information locally and backs it up to the target gateway device in the gateway cluster, thereby avoiding full synchronization of network connection information between devices in the gateway device cluster, that is, there is no need to back up each network connection information to all gateway devices in the cluster, reducing the number of backups of network connection information and alleviating the load on the gateway device.
[0010] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0012] Figure 2 is a flow chart of an embodiment of an information storage method for a gateway cluster according to the present application;
[0013] Figure 3 is a flow chart of another embodiment of the information storage method for a gateway cluster according to the present application;
[0014] Figure 4a is a flow chart of another embodiment of the information storage method for a gateway cluster according to the present application;
[0015] Figure 4b is a schematic diagram of another embodiment of the information storage method for a gateway cluster according to the present application;
[0016] Figure 5 is a schematic diagram of another embodiment of a gateway cluster according to the present application;
[0017] Figure 6 It is a structural diagram of a computer system suitable for implementing a server of an embodiment of the present application. DETAILED DESCRIPTION
[0018] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0019] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0020] Figure 1 The flowchart 100 of an embodiment of the information storage method for a gateway cluster that can be applied to the present application is shown. In this embodiment, the information storage method for a gateway cluster includes the following steps:
[0021] Step 101: In response to receiving a network message, a first gateway device in a gateway cluster determines a second gateway device from the gateway cluster based on network connection information of the network message.
[0022] In this embodiment, the gateway cluster may include multiple gateway devices. The gateway devices in the gateway cluster may be connected to the same switching device (eg, switch, router, etc.), and the first gateway device may be any gateway device in the gateway cluster.
[0023] In response to receiving the network message forwarded by the switching device, the first gateway device may determine the second gateway device from the gateway cluster according to the network connection information of the network message.
[0024] Among them, a network message is a data unit exchanged and transmitted in the network, that is, a block of data to be sent by a station at one time. A network message contains the complete data information to be sent, and its length varies.
[0025] Network connection information refers to the five-tuple information of the network message, which may include: source IP, source port, destination IP, destination port, and message type.
[0026] Here, the first gateway device may determine the second gateway device from the gateway cluster based on the network connection information of the network message in a variety of ways. For example, the second gateway device is determined based on the network connection information of the network message and a mapping relationship table between the preset network connection information and the device information of the gateway device; the gateway devices in the gateway cluster are first sorted and numbered to generate a device number ring, and the target number is determined based on the address information in the network connection information, one or more of the port number information and the device number ring, and the gateway device corresponding to the target number is determined as the second gateway device, etc. This application does not limit this.
[0027] Step 102: In response to receiving the network message sent by the first gateway device and determining that the network connection information is not saved locally, the second gateway device saves the network connection information locally and backs it up to the target gateway device in the gateway cluster.
[0028] In this embodiment, in response to receiving the network message sent by the first gateway device, the second gateway device may determine whether the network connection information of the network message has been saved locally, and if not, save the network connection information.
[0029] Furthermore, the second gateway device may determine a target gateway device in the gateway cluster and back up the network connection information to the target gateway device.
[0030] The number of target gateway devices may be N, the total number of gateway devices in the gateway cluster may be M, N is less than M-1, N and M are both natural numbers, N is greater than or equal to 1, and M is greater than or equal to 2.
[0031] Here, the execution entity may determine the target gateway device in a variety of ways, for example, in a gateway cluster, determine a preset gateway device as the target gateway device; sort and number the gateway devices in the gateway cluster to generate a device number ring, and determine a preset number of gateway devices sorted after the second gateway device as the target gateway devices, etc. This application does not limit this.
[0032] In some optional embodiments, the gateway cluster may include multiple gateway devices.
[0033] In this implementation, the gateway cluster may include multiple gateway devices, and the gateway device may be a gateway device for implementing network address translation, namely NAT, in existing technology or future development technology, such as a NAT gateway.
[0034] NAT is a technology used to use private addresses in a local network and switch to global IP addresses when connecting to the Internet. NAT is designed to translate IP addresses by mapping an external IP address and port to a larger set of internal IP addresses. Basically, NAT uses a traffic table to route traffic from an external (host) IP address and port number to the correct internal IP address associated with an endpoint on the network.
[0035] Here, in response to receiving the network message, the first gateway device may determine the second gateway device from the gateway cluster based on the network connection information of the network message, such as NAT IP information and NAT port number information.
[0036] Specifically, if the network message is a network message in the outbound direction of the public network, that is, a network message from the private network to the public network, the first gateway device can determine the second gateway device in the cluster according to the destination IP address and destination port number in the network connection information of the network message. If the network message is a network message in the inbound direction of the public network, that is, a network message from the public network to the private network, the first gateway device can determine the second gateway device in the cluster according to the source IP address and source port number in the network connection information of the network message.
[0037] This method realizes the storage of network connection information in a cluster composed of gateway devices used for network address translation.
[0038] Figure 2 The flow chart 200 of an embodiment of an information storage method for a gateway cluster that can be applied to the present application is shown. In this embodiment, the information storage method for a gateway cluster includes the following steps:
[0039] Step 201 : In response to receiving a network message, a first gateway device in a gateway cluster determines a target number based on network connection information of the network message and a device number ring, and determines a gateway device corresponding to the target number as a second gateway device.
[0040] In this embodiment, if the first gateway device receives a network message, it can determine the target number according to the network connection information and the device number ring of the network message, and determine the gateway device corresponding to the target number as the second gateway device.
[0041] Among them, the device number ring can be obtained in the following way: according to the device information of each gateway device, that is, the device identification, the gateway devices in the gateway device cluster are sorted and numbered according to the preset rules, and the gateway device ranked first is determined as the next gateway device of the gateway device ranked last.
[0042] Here, the device information of the gateway device is used to distinguish different gateway devices, including but not limited to the device serial number, host name string, IP, etc.
[0043] Among them, the first gateway device can determine the target number based on the network connection information of the network message, the device number ring and the preset network connection information, device number ring and number mapping table; it can also determine the target number based on the network connection information of the network message and the device number ring, using a preset algorithm that can generate a fixed-length output, such as a hash algorithm, a consistent hash algorithm, etc., and the present application does not limit this.
[0044] Among them, the hash algorithm, also known as the hash function, is an algorithm that maps an input of any length (usually a string) to an output of a fixed length (i.e., a hash value). There are six commonly used methods for constructing hash functions: direct addressing, digital analysis, square median, folding, division and remainder, and randomization.
[0045] Specifically, if the network message is a network message in the outbound direction of the public network, the first gateway device can use a hash algorithm to determine the target number according to the destination IP address, destination port number and the total number of gateway devices corresponding to the device number ring in the network connection information of the network message, which can be specifically expressed by the following formula:
[0046] Target number = Hash (destination IP address, destination port number) mod the total number of devices corresponding to the device number ring.
[0047] If the network message is a network message in the direction of the public network, the first gateway device can use a hash algorithm to determine the target number according to the source IP address, source port number and the total number of gateway devices corresponding to the device number ring in the network connection information of the network message, which can be specifically expressed by the following formula:
[0048] Target number = Hash (source IP address, destination port number) mod the total number of devices corresponding to the device number ring.
[0049] Further, the first gateway device may determine the gateway device corresponding to the target number in the device number ring as the second gateway device.
[0050] Step 202: In response to receiving the network message sent by the first gateway device and determining that the network connection information is not stored locally, the second gateway device backs up the network connection information to N consecutive gateway devices in the device number ring that are ordered after the second gateway device.
[0051] In this embodiment, in response to receiving the network message sent by the first gateway device, the second gateway device may back up the network connection information to N gateway devices that are consecutively ordered after the second gateway device in the device number ring.
[0052] Specifically, the device numbering ring is numbered 1-numbered 2-numbered 3-numbered 4-numbered 5. If N is 2 and the target number is numbered 2, gateway devices numbered 3 and 4 can be determined as target gateway devices, or gateway devices numbered 4 and 5 can be determined as target gateway devices.
[0053] In this embodiment, the first gateway device in the gateway cluster responds to receiving a network message, determines a target number based on the network connection information of the network message and a device number ring, and determines the gateway device corresponding to the target number as the second gateway device. The second gateway device responds to receiving the network message sent by the first gateway device and determining that the network connection information is not saved locally, and backs up the network connection information to N consecutive gateway devices sorted after the second gateway device in the device number ring, thereby realizing the backup of network connection information using the device number ring, which helps to evenly back up the network connection information among different gateway devices under the condition that the number of network connection information backups is fixed.
[0054] Figure 3 The flowchart 300 of an embodiment of the information storage method for a gateway cluster that can be applied to the present application is shown. In this embodiment, the information storage method for a gateway cluster includes the following steps:
[0055] Step 301, in response to receiving a network message, the first gateway device in the gateway cluster determines a target number based on the network connection information of the network message, the device number ring, and the device information of the gateway devices added or reduced in the gateway cluster, and determines the gateway device corresponding to the target number as the second gateway device.
[0056] In this embodiment, the first gateway device may monitor the instructions for adding or reducing gateway devices in real time or periodically, wherein the instructions for adding or reducing gateway devices may include: device information of the gateway devices added or reduced in the gateway cluster.
[0057] If an instruction to add or remove a gateway device is received and a network message is received, the initial number can be determined using a hash algorithm based on the network connection information and device number ring of the network message.
[0058] Furthermore, the first gateway device may update the initial number according to the device number ring and the influence of the device information of the added or reduced gateway devices on the initial number to obtain the target number.
[0059] Specifically, the device numbering ring is number 1-number 2-number 3. If the initial number is number 2 and the gateway device numbered 2 is a reduced gateway device, the device numbering ring (i.e., the order of gateway devices in the gateway cluster) becomes number 1-number 2 (corresponding to the device information of the gateway device originally numbered 3), and the initial number is updated to number 2 (original number 3) to obtain the target number; if the initial number is number 3 and a new gateway device is added between numbers 2 and 3, the device numbering ring becomes number 1-number 2-number 3 (corresponding to the device information of the newly added gateway device)-number 4 (corresponding to the device information of the gateway device originally numbered 3), and the initial number is updated to number 4, i.e., number 4 is determined as the target number.
[0060] Step 302: In response to receiving the network message sent by the first gateway device and determining that the network connection information is not stored locally, the second gateway device backs up the network connection information to N consecutive gateway devices in the device number ring that are ordered after the second gateway device.
[0061] In this embodiment, the implementation details and technical effects of step 302 can refer to the description of step 202 and will not be repeated here.
[0062] In this embodiment, the first gateway device in the gateway cluster responds to receiving a network message, determines a target number based on the network connection information of the network message, the device numbering ring, and the device information of the gateway devices added or reduced in the gateway cluster, and determines the gateway device corresponding to the target number as the second gateway device. The second gateway device responds to receiving the network message sent by the first gateway device and determining that the network connection information is not saved locally, and backs up the network connection information to N consecutive gateway devices sorted after the second gateway device in the device numbering ring, thereby realizing backup of the network connection information when the topology structure in the gateway cluster changes.
[0063] In some optional embodiments, the method further includes: in response to determining that there is a new gateway device among the N consecutive gateway devices arranged after the second gateway device, the second gateway device backs up all local network connection information to the new gateway device.
[0064] In this implementation, the second gateway device may detect in real time or periodically whether there is a newly added gateway device in the target gateway device of the current gateway device. If so, all local network connection information is backed up to the newly added gateway device.
[0065] Specifically, the second device numbering ring is number 1-number 2-number 3-number 4, wherein the second gateway device is numbered 2, N is 2, and the two consecutive gateway devices after the second gateway device are gateway device numbered 3 and gateway device numbered 4, respectively. If gateway device numbered 3 is a newly added gateway device, the second gateway device will back up all local network connection information to gateway device numbered 3.
[0066] Furthermore, after backing up all local network connection information to the newly added gateway device, the second gateway device may announce to the switching device for the newly added gateway device to introduce network messages to provide services for the cluster.
[0067] This implementation method is that the second gateway device responds to determining that there is a new gateway device among the N consecutive gateway devices arranged after the second gateway device, and backs up all local network connection information to the new gateway device, thereby achieving timely and effective backup of network connection information when there is a new gateway device in the cluster, and avoiding transmission anomalies caused by the lack of a backup device when the second gateway device fails.
[0068] Figure 4a The flowchart 400 of an embodiment of the information storage method for a gateway cluster that can be applied to the present application is shown. In this embodiment, the information storage method for a gateway cluster includes the following steps:
[0069] Step 401, the first gateway device in the gateway cluster responds to receiving a network message and determines that the network connection information of the network message does not match the first connection list and the second connection list stored locally, determines the target number based on the network connection information and the second device numbering ring, and determines the gateway device corresponding to the target number as the second gateway device.
[0070] In this embodiment, if the first gateway device in the gateway cluster receives a network message and determines that the network connection information of the network message does not match the first connection list and the second connection list stored locally, the target number can be determined based on the network connection information of the network message and the second device number ring, as well as the preset network connection information, device number ring and number mapping relationship table; the target number can also be determined based on the network connection information of the network message and the second device number ring by using a hash algorithm, and the present application does not limit this.
[0071] The first connection list is a network connection information list corresponding to the first device number ring, and the second connection list is a network connection information list corresponding to the second device number ring.
[0072] Here, the second device number ring is obtained by updating the first device number ring in response to receiving an instruction to add or remove gateway devices.
[0073] Specifically, Figure 4b As shown, the numbers of the first device numbering ring are number 1-number 2-number 3. If a gateway device is added between number 2 and number 3, the number of the newly added gateway device is number 3, and the number of the gateway device numbered 3 in the first device numbering ring, that is, the original number 3, becomes number 4, and the numbers of the gateway devices numbered 1 and number 2 remain unchanged. The second device numbering ring is number 1-number 2-number 3-number 4. If the gateway device numbered 2 is reduced, the number of the gateway device numbered 3 in the first device numbering ring, that is, the original number 3, becomes number 2, and the number of the gateway device numbered 1 remains unchanged, and the second device numbering ring is number 1-number 2.
[0074] Furthermore, the first gateway device may determine the gateway device corresponding to the target number as the second gateway device, and store the network connection information in the second connection list.
[0075] In addition, it should be noted that the first gateway device may clear the first device number ring, the first connection list, and the second connection list corresponding to the second device number ring at every preset period.
[0076] The preset period may be set according to actual needs. Specifically, the preset period may be greater than or equal to the timeout period of the network connection.
[0077] Here, the timeout period may be determined according to the maximum interval duration between arrivals of network packets corresponding to the same network connection.
[0078] Step 402: In response to receiving the network message sent by the first gateway device and determining that the network connection information is not stored locally, the second gateway device backs up the network connection information to N consecutive gateway devices in the second device numbering ring that are sorted after the second gateway device.
[0079] In this embodiment, the second gateway device may back up the network connection information to N gateway devices that are sequentially arranged after the second gateway device in the second device numbering ring.
[0080] Specifically, the second device numbering ring is numbered 1-numbered 2-numbered 3. If N is 1, the target number is numbered 1, and the network connection information can be backed up to the gateway device numbered 3.
[0081] In this embodiment, the first gateway device in the gateway cluster responds to receiving a network message and determines that the network connection information of the network message does not match the first connection list and the second connection list stored locally. Based on the network connection information and the second device numbering ring, a target number is determined, and the gateway device corresponding to the target number is determined as the second gateway device. The second gateway device responds to receiving the network message sent by the first gateway device and determines that the network connection information is not stored locally. The network connection information is backed up to N consecutive gateway devices sorted after the second gateway device in the second device numbering ring, thereby realizing the backup of network connection information for new connections.
[0082] In some optional embodiments, the method further includes: the first gateway device determines the target number based on the network connection information and the first device number ring in response to determining that the network connection information matches the first connection list stored locally.
[0083] In this implementation, the first gateway device determines the target number in response to determining that the network connection information of the network message matches the first connection list stored locally, based on the network connection information, the first device number ring and the preset network connection information, the device number ring and the number mapping relationship table; it may also determine the target number based on the network connection information and the first device number ring using a hash algorithm, which is not limited in this application.
[0084] This implementation method determines the target number based on the network connection information and the first device number ring in response to the first gateway device determining that the network connection information matches the first connection list stored locally, thereby confirming the target number of the connection established before receiving the increase or decrease of at least one gateway device.
[0085] In some optional methods, a target number is determined based on network connection information and a first device number ring, including: determining a target value based on the network connection information and the first device number ring; in response to determining that a gateway device in the first device number ring corresponding to the target value is a reduced gateway device, determining the number of any one of N consecutive gateway devices arranged after the second gateway device in the first device number ring as the target number.
[0086] In this implementation, the first gateway device may determine the target value using a hash algorithm based on the network connection information of the network message and the first device number ring.
[0087] Furthermore, the first gateway device may make a judgment based on the device information of the gateway device corresponding to the target value in the first device number ring and the device information of the gateway device corresponding to the target value in the second device number ring to determine whether the gateway device in the first device number ring corresponding to the target value is a reduced gateway device.
[0088] If so, the number of any device among the N consecutive gateway devices that are arranged in the first device number ring after the gateway device corresponding to the target value is determined as the target number.
[0089] Specifically, the first device numbering ring is numbered 1-numbered 2-numbered 3-numbered 4. If N is 2, the target value is 2, and the target value corresponds to the gateway device numbered 2. The N consecutive gateway devices after the gateway device numbered 2 are the gateway device numbered 4 and the gateway device numbered 1. If the gateway device numbered 2 is a reduced gateway device, the first gateway device can determine the number of any one of the gateway device numbered 4 and the gateway device numbered 1 as the target number.
[0090] This implementation method determines the target value based on the network connection information and the first device number ring; in response to determining that the gateway device in the first device number ring corresponding to the target value is a reduced gateway device, the number of any device among the N consecutive gateway devices arranged after the second gateway device in the first device number ring is determined as the target number, thereby improving the accuracy and effectiveness of the determined target number.
[0091] In some optional embodiments, the method further includes: in response to determining that the network connection information matches the second connection list stored locally, determining a target number based on the network connection information and the second device number ring.
[0092] In this implementation, the first gateway device determines that the network connection information of the network message matches the second connection list stored locally, and can determine the target number based on the network connection information, the second device number ring and the preset network connection information, the device number ring and the number mapping relationship table; it can also determine the target number based on the network connection information and the second device number ring using a hash algorithm, and this application does not limit this.
[0093] This implementation method determines the target number based on the network connection information and the second device number ring in response to determining that the network connection information matches the second connection list stored locally, thereby confirming the target number of the established connection after receiving the addition or reduction of at least one gateway device.
[0094] In some optional methods, the third gateway device in the gateway cluster responds to receiving a specified network message and determining that the network connection information of the specified network message is locally stored network connection information for backup, and backs up the backup network connection information to the target gateway device.
[0095] In this implementation, the third gateway device in the gateway cluster responds to receiving a specified network message and determining that the network connection information of the specified network message is locally stored network connection information for backup, and backs up the backup network connection information to the target gateway device in the gateway cluster.
[0096] The third gateway device may be the same gateway device as the first gateway device and the second gateway device, or may be a gateway device different from the first gateway device and the second gateway device.
[0097] This implementation method is that the third gateway device in the gateway cluster responds to receiving a specified network message, and determines that the network connection information of the specified network message is the locally stored network connection information for backup, and backs up the backed-up network connection information to the target gateway device in the gateway cluster, thereby realizing an immediate and effective backup of the network connection information.
[0098] Further, as an implementation of the methods shown in the above figures, the present application provides an embodiment of a gateway cluster, which is similar to Figure 1 The method embodiments shown correspond.
[0099] In this embodiment, the gateway cluster includes multiple gateway devices, and the gateway devices are used to perform the following steps: Figure 1 The information storage method for a gateway cluster described in the corresponding embodiment.
[0100] Specifically, Figure 5As shown, the gateway cluster includes multiple gateway devices 501, 502, 503, and 504, and the multiple gateway devices 501, 502, 503, and 504 are connected to the same switch 505. When the switch 505 receives the network message, it can select any gateway device, such as the gateway device 501, as the first gateway device through the VIP ECMP (Equal-Cost Multipath Routing) Hash algorithm, and forward the network message.
[0101] The first gateway device, namely, gateway device 501, in response to receiving a network message, may determine a second gateway device, such as gateway device 502, from the gateway cluster based on the network connection information of the network message, and forward the network message to the second gateway device; the second gateway device, namely, gateway device 502, in response to receiving a network message sent by the first gateway device and determining that the network connection information is not saved locally, saves the network connection information locally and backs it up to the target gateway devices in the gateway cluster, for example, gateway device 503 and gateway device 504.
[0102] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.
[0103] like Figure 6 , is a block diagram of an electronic device for a gateway cluster information storage method according to an embodiment of the present application.
[0104] 600 is a block diagram of an electronic device for an information storage method for a gateway cluster according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0105] like Figure 6As shown, the electronic device includes: one or more processors 601, a memory 602, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 601 is taken as an example.
[0106] The memory 602 is a non-transitory computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the information storage method for a gateway cluster provided in the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the information storage method for a gateway cluster provided in the present application.
[0107] The memory 602 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the information storage method for gateway clusters in the embodiment of the present application. The processor 601 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 602, that is, implementing the information storage method for gateway clusters in the above method embodiment.
[0108] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of an electronic device for information storage of a gateway cluster, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 602 may optionally include a memory remotely arranged relative to the processor 601, and these remote memories may be connected to an electronic device for information storage of a gateway cluster via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0109] The electronic device for the information storage method of the gateway cluster may further include: an input device 603 and an output device 604. The processor 601, the memory 602, the input device 603 and the output device 604 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0110] The input device 603 can receive input digital or character information, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a track ball, a joystick, and other input devices. The output device 604 may include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.
[0111] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0112] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0113] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0114] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0115] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0116] According to the technical solution of the embodiment of the present application, the number of backups of network connection information is reduced.
[0117] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0118] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A method for storing information of a gateway cluster, the method comprising: The first gateway device in the gateway cluster determines, in response to receiving the network message, a second gateway device from the gateway cluster based on the network connection information of the network message; In response to receiving the network message sent by the first gateway device and determining that the network connection information is not saved locally, the second gateway device saves the network connection information locally and backs it up to the target gateway device in the gateway cluster, wherein the number of the target gateway devices is N, the total number of gateway devices in the gateway cluster is M, and N is less than M-1.
2. The method according to claim 1, wherein: The determining a second gateway device from the gateway cluster based on the network connection information of the network message includes: A target number is determined based on the network connection information of the network message and a device number ring, and a gateway device corresponding to the target number is determined as a second gateway device, wherein the device number ring is obtained in the following manner: according to the device information of each gateway device, each gateway device in the gateway device cluster is sorted and numbered, and a gateway device ranked first is determined as the next gateway device of the gateway device ranked last; Backing up the network connection information to a target gateway device in the gateway cluster includes: The network connection information is backed up to N gateway devices that are consecutively arranged after the second gateway device in the device numbering ring.
3. The method according to claim 2, wherein: The determining of the target number based on the network connection information and the device number of the network message includes: A target number is determined based on the network connection information, the device number ring, and the device information of the gateway devices added or removed in the gateway cluster.
4. The method according to claim 3, further comprising: In response to determining that there is a newly added gateway device among the N consecutive gateway devices arranged after the second gateway device, the second gateway device backs up all local network connection information to the newly added gateway device.
5. The method according to claim 2, wherein: The device number ring includes a first device number ring and a second device number ring, and determining the target number based on the network connection information of the network message and the device number ring includes: In response to determining that the network connection information of the network message does not match the first connection list and the second connection list stored locally, determining a target number based on the network connection information and the second device number ring and storing the network connection information in the second connection list; The first connection list is a network connection information list corresponding to the first device number ring, the second connection list is a network connection information list corresponding to the second device number ring, and the second device number ring is obtained by updating the first device number ring in response to receiving an instruction to increase or decrease a gateway device; The backing up of the network connection information to N gateway devices that are sequentially arranged after the second gateway device in the device numbering ring includes: The network connection information is backed up to N gateway devices that are consecutively arranged after the second gateway device in the second device numbering ring.
6. The method according to claim 5, further comprising: In response to determining that the network connection information matches the locally stored first connection list, the first gateway device determines a target number based on the network connection information and the first device number ring.
7. The method according to claim 6, wherein: The determining a target number based on the network connection information and the first device number ring includes: Determining a target value based on the network connection information and the first device number ring; In response to determining that the gateway device in the first device number ring corresponding to the target value is a reduced gateway device, the number of any device among N consecutive gateway devices in the first device number ring that are ordered after the gateway device corresponding to the target value is determined as the target number.
8. The method according to claim 5, further comprising: In response to determining that the network connection information matches the second connection list stored locally, the first gateway device determines a target number based on the network connection information and the second device number ring.
9. The method according to any one of claims 1 to 8, further comprising: In response to receiving a designated network message and determining that the network connection information of the designated network message is locally stored network connection information for backup, the third gateway device in the gateway cluster backs up the backup network connection information to a target gateway device in the gateway cluster.
10. The method according to any one of claims 1 to 8, wherein: The gateway cluster includes multiple gateway devices, and the gateway devices are used for network address translation.
11. A gateway cluster, characterized in that: include: A plurality of gateway devices, wherein the gateway devices are used to execute the method according to any one of claims 1 to 10.
12. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 10.
13. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 10.
