CN114338502B - Gateway data processing method, device, equipment and storage medium - Google Patents

Gateway data processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN114338502B
CN114338502B CN202111625108.6A CN202111625108A CN114338502B CN 114338502 B CN114338502 B CN 114338502B CN 202111625108 A CN202111625108 A CN 202111625108A CN 114338502 B CN114338502 B CN 114338502B
Authority
CN
China
Prior art keywords
information
target
api gateway
url address
gateway
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111625108.6A
Other languages
Chinese (zh)
Other versions
CN114338502A (en
Inventor
甘兵
廖瑞毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Digital Guangdong Network Construction Co Ltd
Original Assignee
Digital Guangdong Network Construction Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Digital Guangdong Network Construction Co Ltd filed Critical Digital Guangdong Network Construction Co Ltd
Priority to CN202111625108.6A priority Critical patent/CN114338502B/en
Publication of CN114338502A publication Critical patent/CN114338502A/en
Application granted granted Critical
Publication of CN114338502B publication Critical patent/CN114338502B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application relates to a gateway data processing method, a gateway data processing device, gateway data processing equipment and a storage medium. The method comprises the following steps: receiving a data access request, wherein the data access request comprises a target URL address; extracting a root directory to be requested in the target URL address under the condition that the target URL address is not the URL address corresponding to the API gateway; determining the coding information of the target API gateway corresponding to the target URL address from a routing table of the API gateway based on the root directory; and forwarding the data access request to the target API gateway according to the encoded information. Therefore, under the condition that a user does not feel, the cooperative linkage of different API gateways is realized, the interconnection and intercommunication capacity of the different API gateways is improved, and the sharing efficiency of government service is improved. And the data access request can be automatically routed to the target API gateway without the need of a user to specify the coding information of the target API gateway in the data access request, so that the flexibility of the access of the API gateway is improved.

Description

Gateway data processing method, device, equipment and storage medium
Technical Field
The present application relates to the field of computer networks, and in particular, to a gateway data processing method, apparatus, device, and storage medium.
Background
The API gateway (API GATAWAY) refers to that all the calls of the APIs are uniformly accessed to an API gateway layer, and the gateway layer is responsible for access and output. In particular, in a complex service system, the API gateway has stronger routing capability and can provide API management functions such as network security, flow management, service monitoring and the like for the service system.
In the government service industry, it is essential to quickly respond to government jobs and to rely on high-tech means to solve problems. In the informatization construction process of the electronic government affairs, the adoption of the API gateway can bring great convenience to the government affairs work and improve the government affair efficiency. However, when data is requested, in the existing government system, the user needs to specify the coding information of the API gateway to be accessed, that is, needs to specify the specific place of the API gateway to be accessed, so that the division of the API gateway is opaque to the user, and the flexibility of accessing the API gateway is low.
Disclosure of Invention
Based on the above, it is necessary to provide a gateway data processing method, device, equipment and storage medium for solving the technical problem of low access flexibility of an API gateway in the existing government system.
In a first aspect, an embodiment of the present application provides a gateway data processing method, including:
receiving a data access request, wherein the data access request comprises a target URL address;
extracting a root directory to be requested in the target URL address under the condition that the target URL address is not the URL address corresponding to the API gateway;
determining the coding information of the target API gateway corresponding to the target URL address from a routing table of the API gateway based on the root directory;
and forwarding the data access request to the target API gateway according to the encoded information.
In a second aspect, an embodiment of the present application provides a gateway data processing apparatus, including:
The receiving module is used for receiving a data access request, wherein the data access request comprises a target URL address;
The extraction module is used for extracting a root directory to be requested in the target URL address under the condition that the target URL address is not the URL address corresponding to the API gateway;
the determining module is used for determining the coding information of the target API gateway corresponding to the target URL address from the routing table of the API gateway based on the root directory;
and the sending module is used for forwarding the data access request to the target API gateway according to the coding information.
In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the gateway data processing method provided in the first aspect of the embodiment of the present application when executing the computer program.
In a fourth aspect, an embodiment of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the gateway data processing method provided in the first aspect of the embodiment of the present application.
According to the technical scheme provided by the embodiment of the application, after the API gateway receives the data access request, when the target URL address carried in the data access request is determined not to be the URL corresponding to the API gateway, the root directory to be requested in the target URL address can be extracted, the coding information of the target API gateway corresponding to the target URL address is determined from the routing table of the API gateway based on the root directory, and the data access request is forwarded to the target API gateway according to the coding information, so that the cooperative linkage of different API gateways is realized under the condition that a user does not perceive, the interconnection and intercommunication capacity of different API gateways is improved, and the sharing efficiency of government service is improved. And the data access request can be automatically routed to the target API gateway without the need of a user to specify the coding information of the target API gateway in the data access request, so that the flexibility of the access of the API gateway is improved.
Drawings
Fig. 1 is a schematic flow chart of a gateway data processing method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of an exemplary node metadata tree structure according to an embodiment of the present application;
fig. 3 is another flow chart of a gateway data processing method according to an embodiment of the present application;
Fig. 4 is a schematic structural diagram of a gateway data processing device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions in the embodiments of the present application will be further described in detail by the following embodiments with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Fig. 1 is a schematic flow chart of a gateway data processing method according to an embodiment of the present application. The embodiment can be applied to an API gateway, and is applicable to a page access scene in the government field, as shown in fig. 1, the method can include:
s101, receiving a data access request.
Wherein the data access request includes a target URL address. In this step, the API gateway may receive a data access request sent by the service system, where the data access request may include, for example, a target URL address that needs to be accessed.
S102, under the condition that the target URL address is not the URL address corresponding to the API gateway, extracting a root directory to be requested in the target URL address.
The target URL address comprises path information of a page to be requested, and the root directory is a first-level directory in the path information. For example, assuming that the path information of the page to be requested carried in the target URL address is dgdrootA/a/b/c, dgdrootA is the root directory to be requested.
After the API gateway receives the data access request, the API gateway needs to determine whether a target URL address carried in the data access request is a URL address corresponding to the API gateway, and when the target URL address is determined not to be the URL address corresponding to the API gateway, the root directory of the page to be requested can be extracted from the target URL address, and then the coding information of the API gateway to be accessed (namely the target API gateway) is determined based on the root directory.
S103, determining the coding information of the target API gateway corresponding to the target URL address from the routing table of the API gateway based on the root directory.
Specifically, the coding information is a data identifier of the target API gateway in the node metadata tree, and according to the coding information, a target API gateway may be uniquely associated in the node metadata tree. The node metadata tree is a data tree generated by a metadata server according to the received gateway node information reported by each API gateway, and the metadata server is connected with a plurality of API gateways and is used for managing or scheduling the gateway information of each API gateway. Optionally, each API gateway may further actively report own gateway node information to the metadata server when starting up, so that the metadata server generates the node metadata tree based on the reported gateway node information. After the new API gateway is added and started, the gateway node information of the new API gateway can be actively reported to the metadata server, so that the metadata server updates the node metadata tree based on the reported gateway node information. Meanwhile, the metadata driving service of the metadata server can also actively monitor whether all the API gateways have state update, if so, update the relevant subtrees of the node metadata tree based on the updated state information, and synchronize the updated subtrees to all the API gateways. Thus, each API gateway stores the latest node metadata tree. The node metadata tree may include a plurality of levels, wherein each level laterally occupies a layer of the node metadata tree. For example, the following code illustrates an exemplary node metadata tree in this embodiment, where dgdpgtp is a root node, the corresponding level is one level, and different node metadata trees may be generated for the government gateways in different areas respectively, for example, one node metadata tree for the government gateway in area a, another node metadata tree for the government gateway in area B, and so on. 0001. 0002 and the like are leaf nodes of the next layer of the root node, the corresponding level is a second level, and the second level is a second level code; 4401-4404, etc. are next-level leaf nodes of the second level, the corresponding level is three levels, which is a ground three level code. That is, the code "/dgdpgtp/0001" is the coding information of a certain secondary API gateway, and the code "/dgdpgtp/0001/4401" is the coding information of a certain tertiary API gateway.
“/dgdpgtp/0001
|-/dgdpgtp/0001/4401
|-/dgdpgtp/0001/4402
/dgdpgtp/0002
|-/dgdpgtp/0002/4403
|-/dgdpgtp/0002/4404
……”
The above-mentioned node metadata tree may be represented in the form of a tree structure as shown in fig. 2, the highest level is a root node "dgdpgtp", a "first level" node level, the next level of the root node is a "second level" node level, and the next level of the "second level" node level is a "third level" node level.
Each API gateway may periodically report its own gateway node information to the metadata server through a heartbeat message, so that the metadata server generates the node metadata tree. The gateway node information may include gateway role information, encoding information, an IP address and port number of a gateway, and the like.
The routing table of the API gateway stores mapping relations between hash values of different root directories and coding information of the API gateway. Thus, after extracting the root directory to be requested in the target URL address, the present API gateway may determine the encoding information of the target API gateway corresponding to the root directory from the locally stored routing table based on the root directory. That is, when the service system initiates the data access request, it is not necessary to specify in the target URL address which API gateway is specifically the API gateway in which the target API gateway to be accessed is, and it can be automatically determined through the root directory to be requested in the target URL address and the locally stored routing table, which API gateway is specifically the API gateway in which the API gateway to be accessed is, so that the flexibility of access of the API gateway is improved.
As an alternative embodiment, the step S103 may further include the steps of:
determining a first hash value of the root directory; and determining the coding information of the target API gateway corresponding to the target URL address from the routing table of the API gateway based on the first hash value.
Specifically, a preset hash algorithm may be adopted to calculate a first hash value of the root directory, and in a routing table of the API gateway, code information corresponding to the first hash value is searched, and the code information is determined as code information of the target API gateway to be accessed. The hash algorithm may be set based on actual requirements, which is not limited in this embodiment.
S104, forwarding the data access request to the target API gateway according to the coding information.
After the coding information is determined, the API gateway can forward the data access request to the target API gateway corresponding to the coding information, so that the data access of the corresponding page is realized.
According to the gateway data processing method provided by the embodiment of the application, after the API gateway receives the data access request, when the target URL address carried in the data access request is determined not to be the URL corresponding to the API gateway, the root directory to be requested in the target URL address can be extracted, the coding information of the target API gateway corresponding to the target URL address is determined from the routing table of the API gateway based on the root directory, and the data access request is forwarded to the target API gateway according to the coding information, so that the cooperative linkage of different API gateways is realized under the condition that a user does not perceive, the interconnection and intercommunication capacity of different API gateways is improved, and the sharing efficiency of government service is improved. And the data access request can be automatically routed to the target API gateway without the need of a user to specify the coding information of the target API gateway in the data access request, so that the flexibility of the access of the API gateway is improved.
In one embodiment, an optional construction process for the routing table is also provided. On the basis of the above embodiment, optionally, before the step S101, the method further includes: the API gateways synchronize the second hash value of the root directory and the coding information of the root directory through the metadata server; and each API gateway associates the second hash value with the coding information of the corresponding API gateway to obtain the routing table.
Specifically, when the API gateways are opened, the gateway node information of the API gateways can be reported to the metadata server through heartbeat information, so that the metadata server generates the node metadata tree based on the gateway node information. Moreover, each API gateway may report its own gateway node information periodically via a heartbeat message, so that when the gateway node information of the API gateway changes, the metadata server updates the generated node metadata tree. Furthermore, the metadata server may synchronize the node metadata tree to each API gateway, and after each update of the node metadata tree, the metadata server may synchronize the latest node metadata tree to each API gateway. That is, each API gateway locally stores the latest node metadata tree. The gateway node information may include gateway role information (for example, the gateway role information may include level information and function information corresponding to an API gateway), gateway service information (for example, service identifiers, service weights, service port numbers, micro-service parameters, and the like of multiple services included in one API gateway), and gateway code information.
Meanwhile, each API gateway can also report the second hash value of the root directory of the API gateway to the metadata server through heartbeat information periodically, so that the metadata server synchronizes the second hash value of the root directory of each API gateway to other API gateways in the node metadata tree. In this way, the second hash value of the API gateway in the node metadata tree can be correspondingly associated with the encoding information in each API gateway, so as to construct the routing table, and provide a data basis for addressing of subsequent data access. When the root directory and the code information of each API gateway change, each API gateway can exchange update information by the heartbeat information, and update the routing table based on the update information.
In this embodiment, each API gateway can synchronize the second hash value of the root directory and the respective encoding information of the root directory through the metadata server, and associate the second hash value with the encoding information of the corresponding API gateway, thereby constructing a routing table, and providing a data base for addressing of subsequent data access. Therefore, the coding information of the target API gateway can be determined by inquiring the routing table, and a user does not need to specify the specific place of the API gateway to be accessed, so that the data access request is automatically routed to the target API gateway, and the flexibility of the access of the API gateway is improved.
In practical applications, there may be a case where "the first hash value of the same root directory may correspond to a plurality of encoded information in the routing table", for this case, on the basis of the above embodiment, optionally, as shown in fig. 3, the process of S104 may be:
S301, when the target URL address corresponds to a plurality of pieces of coding information from the routing table of the API gateway, the target coding information is determined from the plurality of pieces of coding information.
When determining a plurality of encoded information by querying the routing table of the API gateway, as an optional implementation manner, the target encoded information may be determined from the plurality of encoded information according to a preset load balancing rule. That is, by querying the routing table of the API gateway, if multiple pieces of coding information, namely, cluster mode, are determined, the target API gateway can be determined in the API gateways corresponding to the multiple pieces of coding information based on the load balancing policy, and the data access request is forwarded to the determined target API gateway, so that service level cross-regional multi-level collaboration is implemented, and the user path and multi-level regional dynamic division collaboration is not perceived by the user.
The load balancing rule may be set based on requirements. For example, assuming that the load balancing rule is to select the API gateway with the smallest load as the target API gateway, the present API gateway may monitor loads of the API gateways corresponding to the plurality of encoded information, and determine the encoded information of the API gateway with the smallest load in the plurality of API gateways as the target encoded information. Of course, the load balancing rule may be polling scheduling, and the present API gateway may obtain the first encoded information of the API gateway to which the data access request is allocated last time, and determine, as the target encoded information, the second encoded information other than the first encoded information, from the plurality of encoded information determined this time.
As another alternative embodiment, the above process of determining the target coding information from the plurality of coding information may also be:
and respectively acquiring second geographic information corresponding to each piece of coding information to obtain a second geographic information set.
If the parameter information of the parameter field specified in the target URL address is first matching rule information, determining first geographic information corresponding to the IP address of the requester carried in the data access request; and determining second geographic information matched with the first geographic information in the second geographic information set, and determining coding information corresponding to the matched second geographic information as target coding information.
In this case, since the encoded information of the API gateway is related to the gateway role information of the API gateway, for example, the gateway role information of "/dgdpgtp/0001/4401" may be "XX city YY department", so that the second geographic information corresponding to the encoded information "/dgdpgtp/0001/4401" may be "XX city" can be deduced by the gateway role information. For another example, the gateway role information of "/dgdpgtp/0001/4402" may be "yz city YY department", so that the second geographic information corresponding to the code information "/dgdpgtp/0001/4402" may be obtained by the gateway role information as "ZZ city". And so on, so that the second geographic information corresponding to the plurality of coded information can be obtained.
After the second geographic information corresponding to each encoded information is obtained, the target encoded information may be determined based on the matching rule information indicated by the parameter information specifying the parameter field in the target URL address. If the parameter information of the specified parameter field in the target URL address is first matching rule information, the first matching rule information may be understood as matching according to the IP address of the data requester, the IP address of the data requester may be extracted from the data access request, and the first geographic information corresponding to the IP address may be determined, then the first geographic information is matched with the second geographic information set, so as to determine second geographic information matched with the first geographic information from the second geographic information set, and the code information corresponding to the matched second geographic information may be determined as target code information.
For example, assuming that the first geographic information corresponding to the IP address of the data requester is determined to be XX city, a plurality of encoding information corresponding to the target URL address is determined from the routing table of the API gateway, and the second geographic information corresponding to the plurality of encoding information is respectively XX city, ZZ city and AA city, the encoding information corresponding to "XX city" in the second geographic information set may be determined to be the target encoding information based on the first matching rule information, that is, the latest matching rule with the IP address of the data requester.
Optionally, if the parameter information of the parameter field specified in the target URL address is second matching rule information, obtaining third geographic information indicated by the second matching rule information; and determining second geographic information matched with the third geographic information in the second geographic information set, and determining coding information corresponding to the matched second geographic information as target coding information.
The second matching rule information is different from the first matching rule information, and the second matching rule information can be understood as matching according to third geographic information carried in the target URL address. That is, if the parameter information of the parameter field specified in the target URL address is the second matching rule information, the third geographic information indicated by the second matching rule information may be acquired, then the third geographic information is matched with the second geographic information set, so as to determine the second geographic information matched with the third geographic information from the second geographic information set, and the code information corresponding to the matched second geographic information is determined as the target code information.
For example, assuming that the third geographic information indicated by the parameter information carried by the target URL address is ZZ city, determining that the target URL corresponds to a plurality of coding information from the routing table of the API gateway, and the second geographic information corresponding to the plurality of coding information is XX city, ZZ city and AA city respectively, matching may be performed according to the third geographic information indicated in the target URL address, and the coding information corresponding to "ZZ city" in the second geographic information set is determined as the target coding information.
Of course, if the target URL address does not carry the geographic information to be matched (i.e., the third geographic information), the data access request may be forwarded to the API gateway corresponding to the plurality of encoded information.
S302, forwarding the data access request to a target API gateway corresponding to the target coding information.
After the target coding information is determined, the received data access request can be forwarded to the target API gateway corresponding to the target coding information, so that the data access of the corresponding page is realized.
In this embodiment, when determining that the target URL address corresponds to multiple pieces of encoded information from the routing table of the API gateway, the matching may be performed from the multiple pieces of encoded information according to the matching rule information carried in the target URL address, so as to determine the target encoded information, and further forward the data access request to the target API gateway corresponding to the target encoded information. That is, the access of the API gateway can be performed based on the corresponding matching rule, so that the scenes of the access of the API gateway are diversified, and the flexibility of the access of the API gateway is further improved. And the data access request can be automatically routed to the target API gateway without the need of a user to specify the coding information of the target API gateway in the data access request, so that the flexibility of the access of the API gateway is further improved.
Fig. 4 is a schematic structural diagram of a gateway data processing device according to an embodiment of the present application. As shown in fig. 4, the apparatus may include: a receiving module 401, an extracting module 402, a determining module 403 and a transmitting module 404.
Specifically, the receiving module 401 is configured to receive a data access request, where the data access request includes a target URL address;
The extracting module 402 is configured to extract a root directory to be requested in the target URL address if it is determined that the target URL address is not the URL address corresponding to the API gateway;
The determining module 403 is configured to determine, based on the root directory, encoding information of a target API gateway corresponding to the target URL address from a routing table of the present API gateway;
the sending module 404 is configured to forward the data access request to the target API gateway according to the encoded information.
According to the gateway data processing device provided by the embodiment of the application, after the API gateway receives the data access request, when the target URL address carried in the data access request is determined not to be the URL corresponding to the API gateway, the root directory to be requested in the target URL address can be extracted, the coding information of the target API gateway corresponding to the target URL address is determined from the routing table of the API gateway based on the root directory, and the data access request is forwarded to the target API gateway according to the coding information, so that the cooperative linkage of different API gateways is realized under the condition that a user does not perceive, the interconnection and intercommunication capacity of different API gateways is improved, and the sharing efficiency of government service is improved. And the data access request can be automatically routed to the target API gateway without the need of a user to specify the coding information of the target API gateway in the data access request, so that the flexibility of the access of the API gateway is improved.
On the basis of the above embodiment, optionally, the determining module 403 is specifically configured to determine a first hash value of the root directory; and determining the coding information of the target API gateway corresponding to the target URL address from the routing table of the API gateway based on the first hash value.
On the basis of the above embodiment, optionally, the apparatus further includes: and the synchronization module and the processing module.
Specifically, the synchronization module is configured to synchronize, by using the metadata server, the second hash value of the root directory of each API gateway and the respective encoding information before the receiving module 401 receives the data access request;
And the processing module is used for associating the second hash value with the coding information of the corresponding API gateway to obtain the routing table.
Based on the above embodiment, optionally, the sending module 404 may include: a determining unit and a transmitting unit.
Specifically, the determining unit is configured to determine, when determining that the target URL address corresponds to a plurality of encoded information from the routing table of the API gateway, target encoded information from the plurality of encoded information;
And the sending unit is used for forwarding the data access request to a target API gateway corresponding to the target coding information.
On the basis of the above embodiment, optionally, the determining unit is specifically configured to determine the target coding information from the plurality of coding information according to a preset load balancing rule.
On the basis of the above embodiment, optionally, the above determining unit may include: an acquisition subunit and a first determination subunit.
Specifically, the obtaining subunit is configured to obtain second geographic information corresponding to each piece of coding information, so as to obtain a second geographic information set;
The first determining subunit is configured to determine, when parameter information of a parameter field specified in the target URL address is first matching rule information, first geographic information corresponding to an IP address of a requester carried in the data access request; and determining second geographic information matched with the first geographic information in the second geographic information set, and determining coding information corresponding to the matched second geographic information as target coding information.
On the basis of the above embodiment, optionally, the determining unit may further include: and a second determination subunit.
Specifically, the second determining subunit is configured to obtain third geographic information indicated by the second matching rule information if the parameter information of the parameter field specified in the target URL address is the second matching rule information; and determining second geographic information matched with the third geographic information in the second geographic information set, and determining coding information corresponding to the matched second geographic information as target coding information.
In one embodiment, an electronic device is provided, the internal structure of which may be as shown in FIG. 5. The electronic device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic device includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the electronic device is used for storing data involved in the gateway data processing process. The network interface of the electronic device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a gateway data processing method.
It will be appreciated by those skilled in the art that the structure shown in fig. 5 is merely a block diagram of a portion of the structure associated with the present inventive arrangements and is not limiting of the electronic device to which the present inventive arrangements are applied, and that a particular electronic device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, an electronic device is provided that includes a memory having a computer program stored therein and a processor that when executing the computer program performs the steps of:
receiving a data access request, wherein the data access request comprises a target URL address;
extracting a root directory to be requested in the target URL address under the condition that the target URL address is not the URL address corresponding to the API gateway;
determining the coding information of the target API gateway corresponding to the target URL address from a routing table of the API gateway based on the root directory;
and forwarding the data access request to the target API gateway according to the encoded information.
In one embodiment, the processor when executing the computer program further performs the steps of: determining a first hash value of the root directory; and determining the coding information of the target API gateway corresponding to the target URL address from the routing table of the API gateway based on the first hash value.
In one embodiment, the processor when executing the computer program further performs the steps of: the API gateways synchronize the second hash value of the root directory and the coding information of the root directory through the metadata server; and each API gateway associates the second hash value with the coding information of the corresponding API gateway to obtain the routing table.
In one embodiment, the processor when executing the computer program further performs the steps of: when the target URL address is determined to correspond to a plurality of pieces of coding information from the routing table of the API gateway, determining target coding information from the plurality of pieces of coding information; and forwarding the data access request to a target API gateway corresponding to the target coding information.
In one embodiment, the processor when executing the computer program further performs the steps of: and determining target coding information from the plurality of coding information according to a preset load balancing rule.
In one embodiment, the processor when executing the computer program further performs the steps of: respectively acquiring second geographic information corresponding to each piece of coding information to obtain a second geographic information set; if the parameter information of the parameter field specified in the target URL address is first matching rule information, determining first geographic information corresponding to the IP address of the requester carried in the data access request; and determining second geographic information matched with the first geographic information in the second geographic information set, and determining coding information corresponding to the matched second geographic information as target coding information.
In one embodiment, the processor when executing the computer program further performs the steps of: if the parameter information of the parameter field specified in the target URL address is second matching rule information, acquiring third geographic information indicated by the second matching rule information; and determining second geographic information matched with the third geographic information in the second geographic information set, and determining coding information corresponding to the matched second geographic information as target coding information.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a data access request, wherein the data access request comprises a target URL address;
extracting a root directory to be requested in the target URL address under the condition that the target URL address is not the URL address corresponding to the API gateway;
determining the coding information of the target API gateway corresponding to the target URL address from a routing table of the API gateway based on the root directory;
and forwarding the data access request to the target API gateway according to the encoded information.
The gateway data processing device, the device and the storage medium provided in the foregoing embodiments may execute the gateway data processing method provided in any embodiment of the present application, and have the corresponding functional modules and beneficial effects of executing the method. Technical details not described in detail in the above embodiments may be referred to the gateway data processing method provided in any embodiment of the present application.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (8)

1. A gateway data processing method, comprising:
synchronizing a second hash value and coding information of the root directory of each API gateway through a metadata server, and associating the second hash value with the coding information of the corresponding API gateway to obtain a routing table;
exchanging update information through the metadata server, and updating the routing table based on the update information; receiving a data access request, wherein the data access request comprises a target URL address;
extracting a root directory to be requested in the target URL address under the condition that the target URL address is not the URL address corresponding to the API gateway;
Determining a first hash value of the root directory;
Determining the coding information of the target API gateway corresponding to the target URL address from a routing table of the API gateway based on the first hash value;
And forwarding the data access request to the target API gateway according to the coding information of the target API gateway.
2. The method of claim 1, wherein forwarding the data access request to the target API gateway according to the encoded information of the target API gateway comprises:
When the target URL address is determined to correspond to a plurality of pieces of coding information from the routing table of the API gateway, determining target coding information from the plurality of pieces of coding information;
and forwarding the data access request to a target API gateway corresponding to the target coding information.
3. The method of claim 2, wherein said determining target encoded information from said plurality of encoded information comprises:
and determining target coding information from the plurality of coding information according to a preset load balancing rule.
4. The method of claim 2, wherein said determining target encoded information from said plurality of encoded information comprises:
Respectively acquiring second geographic information corresponding to each piece of coding information to obtain a second geographic information set;
If the parameter information of the parameter field specified in the target URL address is first matching rule information, determining first geographic information corresponding to the IP address of the requester carried in the data access request;
And determining second geographic information matched with the first geographic information in the second geographic information set, and determining coding information corresponding to the matched second geographic information as target coding information.
5. The method as recited in claim 4, further comprising:
If the parameter information of the parameter field specified in the target URL address is second matching rule information, acquiring third geographic information indicated by the second matching rule information;
and determining second geographic information matched with the third geographic information in the second geographic information set, and determining coding information corresponding to the matched second geographic information as target coding information.
6. A gateway data processing apparatus, comprising:
The construction module is used for synchronizing the second hash value and the coding information of the root directory of each API gateway through the metadata server, and associating the second hash value with the coding information of the corresponding API gateway to obtain a routing table; the updating information of each API gateway is interacted through the metadata server, and the routing table is updated based on the updating information;
The receiving module is used for receiving a data access request, wherein the data access request comprises a target URL address;
The extraction module is used for extracting a root directory to be requested in the target URL address under the condition that the target URL address is not the URL address corresponding to the API gateway;
A determining module, configured to determine a first hash value of the root directory; determining the coding information of the target API gateway corresponding to the target URL address from a routing table of the API gateway based on the first hash value; and the sending module is used for forwarding the data access request to the target API gateway according to the coding information of the target API gateway.
7. An electronic device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 when the computer program is executed.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 5.
CN202111625108.6A 2021-12-28 2021-12-28 Gateway data processing method, device, equipment and storage medium Active CN114338502B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111625108.6A CN114338502B (en) 2021-12-28 2021-12-28 Gateway data processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111625108.6A CN114338502B (en) 2021-12-28 2021-12-28 Gateway data processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114338502A CN114338502A (en) 2022-04-12
CN114338502B true CN114338502B (en) 2024-07-05

Family

ID=81015126

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111625108.6A Active CN114338502B (en) 2021-12-28 2021-12-28 Gateway data processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114338502B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115623009B (en) * 2022-12-19 2023-03-28 南京赛宁信息技术有限公司 Active defense gateway visitor data backup and node online capacity expansion method and system

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113438317A (en) * 2021-07-08 2021-09-24 数字广东网络建设有限公司 Gateway data processing method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9935816B1 (en) * 2015-06-16 2018-04-03 Amazon Technologies, Inc. Border gateway protocol routing configuration
CN111092811B (en) * 2018-10-24 2021-11-26 北京金山云网络技术有限公司 Request processing method and device, API gateway and readable storage medium
US11544120B2 (en) * 2020-01-31 2023-01-03 EMC IP Holding Company LLC Tracking application programming interface requests in a cloud computing system
CN113709048A (en) * 2020-05-21 2021-11-26 中国移动通信有限公司研究院 Routing information sending and receiving method, network element and node equipment

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113438317A (en) * 2021-07-08 2021-09-24 数字广东网络建设有限公司 Gateway data processing method and device

Also Published As

Publication number Publication date
CN114338502A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
CN110727499B (en) Method, device, computer equipment and storage medium for acquiring resource data
CN108011929B (en) Data request processing method and device, computer equipment and storage medium
CN108093094B (en) Database instance access method, device, system, storage medium and equipment
CN107508795B (en) Cross-container cluster access processing device and method
CN110213392B (en) Data distribution method and device, computer equipment and storage medium
CN110413845B (en) Resource storage method and device based on Internet of things operating system
CN110765484A (en) Credit investigation data processing method and electronic equipment
US20160241635A1 (en) M2m data querying and invoking methods, querying and invoking devices, and system
CN105512279A (en) Metadata access method, related equipment and system
CN114338502B (en) Gateway data processing method, device, equipment and storage medium
CN111177776A (en) Multi-tenant data isolation method and system
CN107704475B (en) Multilayer distributed unstructured data storage method, query method and device
CN113407560B (en) Update message processing method, data synchronization method and configuration information configuration method
CN109445988B (en) Heterogeneous disaster recovery method, device, system, server and disaster recovery platform
CN109413224B (en) Message forwarding method and device
CN108389124B (en) Data processing method, data processing device, computer equipment and storage medium
CN113610529A (en) Block storage and acquisition method, device, node and storage medium of alliance chain
CN113037885B (en) View matching method, DNS server and computer readable storage medium
CN115004657B (en) Addressing method, addressing system and addressing device
CN110730106B (en) Electronic official document exchange method and device based on tree structure and computer equipment
CN111614750B (en) Data updating method, system, equipment and storage medium
CN110868450B (en) Dual-computer room multi-entrance session keeping method, system, device and storage medium
CN113220759A (en) Big data storage service sharing method and device, computer equipment and storage medium
CN111666290A (en) Data replacement method, device, computer equipment and medium based on artificial intelligence
CN113793148B (en) Block synchronization method, device, node and storage medium of alliance chain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant