Search

CN-121985013-A - Instruction distribution method and terminal based on gateway cluster

CN121985013ACN 121985013 ACN121985013 ACN 121985013ACN-121985013-A

Abstract

The invention discloses an instruction distribution method and a terminal based on a gateway cluster, which are used for responding to a control request for target equipment, broadcasting the control instruction for the target equipment to the gateway cluster, issuing the control instruction to the target equipment by each gateway service in the gateway cluster, responding to issuing success information returned by a first gateway service in the gateway cluster, stopping issuing the control instruction by other gateway services in the gateway cluster, wherein the issuing success information is generated when the first gateway service issues the control instruction to the target equipment successfully.

Inventors

  • WANG HAO
  • LIN SHAOZHONG
  • LI GUOWEI

Assignees

  • 福建时代星云科技有限公司

Dates

Publication Date
20260505
Application Date
20250916

Claims (10)

  1. 1. The command distribution method based on the gateway cluster is characterized by comprising the following steps: the method comprises the steps of constructing a gateway cluster according to instances of deploying gateway services in a plurality of deployment units of a container arranging platform, configuring fixed addresses and names for each gateway service through the container arranging platform, and after long connection is established between equipment and the gateway service, establishing an association relation table of the equipment and the gateway service according to the addresses and names of the gateway service; generating a control request for target equipment, and broadcasting a control instruction for the target equipment to a gateway cluster; Judging whether long connection with the target equipment exists or not by each gateway service in the gateway cluster according to the unique identifier of the target equipment contained in the control instruction, if so, issuing the control instruction to the target equipment, returning issuing success information comprising a success status code and a processing result, and generating an action log when executing the control instruction issued by the gateway service; and responding to the successful issuing information returned by the first gateway service in the gateway cluster, and stopping other gateway services in the gateway cluster from issuing the control instruction to the target equipment.
  2. 2. The method of claim 1, wherein if present, issuing the control instruction to the target device and returning an issue success message, further comprising: if the successful information of the delivery is not received and the waiting time reaches a preset first duration, or all the gateway services return the failed information of the delivery, the error information of the failed delivery is recorded; And the gateway service receives the heartbeat packet reported by the equipment with long connection communication at fixed time, and if the heartbeat packet of the first equipment is not received and the waiting time reaches the preset second duration, the gateway service actively disconnects the long connection with the first equipment and releases the long connection resource.
  3. 3. The method of claim 1, further comprising the step of: Detecting, by a survival probe of the container orchestration platform, whether the gateway service in each deployment unit is available; If there is an unavailable second gateway service, restarting, by the container orchestration platform, the deployment unit of the second gateway service to resume use of the second gateway service.
  4. 4. A method according to claim 3, wherein detecting, by a survival probe of the container orchestration platform, whether the gateway service in each deployment unit is available comprises: When the survival probe detects that the HTTP request returns an error status code, the TCP port cannot be connected or the command fails to execute, and after the preset failure threshold is reached, the survival probe judges that the container is in a non-survival state, and then unavailable second gateway service exists.
  5. 5. A method according to claim 3, characterized in that if there is an unavailable second gateway service, the further step of: and before the second gateway service is restored, forwarding all requests sent to the second gateway service to other available gateway services through a load balancing algorithm.
  6. 6. An instruction distribution terminal based on gateway clusters, comprising a processor, a memory and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the following steps when executing the computer program: the method comprises the steps of constructing a gateway cluster according to instances of deploying gateway services in a plurality of deployment units of a container arranging platform, configuring fixed addresses and names for each gateway service through the container arranging platform, and after long connection is established between equipment and the gateway service, establishing an association relation table of the equipment and the gateway service according to the addresses and names of the gateway service; generating a control request for target equipment, and broadcasting a control instruction for the target equipment to a gateway cluster; Judging whether long connection with the target equipment exists or not by each gateway service in the gateway cluster according to the unique identifier of the target equipment contained in the control instruction, if so, issuing the control instruction to the target equipment, returning issuing success information comprising a success status code and a processing result, and generating an action log when executing the control instruction issued by the gateway service; and responding to the successful issuing information returned by the first gateway service in the gateway cluster, and stopping other gateway services in the gateway cluster from issuing the control instruction to the target equipment.
  7. 7. The terminal of claim 6, wherein if the control command exists, the control command is issued to the target device, and issuing success information is returned, and further comprising: if the successful information of the delivery is not received and the waiting time reaches a preset first duration, or all the gateway services return the failed information of the delivery, the error information of the failed delivery is recorded; And the gateway service receives the heartbeat packet reported by the equipment with long connection communication at fixed time, and if the heartbeat packet of the first equipment is not received and the waiting time reaches the preset second duration, the gateway service actively disconnects the long connection with the first equipment and releases the long connection resource.
  8. 8. The terminal of claim 6, further comprising the step of: Detecting, by a survival probe of the container orchestration platform, whether the gateway service in each deployment unit is available; If there is an unavailable second gateway service, restarting, by the container orchestration platform, the deployment unit of the second gateway service to resume use of the second gateway service.
  9. 9. The terminal of claim 8, wherein detecting, by a survival probe of the container orchestration platform, whether the gateway service is available in each deployment unit comprises: When the survival probe detects that the HTTP request returns an error status code, the TCP port cannot be connected or the command fails to execute, and after the preset failure threshold is reached, the survival probe judges that the container is in a non-survival state, and then unavailable second gateway service exists.
  10. 10. The terminal of claim 8, wherein if there is an unavailable second gateway service, the steps of: and before the second gateway service is restored, forwarding all requests sent to the second gateway service to other available gateway services through a load balancing algorithm.

Description

Instruction distribution method and terminal based on gateway cluster The scheme is a divisional application taking a patent application with the application number of 202511320141.6, the application date of 2025, 09, 16 days and the name of a control instruction issuing method, a terminal and a storage medium as a main application. Technical Field The present invention relates to the field of data transmission technologies, and in particular, to a method and a terminal for distributing instructions based on a gateway cluster. Background The cloud quick charging protocol is a standardized communication interface specially designed for the electric automobile charging pile, and aims to realize efficient and safe data interaction between the charging pile and the cloud platform. The development of a gateway system conforming to the protocol has important strategic significance in promoting the construction of charging infrastructure. To achieve high availability of gateway services, a multi-instance cluster approach is employed on the deployment architecture. In this case, since a cluster system is adopted, a plurality of gateway nodes exist. In the scheme adopted in the prior art, when a charging pile (or a charging gun) is connected to a platform, the information of the currently connected service end is recorded according to the access address (IP/port or other identifiers) of the charging pile. When a control command needs to be issued to a certain gun, the system searches for the gateway service which corresponds to the gun and is in connection. If the gun is currently indeed online in the corresponding gateway service, it is issued directly through the channel, and if it is not online (e.g. the device has been disconnected, migrated or taken over by another service), a rerouting mechanism is triggered, attempting to bind it to the newly available gateway service. Therefore, the situation of disconnection, reconnection, cross-service migration and the like of the charging pile equipment often occurs, and the existing mechanism still takes an initial access address as a unique binding basis, so that 'state inconsistency' is easy to occur. It can be seen that at least the following problems exist in the prior art: (1) The device state is not accurately bound to the service node, resulting in failure or delay of instruction delivery. The current system relies on address information when a charging pile is accessed for the first time to carry out service binding, a dynamic updating mechanism is lacking, after the charging pile is disconnected and reconnected and a cross-node is migrated, a server still keeps an old state, so that an instruction cannot be sent or is wrongly routed in time, and a unified equipment online state management mechanism is lacking, so that equipment cannot be found or is wrongly sent to other nodes frequently when an instruction is issued. (2) The instruction issuing path is redundant, and the response efficiency is low. When the instruction is issued, the home service node of the equipment is required to be inquired firstly, if the equipment is not in the process, the rerouting is triggered, and the flow is complicated, the repeated state confirmation and forwarding operation increases the instruction issuing delay, influences the real-time performance of remote control, and has obvious performance bottleneck for the function requiring high-frequency interaction. Disclosure of Invention The invention aims to solve the technical problem of providing a gateway cluster-based instruction distribution method and a terminal, which can ensure efficient issuing of control instructions. In order to solve the technical problems, the invention adopts the following technical scheme: a command distribution method based on gateway clusters comprises the following steps: the method comprises the steps of constructing a gateway cluster according to instances of deploying gateway services in a plurality of deployment units of a container arranging platform, configuring fixed addresses and names for each gateway service through the container arranging platform, and after long connection is established between equipment and the gateway service, establishing an association relation table of the equipment and the gateway service according to the addresses and names of the gateway service; generating a control request for target equipment, and broadcasting a control instruction for the target equipment to a gateway cluster; Judging whether long connection with the target equipment exists or not by each gateway service in the gateway cluster according to the unique identifier of the target equipment contained in the control instruction, if so, issuing the control instruction to the target equipment, returning issuing success information comprising a success status code and a processing result, and generating an action log when executing the control instruction issued by the gateway service; and respondin