CN115277386A - Registration center management method based on APISIX - Google Patents

Registration center management method based on APISIX Download PDF

Info

Publication number
CN115277386A
CN115277386A CN202210765979.6A CN202210765979A CN115277386A CN 115277386 A CN115277386 A CN 115277386A CN 202210765979 A CN202210765979 A CN 202210765979A CN 115277386 A CN115277386 A CN 115277386A
Authority
CN
China
Prior art keywords
apisix
registration center
registry
registration
access request
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.)
Pending
Application number
CN202210765979.6A
Other languages
Chinese (zh)
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.)
Unihub China Information Technology Co Ltd
Original Assignee
Unihub China Information Technology 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 Unihub China Information Technology Co Ltd filed Critical Unihub China Information Technology Co Ltd
Priority to CN202210765979.6A priority Critical patent/CN115277386A/en
Publication of CN115277386A publication Critical patent/CN115277386A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0876Aspects of the degree of configuration automation
    • H04L41/0886Fully automatic configuration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0893Assignment of logical groups to network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/742Route cache; Operation thereof

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Automation & Control Theory (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a registration center management method based on APISIX, which comprises the following steps: an API interface for managing a registration center is newly added in the APISIX; adding a monitoring event in a routing module of the APISIX; adding a plurality of registry configurations through an API interface; configuring a newly-added route on the APISIX, and selecting a corresponding registration center; the routing module caches the new information of the registration center; and when the APISIX receives an access request of the client, the APISIX acquires back-end service information from the corresponding registration center according to the cache data of the routing module. The method can support the configuration of multiple registration centers, and different routes can be associated with different registration centers; the registration center is managed through the API interface, manual modification of configuration files is not needed, and the probability of human configuration errors is reduced; meanwhile, the hot update of the APISIX registration center is realized, and the stability is improved.

Description

Registration center management method based on APISIX
Technical Field
The invention relates to the field of APISIX, in particular to a registration center management method based on APISIX.
Background
The APISIX is a cloud-native, high-performance and scalable micro-service API open-source gateway that provides rich traffic management functions such as load balancing, dynamic upstream services, gold sparrow release, disconnection, authentication, observability, and the like. APISIX may be used to handle traditional north-south traffic, as well as east-west traffic between services. Meanwhile, the APISIX supports various types of registries, including DNS (Domain Name System), consul, nacos, and Eureka (three load balancing tools), and each type of registry can be configured with a registry cluster.
The current management process of the registration center of the APISIX is to write the configuration information of the registration center in a configuration file, and the APISIX is started to automatically load the configuration information. When the administrator sets the upstream service of the route, the type of the registry can be selected, and the route goes to the registry to obtain the back-end service.
The current APISIX registry management scheme has three problems: 1. when the address of the registration center is changed, the APISIX service needs to be restarted, and hot updating cannot be realized; 2. the information of the registration center is written in the configuration file, and needs to be manually modified, so that errors are easy to occur; 3. only one APISIX can be configured in the same registry, and if a plurality of registries exist, a plurality of sets of APISIX are required to be deployed.
Disclosure of Invention
In order to overcome the problems of the conventional APISIX (application program interface identification) registry management scheme, the invention provides an APISIX-based registry management method.
In order to realize the purpose, the invention adopts the following technical scheme:
in an embodiment of the present invention, an APISIX-based registry management method is provided, including:
an API interface managed by a registration center is newly added in the APISIX and is used for adding a plurality of registration center configurations, and different registration centers can be selected by different routes;
adding a monitoring event in a routing module of the APISIX, wherein the monitoring event is used for monitoring a change event of a registration center;
when the information of the registration center is changed, the routing module monitors the change event of the registration center and updates the new information of the registration center into a cache;
and when receiving an access request of the client, the APISIX accesses the corresponding registration center to acquire the back-end service information according to the cache data of the routing module.
Further, multiple registries may be added for each type of registry.
Further, when new routes are configured on the apifix, each route may select one registry, and one registry may be selected by multiple routes.
Further, when the APISIX receives an access request from a client, according to the cache data of the routing module, the corresponding registration center obtains the back-end service information, which includes:
when the APISIX receives an access request of a client and matches the access request with a route, the route module forwards the access request to a back-end service of a registration center to acquire back-end service information;
if the information of the registration center is modified, the routing module monitors the change event of the registration center and automatically updates the modified information of the registration center into a cache;
and when the APISIX receives an access request of a new client, automatically forwarding the access request to the back-end service of the new registration center to acquire back-end service information.
Further, the API interfaces comprise five interfaces of adding, modifying, inquiring, deleting and batch inquiring of the registration center.
Further, the data structure of the registry contains the following fields: a primary key, a registry type, a registry address, a registry name, an account name, a password, a description, and a creation time.
In an embodiment of the present invention, a computer device is further provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the computer program implements the method for managing the registry based on APISIX.
In an embodiment of the present invention, a computer-readable storage medium is further proposed, in which a computer program for executing the APISIX-based registry management method is stored.
Has the beneficial effects that:
1. the invention supports the configuration of multiple registration centers, and different routes can be associated with different registration centers.
2. The invention manages the registration center through the API interface, does not need to modify the configuration file manually, and reduces the probability of errors caused by manual configuration.
3. The invention realizes the hot update of the APISIX registration center and improves the stability.
Drawings
FIG. 1 is a flow chart diagram of the APISIX-based registry management method of the present invention;
fig. 2 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The principles and spirit of the present invention will be described below with reference to several exemplary embodiments, it being understood that these embodiments are presented only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to the embodiment of the invention, a registration center management method based on APISIX is provided, which comprises the following steps: (1) adding an API (application program interface) managed by a registration center in APISIX; (2) adding a monitoring event in a routing module of the APISIX; (3) adding a plurality of registry configurations through an API interface; (4) Configuring a newly-added route on the APISIX, and selecting a corresponding registration center; (5) The routing module caches the new information of the registration center; (6) And when the APISIX receives an access request of the client, the APISIX acquires back-end service information from the corresponding registration center according to the cache data of the routing module. The invention can support the configuration of multiple registration centers, and different routes can be associated with different registration centers; the registration center is managed through the API interface, the configuration file does not need to be manually modified, and the probability of human configuration errors is reduced; meanwhile, the invention realizes the hot update of the APISIX registration center and improves the stability.
The principles and spirit of the present invention are explained in detail below with reference to several exemplary embodiments of the present invention.
Fig. 1 is a flow chart of the method for managing the registration center based on APISIX of the invention.
As shown in fig. 1, the specific scheme is as follows:
s1, adding an API (application program interface) managed by an enrollment center in APISIX (application platform identification index);
the API interface comprises 5 interfaces for adding, modifying, inquiring, deleting, batch inquiring and the like to the registration center;
the data structure of the registry contains the following fields: a main key, a registry type, a registry address, a registry name, an account name, a password, a description and a creation time, wherein the registry type comprises DNS, consul, nacos and Eureka;
s2, adding a monitoring event in a routing module of the APISIX, wherein the monitoring event is used for monitoring a change event of a registration center;
s3, adding a plurality of registration center configurations through an API (application programming interface) by an administrator, wherein a plurality of registration centers can be added to each type of registration center;
s4, an administrator configures a newly-added route on the APISIX and selects a corresponding registration center, and different routes can select different registration centers;
s5, when the information of the registration center is changed, the routing module can monitor the change event and cache new information of the registration center;
s6, after the APISIX receives the access request of the client and matches the access request with the route, the route module forwards the request to the back-end service of the registration center to acquire back-end service information;
s7, if the information of the registration center is modified, the routing module receives the monitoring event and automatically updates the new information of the registration center into a cache;
s8, when the APISIX receives an access request of a new client, the routing module automatically forwards the request to the back-end service of the new registration center according to the cache data to acquire back-end service information.
It should be noted that although the operations of the method of the present invention have been described in the above embodiments and the accompanying drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the operations shown must be performed, to achieve the desired results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
For a clearer explanation of the aforementioned method for managing the registry based on APISIX, a specific embodiment is described below, however, it should be noted that the embodiment is only for better explaining the present invention, and should not be construed as an undue limitation to the present invention.
Suppose that a company has four services using three registries, wherein a shopping cart service and an order service are registered in registry 1, a goods service is registered in registry 2, and a price service is registered in registry 3; the registry 1 and 3 are each of the type Nacos, and the registry 2 is of the type Eureka.
The backend service and registry basic information is shown in table 1 below:
TABLE 1
Figure BDA0003722126890000061
Companies now need to provide services to the outside through APISIX.
The realization steps are as follows:
1. newly adding three registration centers on the APISIX, wherein the information of the registration centers is shown in the table 1;
2. four new routes are added in the APISIX, each route can be associated with a registry, one registry can be associated by a plurality of routes, and the configuration information is shown in the following table 2:
TABLE 2
Route name Name of registration center Service name Route of travel
Route 1 Registration center 1 Shopping cart service /cart/*
Route 2 Registration center 1 Order service /order/*
Route 3 Registration center 2 Commodity service /commodity/*
Route 4 Registration center 3 Price service /price/*
After the route configuration is completed, the route module caches the association information of the route and the registration center, and the APISIX can receive an access request of the client.
Realizing a scene:
1. if the APISIX receives an access request of a client for accessing the shopping cart, the APISIX matches a route 1 according to a url of the request;
2. the APISIX forwards the request to the shopping cart service of the registry 1 according to the registry information and the service name cached by the route 1, wherein the address of the registry 1 is http:// 192.168.1.1.8848;
3. when the address of the registry 1 is changed, an administrator firstly modifies the registry 1 through an API (application programming interface); for example: the registry address is modified to http:// 192.168.1.4;
4. the routing module monitors the change event of the registration center 1, identifies a route 1 and a route 2 associated with the registration center 1, and modifies the registration center addresses associated with the route 1 and the route 2 in the cache;
5. if the APISIX receives the access request of the client for accessing the shopping cart again, the request is automatically forwarded to a new registry address: http:// 192.168.1.4.
Based on the aforementioned inventive concept, as shown in fig. 2, the present invention further provides a computer apparatus 100, which includes a memory 110, a processor 120, and a computer program 130 stored on the memory 110 and operable on the processor 120, wherein the processor 120 implements the aforementioned method for managing a registry based on APISIX when executing the computer program 130.
Based on the foregoing inventive concept, the present invention also provides a computer-readable storage medium storing a computer program for executing the foregoing method for managing an APISIX-based registry.
The APISIX-based registry management method provided by the invention can support configuration of multiple registries, and different routes can be associated with different registries; the registration center is managed through the API interface, manual modification of configuration files is not needed, and the probability of human configuration errors is reduced; meanwhile, the hot update of the APISIX registration center is realized, and the stability is improved.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
The limitation of the protection scope of the present invention is understood by those skilled in the art, and various modifications or changes which can be made by those skilled in the art without inventive efforts based on the technical solution of the present invention are still within the protection scope of the present invention.

Claims (8)

1. A registration center management method based on APISIX is characterized by comprising the following steps:
an API interface managed by a registration center is newly added in the APISIX and is used for adding a plurality of registration center configurations, and different registration centers can be selected by different routes;
adding a monitoring event in a routing module of the APISIX, wherein the monitoring event is used for monitoring a change event of a registration center;
when the information of the registration center is changed, the routing module monitors the change event of the registration center and updates the new information of the registration center into a cache;
and when the APISIX receives an access request of the client, the APISIX goes to the corresponding registration center to acquire the back-end service information according to the cache data of the routing module.
2. The APISIX-based registry management method of claim 1 wherein multiple registries may be added for each type of registry.
3. The APISIX-based registry management method of claim 1 wherein when new routes are configured on APISIX, one registry can be selected for each route, and one registry can be selected by multiple routes.
4. The method of claim 1, wherein when the APISIX receives an access request from a client, the APISIX obtains backend service information from a corresponding registry according to the cache data of the routing module, including:
when the APISIX receives an access request of a client and matches the access request with a route, the route module forwards the access request to a back-end service of a registration center to acquire back-end service information;
if the information of the registration center is modified, the routing module monitors the change event of the registration center and automatically updates the modified information of the registration center into a cache;
when the APISIX receives an access request of a new client, the APISIX automatically forwards the access request to the back-end service of the new registration center to acquire back-end service information.
5. The APISIX-based registry management method of claim 1 wherein the API interfaces include five interfaces for registry additions, modifications, queries, deletions and batch queries.
6. The APISIX-based registry management method of claim 1 wherein the registry data structure contains the following fields: a primary key, a registry type, a registry address, a registry name, an account name, a password, a description, and a creation time.
7. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-6 when executing the computer program.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for performing the method of any one of claims 1-6.
CN202210765979.6A 2022-06-30 2022-06-30 Registration center management method based on APISIX Pending CN115277386A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210765979.6A CN115277386A (en) 2022-06-30 2022-06-30 Registration center management method based on APISIX

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210765979.6A CN115277386A (en) 2022-06-30 2022-06-30 Registration center management method based on APISIX

Publications (1)

Publication Number Publication Date
CN115277386A true CN115277386A (en) 2022-11-01

Family

ID=83763786

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210765979.6A Pending CN115277386A (en) 2022-06-30 2022-06-30 Registration center management method based on APISIX

Country Status (1)

Country Link
CN (1) CN115277386A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116233239A (en) * 2022-12-30 2023-06-06 北京白驹易行科技有限公司 Comment-based configured gateway registration method and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582732A (en) * 2018-10-25 2019-04-05 东软集团股份有限公司 Using the method, apparatus of cache synchronization, storage medium and electronic equipment
CN112311869A (en) * 2020-10-28 2021-02-02 苏州万店掌网络科技有限公司 Multi-type micro-service registration center management system and method
CN112965700A (en) * 2021-05-17 2021-06-15 太平金融科技服务(上海)有限公司 Routing-based micro-service processing method and device, computer equipment and medium
CN113973129A (en) * 2021-09-30 2022-01-25 广西中科曙光云计算有限公司 Gateway supporting multiple registration center microservices
CN114048046A (en) * 2021-11-08 2022-02-15 马上消费金融股份有限公司 Service calling method and device and load balancing equipment
CN114282201A (en) * 2021-12-01 2022-04-05 浪潮软件股份有限公司 Method and system for applying access gateway
CN114461501A (en) * 2022-02-15 2022-05-10 浙江大华技术股份有限公司 Resource abnormality detection method and device, storage medium, and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582732A (en) * 2018-10-25 2019-04-05 东软集团股份有限公司 Using the method, apparatus of cache synchronization, storage medium and electronic equipment
CN112311869A (en) * 2020-10-28 2021-02-02 苏州万店掌网络科技有限公司 Multi-type micro-service registration center management system and method
CN112965700A (en) * 2021-05-17 2021-06-15 太平金融科技服务(上海)有限公司 Routing-based micro-service processing method and device, computer equipment and medium
CN113973129A (en) * 2021-09-30 2022-01-25 广西中科曙光云计算有限公司 Gateway supporting multiple registration center microservices
CN114048046A (en) * 2021-11-08 2022-02-15 马上消费金融股份有限公司 Service calling method and device and load balancing equipment
CN114282201A (en) * 2021-12-01 2022-04-05 浪潮软件股份有限公司 Method and system for applying access gateway
CN114461501A (en) * 2022-02-15 2022-05-10 浙江大华技术股份有限公司 Resource abnormality detection method and device, storage medium, and electronic device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116233239A (en) * 2022-12-30 2023-06-06 北京白驹易行科技有限公司 Comment-based configured gateway registration method and system
CN116233239B (en) * 2022-12-30 2023-11-21 北京白驹易行科技有限公司 Comment-based configured gateway registration method and system

Similar Documents

Publication Publication Date Title
US10536545B2 (en) Cloud database connection multiplexing
US8423581B2 (en) Proxy support for special subtree entries in a directory information tree using attribute rules
US9143389B2 (en) Methods, appratuses, and computer program products for determining a network interface to access a network resource
US7774329B1 (en) Cross-region data access in partitioned framework
US8285753B2 (en) Change approvals for computing systems
US8214355B2 (en) Small table: multitenancy for lots of small tables on a cloud database
US20140280305A1 (en) High performance dns traffic management
US8185546B2 (en) Enhanced control to users to populate a cache in a database system
US20090177778A1 (en) Session Affinity Cache and Manager
US8645550B2 (en) Database virtualization
US8150870B1 (en) Scalable partitioning in a multilayered data service framework
CN109726206B (en) Data processing method, device, equipment and storage medium for block chain nodes
JP2015513153A (en) Computer-implemented method, computer program product, and system for managing tenant-specific data sets in a multi-tenant environment
CN103067463A (en) Centralized management system and centralized management method for user root permission
JP5932841B2 (en) Site-aware access to distributed file systems from outside the corporate network
EP3376403A1 (en) Method of accessing distributed database and device providing distributed data service
US20120173670A1 (en) Base station, web application server, system, and method
CN106385426B (en) Node content hit method and device
US20120059832A1 (en) Portable Hash-Based Key Location Mechanism
CN115277386A (en) Registration center management method based on APISIX
US8761399B2 (en) Keystore management system
CN108595616B (en) Unified namespace management method for distributed file system
US8316045B1 (en) Database linking system
US10205679B2 (en) Resource object resolution management
US20110060788A1 (en) System and method for automatically providing metadata elements on a web page or web site

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