CN112637126A - Service registration method and Pod - Google Patents

Service registration method and Pod Download PDF

Info

Publication number
CN112637126A
CN112637126A CN202011324501.7A CN202011324501A CN112637126A CN 112637126 A CN112637126 A CN 112637126A CN 202011324501 A CN202011324501 A CN 202011324501A CN 112637126 A CN112637126 A CN 112637126A
Authority
CN
China
Prior art keywords
service
pod
micro
target
registration
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.)
Granted
Application number
CN202011324501.7A
Other languages
Chinese (zh)
Other versions
CN112637126B (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.)
Beijing China Power Information Technology Co Ltd
Original Assignee
State Grid Information and Telecommunication Co Ltd
Beijing China Power 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 State Grid Information and Telecommunication Co Ltd, Beijing China Power Information Technology Co Ltd filed Critical State Grid Information and Telecommunication Co Ltd
Priority to CN202011324501.7A priority Critical patent/CN112637126B/en
Publication of CN112637126A publication Critical patent/CN112637126A/en
Application granted granted Critical
Publication of CN112637126B publication Critical patent/CN112637126B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1073Registration or de-registration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a service registration method and a Pod, wherein an Agent container and a micro-service container are deployed in the same Pod, so that the two containers can perform local communication and communicate with the outside through the same IP address, and the normal communication of micro-services is ensured. Furthermore, an Agent program capable of calling a service registration interface of the target registration center is deployed in the Agent container, and the micro-service can indirectly register the micro-service through the Agent program, so that the micro-service developed by using a non-Java language can be registered in Eureka, and the normal use of the micro-service developed by using the non-Java language is ensured. Furthermore, the registration of the micro-service is indirectly realized by setting the Agent program, the micro-service does not need to be adjusted, and compared with a mode of adding the registration program to the micro-service, the operation of the micro-service is simplified.

Description

Service registration method and Pod
Technical Field
The invention relates to the field of micro-service registration, in particular to a service registration method and a Pod.
Background
The registration center Eureka is an open source framework in Netflix, and is used for realizing service registration management, and services provided by micro services can be used after the micro services are registered in Eureka.
The Eureka is developed based on Java language, and a platform where the Eureka is located is provided with a bottom layer program supporting service registration of micro-services developed by using the Java language, so that the micro-services developed by using the Java language can realize service registration through configuration files. However, for micro-services developed by using non-Java languages, the platform where Eureka is located is not provided with corresponding underlying programs for service registration, so that the micro-services developed by using the non-Java languages cannot be registered in Eureka, and further the micro-services developed by using the non-Java languages cannot be normally used.
Disclosure of Invention
In view of the above, the present invention provides a service registration method and Pod to solve the problem that a micro-service developed using a non-Java language cannot be registered in Eureka, so that the micro-service developed using the non-Java language cannot be normally used.
In order to solve the technical problems, the invention adopts the following technical scheme:
a service registration method is applied to a container combination Pod, wherein an Agent container and a micro-service container are deployed in the Pod, and an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container; the micro service container is deployed with micro services which are developed by using a preset development language and need to be subjected to service registration; the Agent container is preset with service registration parameters corresponding to the micro-service; the micro service container is preset with an Agent proxy address of the Agent program;
the service registration method comprises the following steps:
the Agent program acquires service registration parameters corresponding to the micro-service and a Pod address of the Pod when the Pod responds to a starting instruction; the service registration parameters comprise micro service parameters and a registration center address;
and the Agent program calls the service registration interface and sends the Pod address and the micro-service parameters to a target registration center corresponding to the registration center address through the service registration interface, so that the target registration center stores the Pod address and the micro-service parameters to realize the registration of the micro-service.
Optionally, the Agent program sends the Pod address and the micro service parameter to a target registry corresponding to the registry address through the service registration interface, so that the target registry stores the Pod address and the micro service parameter, and after registration of the micro service is achieved, the method further includes:
and the Agent program sends heartbeat information to the target registration center at fixed time intervals.
Optionally, the Agent program sends the Pod address and the micro service parameter to a target registry corresponding to the registry address through the service registration interface, so that the target registry stores the Pod address and the micro service parameter, and after registration of the micro service is achieved, the method further includes:
the micro service sends a service request to the Agent program; the service request comprises a request service name, request service content and an access address;
the Agent program determines a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address;
and the Agent program generates a service access request comprising the request service content, the access address, the Pod address corresponding to the target service and a service port in the Pod address, and sends the service access request to the service port in the Pod address corresponding to the target service, so that the target service provides the service corresponding to the request service content.
Optionally, the determining, by the Agent program, a target service corresponding to the requested service name, a Pod address corresponding to the target service, and a service port in the Pod address includes:
acquiring service list information registered in the target registration center; the service list information comprises a service name of each service, a Pod address corresponding to the service name and a service port in the Pod address;
and determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address according to the service list information.
Optionally, the obtaining of the service list information registered in the target registration center includes:
and sending a service list information acquisition request to the target registration center, and receiving the service list information returned by the target registration center.
A container combination Pod is provided, wherein an Agent container and a micro-service container are deployed in the Pod, and an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container; the micro service container is deployed with micro services which are developed by using a preset development language and need to be subjected to service registration; the Agent container is preset with service registration parameters corresponding to the micro-service; the micro service container is preset with an Agent proxy address of the Agent program;
the Pod is configured to:
the Agent program acquires service registration parameters corresponding to the micro-service and a Pod address of the Pod when the Pod responds to a starting instruction; the service registration parameters comprise micro service parameters and a registration center address;
and the Agent program calls the service registration interface and sends the Pod address and the micro-service parameters to a target registration center corresponding to the registration center address through the service registration interface, so that the target registration center stores the Pod address and the micro-service parameters to realize the registration of the micro-service.
Optionally, the Agent program is further configured to: and sending heartbeat information to the target registration center at fixed time intervals.
Optionally, the microservice is further configured to send a service request to the Agent program; the service request comprises a request service name, request service content and an access address;
the Agent program is also used for: determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address;
and generating a service access request comprising the request service content, the access address, the Pod address corresponding to the target service and a service port in the Pod address, and sending the service access request to the service port in the Pod address corresponding to the target service so that the target service provides the service corresponding to the request service content.
Optionally, when the Agent program is used to determine the target service corresponding to the requested service name, the Pod address corresponding to the target service, and the service port in the Pod address, the Agent program is specifically configured to:
acquiring service list information registered in the target registration center; the service list information comprises a service name of each service, a Pod address corresponding to the service name and a service port in the Pod address;
and determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address according to the service list information.
Optionally, when the Agent program is used to obtain the service list information registered in the target registration center, the Agent program is specifically configured to:
and sending a service list information acquisition request to the target registration center, and receiving the service list information returned by the target registration center.
Compared with the prior art, the invention has the following beneficial effects:
the Agent container and the micro-service container are deployed in the same Pod, so that the two containers can perform local communication and communicate with the outside through the same IP address, and normal communication of micro-services is guaranteed. On the basis that the micro-service can normally communicate, an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container, and then the micro-service can register the micro-service through the Agent program, namely the micro-service is indirectly registered through the Agent program in the Agent container, so that the micro-service developed by using a non-Java language can be registered in Eureka, and the normal use of the micro-service developed by using the non-Java language is ensured. Furthermore, the registration of the micro-service is indirectly realized by setting the Agent program, the micro-service does not need to be adjusted, and compared with a mode of adding the registration program to the micro-service, the operation of the micro-service is simplified.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for registering a service according to an embodiment of the present invention;
fig. 2 is a flowchart of another service registration method according to an embodiment of the present invention;
fig. 3 is a flowchart of a method of a further service registration method according to an embodiment of the present invention;
fig. 4 is a schematic view of a scenario of a service registration method according to an embodiment of the present invention.
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 only a part of the embodiments of the present invention, and not all of the embodiments. 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 Eureka is developed based on Java language, and a platform where the Eureka is located is provided with a bottom layer program supporting service registration of micro-services developed by using the Java language, so that the micro-services developed by using the Java language can realize service registration through configuration files. However, for micro-services developed by using non-Java languages, the platform where Eureka is located is not provided with corresponding underlying programs for service registration, so that the micro-services developed by using the non-Java languages cannot be registered in Eureka, and further the micro-services developed by using the non-Java languages cannot be normally used.
The inventor has found through research that if a registration program is added to the program of the micro service, the registration program can call the service registration interface of Eureka, and the registration of the micro service can be realized. However, in this case, when the number of micro services is large, it is necessary to improve the program for each micro service, which makes the operation complicated.
Further, the inventor finds that if an Agent program can be written, the Agent program can call a service registration interface of a target registration center, registration of the micro-service is indirectly realized through the Agent program, the registration program does not need to be added to the micro-service program, and the operation is simple. Moreover, the written Agent program can be suitable for a plurality of micro services, the registration operation of the plurality of micro services can be simplified, one-time writing is realized, and the technical effect of being suitable for the plurality of micro services is achieved.
Specifically, in the embodiment of the present invention, the Agent container and the micro-service container are deployed in the same Pod (in a Kubernetes cluster, a Pod is a basis of all service types, and is a combination of one or more containers), and then the two containers can perform local communication, and communicate with the outside through the same IP address, thereby ensuring normal communication of the micro-service. On the basis that the micro-service can normally communicate, an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container, and then the micro-service can register the micro-service through the Agent program, namely the micro-service is indirectly registered through the Agent program in the Agent container, so that the micro-service developed by using a non-Java language can be registered in Eureka, and the normal use of the micro-service developed by using the non-Java language is ensured. Furthermore, the registration of the micro-service is indirectly realized by setting the Agent program, the micro-service does not need to be adjusted, and compared with a mode of adding the registration program to the micro-service, the operation of the micro-service is simplified.
On the basis of the above content, the embodiment of the invention provides a service registration method. Applied to the container assembly Pod. In practical application, an Agent container and a micro-service container are deployed in the Pod, and an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container; the micro service container is deployed with micro services which are developed by using a preset development language (such as non-java language) and need to be registered with services.
In this embodiment, the Deployment is used to create the Pod, and to manage the life cycle of the Pod, and the like. Then, the Agent program and the micro-service are deployed in the same Pod through Kubernets (container cluster management software), so that the Agent program and the micro-service can communicate locally, share a network, communicate with the outside by using the same IP address, namely the Agent program and the micro-service are integrated, the micro-service realizes service provision, and the Agent program realizes the external communication of the micro-service. And the micro service container is preset with an Agent proxy address of the Agent program. Specifically, HTTP _ PROXY (Agent PROXY address) is set by an environment variable inside the application container, i.e., the microservice container. The Agent proxy address is a communication address for subsequently accessing the micro-service, the Agent finds out a Pod address through the name of the micro-service, and the micro-service can be accessed through the Pod address. Wherein, the setting process of the environment variable is as follows:
env:
-name:HTTP_PROXY
value:'127.0.0.1:30000
the Agent container is preset with SERVICE registration parameters corresponding to the micro-SERVICE, and specifically, the Agent container is configured with an EUREKA _ endport (registration center address), a SERVICE _ NAME, and a SERVICE _ PORT (SERVICE PORT) through environment variables. The service name and the service port are service registration parameters corresponding to the micro-service. And accessing the micro service through the Agent proxy address, and providing the service for the outside through the Pod address and the service port by the micro service.
It should be noted that one micro service container and one Agent container are arranged in one Pod, and the other micro service container and the Agent container matched with the micro service container are arranged in one Pod, that is, only one micro service container and one Agent container are arranged in the same Pod.
On the basis of the above, referring to fig. 1, the service registration method in the present invention includes:
and S11, when the Agent program responds to the starting instruction, acquiring the service registration parameter corresponding to the micro service and the Pod address of the Pod.
In practical application, a program is arranged in a Pod, a starting instruction is arranged in the program, the program is operated when the Pod is started for the first time, the starting instruction in the program is responded, and at the moment, the Agent program registers the microservice to a target registry.
Specifically, the Agent program acquires a service registration parameter preset with a micro service corresponding to the micro service and a Pod address allocated to the Pod. The service registration parameters comprise the micro-service parameters and the address of the registration center. The micro-service parameters comprise the service name and the service port, and the registration center address is the registration center address.
And S12, the Agent program calls the service registration interface and sends the Pod address and the micro-service parameter to a target registration center corresponding to the registration center address through the service registration interface, so that the target registration center stores the Pod address and the micro-service parameter and realizes the registration of the micro-service.
After the Agent program obtains the Pod address and the micro-service parameter, a service registration interface is called, the obtained data are sent to a target registration center corresponding to a registration center address through the interface, and the target registration center stores the Pod address and the micro-service parameter to realize registration of the micro-service. And after successful registration, returning successful registration information to the Agent program.
More specifically, the Agent program reads the environment variable and registers the Pod address, the service name and the service port in the registry, and the registry stores the relationship between the service name and the Pod address and the port. And after the registration is finished, the Agent program sends heartbeat information to the target registration center at regular intervals.
Specifically, the Agent sends heartbeat to the registry at regular time, so that the target registry knows whether the application, namely the microservice is normally operated or not, and sends the operation state (UP indicates operation, and DOWN indicates non-operation) and the current time of the application.
In the embodiment, the Eureka provides a service registration function, and the Agent program can access the Eureka to provide an interface, so that the development of Eureka by other language programs is simplified. Specifically, the Agent container and the micro-service container are deployed in the same Pod, so that the two containers can perform local communication and communicate with the outside through the same IP address, and normal communication of micro-services is guaranteed. On the basis that the micro-service can normally communicate, an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container, and then the micro-service can register the micro-service through the Agent program, namely the micro-service is indirectly registered through the Agent program in the Agent container, so that the micro-service developed by using a non-Java language can be registered in Eureka, and the normal use of the micro-service developed by using the non-Java language is ensured. Furthermore, the registration of the micro-service is indirectly realized by setting the Agent program, the micro-service does not need to be adjusted, and compared with a mode of adding the registration program to the micro-service, the operation of the micro-service is simplified. Furthermore, after the Agent program is written, the Agent program can be applied to a plurality of micro services, so that the effects of one-time writing and multiple-time use are achieved.
The above embodiments describe the registration process of the micro service, and in practical applications, after the registration of the micro service, the service can be provided. Specifically, referring to fig. 2, after step S12, the method further includes:
and S21, the micro service sends a service request to the Agent program.
In practical application, one micro service may call another micro service, for example, one micro service is shopping software, the other micro service is order service, if a user wants to access his order after ordering the shopping software, the shopping software is required to call the order service software, and then the shopping software accesses an Agent program in the same Pod as the shopping software in an HTTP proxy manner, and at this time, the shopping software sends a service request to the Agent program.
The service request includes a request service name, request service content, and an access address. The name of the request service may be the order service, the content of the request service may be a query history order, and the access address is an access address in the URL.
And S22, the Agent program determines the target service corresponding to the request service name, the Pod address corresponding to the target service and the service port in the Pod address.
In practical application, an Agent program can obtain a target service corresponding to the requested service name, a Pod address corresponding to the target service and a service port in the Pod address by inquiring from service list information stored in the Agent program.
More specifically, referring to fig. 3, step S22 may include:
and S31, acquiring the service list information registered in the target registration center.
In practical application, the Agent program sends a service list information acquisition request to the target registration center and receives service list information returned by the target registration center.
The service list information comprises a service name of each service, a Pod address corresponding to the service name and a service port in the Pod address.
Specifically, after receiving registration information of the micro-service (a service registration parameter corresponding to the micro-service and a Pod address of the Pod) sent by the Agent program, the target registration center stores the registration information into service list information, so that the service list information includes registration information of each micro-service.
The Agent program can communicate with the target registration center and sends a service list information acquisition request to the target registration center, the target registration center returns the service list information to the Agent program after receiving the service list information acquisition request, and the Agent program stores the service list information in the memory.
S32, according to the service list information, determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address.
Specifically, the service list information includes registration information of each micro service, and the Agent program directly queries the service list information according to the request service name to obtain a target service corresponding to the request service name, a Pod address corresponding to the target service, and a service port in the Pod address.
S23, the Agent program generates a service access request comprising the request service content, the access address, the Pod address corresponding to the target service and the service port in the Pod address, and sends the service access request to the service port in the Pod address corresponding to the target service, so that the target service provides the service corresponding to the request service content.
After the Agent program obtains the Pod address corresponding to the target service and the service port in the Pod address, a service access request, namely a URL request, including the request service content, the access address, the Pod address corresponding to the target service and the service port in the Pod address is generated, and then the URL request is sent to the service port in the Pod address corresponding to the target service, and the micro-service is found through the service port, so that the micro-service provides the service corresponding to the requested service content. Still taking the above embodiment as an example, at this time, the order service provides historical order information to the shopping software, so that the shopping software feeds back the historical order information to the user.
In this embodiment, an application sends a request to an Agent, the Agent receives the request, and the Agent forwards the request to a service provider, in actual application, there may be a plurality of service providers, but only one of the requests is requested at each time, and after receiving the application request, the Agent finds a corresponding Pod address and port according to a service name, randomly selects an instance from a plurality of pieces of information, and sends the request to the service provider. So that the service provider provides the service.
As described above, referring to fig. 4, the Agent program in the Agent container can realize functions such as registration of microservices (applications), transmission of heartbeats, and reading of services.
Optionally, on the basis of the embodiment of the service registration method, another embodiment of the present invention provides a container combination Pod, where an Agent container and a micro-service container are deployed in the Pod, and an Agent program capable of calling a service registration interface of a target registry is deployed in the Agent container; the micro service container is deployed with micro services which are developed by using a preset development language and need to be subjected to service registration; the Agent container is preset with service registration parameters corresponding to the micro-service; the micro service container is preset with an Agent proxy address of the Agent program;
the Pod is configured to:
the Agent program acquires service registration parameters corresponding to the micro-service and a Pod address of the Pod when the Pod responds to a starting instruction; the service registration parameters comprise micro service parameters and a registration center address;
and the Agent program calls the service registration interface and sends the Pod address and the micro-service parameters to a target registration center corresponding to the registration center address through the service registration interface, so that the target registration center stores the Pod address and the micro-service parameters to realize the registration of the micro-service.
Further, the Agent program is further configured to: and sending heartbeat information to the target registration center at fixed time intervals.
Further, the micro service is also used for sending a service request to the Agent program; the service request comprises a request service name, request service content and an access address;
the Agent program is also used for: determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address;
and generating a service access request comprising the request service content, the access address, the Pod address corresponding to the target service and a service port in the Pod address, and sending the service access request to the service port in the Pod address corresponding to the target service so that the target service provides the service corresponding to the request service content.
Further, when the Agent program is used to determine the target service corresponding to the requested service name, the Pod address corresponding to the target service, and the service port in the Pod address, the Agent program is specifically configured to:
acquiring service list information registered in the target registration center; the service list information comprises a service name of each service, a Pod address corresponding to the service name and a service port in the Pod address;
and determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address according to the service list information.
Further, when the Agent program is used to acquire the service list information registered in the target registry, the Agent program is specifically configured to:
and sending a service list information acquisition request to the target registration center, and receiving the service list information returned by the target registration center.
The Agent container and the micro-service container are deployed in the same Pod, so that the two containers can perform local communication and communicate with the outside through the same IP address, and normal communication of micro-services is guaranteed. On the basis that the micro-service can normally communicate, an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container, and then the micro-service can register the micro-service through the Agent program, namely the micro-service is indirectly registered through the Agent program in the Agent container, so that the micro-service developed by using a non-Java language can be registered in Eureka, and the normal use of the micro-service developed by using the non-Java language is ensured. Furthermore, the registration of the micro-service is indirectly realized by setting the Agent program, the micro-service does not need to be adjusted, and compared with a mode of adding the registration program to the micro-service, the operation of the micro-service is simplified.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A service registration method is characterized in that the method is applied to a container combination Pod, an Agent container and a micro-service container are deployed in the Pod, and an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container; the micro service container is deployed with micro services which are developed by using a preset development language and need to be subjected to service registration; the Agent container is preset with service registration parameters corresponding to the micro-service; the micro service container is preset with an Agent proxy address of the Agent program;
the service registration method comprises the following steps:
the Agent program acquires service registration parameters corresponding to the micro-service and a Pod address of the Pod when the Pod responds to a starting instruction; the service registration parameters comprise micro service parameters and a registration center address;
and the Agent program calls the service registration interface and sends the Pod address and the micro-service parameters to a target registration center corresponding to the registration center address through the service registration interface, so that the target registration center stores the Pod address and the micro-service parameters to realize the registration of the micro-service.
2. The service registration method according to claim 1, wherein the Agent program sends the Pod address and the microservice parameter to a target registry corresponding to the registry address through the service registration interface, so that the target registry stores the Pod address and the microservice parameter, and after registration of the microservice is achieved, the method further comprises:
and the Agent program sends heartbeat information to the target registration center at fixed time intervals.
3. The service registration method according to claim 1, wherein the Agent program sends the Pod address and the microservice parameter to a target registry corresponding to the registry address through the service registration interface, so that the target registry stores the Pod address and the microservice parameter, and after registration of the microservice is achieved, the method further comprises:
the micro service sends a service request to the Agent program; the service request comprises a request service name, request service content and an access address;
the Agent program determines a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address;
and the Agent program generates a service access request comprising the request service content, the access address, the Pod address corresponding to the target service and a service port in the Pod address, and sends the service access request to the service port in the Pod address corresponding to the target service, so that the target service provides the service corresponding to the request service content.
4. The service registration method of claim 3, wherein the Agent program determines a target service corresponding to the requested service name, a Pod address corresponding to the target service, and a service port in the Pod address, and comprises:
acquiring service list information registered in the target registration center; the service list information comprises a service name of each service, a Pod address corresponding to the service name and a service port in the Pod address;
and determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address according to the service list information.
5. The service registration method of claim 4, wherein obtaining the service list information registered in the target registry comprises:
and sending a service list information acquisition request to the target registration center, and receiving the service list information returned by the target registration center.
6. A container combination Pod is characterized in that an Agent container and a micro-service container are deployed in the Pod, and an Agent program capable of calling a service registration interface of a target registration center is deployed in the Agent container; the micro service container is deployed with micro services which are developed by using a preset development language and need to be subjected to service registration; the Agent container is preset with service registration parameters corresponding to the micro-service; the micro service container is preset with an Agent proxy address of the Agent program;
the Pod is configured to:
the Agent program acquires service registration parameters corresponding to the micro-service and a Pod address of the Pod when the Pod responds to a starting instruction; the service registration parameters comprise micro service parameters and a registration center address;
and the Agent program calls the service registration interface and sends the Pod address and the micro-service parameters to a target registration center corresponding to the registration center address through the service registration interface, so that the target registration center stores the Pod address and the micro-service parameters to realize the registration of the micro-service.
7. The Pod of claim 6, wherein the Agent program is further configured to: and sending heartbeat information to the target registration center at fixed time intervals.
8. The Pod of claim 6, wherein the microservice is further configured to send a service request to the Agent program; the service request comprises a request service name, request service content and an access address;
the Agent program is also used for: determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address;
and generating a service access request comprising the request service content, the access address, the Pod address corresponding to the target service and a service port in the Pod address, and sending the service access request to the service port in the Pod address corresponding to the target service so that the target service provides the service corresponding to the request service content.
9. The Pod of claim 8, wherein the Agent program, when configured to determine a target service corresponding to the requested service name, a Pod address corresponding to the target service, and a service port in the Pod address, is specifically configured to:
acquiring service list information registered in the target registration center; the service list information comprises a service name of each service, a Pod address corresponding to the service name and a service port in the Pod address;
and determining a target service corresponding to the request service name, a Pod address corresponding to the target service and a service port in the Pod address according to the service list information.
10. The Pod of claim 9, wherein the Agent program, when configured to obtain the service list information registered in the target registry, is specifically configured to:
and sending a service list information acquisition request to the target registration center, and receiving the service list information returned by the target registration center.
CN202011324501.7A 2020-11-23 2020-11-23 Service registration method and Pod Active CN112637126B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011324501.7A CN112637126B (en) 2020-11-23 2020-11-23 Service registration method and Pod

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011324501.7A CN112637126B (en) 2020-11-23 2020-11-23 Service registration method and Pod

Publications (2)

Publication Number Publication Date
CN112637126A true CN112637126A (en) 2021-04-09
CN112637126B CN112637126B (en) 2023-04-07

Family

ID=75303688

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011324501.7A Active CN112637126B (en) 2020-11-23 2020-11-23 Service registration method and Pod

Country Status (1)

Country Link
CN (1) CN112637126B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113938520A (en) * 2021-08-31 2022-01-14 阿里巴巴(中国)有限公司 Service registration method, device and storage medium
CN115242625A (en) * 2022-06-24 2022-10-25 平安银行股份有限公司 Service deployment method and device, computer equipment and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105515759A (en) * 2015-11-27 2016-04-20 国网信息通信产业集团有限公司 Micro service registration method and micro service registration system
US20180152534A1 (en) * 2015-06-03 2018-05-31 Telefonaktiebolaget Lm Ericsson (Publ) Implanted agent within a first service container for enabling a reverse proxy on a second container
CN110134455A (en) * 2019-04-12 2019-08-16 平安医疗健康管理股份有限公司 A kind of application management system and method
CN110990081A (en) * 2019-12-10 2020-04-10 北京懿医云科技有限公司 Microservice registration and discovery method and device, storage medium and electronic equipment
CN111131193A (en) * 2019-12-10 2020-05-08 四川新网银行股份有限公司 Distributed service governance method supporting multi-protocol heterogeneous non-code intrusion
CN111917838A (en) * 2020-07-14 2020-11-10 浙江大华技术股份有限公司 Processing method and device based on micro service, storage medium and electronic device
US20200366752A1 (en) * 2019-05-17 2020-11-19 Citrix Systems, Inc. Systems and methods for recording metadata about microservices for requests to the microservices

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180152534A1 (en) * 2015-06-03 2018-05-31 Telefonaktiebolaget Lm Ericsson (Publ) Implanted agent within a first service container for enabling a reverse proxy on a second container
CN105515759A (en) * 2015-11-27 2016-04-20 国网信息通信产业集团有限公司 Micro service registration method and micro service registration system
CN110134455A (en) * 2019-04-12 2019-08-16 平安医疗健康管理股份有限公司 A kind of application management system and method
US20200366752A1 (en) * 2019-05-17 2020-11-19 Citrix Systems, Inc. Systems and methods for recording metadata about microservices for requests to the microservices
CN110990081A (en) * 2019-12-10 2020-04-10 北京懿医云科技有限公司 Microservice registration and discovery method and device, storage medium and electronic equipment
CN111131193A (en) * 2019-12-10 2020-05-08 四川新网银行股份有限公司 Distributed service governance method supporting multi-protocol heterogeneous non-code intrusion
CN111917838A (en) * 2020-07-14 2020-11-10 浙江大华技术股份有限公司 Processing method and device based on micro service, storage medium and electronic device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113938520A (en) * 2021-08-31 2022-01-14 阿里巴巴(中国)有限公司 Service registration method, device and storage medium
CN113938520B (en) * 2021-08-31 2024-10-08 阿里巴巴(中国)有限公司 Service registration method, device and storage medium
CN115242625A (en) * 2022-06-24 2022-10-25 平安银行股份有限公司 Service deployment method and device, computer equipment and readable storage medium
CN115242625B (en) * 2022-06-24 2024-03-19 平安银行股份有限公司 Service deployment method, device, computer equipment and readable storage medium

Also Published As

Publication number Publication date
CN112637126B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
US11363105B2 (en) Determining a target service based on a service discovery request
CN108510389B (en) Intelligent contract calling method and device based on block chain and readable storage medium
CN111052711B (en) Method for discovering services provided by a network repository function
CN107948135B (en) Data processing method and device supporting multiple API protocols
US11540244B2 (en) MEC information obtaining method and apparatus
US20150195338A1 (en) File fetch from a remote client device
CN111034238B (en) Method for obtaining user subscription data concerning subscribers in a telecommunication network
KR20180090180A (en) Website access method, apparatus, and website system
CN108667866B (en) Request processing method and device based on API intelligent adaptation
CN112637126B (en) Service registration method and Pod
CN106230977B (en) A kind of client functionality loading method, system, client and server-side
CN109982152A (en) P2P CDN method for processing business, intelligent gateway and CDN platform
CN111414261B (en) Cross-network calling method and device of distributed system and related components
US20040199643A1 (en) Distributed service component systems
CN115361279A (en) Configuration data updating method and device, electronic equipment and computer readable medium
WO2009062396A1 (en) Resource access method and resource access system
CN112653772B (en) Domain name management method, device and storage medium
CN114006915A (en) Resource request method, device, equipment and computer readable storage medium
JP4532238B2 (en) On-demand service provision system
KR100601848B1 (en) Method for Processing Download Descriptor in Mobile Communication Terminal
KR101906413B1 (en) Method and apparuats for updating personal information
CN113347284B (en) Resource access method, resource access device, electronic equipment and storage medium
CN117201311A (en) Information optimization method and device and electronic equipment
CN114979269A (en) Method, storage medium and system for receiving management end to manage Web middleware
CN116346775A (en) Network request method and device in android system and electronic equipment

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
TA01 Transfer of patent application right

Effective date of registration: 20211111

Address after: 100192 room 710, scientific research building, No. 15, Xiaoying East Road, Qinghe, Haidian District, Beijing

Applicant after: BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd.

Address before: 100192 room 710, scientific research building, No. 15, Xiaoying East Road, Qinghe, Haidian District, Beijing

Applicant before: BEIJING CHINA POWER INFORMATION TECHNOLOGY Co.,Ltd.

Applicant before: STATE GRID INFORMATION & TELECOMMUNICATION GROUP Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant