Service calling method and device, data center, storage medium and product

By receiving deployment requests uniformly and starting microservice containers in a multi-data center environment, registering in the registration center, selecting target instances for cross-data center calls, it solves the cumbersome problem of the deployment process in the existing technology, and achieves rapid iteration and update Improved efficiency and reduced impact of single point failure.

CN119135754AActive Publication Date: 2024-12-13CHINA UNITED NETWORK COMM GRP CO LTD +2

Patent Information

Application Number
CN202411311795.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-13
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

In the prior art, the microservice deployment process in a multi-data center environment is cumbersome and time-consuming, and it is difficult to meet the needs of rapid iteration and updates.

Method used

Provide a service call method, by uniformly receiving deployment requests sent by the microservice deployment system, obtaining the target image, starting the microservice container and registering it to the local registration center, obtaining the full microservice registration information table, and selecting the target instance according to the preset routing policy , realize service calls across data centers.

Benefits of technology

Reduces the complexity of cross-data center service deployment, speeds up the efficiency of iteration and updates, and reduces the impact of single point of failure through preset routing policies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119135754A_ABST
    Figure CN119135754A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a service calling method and device, a data center, a storage medium and a product, and the method comprises the steps: receiving a deployment request sent by a micro-service deployment system, the deployment request is generated by the micro-service deployment system according to the service demand information in a pre-deployment service, and the deployment request comprises a preset mirror image address; obtaining a target mirror image according to a preset mirror image address; starting a micro-service container according to the target mirror image to register the pre-deployed service to a local registration center, so that the local registration center adds the pre-deployed service to a full micro-service registration information table; when the pre-deployment service needs to initiate a cross-data-center request, obtaining a full-amount micro-service registration information table from a local registration center; and in the total micro-service registration information table, selecting a target instance according to a preset routing strategy, and sending a request to a target data center according to the target instance, so as to realize cross-data-center service calling. According to the method, the complexity of cross-data center service deployment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a service calling method, device, data center, storage medium and product. Background Art

[0002] As a flexible and scalable system design method, microservice architecture divides a single application system into multiple independent service units, enabling the system to better cope with complex business needs and rapidly changing market environments. With the widespread application of cloud computing and microservice architecture, modern enterprises are increasingly facing the challenge of how to efficiently deploy and manage application systems in data centers distributed in multiple geographical locations.

[0003] In the prior art, deployment in a multi-data center environment is achieved by deploying services separately in each data center. However, the process of deploying services separately in each data center is cumbersome and time-consuming, and it is difficult to meet the needs of rapid iteration and updating. Summary of the invention

[0004] The embodiments of the present application provide a service calling method, device, data center, storage medium and product to reduce the complexity of cross-data center service deployment.

[0005] In the first aspect, an embodiment of the present application provides a service calling method, which is applied to each data center and includes: receiving a deployment request sent by a microservice deployment system, wherein the deployment request is generated by the microservice deployment system according to the service demand information in the pre-deployed service, and the deployment request includes a preset image address; obtaining a target image according to the preset image address; starting a microservice container according to the target image to register the pre-deployed service to a local registration center, so that the local registration center adds the pre-deployed service to a full microservice registration information table; when the pre-deployed service needs to initiate a cross-data center request, obtaining a full microservice registration information table from the local registration center; in the full microservice registration information table, selecting a target instance according to a preset routing strategy, and sending a request to the target data center according to the target instance to implement cross-data center service calls.

[0006] In one possible implementation, sending a request to a target data center based on a target instance includes: obtaining information of the target instance, wherein the information of the target instance includes a network address and a port of the target data center; compressing the information of the target instance using a preset compression algorithm to obtain compressed data; appending the compressed data to a hypertext transfer protocol request, and adding a compression identifier to a request header to generate a request body; and sending the request body to the target data center based on the network address and port of the target data center.

[0007] In a possible implementation, starting a microservice container according to a target image to register a pre-deployed service with a local registration center includes: starting the microservice container using the target image and setting configuration parameters for the microservice container; after the microservice container is started, starting the service according to a configuration file startup script of the pre-deployed service so that the pre-deployed service connects to the local registration center; and sending a registration request to the local registration center so that the local registration center processes the registration request.

[0008] In a possible implementation, after starting the microservice container according to the target image to register the pre-deployed service with the local registration center, it also includes: sending a heartbeat signal to the local registration center after a preset time, so that the local registration center updates the registration status of the pre-deployed service after receiving the heartbeat signal.

[0009] In one possible implementation, after starting the microservice container according to the target image to register the pre-deployed service with the local registration center, it also includes: controlling the local registration center to send a check request to the health check endpoint of the pre-deployed service after a preset time to obtain status information of the pre-deployed service; if the status information of the pre-deployed service indicates an unhealthy state, sending a deregistration request to the local registration center to remove the pre-deployed service.

[0010] In a second aspect, an embodiment of the present application provides a service calling device, which is applied to a data center, including:

[0011] The request receiving module is used to receive a deployment request sent by the microservice deployment system, wherein the deployment request is generated by the microservice deployment system according to the service demand information in the pre-deployed service, and the deployment request includes a preset mirror address.

[0012] The target image acquisition module is used to acquire the target image according to the preset image address.

[0013] The container startup module is used to start the microservice container according to the target image to register the pre-deployed service with the local registration center, so that the local registration center adds the pre-deployed service to the full microservice registration information table.

[0014] The full microservice registration information table module is used to obtain the full microservice registration information table from the local registration center when the pre-deployed service needs to initiate a cross-data center request.

[0015] The processing module is used to select a target instance in the full microservice registration information table according to a preset routing strategy, and send a request to the target data center according to the target instance to realize cross-data center service calls.

[0016] In a third aspect, an embodiment of the present application provides a data center, including: a memory, a processor;

[0017] The memory stores computer-executable instructions;

[0018] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0020] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0021] The service calling method, device, data center, storage medium and product provided in the embodiments of the present application reduce the complexity of cross-data center service deployment and speed up the efficiency of iteration and update by uniformly sending service deployment requests to each data center. In addition, according to the preset routing strategy, the target instance is determined in the full microservice registration information table to realize cross-data center service calling, which can reduce the impact of single point failures. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0023] Figure 1 A schematic diagram of an application scenario of the service calling method provided in an embodiment of the present application;

[0024] Figure 2 A flowchart of the service calling method provided for this application;

[0025] Figure 3 A schematic diagram of the structure of a service calling device provided in an embodiment of the present application;

[0026] Figure 4 A schematic diagram of the structure of the data center provided for this application.

[0027] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0028] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0029] First, the terms involved in this application are explained:

[0030] Data center: A facility dedicated to the centralized storage, processing and management of large amounts of data. It usually includes computer servers, storage devices, network equipment and other related hardware and software infrastructure. The main function of a data center is to provide reliable, efficient and secure computing and storage resources to support a variety of applications and services.

[0031] Image: is a read-only template that contains everything needed to run an application, including code, runtime, libraries, and settings.

[0032] Container: is a virtualization technology used to package an application and all its dependencies in a self-contained, portable unit. Containers provide a lightweight way to ensure that applications can run consistently in different computing environments.

[0033] In order to clearly understand the technical solution of the present application, the solution of the prior art is first introduced in detail. Microservice architecture is a design method that divides a single application system into multiple independent service units. Each service unit is independently developed, deployed and operated, and can be independently expanded and updated. Microservice architecture improves the flexibility and scalability of the system through loose coupling and independent deployment between services, and can better cope with complex business needs and rapidly changing market environments. With the popularization of cloud computing technology, more and more companies are beginning to deploy application systems in cloud environments. Cloud computing provides elastic computing resources and flexible deployment methods, so that the advantages of microservice architecture can be fully utilized. However, in actual applications, modern enterprises often need to deploy and manage microservice systems in data centers distributed in multiple geographical locations to improve the reliability and availability of the system. This brings new challenges to the deployment of multiple data centers. In the prior art, deployment in a multi-data center environment is usually achieved by deploying services separately in each data center. Although this method can achieve the deployment of multiple data centers, due to the lack of unified management and automation tools, the deployment process is cumbersome and time-consuming, and it is difficult to meet the needs of modern enterprises for rapid iteration and update.

[0034] In view of the above technical problems, the inventors have come up with the idea of ​​designing a centralized microservice deployment system for unified management of microservice deployment, update and expansion and contraction of multiple data centers. The microservice deployment system generates a deployment request based on the service demand information in the pre-deployment service, and sends the deployment request to each target data center. Each data center receives the deployment request sent uniformly, and pulls the target image from the warehouse according to the preset image address in the deployment request, starts the microservice container according to the target image to register the pre-deployment service to the local registration center, and the registration centers synchronize the service registration information table with each other to obtain the full microservice registration information of multiple data centers. When the pre-deployment service needs to initiate a cross-data center request, the full microservice registration information table is obtained from the local registration center, and in the full microservice registration information table, the target instance is selected according to the preset routing strategy, and the request is sent to the target data center according to the target instance to realize the cross-data center service call. By sending the service deployment request uniformly to each data center, the complexity of cross-data center service deployment is reduced, and the efficiency of iteration and update is accelerated. In addition, determining the target instance in the full microservice registration information table according to the preset routing strategy to realize the cross-data center service call can reduce the impact of single point failure.

[0035] Based on the above creative findings, the inventor proposed the technical solution of the present application.

[0036] Figure 1 Schematic diagram of application scenarios of the service calling method provided in the embodiment of the present application. Figure 1 As shown, it includes: a microservice deployment system 101 and data centers 102.

[0037] Specifically, the microservice deployment system 101 generates a deployment request based on the pre-deployment service demand information and sends the deployment request to each data center 102, wherein the deployment request includes a preset image address. Each data center 102 obtains the target image based on the preset image address, starts the microservice container based on the target image to register the pre-deployment service with the local registration center, so that the local registration center adds the pre-deployment service to the full microservice registration information table. When the pre-deployment service needs to initiate a cross-data center request, the full microservice registration information table is obtained from the local registration center. In the full microservice registration information table, the target instance is selected according to the preset routing strategy, and a request is sent to the target data center according to the target instance to realize cross-data center service calls.

[0038] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0039] Figure 2 A flow chart of the service calling method provided for this application, such as Figure 2 As shown, the method includes:

[0040] S201: receiving a deployment request sent by a microservice deployment system, wherein the deployment request is generated by the microservice deployment system according to service demand information in a pre-deployed service, and the deployment request includes a preset mirror address.

[0041] Among them, the preset image address points to the warehouse where the microservice container image is stored.

[0042] Specifically, the microservice deployment system generates a deployment request according to the service demand information in the pre-deployed service, and sends the deployment request to each data center.

[0043] S202: Obtain a target image according to a preset image address.

[0044] Specifically, after receiving the deployment request, each data center pulls the corresponding microservice container image from the preset image address.

[0045] S203: Start the microservice container according to the target image to register the pre-deployed service with the local registration center, so that the local registration center adds the pre-deployed service to the full microservice registration information table.

[0046] Specifically, including Sa1~Sa3:

[0047] Sa1: Start the microservice container using the target image and set configuration parameters for the microservice container.

[0048] Specifically, each data center configures the operating environment of the pre-deployed service according to the configuration parameters in the deployment request, including environment variables, network configuration, and storage volume mounting.

[0049] Sa2: After the microservice container is started, the service is started according to the startup script of the configuration file of the pre-deployed service so that the pre-deployed service can connect to the local registration center.

[0050] Sa3: Send a registration request to the local registration center so that the local registration center processes the registration request.

[0051] Specifically, after the configuration is completed, the pre-deployed service is started and registered with the local registry. The local registry of each data center is synchronized through the global service registry to ensure that the service instances of all data centers can discover and communicate with each other. The configuration file is dynamically updated to ensure that the service instances of each data center can automatically synchronize the latest configuration.

[0052] Specifically, after registering the pre-deployed service to the local registration center, Sb1 is also included:

[0053] Sb1: Send a heartbeat signal to the local registration center after a preset time, so that the local registration center updates the registration status of the pre-deployed service after receiving the heartbeat signal.

[0054] Among them, the heartbeat signal usually includes the health status information of each microservice.

[0055] Specifically, the preset time interval in the configuration file or environment variable is read, and when the preset time interval arrives, the heartbeat transmitter is triggered so that the heartbeat transmitter constructs a heartbeat signal and sends the heartbeat signal to the local registration center through the hypertext transfer protocol or other communication protocols. After receiving the heartbeat signal, the local registration information updates the last heartbeat time of the pre-deployed service to maintain its registration status.

[0056] S204: When the pre-deployed service needs to initiate a cross-data center request, the full microservice registration information table is obtained from the local registration center.

[0057] Among them, the full microservice registration information table includes the microservice instance information of all data centers, including service name, instance address, and port number.

[0058] S205: In the full microservice registration information table, a target instance is selected according to a preset routing strategy, and a request is sent to a target data center according to the target instance to implement a cross-data center service call.

[0059] Among them, the preset routing strategy refers to the rules and methods that determine how to assign requests to target instances in the microservice architecture.

[0060] Among them, the preset routing policy can be a polling policy, which allocates requests to each available target instance in turn, ensuring that the number of requests received by each instance is roughly the same. The preset routing policy can be a random policy, which randomly allocates requests to available target instances. The preset routing policy can be a minimum connection policy, which allocates requests to the target instance with the least current connections. The preset routing policy can be a fastest response time policy, which allocates requests to the target instance with the shortest response time. The preset routing policy can be a weight policy, which allocates a weight to each target instance and allocates requests according to the weight. The weight can be set according to factors such as the performance and resource configuration of the target instance. The preset routing policy can be a geographic location policy, which selects the nearest target instance according to the geographic location of the request. The preset routing policy can be a session persistence policy, which always allocates requests of the same user to the same target instance. The preset routing policy can be a failover policy, which transfers requests to other available instances when the target instance is unavailable. The preset routing policy can also be a multi-level routing policy, which combines multiple routing policies to select a suitable target instance according to different conditions.

[0061] Specifically, the pre-deployment service selects a target instance according to the full microservice registration information table and initiates a cross-data center request, including steps Sc1 to Sc4:

[0062] Sc1: Obtain information about a target instance, where the information about the target instance includes a network address and port of a target data center.

[0063] Specifically, the network address and port of the target data center are read from a pre-configured file, and then the information of the target instance is obtained through the service discovery mechanism.

[0064] Sc2: Use a preset compression algorithm to compress the information of the target instance to obtain compressed data.

[0065] The preset compression algorithm may be a lossless compression algorithm or a lossy compression algorithm, which takes information of the target instance such as a network address and a port as input, performs a compression operation, and obtains compressed data.

[0066] Sc3: Append the compressed data to the Hypertext Transfer Protocol request and add a compression flag in the request header to generate the request body.

[0067] Specifically, a Hypertext Transfer Protocol request object is created, the compressed data is attached to the Hypertext Transfer Protocol request as a request body, and an identifier is added to the Hypertext Transfer Protocol request header to indicate that the data in the request body is compressed and the compression algorithm used is indicated.

[0068] Sc4: Send the request body to the target data center based on the network address and port of the target data center.

[0069] Specifically, a target URL is constructed according to the network address and port of the target data center, and a hypertext transfer protocol request is sent to the target data center using a hypertext transfer protocol client library.

[0070] In summary, by sending service deployment requests to each data center in a unified manner, the complexity of cross-data center service deployment is reduced, and the efficiency of iteration and update is accelerated. In addition, determining the target instance in the full microservice registration information table according to the preset routing strategy to realize cross-data center service calls can reduce the impact of single point failures.

[0071] In another embodiment of the present application, after the microservice container is started according to the target image and the pre-deployed service has been registered with the local registration center, if the pre-deployed service is deployed successfully, it is necessary to continuously monitor the registration status of the pre-deployed service, specifically, including S301~S302:

[0072] S301: Control the local registration center to send a check request to the health check endpoint of the pre-deployment service after a preset time to obtain status information of the pre-deployment service.

[0073] Specifically, each data center controls the local registration center to send a check request to the health check endpoint of the pre-deployed service according to the preset time interval in the configuration file to obtain the status information of the pre-deployed service. The health check endpoint usually returns a status code and possible status description information.

[0074] S302: If the status information of the pre-deployed service indicates an unhealthy state, a deregistration request is sent to the local registration center to remove the pre-deployed service.

[0075] Specifically, after receiving the health check response of the pre-deployed service, each data center will parse the response content. If the response status code indicates that the service is in a healthy state, the local registration center will record this state and wait for the next check cycle. If the response status code indicates an unhealthy state, a deregistration request will be sent to the local registration center to remove the information of the pre-deployed service. The local registration center processes the deregistration request, updates the internal registration table, and removes the information of the pre-deployed service.

[0076] In summary, the local registration center can ensure the stability and reliability of each data center by effectively monitoring the health status of the pre-deployed services and deregistering the pre-deployed services when the pre-deployed services are in an unhealthy state.

[0077] Figure 3 This is a schematic diagram of the structure of the service calling device provided in the embodiment of the present application. Figure 3 As shown, the service calling device includes: a request receiving module 301, a target image acquisition module 302, a container startup module 303, a full microservice registration information table module 304 and a processing module 305.

[0078] The request receiving module 301 is used to receive a deployment request sent by the microservice deployment system, wherein the deployment request is generated by the microservice deployment system according to the service demand information in the pre-deployed service, and the deployment request includes a preset mirror address.

[0079] The target image acquisition module 302 is used to acquire the target image according to a preset image address.

[0080] The container startup module 303 is used to start the microservice container according to the target image to register the pre-deployed service with the local registration center, so that the local registration center adds the pre-deployed service to the full microservice registration information table.

[0081] The full microservice registration information table module 304 is used to obtain the full microservice registration information table from the local registration center when the pre-deployed service needs to initiate a cross-data center request.

[0082] The processing module 305 is used to select a target instance in the full microservice registration information table according to a preset routing strategy, and send a request to the target data center according to the target instance to implement a cross-data center service call.

[0083] In one possible implementation, the processing module 305 is specifically used to obtain information of the target instance, wherein the information of the target instance includes the network address and port of the target data center; compress the information of the target instance using a preset compression algorithm to obtain compressed data; append the compressed data to a hypertext transfer protocol request, and add a compression identifier to the request header to generate a request body; and send the request body to the target data center according to the network address and port of the target data center.

[0084] In one possible implementation, the full microservice registration information table module 304 is specifically used to start the microservice container using the target image and set configuration parameters for the microservice container; after the microservice container is started, the service is started according to the configuration file startup script of the pre-deployed service so that the pre-deployed service connects to the local registration center; and a registration request is sent to the local registration center so that the local registration center processes the registration request.

[0085] In a possible implementation, the service calling device further includes a registration status update module, which is used to send a heartbeat signal to the local registration center after a preset time, so that the local registration center updates the registration status of the pre-deployed service after receiving the heartbeat signal.

[0086] In one possible implementation, the service calling device also includes a status check module, which is used to control the local registration center to send a check request to the health check endpoint of the pre-deployed service after a preset time to obtain status information of the pre-deployed service; if the status information of the pre-deployed service indicates an unhealthy state, a deregistration request is sent to the local registration center to remove the pre-deployed service.

[0087] The service calling device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.

[0088] Figure 4 This is a schematic diagram of the data center structure provided for this application. Figure 4As shown, the data center provided in this embodiment includes: at least one processor 401 and a memory 402. Optionally, the data center also includes a communication component 403. The processor 401, the memory 402 and the communication component 403 are connected via a bus 404.

[0089] In a specific implementation process, at least one processor 401 executes the computer-executable instructions stored in the memory 402, so that at least one processor 401 executes the above method.

[0090] The specific implementation process of the processor 401 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0091] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the invention can be directly implemented as a hardware processor, or can be implemented by a combination of hardware and software modules in the processor.

[0092] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (NVM), such as at least one disk storage.

[0093] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0094] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0095] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0096] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0097] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0098] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0099] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0100] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0101] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0102] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0103] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A service calling method, characterized in that: Applied to various data centers, including: Receiving a deployment request sent by a microservice deployment system, wherein the deployment request is generated by the microservice deployment system according to service demand information in a pre-deployed service, and the deployment request includes a preset mirror address; Obtain the target image according to the preset image address; Start the microservice container according to the target image to register the pre-deployed service with the local registration center, so that the local registration center adds the pre-deployed service to the full microservice registration information table; When the pre-deployed service needs to initiate a cross-data center request, the full microservice registration information table is obtained from the local registration center; In the full microservice registration information table, a target instance is selected according to a preset routing strategy, and a request is sent to a target data center according to the target instance to implement a cross-data center service call.

2. The method according to claim 1, characterized in that The sending a request to a target data center according to the target instance includes: Acquire information of the target instance, wherein the information of the target instance includes a network address and a port of the target data center; Compress the information of the target instance using a preset compression algorithm to obtain compressed data; Attaching the compressed data to a Hypertext Transfer Protocol request and adding a compression identifier to a request header to generate a request body; The request body is sent to the target data center according to the network address and port of the target data center.

3. The method according to claim 1, characterized in that The starting the microservice container according to the target image to register the pre-deployed service with the local registration center includes: Start the microservice container using the target image and set configuration parameters for the microservice container; After the microservice container is started, the service is started according to the configuration file startup script of the pre-deployed service, so that the pre-deployed service is connected to the local registration center; Sending a registration request to the local registration center so that the local registration center processes the registration request.

4. The method according to claim 3, characterized in that After starting the microservice container according to the target image to register the pre-deployed service with the local registration center, the method further includes: A heartbeat signal is sent to the local registration center after a preset time, so that the local registration center updates the registration status of the pre-deployed service after receiving the heartbeat signal.

5. The method according to claim 1, characterized in that After starting the microservice container according to the target image to register the pre-deployed service with the local registration center, the method further includes: Control the local registration center to send a check request to the health check endpoint of the pre-deployment service after a preset time to obtain status information of the pre-deployment service; If the status information of the pre-deployment service indicates an unhealthy state, a deregistration request is sent to the local registration center to remove the pre-deployment service.

6. A service calling device, characterized in that: Applied to various data centers, including: A request receiving module, used to receive a deployment request sent by a microservice deployment system, wherein the deployment request is generated by the microservice deployment system according to service demand information in a pre-deployed service, and the deployment request includes a preset mirror address; A target image acquisition module, used to acquire the target image according to the preset image address; A container startup module, used to start the microservice container according to the target image to register the pre-deployed service with the local registration center, so that the local registration center adds the pre-deployed service to the full microservice registration information table; A full microservice registration information table module is used to obtain the full microservice registration information table from the local registration center when the pre-deployed service needs to initiate a cross-data center request; The processing module is used to select a target instance in the full microservice registration information table according to a preset routing strategy, and send a request to a target data center according to the target instance to implement a cross-data center service call.

7. The device according to claim 6, characterized in that The processing module is specifically used to obtain information of the target instance, wherein the information of the target instance includes the network address and port of the target data center; compress the information of the target instance using a preset compression algorithm to obtain compressed data; append the compressed data to a hypertext transfer protocol request, and add a compression identifier in the request header to generate a request body; and send the request body to the target data center according to the network address and port of the target data center.

8. A data center, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.

10. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 5 when being executed by a processor.

Citation Information

Patent Citations

  • Service provision to IoT devices

    CN110024330A

  • Method and system for realizing cross-domain and cross-center communication in enterprise-level micro-service platform

    CN111147588A

  • Packet routing method and device, electronic equipment and storage medium

    CN114363233A

  • Micro-service governance method and device, terminal equipment and storage medium

    CN118524149A

  • Embedded database as a microservice for distributed container cloud platform

    US20180146067A1

Cited By

  • Registration center monitoring method, electronic device, storage medium and program

    CN120066902A