Service instance calling method, electronic equipment, data center and storage medium
Through the grouping identification mapping relationship of service instances, the problem of low efficiency in service instance calls is solved, and more efficient service instance calls and coordination are achieved.
Patent Information
- Application Number
- CN202411190815.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-06
AI Technical Summary
The inefficiency of calling between service instances results in the long call chain and the inability to effectively coordinate and cooperate.
Through the grouping identity mapping relationship of the service instance, the grouping identity of the target service instance is obtained, and the target service instance is called based on the identity to shorten the length of the call chain.
It effectively improves the call efficiency between service instances, reduces the length of the call chain, and improves the coordination and coordination capabilities of service instances.
Smart Images

Figure CN119094618A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology, and in particular to a service instance calling method, electronic equipment, a data center and a storage medium. Background Art
[0002] As the functions of applications become increasingly complex, applications are usually split into multiple independent services, each of which is responsible for a specific business function or business logic. The services coordinate and cooperate with each other to achieve the overall function.
[0003] Each service can include multiple service instances. Multiple service instances provide the same functions and form redundancy and backup between each other. Multiple service instances corresponding to the same service can run in different data centers, and each data center can be located in different geographical locations. When service instances call each other, there are usually technical problems such as long call chains and low service instance call efficiency. Summary of the invention
[0004] In view of this, an embodiment of the present application provides a service instance calling method, an electronic device, a data center and a storage medium, which can effectively improve the calling efficiency of the service instance.
[0005] In the first aspect, an embodiment of the present application provides a service instance calling method, the method comprising: a first service instance obtains the name of a target service; wherein the target service is a service to which the target service instance that the first service instance needs to call belongs, the target service includes M service instances, the target service instance is one of the M service instances, and M is a positive integer greater than or equal to 1; the first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service; wherein different group identifiers of the service instance are used to distinguish different geographical ranges of the service instance; there is a preset mapping relationship between the group identifier of the first service instance and the group identifier of the target service instance; the first service instance calls the target service instance based on the name of the target service and the group identifier of the target service instance.
[0006] Optionally, the first service instance calls the target service instance based on the name of the target service and the group identifier of the target service instance, including: the first service instance obtains the IP address and port number of the target service instance based on the name of the target service and the group identifier of the target service instance; the first service instance calls the target service instance from the M service instances based on the IP address and port number of the target service instance.
[0007] Optionally, the first service instance obtains the IP address and port number of the target service instance based on the name of the target service and the group identifier of the target service instance, including: the first service instance sends the name of the target service and the group identifier of the target service instance to a service discovery server, so that the service discovery server determines the IP address and port number of the target service instance based on the name of the target service and the group identifier of the target service instance; the first service instance receives the IP address and port number of the target service instance sent by the service discovery server.
[0008] Optionally, the first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service, including: the first service instance sends the first service instance's own group identifier and the name of the target service to a service discovery server, so that the service discovery server obtains the group identifier of the target service instance based on the first service instance's own group identifier and the name of the target service; wherein the service discovery server stores a preset mapping relationship between the first service instance's own group identifier and the group identifier of the target service instance; and the first service instance receives the group identifier of the target service instance sent by the service discovery server.
[0009] Optionally, before the first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service, the method also includes: the first service instance sends its corresponding environment variables to the service discovery server, so that the service discovery server determines the group identifier of the first service instance itself based on the environment variables; the first service instance receives the group identifier of the first service instance itself sent by the service discovery server.
[0010] Optionally, the service discovery server obtains the group identifier of the target service instance based on the group identifier of the first service instance itself and the name of the target service, including: the service discovery server determines the first target group identifier based on the group identifier of the first service instance itself and the name of the target service; wherein the service instance corresponding to the first target group identifier is within the same geographical scope as the first service instance, and there is a preset mapping relationship between the group identifier of the first service instance itself and the first target group identifier; it is determined whether the service instance corresponding to the first target group identifier exists; if a service instance corresponding to the first target group identifier exists, the first target group identifier is used as the group identifier of the target service instance.
[0011] Optionally, the service discovery server obtains the group identifier of the target service instance based on the group identifier of the first service instance itself and the name of the target service, and also includes: if there is no service instance corresponding to the first target group identifier, the service discovery server determines a second target group identifier based on the group identifier of the first service instance itself and the name of the target service; wherein the service instance corresponding to the second target group identifier is within the same geographical scope or in a different geographical scope as the first service instance, and there is a preset mapping relationship between the group identifier of the first service instance itself and the second target group identifier; determines whether the service instance corresponding to the second target group identifier exists; if there is a service instance corresponding to the second target group identifier, uses the second target group identifier as the group identifier of the target service instance.
[0012] In the second aspect, an embodiment of the present application also provides an electronic device, comprising: a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, and is used to execute any service instance calling method provided in the embodiments of the present application.
[0013] In a third aspect, an embodiment of the present application further provides a data center, which includes any electronic device provided in the embodiment of the present application.
[0014] In a fourth aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute any one of the service instance calling methods provided in the embodiments of the present application.
[0015] An embodiment of the present application provides a service instance calling method, in which a first service instance can obtain the name of a target service, and based on its own group identifier and the name of the target service, can obtain the group identifier of the target service instance. Since there is a preset mapping relationship between the group identifier of the first service instance and the group identifier of the target service instance, the first service instance can call the target service instance corresponding to the first service instance based on the name of the target service and the group identifier of the target service instance. Specifically, the first service instance can call the target service instance in the same geographical range as the first service instance, thereby effectively shortening the length of the call chain and improving the calling efficiency between service instances. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A flow chart of a service instance calling method provided in an embodiment of the present application;
[0018] Figure 2 A schematic diagram of an application scenario of the service instance calling method provided in an embodiment of the present application;
[0019] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0020] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0021] It should be clear that the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] In a first aspect, an embodiment of the present application provides a service instance calling method, which can shorten the length of the calling chain and solve the technical problem of low efficiency of service instance calling.
[0023] like Figure 1 As shown, an embodiment of the present application provides a service instance calling method, including:
[0024] S11, the first service instance obtains the name of the target service; wherein, the target service is the service to which the target service instance that the first service instance needs to call belongs, the target service includes M service instances, the target service instance is one of the M service instances, and M is a positive integer greater than or equal to 1.
[0025] In this step, each service may include one or more service instances. Multiple service instances included in a service may be deployed on different servers respectively. The first service instance may be any service instance, and the embodiment of the present application does not impose any limitation on this.
[0026] Service instances often need to call each other to complete specific tasks. When the first service instance needs to call a service instance (i.e., the target service instance), the name of the service to which the target service instance belongs (i.e., the target service) can be determined first. In a specific implementation, when the first service instance receives a task request sent by a client, it can determine the name of the target service based on the business logic in the task request.
[0027] It can be understood that, in addition to the target service instance, the target service may also include other service instances.
[0028] S12, the first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service; wherein, different group identifiers of the service instance are used to distinguish different geographical ranges where the service instance is located; there is a preset mapping relationship between the group identifier of the first service instance and the group identifier of the target service instance.
[0029] Specifically, since different service instances of the same service can be deployed on different servers, different servers can be in different geographical ranges. In an embodiment of the present application, a group identifier corresponding to the geographical range of each service instance can be allocated in advance to each service instance based on the geographical range where the service instance is located. Therefore, the group identifier can be used to indicate the geographical range where the server where the service instance is running is located. In a specific implementation method, during the service instance registration process, a corresponding group identifier can be allocated to the service instance based on the geographical range where the service instance is located.
[0030] For example, Figure 2 As shown, Figure 2 A schematic diagram of an application scenario of a service instance calling method is shown. The service to which the first service instance belongs is recorded as service A, and service A includes three service instances, namely service instance A1, service instance A2, and service instance A3. Service instance A1 runs on server BJ in the Beijing data center, so the geographical scope of service instance A1 is in the Beijing data center. When registering service instance A1, group identifier IDC1 can be assigned to registered service instance A1.
[0031] Similarly, the service instance A2 runs on the server SH in the Shanghai data center, so the geographical scope of the service instance A2 is in the Shanghai data center. When registering the service instance A2, the group identifier IDC2 can be assigned to the registered service instance A2.
[0032] The service instance A3 runs on the server SZ of the Shenzhen data center, so the geographical range of the service instance A3 is in the Shenzhen data center. When registering the service instance A3, the group identifier IDC3 can be assigned to the registered service instance A3.
[0033] The target service is recorded as service B. Service B includes three service instances, namely service instance B1, service instance B2 and service instance B3. The geographical scope of service instance B1 is in the Beijing data center. When registering service instance B1, the group identifier IDCA can be assigned to the registered service instance B1. Similarly, the geographical scope of service instance B2 is in the Shanghai data center. When registering service instance B2, the group identifier IDCB can be assigned to the registered service instance B2. The geographical scope of service instance B3 is in the Shenzhen data center. When registering service instance B3, the group identifier IDCC can be assigned to the registered service instance B3.
[0034] The user can establish a mapping relationship between the group identifier IDC1 and the group identifier of the service instance included in service B according to actual needs. In a specific implementation, since IDC1 and IDCA represent the same geographical scope (Beijing data center), IDC2 and IDCB represent the same geographical scope (Shanghai data center), and IDC3 and IDCC represent the same geographical scope (Shenzhen data center), the mapping relationship between the group identifier IDCA and the group identifier IDC1 can be pre-established according to the geographical scope. Similarly, the mapping relationship between IDCB and the group identifier IDC2, as well as the mapping relationship between IDCC and the group identifier IDC3 can also be pre-established.
[0035] In this way, based on the aforementioned mapping relationship, the first service instance can determine the group identifier of the target service instance according to its own group identifier and the name of the target service, thereby determining the target service instance corresponding to the first service instance. Specifically, the target service instance corresponding to the first service instance can be a target service instance in the same geographical range as the first service instance.
[0036] For example, there is a preset mapping relationship between the group identifier IDC1 and the group identifier IDCA. The group identifier of the first service instance is IDC1. Based on the preset mapping relationship, the first service instance can determine that the group identifier of the target service instance is IDCA based on its own service identifier IDC1 and the name of the target service.
[0037] S13: The first service instance calls the target service instance based on the name of the target service and the group identifier of the target service instance.
[0038] In this step, the first service instance can call the target service instance corresponding to the first service instance based on the name of the target service and the group identifier of the target service instance. Specifically, the first service instance can call the target service instance in the same geographical range as the first service instance, thereby reducing the length of the call chain between service instances and improving the calling efficiency of the service instance.
[0039] An embodiment of the present application provides a service instance calling method, in which a first service instance can obtain the name of a target service, and based on its own group identifier and the name of the target service, can obtain the group identifier of the target service instance. Since there is a preset mapping relationship between the group identifier of the first service instance and the group identifier of the target service instance, the first service instance can call the target service instance corresponding to the first service instance based on the name of the target service and the group identifier of the target service instance. Specifically, the first service instance can call the target service instance in the same geographical range as the first service instance, thereby effectively shortening the length of the call chain and improving the calling efficiency between service instances.
[0040] Optionally, in some embodiments of the present application, the first service instance calls the target service instance based on the name of the target service and the group identifier of the target service instance (step S13), which may include: the first service instance obtains the IP address and port number of the target service instance based on the name of the target service and the group identifier of the target service instance; the first service instance calls the target service instance from the M service instances based on the IP address and port number of the target service instance.
[0041] In an embodiment of the present application, for each service instance, an association relationship between the name of the service to which the service instance belongs and the group identifier of the service instance and the IP address and port number of the service instance can be established in advance.
[0042] Exemplarily, the name of the target service (ie, service B) to which the target service instance B1 belongs is SERB, the group identifier of the target service instance B1 is IDCA, the IP address of the target service instance B1 is IP1, and the port number of the target service instance B1 is Port1. The above information can be associated in advance.
[0043] In this way, the first service instance can obtain the IP address and port number of the target service instance based on the above association relationship, according to the name of the target service and the group identifier of the target service instance. Next, the first service instance can call the target service instance from the aforementioned M service instances according to the IP address and port number of the target service instance to implement the function corresponding to the target service instance.
[0044] Optionally, in some embodiments of the present application, the first service instance obtains the IP address and port number of the target service instance based on the name of the target service and the group identifier of the target service instance, which may include: the first service instance sends the name of the target service and the group identifier of the target service instance to a service discovery server, so that the service discovery server determines the IP address and port number of the target service instance based on the name of the target service and the group identifier of the target service instance; the first service instance receives the IP address and port number of the target service instance sent by the service discovery server.
[0045] In the embodiment of the present application, a corresponding service discovery server may be pre-set in each data center, and the aforementioned preset association relationship may be stored in the service discovery server. Figure 2 The service discovery server in the Beijing data center is shown in FIG. When the first service instance is located in the Shanghai data center or the Shenzhen data center, a corresponding service discovery server can also be set in the corresponding data center, which is not described in detail here. In this way, the first service instance can obtain the IP address and port number of the target service instance with the help of the service discovery server.
[0046] Specifically, the first service instance can send the name of the target service and the group identifier of the target service instance to the service discovery server. After receiving the name of the target service and the group identifier of the target service instance, the service discovery server can obtain the IP address and port number of the target service instance according to the aforementioned preset mapping relationship, and send it to the first service instance. In this way, the first service instance can receive the IP address and port number of the target service instance from the service discovery server.
[0047] Optionally, in some embodiments of the present application, the first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service (step S12), which may include: the first service instance sends the first service instance's own group identifier and the name of the target service to a service discovery server, so that the service discovery server obtains the group identifier of the target service instance based on the first service instance's own group identifier and the name of the target service; wherein the service discovery server stores a preset mapping relationship between the first service instance's own group identifier and the group identifier of the target service instance; and the first service instance receives the group identifier of the target service instance sent by the service discovery server.
[0048] In an embodiment of the present application, a preset mapping relationship between the group identifier of the first service instance itself and the group identifier of the target service instance is stored in the service discovery server. In this way, after the first service instance sends the group identifier of the first service instance itself and the name of the target service to the service discovery server, the service discovery server can determine the group identifier of the target service instance based on the group identifier of the first service instance itself and the name of the target service, and send it to the first service instance. In this way, the first service instance can receive the group identifier of the target service instance from the service discovery server.
[0049] Optionally, in some embodiments of the present application, before the first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service (step S12), the method may further include: the first service instance sends its corresponding environment variables to the service discovery server, so that the service discovery server determines the group identifier of the first service instance itself based on the environment variables; the first service instance receives the group identifier of the first service instance itself sent by the service discovery server.
[0050] In the embodiment of the present application, environment variables generally refer to some parameters used to specify the operating environment of the operating system in the operating system. When registering the first service instance, the first service instance can be assigned corresponding environment variables, which include the identity information of the first service instance.
[0051] Therefore, the first service instance can send its corresponding environment variables to the service discovery server. The service discovery server can determine the identity information of the first service instance based on the environment variables, and then, based on the identity information of the first service instance, obtain the group identifier of the first service instance itself and send it to the first service instance. In this way, the first service instance can receive the group identifier of the first service instance itself sent by the service discovery server.
[0052] Optionally, in some embodiments of the present application, the service discovery server obtains the group identifier of the target service instance based on the group identifier of the first service instance itself and the name of the target service, which may include: the service discovery server determines the first target group identifier based on the group identifier of the first service instance itself and the name of the target service; wherein the service instance corresponding to the first target group identifier is within the same geographical scope as the first service instance, and there is a preset mapping relationship between the group identifier of the first service instance itself and the first target group identifier; determines whether the service instance corresponding to the first target group identifier exists; if a service instance corresponding to the first target group identifier exists, uses the first target group identifier as the group identifier of the target service instance.
[0053] In an embodiment of the present application, a group identifier representing the same geographical range as the group identifier of the first service instance can be used as the first target group identifier in advance, and the mapping relationship between the two can be stored in the service discovery server. Specifically, using the above example, the group identifier of the first service instance is IDC1, and correspondingly, the first target group identifier can be IDCA.
[0054] In this way, the service discovery server can determine the group identifier (first target group identifier) that has a mapping relationship with its group identifier based on the group identifier of the first service instance and the name of the target service, and then determine whether the service instance corresponding to the first target group identifier exists. If it exists, the first target group identifier can be used as the group identifier of the target service instance, so that the first service instance can call the service instance corresponding to the first target group identifier.
[0055] Optionally, in some embodiments of the present application, the service discovery server obtains the group identifier of the target service instance based on the group identifier of the first service instance itself and the name of the target service, and may also include: if there is no service instance corresponding to the first target group identifier, the service discovery server determines the second target group identifier based on the group identifier of the first service instance itself and the name of the target service; wherein the service instance corresponding to the second target group identifier is within the same geographical scope or in a different geographical scope as the first service instance, and there is a preset mapping relationship between the group identifier of the first service instance itself and the second target group identifier; determines whether the service instance corresponding to the second target group identifier exists; if there is a service instance corresponding to the second target group identifier, uses the second target group identifier as the group identifier of the target service instance.
[0056] In an embodiment of the present application, a group identifier representing the same geographical range or a different geographical range as the group identifier of the first service instance can also be pre-set as a second target group identifier, and the mapping relationship between the two can be stored in the service discovery server. Specifically, the second target group identifier can be used to represent the geographical range that is second closest to the geographical range of the first service instance among the M service instances. For example, the group identifier of the first service instance is IDC1, and the second target group identifier can be IDCB.
[0057] In this way, when there is no service instance corresponding to the first target group identifier, the service discovery server can determine the second target group identifier based on the group identifier of the first service instance itself and the name of the target service, and judge whether the service instance corresponding to the second target group identifier exists. If there is a service instance corresponding to the second target group identifier, the second target group identifier can be used as the group identifier of the target service instance, so that the first service instance can call the service instance corresponding to the second target group identifier.
[0058] Continuing with the previous example, the second target group identifier is IDCB. If there is no service instance corresponding to the group identifier IDCA, the group identifier IDCB can be used as the group identifier of the target service instance to facilitate the first service instance to call the service instance corresponding to the group identifier IDCB (ie, service instance B2).
[0059] Through the above method, when the service instance B1 of service B is named abnormally, or the network where the service instance B1 is located is abnormal, the first service instance can also quickly switch to the service instance B2, thereby achieving rapid stop loss and improving service stability.
[0060] like Figure 3 As shown, an electronic device provided by an embodiment of the present application may include: a shell 31, a processor 32, a memory 33, a circuit board 34 and a power circuit 35, wherein the circuit board 34 is arranged inside the space enclosed by the shell 31, and the processor 32 and the memory 33 are arranged on the circuit board 34; the power circuit 35 is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory 33 is used to store executable program code; the processor 32 runs the program corresponding to the executable program code by reading the executable program code stored in the memory 33, so as to execute the service instance calling method described in any of the aforementioned embodiments.
[0061] The specific execution process of the above steps by the processor 32 and the steps further executed by the processor 32 by running the executable program code can be found in the description of the above embodiment, which will not be repeated here.
[0062] This electronic device exists in many forms, including but not limited to:
[0063] (1) Mobile communication devices: These devices are characterized by their mobile communication functions and their main purpose is to provide voice and data communications. These terminals include: smart phones (such as iPhone), multimedia phones, functional phones, and low-end phones.
[0064] (2) Ultra-mobile personal computer devices: These devices fall into the category of personal computers, have computing and processing capabilities, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, such as iPad.
[0065] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players (such as iPods), handheld game consoles, e-books, smart toys, and portable car navigation devices.
[0066] (4) Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, and manageability.
[0067] (5) Other electronic devices with data interaction functions.
[0068] In a fourth aspect, an embodiment of the present application further provides a data center, wherein the computer data center includes any electronic device provided in the aforementioned embodiments.
[0069] In the fifth aspect, an embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement any service instance calling method provided by the aforementioned embodiments, thereby also being able to achieve the corresponding technical effects, which have been described in detail above and will not be repeated here.
[0070] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0071] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0072] In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0073] For the convenience of description, the above device is described by dividing the functions into various units / modules. Of course, when implementing the present invention, the functions of each unit / module can be implemented in the same or multiple software and / or hardware.
[0074] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0075] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A service instance calling method, characterized in that: The method comprises: The first service instance obtains the name of the target service; wherein the target service is a service to which the target service instance to be called by the first service instance belongs, the target service includes M service instances, the target service instance is one of the M service instances, and M is a positive integer greater than or equal to 1; The first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service; wherein different group identifiers of the service instances are used to distinguish different geographical ranges where the service instances are located; and there is a preset mapping relationship between the group identifier of the first service instance and the group identifier of the target service instance; The first service instance calls the target service instance based on the name of the target service and the group identifier of the target service instance.
2. The method according to claim 1, characterized in that: The first service instance calls the target service instance based on the name of the target service and the group identifier of the target service instance, including: The first service instance obtains the IP address and port number of the target service instance based on the name of the target service and the group identifier of the target service instance; The first service instance calls the target service instance from the M service instances based on the IP address and port number of the target service instance.
3. The method according to claim 2, characterized in that The first service instance obtains the IP address and port number of the target service instance based on the name of the target service and the group identifier of the target service instance, including: The first service instance sends the name of the target service and the group identifier of the target service instance to the service discovery server, so that the service discovery server determines the IP address and port number of the target service instance according to the name of the target service and the group identifier of the target service instance; The first service instance receives the IP address and port number of the target service instance sent by the service discovery server.
4. The method according to claim 1, characterized in that: The first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service, including: The first service instance sends the group identifier of the first service instance itself and the name of the target service to a service discovery server, so that the service discovery server obtains the group identifier of the target service instance according to the group identifier of the first service instance itself and the name of the target service; wherein the service discovery server stores a preset mapping relationship between the group identifier of the first service instance itself and the group identifier of the target service instance; The first service instance receives the group identifier of the target service instance sent by the service discovery server.
5. The method according to claim 1, characterized in that Before the first service instance obtains the group identifier of the target service instance based on its own group identifier and the name of the target service, the method further includes: The first service instance sends its corresponding environment variable to the service discovery server, so that the service discovery server determines the group identifier of the first service instance itself according to the environment variable; The first service instance receives the group identifier of the first service instance itself sent by the service discovery server.
6. The method according to claim 4, characterized in that The service discovery server obtains the group identifier of the target service instance according to the group identifier of the first service instance itself and the name of the target service, including: The service discovery server determines a first target group identifier according to the group identifier of the first service instance and the name of the target service; wherein the service instance corresponding to the first target group identifier is within the same geographical range as the first service instance, and there is a preset mapping relationship between the group identifier of the first service instance and the first target group identifier; Determine whether a service instance corresponding to the first target group identifier exists; If there is a service instance corresponding to the first target group identifier, the first target group identifier is used as the group identifier of the target service instance.
7. The method according to claim 6, characterized in that The service discovery server obtains the group identifier of the target service instance according to the group identifier of the first service instance and the name of the target service, further comprising: If there is no service instance corresponding to the first target group identifier, the service discovery server determines the second target group identifier based on the group identifier of the first service instance itself and the name of the target service; wherein the service instance corresponding to the second target group identifier is within the same geographical scope or a different geographical scope as the first service instance, and there is a preset mapping relationship between the group identifier of the first service instance itself and the second target group identifier; Determine whether a service instance corresponding to the second target group identifier exists; If there is a service instance corresponding to the second target group identifier, the second target group identifier is used as the group identifier of the target service instance.
8. An electronic device, characterized in that: The electronic device comprises: a processor, a memory, a circuit board and a power supply circuit, wherein the circuit board is placed inside the space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory is used to store executable program code; the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute any one of the methods of claims 1 to 7.
9. A data center, characterized in that: The data center includes the electronic equipment described in claim 8.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1 to 7.
