CN117221383A - Micro-service calling method, micro-service calling device, computer equipment and storage medium - Google Patents

Micro-service calling method, micro-service calling device, computer equipment and storage medium Download PDF

Info

Publication number
CN117221383A
CN117221383A CN202310978219.8A CN202310978219A CN117221383A CN 117221383 A CN117221383 A CN 117221383A CN 202310978219 A CN202310978219 A CN 202310978219A CN 117221383 A CN117221383 A CN 117221383A
Authority
CN
China
Prior art keywords
service
service name
micro
address
name
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
CN202310978219.8A
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.)
China Mobile Communications Group Co Ltd
China Mobile Group Fujian Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Fujian 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 China Mobile Communications Group Co Ltd, China Mobile Group Fujian Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202310978219.8A priority Critical patent/CN117221383A/en
Publication of CN117221383A publication Critical patent/CN117221383A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a micro-service calling method, a micro-service calling device, computer equipment and a storage medium, wherein the method comprises the following steps: when the first micro service calls other micro services, a first service address is obtained; extracting a first service name from the first service address; analyzing the first service name to obtain an IP address corresponding to the first service name; updating the first service address according to the IP address to obtain a second service address; and calling a second micro-service corresponding to the first service name according to the second service address. Therefore, when other micro services are called, the service name can be analyzed to obtain the IP address, and further the service address for calling the other micro services is obtained according to the IP address, so that the other micro services can be called according to the service name, the control of each micro service is not needed, and the operation and maintenance configuration is simple.

Description

Micro-service calling method, micro-service calling device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for calling a micro service, a computer device, and a storage medium.
Background
In order to guarantee fault isolation during deployment of a large-scale information technology (Information Technology, IT) system, a multi-channel deployment mode is generally adopted, wherein the multi-channel deployment is to deploy programs of one application system into multiple sets, and one set of deployment can be called one channel. In order to ensure the mutual calling among different application systems, the called service instance is ensured to be in the same channel class.
Disclosure of Invention
The application provides a micro-service calling method, a micro-service calling device, computer equipment and a storage medium. The specific scheme is as follows:
in one aspect, an embodiment of the present application provides a method for calling a micro service, including:
when the first micro service calls other micro services, a first service address is obtained;
extracting a first service name from the first service address;
analyzing the first service name to obtain an IP address corresponding to the first service name;
updating the first service address according to the IP address to obtain a second service address;
and calling a second micro-service corresponding to the first service name according to the second service address.
In another aspect, an embodiment of the present application provides a method for calling a micro service, including:
acquiring a first analysis request sent by a first micro service, wherein the first analysis request comprises a second service name;
inquiring to obtain an IP address corresponding to the second service name according to the second service name;
and returning the IP address corresponding to the second service name to the first micro service.
Another embodiment of the present application provides a micro service invocation apparatus, including:
the acquisition module is used for acquiring a first service address when the first micro service calls other micro services;
the extraction module is used for extracting a first service name from the first service address;
the analysis module is used for analyzing the first service name to obtain an IP address corresponding to the first service name;
the updating module is used for updating the first service address according to the IP address to obtain a second service address;
and the calling module is used for calling the second micro-service corresponding to the first service name according to the second service address.
Another embodiment of the present application provides a micro service invocation apparatus, including:
the acquisition module is used for acquiring a first analysis request sent by a first micro-service, wherein the first analysis request comprises a second service name;
the query module is used for querying and obtaining the IP address corresponding to the second service name according to the second service name;
and the return module is used for returning the IP address corresponding to the second service name to the first micro service.
Another embodiment of the present application provides a computer device, including a processor and a memory;
wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for implementing the method according to the embodiment of the above aspect or implementing the method according to the embodiment of the above aspect.
Another aspect of the application provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method as described in the above-described embodiment of one aspect, or implements a method as described in the above-described embodiment of another aspect.
Additional aspects and advantages of the application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the application.
Drawings
The foregoing and/or additional aspects and advantages of the application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a schematic diagram of a channel-wise deployment of micro services according to an embodiment of the present application;
FIG. 2 is a flow chart of a micro service invocation method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating another micro service invocation method according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating another micro service invocation method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a micro service calling device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another micro service invocation apparatus according to an embodiment of the present application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative and intended to explain the present application and should not be construed as limiting the application.
The following describes a micro service invocation method, apparatus, computer device, and storage medium of an embodiment of the present application with reference to the accompanying drawings.
In order to ensure fault isolation during deployment of a large IT system, a multi-channel deployment mode is generally adopted, wherein the multi-channel deployment is to deploy programs of one application system into multiple sets, and one set of deployment can be called one channel. In order to ensure that different application systems call each other, the called service instance is guaranteed to be in the same channel class.
The channel deployment characteristics may include: 1. the resources are isolated, and different channels are deployed on different hosts; 2. deploying homogenization, the applications in each channel being homogenous; 3. the channels are isolated, and the applications of different channels are not mutually dependent. These characteristics determine that when one channel fails, the other channel is not affected, and fault isolation is achieved.
In some embodiments, multiple business systems may be deployed per channel, as shown in FIG. 1, client 1 may invoke micro-services on channel 1, and client 2 may invoke micro-services on channel 2. When a plurality of service systems are deployed according to channels, the channels are required to be maintained when the service between a plurality of application systems is called, namely, when different application systems are mutually called, the called service instance is ensured to be in the same channel class. As shown in fig. 1, when the micro service of the channel 1 of the application system 1 calls the micro service of the application system 2, the micro service tuned to the channel 1 needs to be guaranteed, and the micro service cannot be tuned to the channel 2.
To ensure that the invoked service instance is in the same channel class, each micro-service may control itself, with each micro-service supporting a different invocation address configured according to a different channel.
In the mode, each micro-service needs to support different calling addresses according to different channel configurations, the channels cannot be maintained as long as one micro-service is not supported, and the different micro-service configuration modes are different, so that the operation and maintenance configuration is complex, the operation and maintenance change workload is large, and the operation and maintenance change workload is easy to leak and error.
Fig. 2 is a flow chart of a micro service call method according to an embodiment of the present application.
As shown in fig. 2, the micro service invocation method includes:
in step 201, when the first micro service invokes other micro services, a first service address is obtained.
In the application, when the first micro service calls other micro services, a configuration file or a configuration table can be read, and a first service address is obtained from the configuration file or the configuration table. For example, the first service address is http:// ms2:8080/getUserInfo.
In the present application, the service address in the configuration file or the configuration table may be one or more, which is not limited in this aspect of the present application.
Step 202, a first service name is extracted from a first service address.
In the application, the first service address can be analyzed according to the predefined format of the first service address, and the first service name of the micro service to be called is extracted from the preset character position in the first service address. The first service name is the name of the micro service to be called, and the first service name does not contain channel information.
For example, when the micro service ms1 calls other micro services, the first service address is obtained as http:// m2:8080/getUserInfo, and the first service name ms2 can be extracted from the first service address.
And 203, analyzing the first service name to obtain the IP address corresponding to the first service name.
In the application, the corresponding relation among the service names, the channels and the IP addresses can be established according to the channels where the micro services are located and the service names of the micro services. Because the micro-service to be called by the first micro-service and the first micro-service are in the same channel, the corresponding relation can be queried according to the first service name and the channel where the first micro-service is located, and the IP address corresponding to the first service name and the channel where the first micro-service is located can be determined.
And step 204, updating the first service address according to the IP address to obtain a second service address.
In the application, the first service name in the first service address can be replaced by the IP address to obtain the second service address. For example, if the first service address is http:// ms2:8080/getUserInfo and the IP address is 192.168.1.1, replacing ms with the IP address can obtain the second service address of http://192.168.1.1:8080/getUserInfo.
Step 205, calling a second micro-service corresponding to the first service name according to the second service address.
In the application, the second micro-service with the service name of the first service name can be called by using the second service address.
In the embodiment of the application, when the first micro service calls other micro services, a first service address is obtained, a first service name is extracted from the first service address, the first service name is analyzed to obtain an IP address corresponding to the first service name, the first service address is updated according to the IP address to obtain a second service address, and finally a second micro service corresponding to the first service name is called according to the second service address. Therefore, when other micro services are called, the service name can be analyzed to obtain the IP address, and further the service address for calling the other micro services is obtained according to the IP address, so that the other micro services can be called according to the service name, the control of each micro service is not needed, and the operation and maintenance configuration is simple.
Fig. 3 is a flowchart of another micro service invocation method according to an embodiment of the present application.
As shown in fig. 3, the micro service invocation method includes:
in step 301, when the first micro service invokes other micro services, a first service address is obtained.
Step 302, a first service name is extracted from a first service address.
In the present application, steps 301 to 302 may be referred to the description of the related content in the above embodiment, so that the description is omitted here.
In step 303, the first micro service invokes the service name resolution service, and determines a second service name according to the first service name.
In the application, the first micro-service can call the service name analysis service, and the service name analysis service can determine the second service name according to whether the first service name contains the preset character or not and the position of the preset character if the first service name contains the preset character. Wherein the second service name may include the first service name.
As a possible implementation manner, whether the first service name contains a preset character or not may be judged, if the first service name does not contain the preset character, the label information of the host where the second micro service is located may be queried from the environment variable or DNS configuration file, the label information includes a channel to which the host belongs, and then the first service name and the label information may be spliced to obtain the second service name, where the second service name includes information of the channel where the micro service to be invoked is located. Therefore, the channel information can be automatically supplemented according to the label information of the host computer, and the service calling channel can be maintained.
In the application, the label information of the host is obtained according to the channel configuration of the host.
For example, the first service name is ms2, the tag information is hx.demo.com, where hx is a channel name, and the first service name and the second service name are spliced according to a preset sequence to obtain a second service name ms2.hx.demo.com.
If the first service name contains preset characters and the preset characters are located at non-preset positions in the first service name, a second analysis request can be sent to a service name analysis service end, wherein the second analysis request comprises the first service name, the service name analysis service end can inquire an IP address according to the first service name, if information which is returned by the service name analysis service end and is not inquired to the IP address is received, the fact that the IP address is inquired according to the first service name fails is indicated, label information of a host where a second micro service is located can be inquired from an environment variable or DNS configuration file, and the first service name and the label information are spliced to obtain the second service name. Therefore, when the inquiry of the IP address fails according to the first service name, the channel information can be supplemented according to the label information of the host computer, and the service calling channel can be maintained.
For example, the first service name is in the form of "a.b", where the first service name includes a preset character ". And the preset character is not the last character of the first service name, then the first service name may be sent to the service name analysis server for analysis, and if analysis fails, then the first service name and the label information of the host are spliced to obtain a second service name, and the second service name is used to apply for analysis to the service name analysis server.
If the first service name contains a preset character and the character at the preset position in the first service name is the preset character, the first service name can be determined to be the second service name. For example, in the form of "a.b." the first service name, the last character of the first service name is a preset character ", the first service name can be determined as the second service name.
The preset character is "", and if the first service name does not contain "", the first service name and the acquired host tag information can be spliced to obtain a second service name; if the first service name contains "," and the character is not the last character of the first service name, the first service name can be used for applying for analysis service to the service name analysis service end, and if the IP address is not queried, the first service name and the label information of the host can be spliced to obtain a second service name; if the first service name contains "," and the last character of the first service name is "," the first service name can be directly used for applying the analysis service to the service name analysis service end without splicing the label information of the host. Therefore, the channel information can be supplemented according to whether the first service name contains the preset character or not, if the channel information does not contain the preset character, the second service name is determined according to the position of the preset character, and therefore other micro services can be called in various scenes, and the application range is wide.
Step 304, a first resolving request is sent to a service name resolving server, wherein the first resolving request includes a second service name.
In the application, after determining the second service name, the first micro service may send a first analysis request to the service name analysis server, where the first analysis request may include the second service name, and the second service name may include the first service name, and may also include label information of the host, and so on. The service name analysis server side can query the corresponding relation between the second service name and the IP address of each micro service according to the second service name of the micro service to be called, determine the IP address corresponding to the second service name of the micro service to be called by the first micro service, and return the IP address to the first micro service.
For example, the second service name is obtained by splicing the first service name and the tag information, so that the service name analysis server can query the IP address by using the complete service name. The second service name contains channel information, so that the channel maintenance of service call can be realized.
Step 305, obtaining the IP address corresponding to the second service name returned by the service name resolution server.
In the application, the first micro-service can acquire the IP address corresponding to the second service name returned by the service name analysis service end.
And 306, updating the first service address according to the IP address to obtain a second service address.
Step 307, calling a second micro-service corresponding to the first service name according to the second service address.
In the present application, steps 306 to 307 can be referred to the description of the related content in the above embodiment, so that the description is omitted here.
In the application, the second service name obtained by splicing the first service name information and the label information of the host can be inquired to obtain the IP address, and the second service address is obtained by updating the IP address to call the second micro-service, thereby realizing the calling of the micro-service by the service name, and automatically supplementing channel information according to the label information of the host, and realizing the maintenance of the service calling channel.
In the embodiment of the application, a first micro service calls a service name analysis service, a second service name is determined according to the first service name, and a first analysis request is sent to a service name analysis service end, wherein the first analysis request comprises the second service name, an IP address corresponding to the second service name returned by the service name analysis service end is acquired, the first service address is updated by using the IP address, a second service address is obtained, and the second micro service is called by using the second service address. Therefore, the first micro service can determine the second service name by calling the service name analysis service, so that the service name analysis service end queries the IP address through the second service name, the first service name is analyzed to obtain the IP address, and the micro service is called according to the service name.
Fig. 4 is a flowchart of another micro service invocation method according to an embodiment of the present application. The micro service calling method can be executed by a service name analysis server.
As shown in fig. 4, the micro service invocation method includes:
step 401, a first analysis request sent by a first micro service is obtained, where the first analysis request includes a second service name.
In the application, the service name analysis server can receive the first analysis request sent by the first micro service, and the analysis request comprises the second service name. The second service name may include a first service name, where the first service name is a name of a micro service to be called by the first micro service.
In some embodiments, the second service name includes a first service name and may further include tag information, where the tag information may include channel information to which a host to which the micro service to be invoked by the first micro service belongs.
And step 402, according to the second service name, inquiring to obtain the IP address corresponding to the second service name.
The service name analysis server side can query the corresponding relation between the second service name and the IP address of each micro service according to the second service name of the micro service to be called, and determine the IP address corresponding to the second service name of the micro service to be called by the first micro service.
For example, the second service name is obtained by splicing the first service name and the tag information, so that the service name analysis server can query the IP address by using the complete service name. The second service name contains channel information, so that the channel maintenance of service call can be realized.
And step 403, returning the IP address corresponding to the second service name to the first micro service.
And the service name analysis server returns the queried IP address to the first micro service. Optionally, if the IP address is not queried, information of the non-queried IP address is returned to the first micro service.
In the embodiment of the application, the service name analysis server can acquire the first analysis request sent by the first micro service, inquire the IP address corresponding to the second service name according to the second service name in the first analysis request, and return the inquired IP address to the first micro service. Therefore, the IP address can be inquired through the second service name, the service name can be analyzed to obtain the IP address, and the micro service can be called according to the service name.
In order to facilitate understanding of the above embodiments, the following description is given in connection with the following embodiments.
The present application provides a generic, cross-language, non-intrusive channel retention mechanism.
Integral frame: 1. channel specification: dividing channels, including a host list, and planning service domain name segmentation; 2. name resolution service: providing service name analysis service, which is responsible for analyzing the service name into an IP address; 3. micro-services: calling other micro-services by adopting a service name; 4. host tag configuration: the label information is configured at the host according to the home channel.
Channel specification: the number of channels deployed for an application is normalized, e.g. 2 channels (core channel, internet channel), and hosts are assigned to a certain channel, each host can only be assigned to one channel. Such as host 1 belonging to the core channel.
Host tag configuration: according to the channel information of the host, a label (namely, label information) is set on the host, and the label contains the channel information. One tag content is as follows:
{ channel name }. Demo.com
Channel name: channel names, such as hx, represent core channels and hlw represent internet channels.
Through the label, each micro-service has different complete service long names in different channels, and the channel distinction can be carried out by using the complete service long names.
The host tag is provided with multiple methods as follows: 1. modifying on the host that the DNS search contains label information, such as hx.demo.com, indicating that the host belongs to the core channel; 2. an environment variable, such as table=hx.demo.com, is set in the user where the micro service is running.
Name resolution service: there are many implementations for managing resolving service names to IP addresses, such as DNS services or micro-service registries like nacos.
The service name analysis server configures different addresses for the same service name (e.g. ms 2) according to different channels, as follows:
core channel ms2.hx.demo.com 192.168.1.1
Internet channel ms2.hlw.demo.com 192.168.1.2.
Micro-services: when other services are called, a service name mode is adopted, and an IP address is not adopted. To support multiple scenarios when invoking other services, the following three approaches may be used:
1. if the service name does not contain the label information of the host, the label information of the host is spliced, and then the service name analysis server applies for analysis service.
2. The service name contains "," but is not the last character, the service name analysis server applies for analysis service, if the service name cannot be found, the host label information is spliced, and then the service name analysis is requested again.
3. The service name always contains "," and is the last character, the host label information is not spliced, and the service name analysis server side is directly applied for analysis service. If no direct error is found, the parsing is terminated.
Taking core channel micro service ms1 as an example to call micro service ms2, micro services ms1 and ms2 have two channels, and the addresses of the two channels ms2 are as follows:
core channel ms2.hx.demo.com 192.168.1.1
Internet channel ms2.hlw.demo.com 192.168.1.2
When the micro service ms1 calls the service, a configuration file or a configuration table is read to acquire a call service address, such as http:// ms2:8080/getUserInfo. The service name ms2 is obtained from the service address by analysis, and the obtained name only has the service name and does not contain channel information.
ms1 calls a service name analysis program client to analyze the service name, and a parameter ms2 is transmitted;
the service name parser client queries the label information of the host computer running the micro service ms1 from the environment variable or DNS configuration file to obtain the configuration "hx.demo.com",
because the input parameter "ms2" does not contain ", the" ms2 "and get host tag configuration" hx.demo.com "are concatenated to get the full service name" ms2.hx.demo.com ". The domain name contains channel information.
The service name analysis program client requests the complete service name to be analyzed from the service name analysis program server. The service name analysis program server receives the request, the content is 'ms2.hx.demo.com', and the IP corresponding to the service name is found to be 192.168.1.1. The IP address 192.168.1.1 is returned to the client.
After receiving the returned IP address, the service name parser client returns the result to ms1.
The micro service ms1 fills the obtained IP address into the service address, obtains the call address "http://192.168.1.1:8080/getUserInfo", and uses this address to call the micro service ms2.
The channel names mentioned above are only examples, and the channel names may be set according to actual needs, which is not limited thereto.
The scheme of the application is based on the channel specification, adopts service name calling and automatically supplements channel information according to the label information of the host computer, and realizes service calling channel maintenance. The multiple service name configuration modes are applicable to multiple application scenes.
The scheme of the application adopts the automatic supplementing mechanism of the label and the label information arranged on the host, and the application service does not need to be modified, so long as the position of the original configuration IP address is changed into the service name, and the programming language and the development framework can not be limited. The integration can be easily accessed even if the service is not designed with the multi-channel configuration in mind.
The scheme of the application has the advantages of small application transformation and wide application range, is suitable for a plurality of initial non-sub-channels, can be used for carrying out sub-channel deployment along with the subsequent service expansion, and can be used for rapidly realizing channel maintenance, flow isolation and resource isolation.
In order to achieve the above embodiment, the embodiment of the present application further provides a micro service calling device. Fig. 5 is a schematic structural diagram of a micro service call device according to an embodiment of the present application.
As shown in fig. 5, the micro service invocation apparatus 500 includes:
the obtaining module 510 is configured to obtain a first service address when the first micro service invokes other micro services;
an extracting module 520, configured to extract a first service name from the first service address;
the parsing module 530 is configured to parse the first service name to obtain an IP address corresponding to the first service name;
an updating module 540, configured to update the first service address according to the IP address to obtain a second service address;
and the calling module 550 is configured to call a second micro service corresponding to the first service name according to the second service address.
In one possible implementation manner of the embodiment of the present application, the parsing module 530 is configured to:
the first micro service calls a service name analysis service, and a second service name is determined according to the first service name;
sending a first analysis request to a service name analysis server, wherein the first analysis request comprises a second service name;
and acquiring the IP address corresponding to the second service name returned by the service name analysis server.
In one possible implementation manner of the embodiment of the present application, the parsing module 530 is configured to:
inquiring label information of a host where the second micro service is located under the condition that the first service name does not contain preset characters; the label information comprises a channel to which the host belongs;
and splicing the first service name with the tag information to obtain a second service name.
In one possible implementation manner of the embodiment of the present application, the parsing module 530 is configured to:
under the condition that the first service name comprises preset characters and the preset characters are located at non-preset positions in the first service name, a second analysis request is sent to a service name analysis service end, wherein the second analysis request comprises the first service name;
under the condition that the information of the IP address is not queried and returned by the service name analysis server, querying the label information of the host where the second micro-service is located; the label information comprises a channel to which the host belongs;
and splicing the first service name with the tag information to obtain a second service name.
In one possible implementation manner of the embodiment of the present application, the parsing module 530 is configured to:
and determining the first service name as the second service name under the condition that the first service name comprises preset characters and the characters at the preset positions in the first service name are preset characters.
The explanation of the micro service invocation method embodiment is also applicable to the micro service invocation device of this embodiment, and therefore will not be repeated here.
In the embodiment of the application, when the first micro service calls other micro services, a first service address is obtained, a first service name is extracted from the first service address, the first service name is analyzed to obtain an IP address corresponding to the first service name, the first service address is updated according to the IP address to obtain a second service address, and finally a second micro service corresponding to the first service name is called according to the second service address. Therefore, when other micro services are called, the service name can be analyzed to obtain the IP address, and further the service address for calling the other micro services is obtained according to the IP address, so that the other micro services can be called according to the service name, the control of each micro service is not needed, and the operation and maintenance configuration is simple.
In order to achieve the above embodiment, the embodiment of the present application further provides a micro service calling device. Fig. 6 is a schematic structural diagram of another micro service invocation apparatus according to an embodiment of the present application.
As shown in fig. 6, the micro service invocation apparatus 600 includes:
an obtaining module 610, configured to obtain a first resolution request sent by a first micro service, where the first resolution request includes a second service name;
the query module 620 is configured to query for an IP address corresponding to the second service name according to the second service name;
and a return module 630, configured to return the IP address corresponding to the second service name to the first micro service.
The explanation of the micro service invocation method embodiment is also applicable to the micro service invocation device of this embodiment, and therefore will not be repeated here.
In the embodiment of the application, a first micro service calls a service name analysis service, a second service name is determined according to the first service name, and a first analysis request is sent to a service name analysis service end, wherein the first analysis request comprises the second service name, an IP address corresponding to the second service name returned by the service name analysis service end is acquired, the first service address is updated by using the IP address, a second service address is obtained, and the second micro service is called by using the second service address. Therefore, the first micro service can determine the second service name by calling the service name analysis service, so that the service name analysis service end queries the IP address through the second service name, the first service name is analyzed to obtain the IP address, and the micro service is called according to the service name.
In order to implement the above embodiments, the embodiments of the present application further provide a computer device, including a processor and a memory;
wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, for implementing the micro service invocation method as described in the above embodiment.
In order to implement the above-described embodiments, the embodiments of the present application also propose a non-transitory computer-readable storage medium, on which a computer program is stored, which when being executed by a processor implements the micro service invocation method as described in the above-described embodiments.
In the description of this specification, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
While embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.

Claims (14)

1. A micro service invocation method, comprising:
when the first micro service calls other micro services, a first service address is obtained;
extracting a first service name from the first service address;
analyzing the first service name to obtain an IP address corresponding to the first service name;
updating the first service address according to the IP address to obtain a second service address;
and calling a second micro-service corresponding to the first service name according to the second service address.
2. The method of claim 1, wherein the parsing the first service name to obtain the IP address corresponding to the first service name comprises:
the first micro service calls a service name analysis service, and a second service name is determined according to the first service name;
a first analysis request is sent to a service name analysis server, wherein the first analysis request comprises the second service name;
and acquiring the IP address corresponding to the second service name returned by the service name analysis server.
3. The method of claim 2, wherein said determining a second service name from said first service name comprises:
inquiring label information of a host where the second micro service is located under the condition that the first service name does not contain preset characters; the label information comprises a channel to which the host belongs;
and splicing the first service name with the tag information to obtain the second service name.
4. The method of claim 2, wherein said determining a second service name from said first service name comprises:
sending a second analysis request to the service name analysis service end under the condition that the first service name contains preset characters and the preset characters are located at non-preset positions in the first service name, wherein the second analysis request comprises the first service name;
under the condition that the information of the IP address is not queried and returned by the service name analysis server, querying the label information of the host where the second micro service is located; the label information comprises a channel to which the host belongs;
and splicing the first service name with the tag information to obtain the second service name.
5. The method of claim 2, wherein said determining a second service name from said first service name comprises:
and determining the first service name as the second service name under the condition that the first service name comprises preset characters and the characters at the preset positions in the first service name are the preset characters.
6. A micro service invocation method, comprising:
acquiring a first analysis request sent by a first micro service, wherein the first analysis request comprises a second service name;
inquiring to obtain an IP address corresponding to the second service name according to the second service name;
and returning the IP address corresponding to the second service name to the first micro service.
7. A micro service invocation apparatus, comprising:
the acquisition module is used for acquiring a first service address when the first micro service calls other micro services;
the extraction module is used for extracting a first service name from the first service address;
the analysis module is used for analyzing the first service name to obtain an IP address corresponding to the first service name;
the updating module is used for updating the first service address according to the IP address to obtain a second service address;
and the calling module is used for calling the second micro-service corresponding to the first service name according to the second service address.
8. The apparatus of claim 7, wherein the parsing module is to:
the first micro service calls a service name analysis service, and a second service name is determined according to the first service name;
a first analysis request is sent to a service name analysis server, wherein the first analysis request comprises the second service name;
and acquiring the IP address corresponding to the second service name returned by the service name analysis server.
9. The apparatus of claim 8, wherein the parsing module is to:
inquiring label information of a host where the second micro service is located under the condition that the first service name does not contain preset characters; the label information comprises a channel to which the host belongs;
and splicing the first service name with the tag information to obtain the second service name.
10. The apparatus of claim 8, wherein the parsing module is to:
sending a second analysis request to the service name analysis service end under the condition that the first service name contains preset characters and the preset characters are located at non-preset positions in the first service name, wherein the second analysis request comprises the first service name;
under the condition that the information of the IP address is not queried and returned by the service name analysis server, querying the label information of the host where the second micro service is located; the label information comprises a channel to which the host belongs;
and splicing the first service name with the tag information to obtain the second service name.
11. The apparatus of claim 8, wherein the parsing module is to:
and determining the first service name as the second service name under the condition that the first service name comprises preset characters and the characters at the preset positions in the first service name are the preset characters.
12. A micro service invocation apparatus, comprising:
the acquisition module is used for acquiring a first analysis request sent by a first micro-service, wherein the first analysis request comprises a second service name;
the query module is used for querying and obtaining the IP address corresponding to the second service name according to the second service name;
and the return module is used for returning the IP address corresponding to the second service name to the first micro service.
13. A computer device comprising a processor and a memory;
wherein the processor runs a program corresponding to executable program code stored in the memory by reading the executable program code for implementing the method according to any one of claims 1-5 or for implementing the method according to claim 6.
14. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-5 or the method according to claim 6.
CN202310978219.8A 2023-08-04 2023-08-04 Micro-service calling method, micro-service calling device, computer equipment and storage medium Pending CN117221383A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310978219.8A CN117221383A (en) 2023-08-04 2023-08-04 Micro-service calling method, micro-service calling device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310978219.8A CN117221383A (en) 2023-08-04 2023-08-04 Micro-service calling method, micro-service calling device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117221383A true CN117221383A (en) 2023-12-12

Family

ID=89048625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310978219.8A Pending CN117221383A (en) 2023-08-04 2023-08-04 Micro-service calling method, micro-service calling device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117221383A (en)

Similar Documents

Publication Publication Date Title
US8583810B2 (en) Session affinity cache and manager
US7529833B2 (en) Method, system, and web service broker for dynamic web service invocation
US7509422B2 (en) System and method for locating web services
EP1355231A2 (en) Processing data files using plug-ins
CN110413418B (en) Cache synchronization device and method, cache synchronization system and electronic equipment
US8214472B2 (en) Registering a common information model provider to a common information model object manager
US20100313197A1 (en) System and method for operating domain profile using database in core framework for sdr mobile terminals
CN103077024A (en) Device and method for supporting customization and running of software-as-a-service (SaaS) application processes
CN111245634B (en) Virtualization management method and device
US20210092073A1 (en) Resource trees by management controller
US20230205503A1 (en) Method for dynamically integrating application programs, and software system and machine using the same
US20090165011A1 (en) Resource management method, information processing system, information processing apparatus, and program
US9189546B2 (en) Semantic client, semantic information management server, method of generating semantic information, method of searching semantic information, and computer program recording medium for performing the methods
CN107968725B (en) Method and device for returning and configuring configuration information of home gateway unit type terminal device
CN117221383A (en) Micro-service calling method, micro-service calling device, computer equipment and storage medium
CN112702441B (en) Container-based access data processing method, device, system and storage medium
CN115795212A (en) Page display method and device, electronic equipment and storage medium
CN111935329B (en) Domain name resolution method and device
CN111782413B (en) Cross-application component communication method and device
US8359383B2 (en) Ubiquitous service framework system for supporting service in multiple domain and method thereof
CN110266762A (en) A kind of data uploading method, system, device and storage medium
CN110943968A (en) Equipment access control method and equipment access assembly
CN116150250B (en) PostgreSQL-based dual-port analysis method and device
CN110890110A (en) Method for integrating VR player in VR all-in-one machine and storage medium
CN117149469B (en) Method, device, equipment and storage medium for calling host function by H5 page

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