Data forwarding method and device based on distributed cluster gateway
By using timestamps in a distributed cluster gateway to generate a unique link handle and allocate based on node load information, the problems of collaborative inconsistency and complex access processes are solved, and the rapid access and data forwarding efficiency of terminal devices is improved. Ensure efficient operation of the gateway and stability of the network system.
Patent Information
- Application Number
- CN202411260856.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-10
- Publication Date
- 2024-12-24
AI Technical Summary
The existing distributed cluster gateways have problems such as inconsistency in the data forwarding process and complex terminal equipment access processes, resulting in inefficiency and inability to effectively adapt to the access needs of massive terminal equipment.
By obtaining the time stamp of the terminal device, generating a unique link handle, and assigning it in combination with the node load information, selecting the optimal forwarding path and channel, and realizing fast access and data forwarding of the terminal device.
Improves the gateway's identification and access efficiency of terminal devices, avoids the problem of inefficient data forwarding, ensures the load balancing and stable operation of the gateway, avoids network congestion and resource waste, and improves the operation efficiency and stability of the entire network system. sex.
Smart Images

Figure CN119182740A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of gateway control, and in particular to a data forwarding method and device based on a distributed cluster gateway. Background Art
[0002] With the continuous development of the Internet, network architecture is becoming increasingly complex and diversified. Gateway, as a key device for connecting different network devices and forwarding data, is an indispensable and important part of the network system. Its data forwarding performance affects the operating efficiency and stability of the entire network system.
[0003] Most of the current gateways adopt a centralized architecture, and the data of multiple terminal devices are forwarded through a single gateway. However, with the increasing number of terminal devices accessing the network system, the data forwarding demand in the network system is also increasing. The centralized architecture gateway can no longer adapt well to the data forwarding demand of the network system. Therefore, a new type of gateway based on a distributed cluster gateway is gradually applied to the data forwarding of the network system. Although the gateway based on a distributed cluster can adapt well to the data forwarding needs of a large number of terminal devices, due to the complexity of the distributed cluster gateway itself, it still has many deficiencies and defects in data forwarding, such as inconsistent coordination of different nodes in the gateway, complex access process of terminal devices, etc., which all lead to unsatisfactory data forwarding effect based on the distributed cluster gateway. Therefore, a new data forwarding method and device based on a distributed cluster gateway is needed to solve the defects of the prior art. Summary of the invention
[0004] The present invention provides a data forwarding method and device based on a distributed cluster gateway, so as to solve the technical problem in the prior art that the distributed cluster gateway cannot efficiently forward the data of the terminal device.
[0005] In order to solve the above technical problems, an embodiment of the present invention provides a data forwarding method based on a distributed cluster gateway, comprising:
[0006] Obtaining a timestamp corresponding to the terminal device to be connected, and generating and allocating a corresponding link handle to the terminal device in combination with a preset link handle generation method; the timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port;
[0007] According to the load information of each node in the gateway and in combination with a preset node allocation algorithm, nodes are allocated to the terminal device to complete the gateway access of the terminal device;
[0008] When the terminal device that has completed the connection issues a data forwarding request, the target node corresponding to the data forwarding request is calculated according to the preset node selection algorithm, combined with the configuration information of the current gateway and the node and link handle corresponding to the terminal device;
[0009] Construct the optimal forwarding path and channel between the target node and the node corresponding to the terminal device, and forward the data of the terminal device.
[0010] It can be understood that, compared with the prior art, the present invention constructs a unique link handle corresponding to the terminal device through a timestamp and performs node allocation of the terminal device according to the node load information, which greatly improves the efficiency of terminal device access to the gateway while ensuring that the gateway can accurately identify each terminal device accessing the gateway and the load balance and stable operation of the gateway; through the link handle and the node where the terminal device is located, the target node for data forwarding can be accurately calculated, avoiding low data forwarding efficiency caused by target node discovery errors; with the two dimensions of rapid access of terminal devices and accurate calculation of data forwarding target nodes, the data forwarding efficiency of the gateway is improved, so that the distributed cluster gateway can efficiently forward the data of the terminal device, thereby improving the working performance of the gateway, avoiding network congestion and resource waste of the network system, and improving the operating efficiency and stability of the entire network system.
[0011] As a preferred solution, the timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port, specifically including:
[0012] When receiving an access request from a terminal device to be connected, detecting the number of accessible ports of the current gateway;
[0013] When the number of accessible ports of the gateway is not zero, a gateway port is allocated to the terminal device to be accessed according to a preset port allocation strategy;
[0014] When the number of accessible ports of the gateway is zero, the ports of the gateway are expanded according to a preset port expansion strategy, and the expanded gateway ports are allocated to the terminal device to be accessed;
[0015] Control the terminal device to connect to the corresponding gateway port and record the timestamp of the connection.
[0016] By detecting the number of ports and the expansion of the number of ports when the terminal device is connected to the gateway, the waste of gateway resources caused by expanding too many ports at one time can be avoided. By expanding the ports, the access needs of massive terminal devices can be met.
[0017] As a preferred solution, the obtaining of the timestamp corresponding to the terminal device to be connected and the generation of the corresponding link handle for the terminal device in combination with a preset link handle generation method specifically include:
[0018] According to a preset serial number search algorithm, the serial number corresponding to the terminal device to be connected is searched from a preset sequence set;
[0019] According to a preset link handle generation method, a link handle corresponding to the terminal device to be accessed is generated in combination with a timestamp and a serial number corresponding to the terminal device to be accessed.
[0020] By generating a unique link handle corresponding to the terminal device through timestamp and serial number, the gateway can improve the monitoring and management of the terminal device, and avoid the situation where the gateway cannot accurately identify the data forwarding requirements corresponding to each terminal device when too many terminal devices have data forwarding requirements.
[0021] As a preferred solution, the node allocation is performed on the terminal device to be connected according to the load information of each node in the gateway and in combination with a preset node allocation algorithm to complete the gateway access of the terminal device, specifically including:
[0022] Obtaining a number of load information corresponding to each node in the gateway, wherein the load information includes: CPU usage, memory usage, and network traffic;
[0023] According to a preset node allocation algorithm, combined with the load information of each node in the gateway, a node is allocated to the terminal device so that after the terminal device accesses the node, each load information of each node in the gateway is within the corresponding preset threshold range; the node allocation algorithm includes: a polling algorithm, a weighted polling algorithm or a least connection algorithm.
[0024] By allocating nodes to terminal devices based on the node load information, it is possible to ensure that each node in the gateway is load balanced, avoiding the low efficiency of gateway data forwarding caused by one node being overworked while another node is idle.
[0025] As a preferred solution, several load information corresponding to each node in the gateway is obtained, and the several load information includes: CPU usage, memory usage and network traffic, and also includes:
[0026] According to the heartbeat detection mechanism, combined with a number of load information corresponding to each node in the gateway, the working status of each node in the gateway is monitored in real time;
[0027] When any node of the gateway is detected to be faulty, the node is marked as a faulty node, and the load information of the non-faulty nodes in the gateway is evaluated according to the preset node load evaluation algorithm;
[0028] According to the evaluation result of the load information, the work tasks of the faulty node are reallocated.
[0029] By monitoring the working status of the nodes in real time, failover is achieved, avoiding the low overall data forwarding efficiency of the gateway caused by the failure to resolve the data forwarding task of the failed node.
[0030] Accordingly, an embodiment of the present invention provides a data forwarding device based on a distributed cluster gateway, comprising: a link handle generation module, a node allocation module, a target node calculation module and a data forwarding module;
[0031] The link handle generation module is used to obtain the timestamp corresponding to the terminal device to be connected, and generate the corresponding link handle for the terminal device in combination with the preset link handle generation method; the timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port;
[0032] The node allocation module is used to allocate nodes to the terminal device to be connected according to the load information of each node in the gateway and in combination with a preset node allocation algorithm, so as to complete the gateway access of the terminal device;
[0033] The target node calculation module is used to calculate the target node corresponding to the data forwarding request according to the preset node selection algorithm, in combination with the configuration information of the current gateway and the node and link handle corresponding to the terminal device when the terminal device that has completed the connection sends a data forwarding request;
[0034] The data forwarding module is used to construct an optimal forwarding path and channel between the target node and the node corresponding to the terminal device, and forward the data of the terminal device.
[0035] As a preferred solution, the link handle generation module includes: a timestamp acquisition unit;
[0036] The timestamp acquisition unit is used to detect the number of accessible ports of the current gateway when receiving an access request from a terminal device to be accessed;
[0037] When the number of accessible ports of the gateway is not zero, a gateway port is allocated to the terminal device to be accessed according to a preset port allocation strategy;
[0038] When the number of accessible ports of the gateway is zero, the ports of the gateway are expanded according to a preset port expansion strategy, and the expanded gateway ports are allocated to the terminal device to be accessed;
[0039] Control the terminal device to connect to the corresponding gateway port and record the timestamp of the connection.
[0040] As a preferred solution, the link handle generation module further includes: a link handle generation unit;
[0041] The link handle generation unit is used to search for a serial number corresponding to the terminal device to be connected from a preset sequence set according to a preset sequence number search algorithm;
[0042] According to a preset link handle generation method, a link handle corresponding to the terminal device to be accessed is generated in combination with a timestamp and a serial number corresponding to the terminal device to be accessed.
[0043] As a preferred solution, the node allocation module includes: a node allocation unit;
[0044] The node allocation unit is used to obtain a number of load information corresponding to each node in the gateway, and the several load information includes: CPU usage, memory occupancy and network traffic;
[0045] According to a preset node allocation algorithm, combined with the load information of each node in the gateway, a node is allocated to the terminal device so that after the terminal device accesses the node, each load information of each node in the gateway is within the corresponding preset threshold range; the node allocation algorithm includes: a polling algorithm, a weighted polling algorithm or a least connection algorithm.
[0046] As a preferred solution, the node allocation unit includes: a node failure processing subunit;
[0047] The node fault processing subunit is used to monitor the working status of each node in the gateway in real time according to the heartbeat detection mechanism and in combination with a number of load information corresponding to each node in the gateway;
[0048] When any node of the gateway is detected to be faulty, the node is marked as a faulty node, and the load information of the non-faulty nodes in the gateway is evaluated according to the preset node load evaluation algorithm;
[0049] According to the evaluation result of the load information, the work tasks of the faulty node are reallocated.
[0050] The device constructs a unique link handle corresponding to the terminal device through a timestamp and performs node allocation of the terminal device according to the node load information. Under the premise of ensuring that the gateway can accurately identify each terminal device accessing the gateway and the load balance and stable operation of the gateway, the efficiency of terminal device access to the gateway is greatly improved; through the link handle and the node where the terminal device is located, the target node for data forwarding can be accurately calculated, avoiding low data forwarding efficiency caused by target node discovery errors; with the two dimensions of rapid access of terminal devices and accurate calculation of data forwarding target nodes, the data forwarding efficiency of the gateway is improved, so that the distributed cluster gateway can efficiently forward the data of the terminal device, thereby improving the working performance of the gateway, avoiding network congestion and resource waste of the network system, and improving the operating efficiency and stability of the entire network system. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 : A flow chart of the steps of a data forwarding method based on a distributed cluster gateway provided in an embodiment of the present invention;
[0052] Figure 2 : A structural diagram of a data forwarding device based on a distributed cluster gateway provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] With the rapid development of Internet technology, network architecture is becoming increasingly complex and diversified. Gateways, as important devices that connect different network devices and realize data forwarding, play a vital role in network systems. The data forwarding performance of gateways profoundly affects the operating efficiency and stability of the entire network system.
[0055] Existing gateways usually adopt a centralized architecture, where data is input from terminal devices through a single entrance and then processed and stored. The disadvantage of this approach is that with the increase in terminal devices and the amount of data, the speed and efficiency of data processing will be greatly reduced. At the same time, the centralized architecture is also prone to become a single point of failure in the system, affecting the stability of the entire system.
[0056] A new type of gateway based on distributed clusters is gradually being applied in network systems. This distributed cluster gateway can well meet the data forwarding needs of a large number of terminal devices. However, the data forwarding of distributed cluster gateways still has major defects. For example, the coordination between different nodes is inconsistent, the access process of terminal devices is complicated, etc., all of which lead to unsatisfactory data forwarding effects.
[0057] Embodiment 1
[0058] Please refer to Figure 1 , is a step flow chart of a data forwarding method based on a distributed cluster gateway provided in an embodiment of the present invention, including: step S101-step S104.
[0059] Step S101: Obtain the timestamp corresponding to the terminal device to be connected, and generate the corresponding link handle for the terminal device in combination with the preset link handle generation method; the timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port.
[0060] In this embodiment, the timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port, specifically including:
[0061] When receiving an access request from a terminal device to be connected, detecting the number of accessible ports of the current gateway;
[0062] When the number of accessible ports of the gateway is not zero, a gateway port is allocated to the terminal device to be accessed according to a preset port allocation strategy;
[0063] When the number of accessible ports of the gateway is zero, the ports of the gateway are expanded according to a preset port expansion strategy, and the expanded gateway ports are allocated to the terminal device to be accessed;
[0064] Control the terminal device to connect to the corresponding gateway port and record the timestamp of the connection.
[0065] By detecting the number of ports and the expansion of the number of ports when the terminal device is connected to the gateway, the waste of gateway resources caused by expanding too many ports at one time can be avoided. By expanding the ports, the access needs of massive terminal devices can be met.
[0066] In an optional embodiment, when the number of accessible ports of the gateway is zero, a search is performed for a terminal device that has been connected to the gateway and has not had any data forwarding requirements for more than a preset time; when the terminal device is found, the connection between the gateway and the terminal device is closed to release the port occupied by the terminal device, and the port is allocated to the terminal device to be connected; when no qualified terminal device is found, a new listening thread or process is started to expand the port, and the newly expanded port is allocated to the terminal device to be connected.
[0067] In this embodiment, the obtaining of the timestamp corresponding to the terminal device to be connected and the generation of the corresponding link handle for the terminal device in combination with the preset link handle generation method specifically include:
[0068] According to a preset serial number search algorithm, the serial number corresponding to the terminal device to be connected is searched from a preset sequence set;
[0069] According to a preset link handle generation method, a link handle corresponding to the terminal device to be accessed is generated in combination with a timestamp and a serial number corresponding to the terminal device to be accessed.
[0070] By generating a unique link handle corresponding to the terminal device through timestamp and serial number, the gateway can improve the monitoring and management of the terminal device, and avoid the situation where the gateway cannot accurately identify the data forwarding requirements corresponding to each terminal device when too many terminal devices have data forwarding requirements.
[0071] Step S102: According to the load information of each node in the gateway and in combination with a preset node allocation algorithm, nodes are allocated to the terminal device to be connected, so as to complete the gateway access of the terminal device.
[0072] In this embodiment, the node allocation is performed on the terminal device to be connected according to the load information of each node in the gateway and in combination with a preset node allocation algorithm to complete the gateway access of the terminal device, specifically including:
[0073] Obtaining a number of load information corresponding to each node in the gateway, wherein the load information includes: CPU usage, memory usage, and network traffic;
[0074] According to a preset node allocation algorithm, combined with the load information of each node in the gateway, a node is allocated to the terminal device so that after the terminal device accesses the node, each load information of each node in the gateway is within the corresponding preset threshold range; the node allocation algorithm includes: a polling algorithm, a weighted polling algorithm or a least connection algorithm.
[0075] By allocating nodes to terminal devices based on the node load information, it is possible to ensure that each node in the gateway is load balanced, avoiding the low efficiency of gateway data forwarding caused by one node being overworked while another node is idle.
[0076] In an optional embodiment, when any load value of the CPU usage, memory occupancy and network traffic of any node in the gateway exceeds a preset safety threshold, the task of the node is reallocated so that any load value of the CPU usage, memory occupancy and network traffic of the node does not exceed the preset safety threshold; the preset safety threshold is 10%.
[0077] In this embodiment, several load information corresponding to each node in the gateway is obtained, and the several load information includes: CPU usage, memory usage and network traffic, and also includes:
[0078] According to the heartbeat detection mechanism, combined with a number of load information corresponding to each node in the gateway, the working status of each node in the gateway is monitored in real time;
[0079] When any node of the gateway is detected to be faulty, the node is marked as a faulty node, and the load information of the non-faulty nodes in the gateway is evaluated according to the preset node load evaluation algorithm;
[0080] According to the evaluation result of the load information, the work tasks of the faulty node are reallocated.
[0081] By monitoring the working status of the nodes in real time, failover is achieved, avoiding the low overall data forwarding efficiency of the gateway caused by the failure to resolve the data forwarding task of the failed node.
[0082] In an optional embodiment, according to the heartbeat detection mechanism, each node in the gateway sends a heartbeat signal to the cluster management module of the gateway at a preset time interval. When the heartbeat signal of a node is interrupted or times out, the node whose heartbeat signal is interrupted or times out is marked as a faulty node; the load information of the remaining non-faulty nodes in the gateway is evaluated, and a target transfer node is obtained according to the evaluation results; the node status information, node configuration information and node task information of the faulty node are synchronized to the target transfer node through a preset synchronization method; the preset synchronization method includes: a shared storage method, a distributed database method and a replication mechanism.
[0083] Step S103: When the terminal device that has completed the connection issues a data forwarding request, the target node corresponding to the data forwarding request is calculated according to a preset node selection algorithm, combined with the configuration information of the current gateway and the node and link handle corresponding to the terminal device.
[0084] Step S104: construct an optimal forwarding path and channel between the target node and the node corresponding to the terminal device, and forward the data of the terminal device.
[0085] This embodiment constructs a unique link handle corresponding to the terminal device through a timestamp and allocates the node of the terminal device according to the load information of the node. Under the premise of ensuring that the gateway can accurately identify each terminal device accessing the gateway and the load balancing and stable operation of the gateway, the efficiency of the terminal device accessing the gateway is greatly improved; through the link handle and the node where the terminal device is located, the target node for data forwarding can be accurately calculated, avoiding the low data forwarding efficiency caused by the target node discovery error; with the two dimensions of fast access of terminal devices and accurate calculation of data forwarding target nodes, the data forwarding efficiency of the gateway is improved, so that the distributed cluster gateway can efficiently forward the data of the terminal device, thereby improving the working performance of the gateway, avoiding network congestion and resource waste of the network system, and improving the operation efficiency and stability of the entire network system.
[0086] Embodiment 2
[0087] Please refer to Figure 2 , which is a structural diagram of a data forwarding device based on a distributed cluster gateway provided in an embodiment of the present invention, including: a link handle generation module 201, a node allocation module 202, a target node calculation module 203 and a data forwarding module 204.
[0088] Among them, the link handle generation module 201 is used to obtain the timestamp corresponding to the terminal device to be connected, and generate the corresponding link handle for the terminal device in combination with the preset link handle generation method; the timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port.
[0089] In this embodiment, the link handle generation module 201 includes: a timestamp acquisition unit;
[0090] The timestamp acquisition unit is used to detect the number of accessible ports of the current gateway when receiving an access request from a terminal device to be accessed;
[0091] When the number of accessible ports of the gateway is not zero, a gateway port is allocated to the terminal device to be accessed according to a preset port allocation strategy;
[0092] When the number of accessible ports of the gateway is zero, the ports of the gateway are expanded according to a preset port expansion strategy, and the expanded gateway ports are allocated to the terminal device to be accessed;
[0093] Control the terminal device to connect to the corresponding gateway port and record the timestamp of the connection.
[0094] As a preferred solution, the link handle generation module 201 further includes: a link handle generation unit;
[0095] The link handle generation unit is used to search for a serial number corresponding to the terminal device to be connected from a preset sequence set according to a preset sequence number search algorithm;
[0096] According to a preset link handle generation method, a link handle corresponding to the terminal device to be accessed is generated in combination with a timestamp and a serial number corresponding to the terminal device to be accessed.
[0097] The node allocation module 202 is used to allocate nodes to the terminal device to be connected according to the load information of each node in the gateway and in combination with a preset node allocation algorithm, so as to complete the gateway access of the terminal device.
[0098] As a preferred solution, the node allocation module 202 includes: a node allocation unit;
[0099] The node allocation unit is used to obtain a number of load information corresponding to each node in the gateway, and the several load information includes: CPU usage, memory occupancy and network traffic;
[0100] According to a preset node allocation algorithm, combined with the load information of each node in the gateway, a node is allocated to the terminal device so that after the terminal device accesses the node, each load information of each node in the gateway is within the corresponding preset threshold range; the node allocation algorithm includes: a polling algorithm, a weighted polling algorithm or a least connection algorithm.
[0101] As a preferred solution, the node allocation unit includes: a node failure processing subunit;
[0102] The node fault processing subunit is used to monitor the working status of each node in the gateway in real time according to the heartbeat detection mechanism and in combination with a number of load information corresponding to each node in the gateway;
[0103] When any node of the gateway is detected to be faulty, the node is marked as a faulty node, and the load information of the non-faulty nodes in the gateway is evaluated according to the preset node load evaluation algorithm;
[0104] According to the evaluation result of the load information, the work tasks of the faulty node are reallocated.
[0105] The target node calculation module 203 is used to calculate the target node corresponding to the data forwarding request according to a preset node selection algorithm, combined with the configuration information of the current gateway and the node and link handle corresponding to the terminal device when the terminal device that has completed the connection sends a data forwarding request.
[0106] The data forwarding module 204 is used to construct an optimal forwarding path and channel between the target node and the node corresponding to the terminal device, and forward the data of the terminal device.
[0107] This embodiment constructs a unique link handle corresponding to the terminal device through a timestamp and allocates the node of the terminal device according to the load information of the node. Under the premise of ensuring that the gateway can accurately identify each terminal device accessing the gateway and the load balancing and stable operation of the gateway, the efficiency of the terminal device accessing the gateway is greatly improved; through the link handle and the node where the terminal device is located, the target node for data forwarding can be accurately calculated, avoiding the low data forwarding efficiency caused by the target node discovery error; with the two dimensions of fast access of terminal devices and accurate calculation of data forwarding target nodes, the data forwarding efficiency of the gateway is improved, so that the distributed cluster gateway can efficiently forward the data of the terminal device, thereby improving the working performance of the gateway, avoiding network congestion and resource waste of the network system, and improving the operation efficiency and stability of the entire network system.
[0108] To summarize, this embodiment constructs a unique link handle corresponding to the terminal device through a timestamp and performs node allocation of the terminal device according to the node load information, which greatly improves the efficiency of terminal device access to the gateway while ensuring that the gateway can accurately identify each terminal device accessing the gateway and the load balance and stable operation of the gateway; through the link handle and the node where the terminal device is located, the target node for data forwarding can be accurately calculated, avoiding low data forwarding efficiency caused by target node discovery errors; with the two dimensions of rapid access of terminal devices and accurate calculation of data forwarding target nodes, the data forwarding efficiency of the gateway is improved, so that the distributed cluster gateway can efficiently forward the data of the terminal device, thereby improving the working performance of the gateway, avoiding network congestion and resource waste of the network system, and improving the operating efficiency and stability of the entire network system.
[0109] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A data forwarding method based on a distributed cluster gateway, characterized in that: include: Obtain the timestamp corresponding to the terminal device to be connected, and generate the corresponding link handle for the terminal device in combination with the preset link handle generation method; The timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port; According to the load information of each node in the gateway and in combination with a preset node allocation algorithm, nodes are allocated to the terminal device to be connected, so as to complete the gateway access of the terminal device; When the terminal device that has completed the connection issues a data forwarding request, the target node corresponding to the data forwarding request is calculated according to the preset node selection algorithm, combined with the configuration information of the current gateway and the node and link handle corresponding to the terminal device; Construct the optimal forwarding path and channel between the target node and the node corresponding to the terminal device, and forward the data of the terminal device.
2. A data forwarding method based on a distributed cluster gateway as claimed in claim 1, characterized in that: The timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port, specifically including: When receiving an access request from a terminal device to be connected, detecting the number of accessible ports of the current gateway; When the number of accessible ports of the gateway is not zero, a gateway port is allocated to the terminal device to be accessed according to a preset port allocation strategy; When the number of accessible ports of the gateway is zero, the ports of the gateway are expanded according to a preset port expansion strategy, and the expanded gateway ports are allocated to the terminal device to be accessed; Control the terminal device to connect to the corresponding gateway port and record the timestamp of the connection.
3. A data forwarding method based on a distributed cluster gateway as claimed in claim 2, characterized in that: The obtaining of a timestamp corresponding to the terminal device to be connected and generating a corresponding link handle for the terminal device in combination with a preset link handle generation method specifically includes: According to a preset serial number search algorithm, the serial number corresponding to the terminal device to be connected is searched from a preset sequence set; According to a preset link handle generation method, a link handle corresponding to the terminal device to be accessed is generated in combination with a timestamp and a serial number corresponding to the terminal device to be accessed.
4. A data forwarding method based on a distributed cluster gateway as claimed in claim 1, characterized in that: The method of allocating nodes to the terminal device to be connected according to the load information of each node in the gateway and combining with a preset node allocation algorithm to complete the gateway access of the terminal device specifically includes: Obtaining a number of load information corresponding to each node in the gateway, wherein the load information includes: CPU usage, memory usage, and network traffic; According to a preset node allocation algorithm, combined with the load information of each node in the gateway, a node is allocated to the terminal device so that after the terminal device accesses the node, each load information of each node in the gateway is within the corresponding preset threshold range; the node allocation algorithm includes: a polling algorithm, a weighted polling algorithm or a least connection algorithm.
5. A data forwarding method based on a distributed cluster gateway as claimed in claim 4, characterized in that: Obtain several load information corresponding to each node in the gateway, including: CPU usage, memory usage and network traffic, and also includes: According to the heartbeat detection mechanism, combined with a number of load information corresponding to each node in the gateway, the working status of each node in the gateway is monitored in real time; When any node of the gateway is detected to be faulty, the node is marked as a faulty node, and the load information of the non-faulty nodes in the gateway is evaluated according to the preset node load evaluation algorithm; According to the evaluation result of the load information, the work tasks of the faulty node are reallocated.
6. A data forwarding device based on a distributed cluster gateway, characterized in that: include: Link handle generation module, node allocation module, target node calculation module and data forwarding module; The link handle generation module is used to obtain the timestamp corresponding to the terminal device to be connected, and generate the corresponding link handle for the terminal device in combination with the preset link handle generation method; the timestamp corresponding to the terminal device to be connected is determined when the terminal device to be connected is connected to the gateway port; The node allocation module is used to allocate nodes to the terminal device to be connected according to the load information of each node in the gateway and in combination with a preset node allocation algorithm, so as to complete the gateway access of the terminal device; The target node calculation module is used to calculate the target node corresponding to the data forwarding request according to the preset node selection algorithm, in combination with the configuration information of the current gateway and the node and link handle corresponding to the terminal device when the terminal device that has completed the connection sends a data forwarding request; The data forwarding module is used to construct an optimal forwarding path and channel between the target node and the node corresponding to the terminal device, and forward the data of the terminal device.
7. A data forwarding device based on a distributed cluster gateway as claimed in claim 6, characterized in that: The link handle generation module includes: a timestamp acquisition unit; The timestamp acquisition unit is used to detect the number of accessible ports of the current gateway when receiving an access request from a terminal device to be accessed; When the number of accessible ports of the gateway is not zero, a gateway port is allocated to the terminal device to be accessed according to a preset port allocation strategy; When the number of accessible ports of the gateway is zero, the ports of the gateway are expanded according to a preset port expansion strategy, and the expanded gateway ports are allocated to the terminal device to be accessed; Control the terminal device to connect to the corresponding gateway port and record the timestamp of the connection.
8. A data forwarding device based on a distributed cluster gateway as claimed in claim 7, characterized in that: The link handle generation module further includes: a link handle generation unit; The link handle generation unit is used to search for a serial number corresponding to the terminal device to be connected from a preset sequence set according to a preset sequence number search algorithm; According to a preset link handle generation method, a link handle corresponding to the terminal device to be accessed is generated in combination with a timestamp and a serial number corresponding to the terminal device to be accessed.
9. A data forwarding device based on a distributed cluster gateway as claimed in claim 6, characterized in that: The node allocation module includes: a node allocation unit; The node allocation unit is used to obtain a number of load information corresponding to each node in the gateway, and the several load information includes: CPU usage, memory occupancy and network traffic; According to a preset node allocation algorithm, combined with the load information of each node in the gateway, a node is allocated to the terminal device so that after the terminal device accesses the node, each load information of each node in the gateway is within the corresponding preset threshold range; the node allocation algorithm includes: a polling algorithm, a weighted polling algorithm or a least connection algorithm.
10. A data forwarding device based on a distributed cluster gateway as claimed in claim 9, characterized in that: The node allocation unit includes: a node failure processing subunit; The node fault processing subunit is used to monitor the working status of each node in the gateway in real time according to the heartbeat detection mechanism and in combination with a number of load information corresponding to each node in the gateway; When any node of the gateway is detected to be faulty, the node is marked as a faulty node, and the load information of the non-faulty nodes in the gateway is evaluated according to the preset node load evaluation algorithm; According to the evaluation result of the load information, the work tasks of the faulty node are reallocated.
