CN108965007B - API gateway interface configuration updating method and device - Google Patents
API gateway interface configuration updating method and device Download PDFInfo
- Publication number
- CN108965007B CN108965007B CN201810796256.6A CN201810796256A CN108965007B CN 108965007 B CN108965007 B CN 108965007B CN 201810796256 A CN201810796256 A CN 201810796256A CN 108965007 B CN108965007 B CN 108965007B
- Authority
- CN
- China
- Prior art keywords
- equipment
- api
- center
- distributed
- configuration
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 33
- 238000012544 monitoring process Methods 0.000 claims description 27
- 238000004590 computer program Methods 0.000 claims description 11
- 238000012423 maintenance Methods 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 5
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 229910003460 diamond Inorganic materials 0.000 description 1
- 239000010432 diamond Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0813—Configuration setting characterised by the conditions triggering a change of settings
- H04L41/0816—Configuration setting characterised by the conditions triggering a change of settings the condition being an adaptation, e.g. in response to network events
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4416—Network booting; Remote initial program loading [RIPL]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/66—Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a method and a device for updating API gateway interface configuration, which comprises the following steps: writing configuration information of the API interface into a distributed configuration center; when the API gateway is started, acquiring configuration information of each API interface included by the API gateway from the distributed configuration center; when the configuration information of the API interface written in the distributed configuration center is updated, the corresponding API interface acquires the updated configuration information from the distributed configuration center. Therefore, the configuration information of the API interface is written into the distributed configuration center, so that the hot update of the configuration information of the API interface can be realized, the maintenance difficulty of the API gateway is reduced, and the stability is improved.
Description
Technical Field
The invention relates to the technical field of information, in particular to a method and a device for updating configuration of an API gateway interface.
Background
Currently, many enterprises use an API Gateway (Application Programming Interface Gateway, abbreviated as API Gateway or API-Gateway) as the only portal for external access to enterprise internal API services.
For existing API gateways, routing information is typically configured into a project's configuration file, which requires restarting the API gateway after each modification if the interface configuration needs to be modified.
The existing API gateway interface configuration has a problem of being difficult to maintain.
Disclosure of Invention
In a first aspect, an embodiment of the present disclosure provides an interface configuration updating method for an API gateway, including:
writing configuration information of the API interface into a distributed configuration center;
when the API gateway is started, acquiring configuration information of each API interface included by the API gateway from the distributed configuration center;
when the configuration information of the API interface written in the distributed configuration center is updated, the corresponding API interface acquires the updated configuration information from the distributed configuration center.
In some embodiments, after writing the configuration information of the API interface into the distributed configuration center, the method further includes:
and establishing long connection between the API gateway and the distributed configuration center, and registering a monitoring event for monitoring the configuration information updating state of the API interface in a registration center of the distributed configuration center.
In some embodiments, when the configuration information of the API interface written in the distributed configuration center is updated, the obtaining, by the corresponding API interface, the updated configuration information from the distributed configuration center includes:
when the configuration information of the API written in the distributed configuration center is updated, sending update information to the corresponding API according to the monitoring event;
and the API interface which receives the updating information acquires the updated configuration information from the distributed configuration center according to the updating information.
In some embodiments, further comprising:
registering equipment where service items corresponding to all API interfaces are located in a registry of a distributed configuration center;
reading a device list of registered devices from the registry according to the service items;
when an access request of a client for accessing a target service item is received, selecting target equipment from the equipment list of the registered equipment according to the target service item;
accessing the target equipment according to the access request of the client, and receiving an access result returned by the target equipment;
and sending the returned access result of the target equipment to the client.
In some embodiments, the selecting a target device from the device list of registered devices according to the target service item includes:
when the equipment with the load smaller than the preset load value exists in the equipment list of the registered equipment, randomly selecting one equipment from the equipment with the load smaller than the preset load value as the target equipment;
and when no equipment with the load smaller than a preset load value exists in the equipment list of the registered equipment, selecting the equipment with the minimum load in the equipment list as the target equipment.
In a second aspect, an embodiment of the present disclosure provides an interface configuration updating apparatus for an API gateway, including:
the writing module is used for writing the configuration information of the API interface into the distributed configuration center;
the acquisition module is used for acquiring configuration information of each API interface included by the API gateway from the distributed configuration center when the API gateway is started;
and the updating module is used for acquiring the updated configuration information from the distributed configuration center by the corresponding API interface when the configuration information of the API interface written in the distributed configuration center is updated.
In some embodiments, further comprising:
and the monitoring module is used for establishing long connection between the API gateway and the distributed configuration center and registering a monitoring event for monitoring the updating state of the configuration information of the API interface in a registration center of the distributed configuration center.
In some embodiments, the update module comprises:
the sending submodule is used for sending update information to the corresponding API interface according to the monitoring event when the configuration information of the API interface written in the distributed configuration center is updated;
and the updating submodule is used for acquiring the updated configuration information from the distributed configuration center according to the updating information by the API interface which receives the updating information.
In some embodiments, further comprising:
the registration module is used for registering equipment where service items corresponding to the API interfaces are located in a registration center of the distributed configuration center;
the reading module is used for reading the equipment list of the registered equipment from the registration center by the API gateway according to the service item;
the selection module is used for selecting target equipment from the equipment list of the registered equipment according to the target service item when receiving an access request of a client for accessing the target service item;
the access module is used for accessing the target equipment according to the access request of the client and receiving an access result returned by the target equipment;
and the sending module is used for sending the returned access result of the target equipment to the client.
In some embodiments, the selection module comprises:
a first selection submodule, configured to randomly select, when there is a device whose load is smaller than a preset load value in the device list of the registered device, one device from the devices whose load is smaller than the preset load value as the target device;
and the second selection submodule is used for selecting the equipment with the minimum load in the equipment list as the target equipment when the equipment with the load smaller than the preset load value does not exist in the equipment list of the registered equipment.
In a third aspect, an embodiment of the present disclosure provides a server, including a processor, a memory, and a computer program stored on the memory and executable on the processor, where the computer program, when executed by the processor, implements the steps of the API gateway interface configuration updating method according to any one of the above items.
In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the API gateway interface configuration updating method according to any one of the above.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a flowchart of an API gateway interface configuration updating method in an embodiment of the present disclosure;
FIG. 2 is a flowchart of another API gateway configuration update apparatus according to an embodiment of the present disclosure;
FIG. 3 is a block diagram of an API gateway configuration update apparatus according to an embodiment of the present disclosure;
FIG. 4 is a block diagram of another API gateway configuration update apparatus in an embodiment of the present disclosure;
FIG. 5 is a block diagram of another API gateway configuration update apparatus according to an embodiment of the present disclosure;
FIG. 6 is a block diagram of another API gateway configuration update apparatus in an embodiment of the present disclosure;
fig. 7 is a block diagram of another API gateway interface configuration update apparatus according to an embodiment of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the disclosure provides an API gateway interface configuration updating method.
As shown in fig. 1, in a specific embodiment, the API gateway interface configuration updating method includes the steps of:
step 101: and writing the configuration information of the API interface into the distributed configuration center.
In the embodiment of the disclosure, the relevant API configuration information is configured in the management background, and then the configured API configuration information is written into the distributed configuration center. The distributed configuration center may be a zookeeper configuration center, a mysql configuration center, a git configuration center, an eureka configuration center, or other various distributed configuration centers, and a specific type of the configuration center is not further limited in this embodiment.
The configuration information of the API interface may include parameters related to API configuration, such as service item (service ID), path (path) of the service item, and traffic limitation.
Generally, an enterprise provides a plurality of network-based services to the outside, the services are implemented by using devices such as different servers inside the enterprise, external access to the services is implemented by an API gateway of the enterprise, the API gateway includes a plurality of API interfaces, each API interface is connected to a different server to provide a corresponding service, and accordingly, when managing the API interfaces in the API gateway, configuration information of each API interface needs to be configured.
In the embodiment of the disclosure, the configuration information of each API interface is written into the distributed configuration center.
Step 102: and when the API gateway is started, acquiring configuration information of each API interface included by the API gateway from the distributed configuration center.
When the API gateway is started, reading the configuration information of each configured API interface from the distributed configuration center, wherein the distributed configuration center is used for managing the configuration information of all the API interfaces, and after the configured API information is read, the configuration of all the API interfaces is completed.
Step 103: when the configuration information of the API interface written in the distributed configuration center is updated, the corresponding API interface acquires the updated configuration information from the distributed configuration center.
When the configuration information of a certain API interface needs to be changed, the corresponding configuration information is modified in the distributed configuration center, and then the corresponding API interface can read the updated configuration information from the distributed configuration center, so that the hot update of the API interface can be realized.
Therefore, in the embodiment of the disclosure, by writing the API configuration information into the distributed configuration center, the distributed configuration center can implement the function of distributed management on each parameter, and when the configuration information of the API interface is updated, the online hot update of the configuration information is implemented, thereby avoiding restarting the API gateway in the updating process, reducing the maintenance difficulty of the API gateway, and improving the stability.
Fig. 2 is a flowchart of an API gateway interface configuration updating method according to another disclosed embodiment of the present invention. The main difference between this embodiment and the embodiment shown in fig. 1 is that the corresponding snoop event is also registered in the distributed configuration center.
Step 201: and writing the configuration information of the API interface into the distributed configuration center.
In the embodiment of the disclosure, the configuration information of the preset API interface is written into the distributed configuration center.
Step 202: and establishing long connection between the API gateway and the distributed configuration center, and registering a monitoring event for monitoring the configuration information updating state of the API interface in a registration center of the distributed configuration center.
This step 202 may be performed before step 203, or may be performed before step 203. The purpose of this step 202 is to update the configuration information of the API interface written in the distributed configuration center in time when the configuration information of the API interface is updated.
For different distributed configuration centers, corresponding registration centers also have certain differences, for example, for a zookeeper configuration center, a disconf registration center or a zookeeper registration center may be used, and for a mysql configuration center, a diamond registration center may be used.
After the corresponding monitoring event is registered, the dynamic monitoring of the configuration information of the PI interface stored in the distributed configuration center can be realized, and the configuration information of the corresponding API interface can be updated in time when the configuration information of the PI interface stored in the distributed configuration center is updated.
Step 203: and when the API gateway is started, acquiring configuration information of each API interface included by the API gateway from the distributed configuration center.
When the API gateway is started, the configuration information of each API interface is read from the distributed configuration center, and the configuration of the API interfaces is completed.
Step 204: when the configuration information of the API interface written in the distributed configuration center is updated, the corresponding API interface acquires the updated configuration information from the distributed configuration center.
When a corresponding listening event is registered in the registry, this step 204 may further include:
when the configuration information of the API written in the distributed configuration center is updated, sending update information to the corresponding API according to the monitoring event;
and the API interface which receives the updating information acquires the updated configuration information from the distributed configuration center according to the updating information.
In this embodiment, when the configuration information of the API interface written in the distributed configuration center is updated, according to a listening event that each API interface registers in the registration center of the distributed configuration center, the corresponding API interface can be determined, and the update information is sent to the corresponding API interface to notify that the configuration information of the corresponding API interface is updated.
Therefore, the configuration information is updated according to the monitoring event, and the data of the API can be updated in time.
Further, the updated configuration information is read from the distributed configuration center according to the update information, and the update of the configuration information of the API interface is completed.
In the embodiment of the disclosure, by establishing a long connection between the API gateway and the distributed configuration center and registering a monitoring event for monitoring the update state of the configuration information of the API interface in the registry of the distributed configuration center, monitoring of the configuration information of the API interface in the distributed configuration center is realized, and data of the API interface can be updated in time when the configuration information of the API interface in the distributed configuration center is updated.
Further, in the above two embodiments, the method may further include the steps of:
and registering equipment where the service items corresponding to the API interfaces are located in a registry of the distributed configuration center.
In the embodiment of the disclosure, first, a device where each service item is located is registered in a registry of a distributed configuration center, where the registry is mainly used for managing name services of each service address, and real-time refreshing is performed through long connection to ensure timeliness of data transmission. For order service, for example, its address is defined as order and registered in the registry.
Here, the device where the service item is located refers to a device storing relevant data, and generally refers to a server or a database, and here, it is described that two servers are provided to provide order services as an example.
It should be understood that, since the carrying capacity of a single server is limited, in practical use, the server used is usually a plurality of servers sharing data, so as to meet the external access requirement.
Each server may be registered in the registry by its own server number, or may be registered in the registry by information such as mac address and ip address. Here, the server is registered with an ip address as an example.
For example, if the ip addresses of the two servers are 192.168.0.1 and 192.168.0.2, respectively, the two ip addresses are registered in the registration center.
And the API gateway reads the equipment list of the registered equipment from the registration center according to the service item.
Since the entries of the external access requests are all API gateways, in this embodiment, the API gateway further reads the device list of the registered device.
In order to enable external users to access relevant data, the API gateway reads a device list of registered devices, i.e. ip addresses of registered servers, from the registry. The API gateway stores the read ip address in its internal memory, and preferably caches the read machine list in the memory in order to increase the access speed.
And when an access request of a client for accessing a target service item is received, selecting target equipment from the equipment list of the registered equipment according to the target service item.
When the API gateway receives an access request from a client, for example, the client accesses an order service, the access request from the client firstly accesses the API gateway and submits an address corresponding to the order service, for example, https:// API. Wherein https:// api. xxx.com/corresponds to the address of the enterprise gateway, and order/123424 is the path of the service item, i.e., the path of the order service. The API gateway can determine the service requested to be accessed by the client side as order service according to the address submitted by the client side.
After obtaining the path of the order service, the API gateway matches the corresponding API interface according to the path, and the path of the service item is registered and maintained by the registration center, so that the corresponding API interface can be matched according to the accessed item. For example, the corresponding API interface/order/, is matched according to the service path order/123424.
After determining the corresponding API interface, a device corresponding to the API interface may be further selected from the device list of the registered devices as a target device for acquiring the data requested by the client.
And accessing the target equipment according to the access request of the client, and receiving an access result returned by the target equipment.
The related data of the order service is stored in the corresponding server, and if the number of the servers corresponding to the order service is two in the embodiment of the disclosure, one of the two servers can be selected, the data requested to be obtained in the request of the client is read, and the related data in the server is returned to the API gateway
And sending the returned access result of the target equipment to the client.
The API gateway further returns data to the client to satisfy the user's access request.
Further, the selecting a target device from the device list of the registered devices according to the target service item includes:
when the registered equipment list has equipment with the load smaller than a preset load value, randomly selecting one equipment from the equipment with the load smaller than the preset load value as the target equipment;
and when no equipment with the load smaller than a preset load value exists in the registered equipment list, selecting the equipment with the minimum load in the equipment list as the target equipment.
Since the carrying capacity of a single server is limited, a plurality of servers are required to meet the access requirements of users.
Meanwhile, in order to guarantee the access speed, it should be ensured that the load of the server is not higher than a certain value. The preset load value in this embodiment may be set according to actual conditions, for example, set to various values such as 80%, 85&, 90% of the maximum load of the server.
And when the server with the load smaller than the preset load value exists, selecting any one server from the servers with the complexity smaller than the preset load value as the target equipment, and accessing the related data in the server.
And when no equipment with the load smaller than the preset load value exists, taking the server with the minimum load as the target equipment, and accessing the related data in the server.
In addition, the burden of other servers can be shared by adding additional servers.
Thus, the optimal access speed can be ensured by balancing the load of each server, and the user experience is improved.
An embodiment of the present disclosure provides an API gateway interface configuration updating apparatus 300, as shown in fig. 3, where the API gateway interface configuration updating apparatus 300 includes:
a writing module 301, configured to write configuration information of the API interface into the distributed configuration center;
an obtaining module 302, configured to obtain, from the distributed configuration center, configuration information of each API interface included in an API gateway when the API gateway is started;
an updating module 303, configured to, when the configuration information of the API interface written in the distributed configuration center is updated, obtain, by the corresponding API interface, the updated configuration information from the distributed configuration center.
Optionally, as shown in fig. 4, the method further includes:
a monitoring module 304, configured to establish a long connection between the API gateway and the distributed configuration center, and register a monitoring event for monitoring the configuration information update state of the API interface in a registry of the distributed configuration center.
Optionally, as shown in fig. 5, the updating module 303 includes:
a sending submodule 3031, configured to send, when configuration information of an API interface written in the distributed configuration center is updated, update information to a corresponding API interface according to the monitoring event;
and the update submodule 3032 is configured to obtain, by the API interface that receives the update information, updated configuration information from the distributed configuration center according to the update information.
Optionally, as shown in fig. 6, the method further includes:
a registration module 305, configured to register, in a registry of the distributed configuration center, a device in which a service item corresponding to each API interface is located;
a reading module 306, configured to read, by the API gateway, a device list of registered devices from the registry according to the service item;
a selecting module 307, configured to select a target device from the device list of the registered device according to a target service item when receiving an access request for accessing the target service item by a client;
the access module 308 is configured to access the target device according to the access request of the client, and receive an access result returned by the target device;
a sending module 309, configured to send the returned access result of the target device to the client.
Optionally, as shown in fig. 7, the selecting module 307 includes:
a first selecting submodule 3071, configured to randomly select, when there are devices whose loads are smaller than a preset load value in the device list of the registered device, one device from the devices whose loads are smaller than the preset load value as the target device;
the second selecting submodule 3072 is configured to, when there is no device with a load smaller than a preset load value in the device list of the registered device, select a device with a minimum load in the device list as the target device.
The API gateway interface configuration updating apparatus 300 provided in the embodiment of the present invention can implement each process in the method embodiment of fig. 1, and details are not described here.
Preferably, an embodiment of the present invention further provides a mobile client, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements each process of the API gateway interface configuration update method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not described here again.
The embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the API gateway interface configuration update method embodiment, and can achieve the same technical effect, and in order to avoid repetition, the detailed description is omitted here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. An interface configuration updating method for an API gateway is characterized by comprising the following steps:
writing configuration information of the API interface into a distributed configuration center;
establishing long connection between the API gateway and the distributed configuration center, and registering a monitoring event for monitoring the configuration information updating state of the API interface in a registration center of the distributed configuration center;
when the API gateway is started, acquiring configuration information of each API interface included by the API gateway from the distributed configuration center, wherein the distributed configuration center can realize distributed management on each parameter;
when the configuration information of the API interface written in the distributed configuration center is updated, the corresponding API interface acquires the updated configuration information from the distributed configuration center.
2. The method of claim 1, wherein when the configuration information of the API interface written in the distributed configuration center is updated, the corresponding API interface obtains the updated configuration information from the distributed configuration center, including:
when the configuration information of the API written in the distributed configuration center is updated, sending update information to the corresponding API according to the monitoring event;
and the API interface which receives the updating information acquires the updated configuration information from the distributed configuration center according to the updating information.
3. The method of any one of claim 1 to claim 2, further comprising:
registering equipment where service items corresponding to all API interfaces are located in a registry of a distributed configuration center;
the API gateway reads the equipment list of the registered equipment from the registration center according to the service item;
when an access request of a client for accessing a target service item is received, selecting target equipment from the equipment list of the registered equipment according to the target service item;
accessing the target equipment according to the access request of the client, and receiving an access result returned by the target equipment;
and sending the returned access result of the target equipment to the client.
4. The method of claim 3, wherein the selecting a target device from the device list of registered devices based on the target service item comprises:
when the equipment with the load smaller than the preset load value exists in the equipment list of the registered equipment, randomly selecting one equipment from the equipment with the load smaller than the preset load value as the target equipment;
and when no equipment with the load smaller than a preset load value exists in the equipment list of the registered equipment, selecting the equipment with the minimum load in the equipment list as the target equipment.
5. An interface configuration updating apparatus of an API gateway, comprising:
the writing module is used for writing the configuration information of the API interface into the distributed configuration center;
the monitoring module is used for establishing long connection between the API gateway and the distributed configuration center and registering a monitoring event for monitoring the configuration information updating state of the API interface in a registration center of the distributed configuration center;
the acquisition module is used for acquiring configuration information of each API interface included by the API gateway from the distributed configuration center when the API gateway is started, wherein the distributed configuration center can realize distributed management on each parameter;
and the updating module is used for acquiring the updated configuration information from the distributed configuration center by the corresponding API interface when the configuration information of the API interface written in the distributed configuration center is updated.
6. The apparatus of claim 5, wherein the update module comprises:
the sending submodule is used for sending update information to the corresponding API interface according to the monitoring event when the configuration information of the API interface written in the distributed configuration center is updated;
and the updating submodule is used for acquiring the updated configuration information from the distributed configuration center according to the updating information by the API interface which receives the updating information.
7. The apparatus of any one of claims 5 to 6, further comprising:
the registration module is used for registering equipment where service items corresponding to the API interfaces are located in a registration center of the distributed configuration center;
the reading module is used for reading the equipment list of the registered equipment from the registration center by the API gateway according to the service item;
the selection module is used for selecting target equipment from the equipment list of the registered equipment according to the target service item when receiving an access request of a client for accessing the target service item;
the access module is used for accessing the target equipment according to the access request of the client and receiving an access result returned by the target equipment;
and the sending module is used for sending the returned access result of the target equipment to the client.
8. The apparatus of claim 7, wherein the selection module comprises:
a first selection submodule, configured to randomly select, when there is a device whose load is smaller than a preset load value in the device list of the registered device, one device from the devices whose load is smaller than the preset load value as the target device;
and the second selection submodule is used for selecting the equipment with the minimum load in the equipment list as the target equipment when the equipment with the load smaller than the preset load value does not exist in the equipment list of the registered equipment.
9. A server, comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the API gateway interface configuration update method of any one of claims 1 to 4.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the API gateway interface configuration updating method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810796256.6A CN108965007B (en) | 2018-07-19 | 2018-07-19 | API gateway interface configuration updating method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810796256.6A CN108965007B (en) | 2018-07-19 | 2018-07-19 | API gateway interface configuration updating method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108965007A CN108965007A (en) | 2018-12-07 |
CN108965007B true CN108965007B (en) | 2021-08-27 |
Family
ID=64495540
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810796256.6A Active CN108965007B (en) | 2018-07-19 | 2018-07-19 | API gateway interface configuration updating method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108965007B (en) |
Families Citing this family (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109710223B (en) * | 2018-12-29 | 2021-03-12 | 北京邮电大学 | API gateway hot plug system based on distributed KV storage system |
CN109981757B (en) * | 2019-03-13 | 2022-07-08 | 青岛特来电新能源科技有限公司 | API gateway load balancing method for small-scale micro-service architecture |
CN110113394A (en) * | 2019-04-19 | 2019-08-09 | 浙江数链科技有限公司 | API Calls method and apparatus |
CN110365809B (en) * | 2019-07-23 | 2021-12-14 | 中南民族大学 | Distributed server address configuration system and method |
CN110493067B (en) * | 2019-09-05 | 2022-02-18 | 中国银联股份有限公司 | Method and device for updating API gateway service |
CN110784360A (en) * | 2019-11-01 | 2020-02-11 | 浪潮云信息技术有限公司 | Method and system for realizing Kong declarative configuration hot update |
CN111092774A (en) * | 2019-12-25 | 2020-05-01 | 中国联合网络通信集团有限公司 | Configuration method and equipment of acquisition gateway |
CN110995873A (en) * | 2019-12-27 | 2020-04-10 | 美的集团股份有限公司 | Gateway service interface discovery method, system, electronic device and storage medium |
CN111049695A (en) * | 2020-01-09 | 2020-04-21 | 深圳壹账通智能科技有限公司 | Cloud gateway configuration method and system |
CN113381866A (en) * | 2020-02-25 | 2021-09-10 | 北京同邦卓益科技有限公司 | Service calling method, device, equipment and storage medium based on gateway |
CN112636986A (en) * | 2020-12-29 | 2021-04-09 | 苏州思必驰信息科技有限公司 | Gateway plug-in updating method and device |
CN113076361A (en) * | 2021-03-17 | 2021-07-06 | 国家气象信息中心(中国气象局气象数据中心) | Method for realizing massive meteorological data unified service interface based on big data |
CN113315710A (en) * | 2021-05-29 | 2021-08-27 | 东方电子股份有限公司 | Middle station API gateway management configuration and extension method based on asynchronous dynamic routing |
CN114422358B (en) * | 2022-01-26 | 2024-01-30 | 中国农业银行股份有限公司 | API gateway configuration updating method and equipment |
CN114666216B (en) * | 2022-03-17 | 2024-06-11 | 北京思特奇信息技术股份有限公司 | Management method and management system of API gateway |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104065517A (en) * | 2014-07-07 | 2014-09-24 | 用友软件股份有限公司 | Distributed-system software configuration management method and system |
CN105827446A (en) * | 2016-03-31 | 2016-08-03 | 深圳市金溢科技股份有限公司 | Intelligent traffic API gateway and intelligent traffic service system |
CN107885541A (en) * | 2016-09-30 | 2018-04-06 | 北京京东尚科信息技术有限公司 | The method and device of processing system configuration |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101640867B (en) * | 2009-08-18 | 2012-07-25 | 中兴通讯股份有限公司 | Method and system for updating equipment configuration information of message-type application gateway |
CN103186401B (en) * | 2011-12-31 | 2016-04-20 | 北京新媒传信科技有限公司 | A kind of software systems and config update method thereof |
US20160092297A1 (en) * | 2014-09-29 | 2016-03-31 | Digital River, Inc. | API Gateway System and Method |
CN105677404B (en) * | 2015-12-31 | 2019-03-19 | 拉扎斯网络科技(上海)有限公司 | A kind of configuration update method and device based on Zookeeper |
CN108076125A (en) * | 2016-11-11 | 2018-05-25 | 北京京东尚科信息技术有限公司 | Interface allocation method and system |
CN107360018A (en) * | 2017-06-05 | 2017-11-17 | 小草数语(北京)科技有限公司 | Config update method and device |
-
2018
- 2018-07-19 CN CN201810796256.6A patent/CN108965007B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104065517A (en) * | 2014-07-07 | 2014-09-24 | 用友软件股份有限公司 | Distributed-system software configuration management method and system |
CN105827446A (en) * | 2016-03-31 | 2016-08-03 | 深圳市金溢科技股份有限公司 | Intelligent traffic API gateway and intelligent traffic service system |
CN107885541A (en) * | 2016-09-30 | 2018-04-06 | 北京京东尚科信息技术有限公司 | The method and device of processing system configuration |
Non-Patent Citations (1)
Title |
---|
分布式配置中心;https://www.cnblogs.com/zhangjianbin/p/6262504.html;《博客园》;20170108;正文第1-5页 * |
Also Published As
Publication number | Publication date |
---|---|
CN108965007A (en) | 2018-12-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108965007B (en) | API gateway interface configuration updating method and device | |
TWI745473B (en) | Network verification method and device | |
WO2017114206A1 (en) | Method and device for processing short link, and short link server | |
US10057208B2 (en) | Visibility control for domain name system service discovery | |
CN109885786B (en) | Data caching processing method and device, electronic equipment and readable storage medium | |
CN109547286B (en) | CDN node selection method, device and storage medium | |
CN109586969A (en) | Content distributing network disaster recovery method, device, computer equipment and storage medium | |
CN109408751A (en) | A kind of data processing method, terminal, server and storage medium | |
CN109873839B (en) | Data access method, server and distributed system | |
US20210105251A1 (en) | Ip address access based on security level and access history | |
CN110968356B (en) | Method and device for acquiring configuration information | |
US20170171147A1 (en) | Method and electronic device for implementing domain name system | |
CN106101055A (en) | The data access method of a kind of multiple database and system thereof and proxy server | |
CN111556135A (en) | Request scheduling method, system and device and electronic equipment | |
CN109981569A (en) | Network system access method, device, computer equipment and readable storage medium storing program for executing | |
CN106708636A (en) | Cluster-based data caching method and apparatus | |
CN114221959A (en) | Service sharing method, device and system | |
CN104144170A (en) | URL filtering method, device and system | |
CN108112268A (en) | Management and the relevant load balancer of automatic expanded set | |
CN109379426A (en) | X-CDN dispatching method, equipment and system based on X-DNS | |
US10623528B2 (en) | Enterprise application ecosystem operating system | |
CN111767481A (en) | Access processing method, device, equipment and storage medium | |
CN114765630B (en) | Data access method of multi-tenant platform, multi-tenant platform and server | |
CN112040023B (en) | Object access method and device, electronic equipment and machine-readable storage medium | |
CN115004657B (en) | Addressing method, addressing system and addressing device |
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 | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20211129 Address after: Room 103, building 1, yard 4, Hengxing Road, Gaoliying Town, Shunyi District, Beijing Patentee after: Beijing Rockwell Technology Co.,Ltd. Address before: Room 801, 8 / F, building 3, No.10 courtyard, Wangjing street, Chaoyang District, Beijing 100102 Patentee before: BEIJING CHJ AUTOMOTIVE TECHNOLOGY Co.,Ltd. |
|
TR01 | Transfer of patent right |