System smooth online and offline method and device based on registration center
By registering IP information in the registration center and achieving smooth switching between services, the interruption problem caused by the service up and down line in the distributed system architecture is solved, lossless up and down line is achieved, and maintenance costs are reduced.
Patent Information
- Application Number
- CN202411484822.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-06-27
AI Technical Summary
Driven by cloud native technology, the service up and down process of distributed system architectures may lead to instantaneous interruptions or flash interruptions. Traditional solutions are difficult to implement in system clusters without container orchestration frameworks and are costly to maintain.
The system smoothly up-and-down method based on the registration center is adopted. By deploying the mirror files of the services to be launched to the work node, a container instance is built, and IP information is registered in the registration center, smooth switching between services and down-down operations are achieved.
It realizes lossless service up and down, strong adaptability and operability, meets the actual needs of smooth up and down, reduces maintenance costs, and is adapted to any registration center technical selection.
Smart Images

Figure CN120216161A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a method and device for smooth online and offline of a system based on a registry center. Background Art
[0002] Currently, driven by cloud-native technology, more and more enterprises are gradually turning to a distributed system architecture. This architecture splits the original single and bloated monolithic service into multiple services, which is conducive to modular development of services and makes testing, iteration, and deployment during the development process more flexible and efficient. However, with this transformation, problems may occur during the service online and offline process, especially in the production environment, which may lead to instantaneous interruption of services, and even situations such as service flickering. Traditional solutions generally rely on container orchestration frameworks such as K8S to implement, which are relatively difficult to implement in some system clusters that do not use this type of framework, and rely on many components, resulting in high later maintenance costs.
[0003] Therefore, to meet the actual needs, a technology for smooth online and offline of a system based on a registry center is provided. Summary of the Invention
[0004] Aiming at the defects existing in the prior art, the purpose of the present invention is to provide a method and device for smooth online and offline of a system based on a registry center.
[0005] To achieve the above object, the technical solution adopted by the present invention is as follows:
[0006] In a first aspect, the present application provides a method for smooth online and offline of a system based on a registry center, and the method further includes the following steps:
[0007] Deploy the image file of the service to be launched to a working node, allocate a virtual container, and construct a corresponding container instance;
[0008] Perform a health check on the container instance of the service to be launched. If it is determined that the health is normal and the corresponding IP information is registered in the registry center, it is determined that the registration of the container instance of the service to be launched is successful;
[0009] Based on the IP information of the container instance of the service to be taken offline, issue a take-offline request for the service to be taken offline and execute a smooth switching process between services;
[0010] Perform a take-offline operation on the container instance of the service to be taken offline.
[0011] On the basis of the above technical solution, the method further includes the following steps:
[0012] Obtain the IP information of the container instance of the service to be taken offline and persist it to a preset database.
[0013] Based on the above technical solution, the method further includes the following steps:
[0014] Perform a health check on the container instances of the service to be launched. If it is determined that the health is abnormal and the number of instances corresponding to the registry has not changed, delete the container instances of the service to be launched and delete the virtual containers corresponding to the service to be launched.
[0015] Based on the above technical solution, after performing a shutdown operation on the container instances of the service to be shut down, the method includes the following steps:
[0016] Delete the virtual containers and container instances of the service to be shut down.
[0017] Based on the above technical solution, the smooth service switching process includes the following steps:
[0018] Based on the IP information of the container instances of the service to be shut down, obtain the acceptance shutdown notification interface corresponding to the container instances of the service to be shut down, and identify whether there is a shutdown request for the service to be shut down;
[0019] If there is, poll to obtain the IP information of the container instances of the service to be launched and update the local Ribbon cache.
[0020] Based on the above technical solution, performing the shutdown operation on the container instances of the service to be shut down includes the following steps:
[0021] Respond to the shutdown request for the service to be shut down and calculate the corresponding required shutdown time;
[0022] Based on the required shutdown time, perform a shutdown operation on the container instances of the service to be shut down.
[0023] Based on the above technical solution, the method further includes a service preheating process, and the service preheating process includes the following steps:
[0024] Asynchronously calculate the preheating traffic coefficient ratio of the container instances of the service to be launched;
[0025] When performing traffic switching in the registry, control the production traffic switching ratio according to the preheating traffic coefficient ratio, and import the preheating traffic into the container instances of the service to be launched to complete service preheating.
[0026] Based on the above technical solution, the method is configured with a preheating traffic coefficient ratio calculation formula;
[0027] The preheating traffic coefficient ratio calculation formula is: Y = F(x, y, z); where,
[0028] Y is the preheating flow coefficient ratio, x is the TPS of the target system, y is the startup registration time of the target system, and z is the target system weight ratio.
[0029] Based on the above technical solution, deploy the image file of the service to be launched to the working node, allocate a virtual container, and construct a corresponding container instance, including the following steps:
[0030] Based on the image file of the service to be launched and the virtual container, use the Docker service to construct the container instance corresponding to the service to be launched.
[0031] In a second aspect, the present application provides a system smooth online and offline device based on a registration center, and the device includes:
[0032] A preparation module, which is used to deploy the image file of the service to be launched to the working node, allocate a virtual container, and construct a corresponding container instance;
[0033] A registration module, which is used to perform a health check on the container instance of the service to be launched. If it is determined that the health is normal and the corresponding IP information is registered in the registration center, it is determined that the container instance of the service to be launched is successfully registered;
[0034] A switching module, which is used to publish a shutdown request for the service to be shut down based on the IP information of the container instance of the service to be shut down, and execute the smooth switching process between services;
[0035] A shutdown module, which is used to perform a shutdown operation on the container instance of the service to be shut down.
[0036] Based on the above technical solution, the device further includes an information extraction module, which is used to obtain the IP information of the container instance of the service to be shut down and persist it to a preset database.
[0037] Based on the above technical solution, the registration module is further used to perform a health check on the container instance of the service to be launched. If it is determined that the health is abnormal and the number of corresponding instances in the registration center has not changed, delete the container instance of the service to be launched and delete the virtual container corresponding to the service to be launched.
[0038] Based on the above technical solution, the device further includes a deletion module, which is used to delete the virtual container and the container instance of the service to be shut down.
[0039] Based on the above technical solution, the smooth switching process between services includes the following steps:
[0040] Based on the IP information of the container instances of the offline service, obtain the interface for receiving the offline notice corresponding to the container instances of the offline service, and identify whether there is an offline request for the service to be taken offline;
[0041] If there is, poll to obtain the IP information of the container instances of the service to be taken online, and update the local Ribbon cache.
[0042] On the basis of the above technical solution, the offline module is further configured to respond to the offline request for the service to be taken offline, and calculate the corresponding time required for offline;
[0043] The offline module is further configured to perform an offline operation on the container instances of the service to be taken offline based on the time required for offline.
[0044] On the basis of the above technical solution, the device further includes a service preheating module, which is configured to asynchronously calculate the preheating traffic coefficient ratio of the container instances of the service to be taken online;
[0045] The service preheating module is further configured to control the production traffic switching ratio according to the preheating traffic coefficient ratio when the traffic is switched in the registration center, and import the preheating traffic into the container instances of the service to be taken online to complete the service preheating.
[0046] On the basis of the above technical solution, the device is further configured with a calculation formula for the preheating traffic coefficient ratio;
[0047] The calculation formula for the preheating traffic coefficient ratio is: Y = F(x, y, z); where,
[0048] Y is the preheating traffic coefficient ratio, x is the TPS of the target system, y is the startup registration time of the target system, and z is the target system weight ratio.
[0049] On the basis of the above technical solution, the preparation module is further configured to build the container instances corresponding to the service to be taken online by using the Docker service based on the image file and virtual container of the service to be taken online.
[0050] Compared with the prior art, the advantages of the present invention are as follows:
[0051] The present invention configures a unique online and offline operation process and rules, realizes lossless online and offline of services, has good adaptability and operability, and meets the actual needs of smooth online and offline. Description of the Drawings
[0052] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0053] Figure 1 It is a flowchart of the steps of the system smooth online and offline method based on the registry center in the embodiments of the present invention;
[0054] Figure 2 It is a schematic diagram of the process principle of the registry center in the system smooth online and offline method based on the registry center in the embodiments of the present invention;
[0055] Figure 3 It is a schematic diagram of the request principle of smooth replacement between services in the system smooth online and offline method based on the registry center in the embodiments of the present invention;
[0056] Figure 4 It is a schematic diagram of service preheating of the registry center in the system smooth online and offline method based on the registry center in the embodiments of the present invention;
[0057] Figure 5 It is a schematic diagram of lossless offline of the registry center in the system smooth online and offline method based on the registry center in the embodiments of the present invention;
[0058] Figure 6 It is a structural block diagram of the system smooth online and offline device based on the registry center in the embodiments of the present invention. Detailed implementation manners
[0059] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, rather than all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present application.
[0060] The following further elaborates on the embodiments of the present invention with reference to the accompanying drawings.
[0061] The embodiments of the present application provide a system smooth online and offline method and device based on the registry center, configure specific online and offline operation processes and rules, realize lossless online and offline of services, have good adaptability and operability, and meet the actual requirements of smooth online and offline.
[0062] To achieve the above technical effects, the general idea of the present application is as follows:
[0063] A method for smooth online and offline of a system based on a registry, the method comprising the following steps:
[0064] S1. Deploy the mirror file of the service to be launched to the working node, allocate a virtual container, and construct a corresponding container instance;
[0065] S2. Perform a health check on the container instance of the service to be launched. If it is determined to be healthy and the corresponding IP information is registered in the registry, it is determined that the container instance of the service to be launched is successfully registered;
[0066] S3. Based on the IP information of the container instance of the service to be taken offline, issue an offline request for the service to be taken offline, and execute the smooth switching process between services;
[0067] S4. Perform an offline operation on the container instance of the service to be taken offline.
[0068] The following further elaborates on the embodiments of the present application in conjunction with the accompanying drawings.
[0069] In a first aspect, as shown in Figures 1 to 5 the embodiments of the present application provide a method for smooth online and offline of a system based on a registry, the method comprising the following steps:
[0070] S1. Deploy the mirror file of the service to be launched to the working node, allocate a virtual container, and construct a corresponding container instance;
[0071] S2. Perform a health check on the container instance of the service to be launched. If it is determined to be healthy and the corresponding IP information is registered in the registry, it is determined that the container instance of the service to be launched is successfully registered;
[0072] S3. Based on the IP information of the container instance of the service to be taken offline, issue an offline request for the service to be taken offline, and execute the smooth switching process between services;
[0073] S4. Perform an offline operation on the container instance of the service to be taken offline.
[0074] The embodiments of the present application achieve lossless online and offline of a distributed system based on a registry, which can support frequent iterations in enterprise-level development without affecting online services;
[0075] provide strong support for the rapid iteration of the system, and this solution can be adapted to any technical selection of the registry;
[0076] It has good portability and operability. At the same time, in cloud native, it does not depend on any container orchestration framework, has strong decoupling, strong adaptability, and can be compatible with the vast majority of enterprise application scenarios; In particular, functions such as service preheating, accurate offline time calculation, and offline notification between services are added to ensure smooth online and achieve true lossless traffic.
[0077] Further, the method further includes the following steps:
[0078] Obtain the IP information of the container instance of the service to be taken offline, and persist it to a preset database.
[0079] Further, the method further includes the following steps:
[0080] Perform a health check on the container instance of the service to be taken online. If it is determined that the health is abnormal and the number of instances corresponding to the registry has not changed, delete the container instance of the service to be taken online and delete the virtual container corresponding to the service to be taken online.
[0081] Further, after performing the offline operation on the container instance of the service to be taken offline, the method includes the following steps:
[0082] Delete the virtual container and container instance of the service to be taken offline.
[0083] Further, the smooth service switching process includes the following steps:
[0084] Based on the IP information of the container instance of the offline service, obtain the interface for receiving the offline notice corresponding to the container instance of the offline service, and identify whether there is an offline request for the service to be taken offline;
[0085] If there is, poll to obtain the IP information of the container instance of the service to be taken online and update the local Ribbon cache.
[0086] Further, performing the offline operation on the container instance of the service to be taken offline includes the following steps:
[0087] Respond to the offline request for the service to be taken offline, and calculate the corresponding time required for offline;
[0088] Based on the time required for offline, perform the offline operation on the container instance of the service to be taken offline.
[0089] Further, the method also includes a service preheating process, and the service preheating process includes the following steps:
[0090] Asynchronously calculate the preheating traffic coefficient ratio of the container instance of the service to be taken online;
[0091] When performing traffic switching in the registry, control the production traffic switching ratio according to the preheating traffic coefficient ratio, and import the preheating traffic into the container instance of the service to be taken online to complete service preheating.
[0092] Further, the method is configured with a calculation formula for the preheating traffic coefficient ratio;
[0093] The calculation formula for the preheating flow coefficient ratio is: Y = F(x, y, z); where,
[0094] Y is the preheating flow coefficient ratio, x is the TPS of the target system, y is the startup registration time of the target system, and z is the target system weight ratio.
[0095] Further, deploying the image file of the service to be launched to the working node, allocating a virtual container, and constructing a corresponding container instance includes the following steps:
[0096] Based on the image file of the service to be launched and the virtual container, use the Docker service to construct the container instance corresponding to the service to be launched.
[0097] Based on the technical solution of the embodiment of the present application, in actual implementation, the specific situation is as follows:
[0098] Step 1: Use swarm to publish a new docker image instance. Specifically, deploy the image file of the service to be launched to the working node through the control command of the swarm master node, and ensure the health of the switched instance by starting a new container instance in advance to avoid the loss of subsequent service switching requests;
[0099] Among them, use the swarm container orchestration command to deploy and start the newly packaged image file. The function of this step is to start a new container instance first and perform a health check to avoid the loss of requests during traffic switching.
[0100] Step 2: Asynchronously obtain the IP information of the old instance of the service to be taken offline through the registration center interface request, and persist it in the database to distinguish between new and old instances in the future and accurately locate the container address to be taken offline;
[0101] Among them, use the interface of the registration center to obtain the IP information of the container instance of the service to be taken offline and save it in the database. This step is to identify the IP information of the container instance of the service to be launched and the container instance of the service to be taken offline during the subsequent traffic switching, and accurately take offline the container instance address of the service to be taken offline.
[0102] Step 3: During the publishing process, perform real-time health detection through the health interface of the service to be launched. When the health status is abnormal and the number of instances in the registration center has not changed, automatically kill and delete the virtual container corresponding to the service to be launched and notify the publishing result;
[0103] This step can ensure that the container instance of the service to be launched is healthy and available.
[0104] Step 4: When the health check status is detected as normal through the health check mechanism in Step 3 and the IP of the service to be launched is successfully registered in the registry, it is determined that the service to be launched is successfully registered. At this time, the service to be launched and the service to be taken offline will coexist, and only the containers that pass the health check in Step 3 will be successfully registered in the registry;
[0105] The health status in this step refers to the health of the service to be launched to ensure that it can provide services externally normally.
[0106] Step 5: Obtain the IP of the container instance of the service to be taken offline from the database and send a take-offline request to the registry; the container instance of the service to be taken offline will no longer receive new traffic requests.
[0107] Step 6: Check the take-offline situation of the container instance of the service to be taken offline in real time, and the service inter-smooth switching process will be executed asynchronously.
[0108] Step 7: Send a shutdown request to the container instance of the service to be taken offline to notify the application to gracefully go offline.
[0109] Step 8: Detect the shutdown status of the container instance of the service to be taken offline. After ensuring that the service to be taken offline has been completely shut down, delete the container instance of the service to be taken offline to complete the release process.
[0110] It should be noted that the service to be launched can also be called a new service, the service to be taken offline can also be called an old service, the container instance of the service to be launched can also be called a new instance or a new container instance, and the container instance of the service to be taken offline can also be called an old instance or an old container instance.
[0111] Regarding the service inter-smooth switching process mentioned in the embodiments of the present application, the specific description is as follows:
[0112] In the actual use of enterprise systems, there are different registry usage schemes. In some RPC frameworks such as dubble, etc., the upstream service consumers can be actively notified of their own IP changes so that the consumers can actively switch the call link to call the new service provider. However, in some SpringCloud-based microservice architectures, the registry generally does not actively provide service IP change notifications, but relies on consumers to actively pull IP information regularly to obtain the latest service address information. In a high-traffic production environment, this scenario will inevitably lead to obtaining the old service address information due to untimely IP address pulling, ultimately resulting in service call timeout failures. To comprehensively solve this scenario, an active notification function is added after the service is taken offline to enable consumers to perceive this change in a timely manner, so that the call link switching is lossless.
[0113] Taking the Nacos + SpringCloud technology stack as an example:
[0114] A1: Develop a common dependent jar package, mainly implementing two interface functions:
[0115] Offline notification interface: This function is actively triggered when receiving an external offline notification request, obtains all current consumer IPs in the registry, and traverses and calls the consumer's receive offline notification interface;
[0116] Receive offline notification interface: When receiving an offline notification request, this interface will immediately poll and refresh the IP list in the registry.
[0117] A2: The consumer actively requests the registry to obtain the latest provider IP information and updates the local ribbon cache.
[0118] A3: The consumer calls the latest service provider.
[0119] The embodiments of this application also relate to service warm-up, and the specific content is as follows:
[0120] In the context of a business peak period or large production traffic, a newly started Java service may, due to incomplete initialization of class resources or partial use of lazy loading mechanisms, cause a huge pressure on the system at the moment when a large amount of traffic is cut in, and may even lead to production problems such as abnormal request blocking and soaring CPU (Central Processing Unit) resources. In this context, the service warm-up technology is introduced. For newly started containers, before cutting in full traffic, the warm-up traffic coefficient ratio will be calculated based on the system's TPS (Transaction Per Second), startup registration time, and system weight ratio, and the coefficient ratio is used to control the access of warm-up traffic to warm up the system, which can further improve the effect of smooth online.
[0121] B1: Asynchronously calculate the warm-up traffic coefficient ratio of the new instance. The calculation formula is Y (warm-up traffic ratio) = F(x, y, z), where x is the system's TPS, y is the system's startup registration time, and z is the system weight ratio, and save the asynchronously calculated data.
[0122] B2: When switching the traffic in the registry, the production traffic switching ratio will be controlled according to the calculation result, and warm-up traffic will be imported into the new instance to complete service warm-up.
[0123] The embodiments of this application also relate to the lossless offline operation of the service, and the specific content is as follows:
[0124] During the process of the system going offline without loss, the common practice in the industry is to set a specified time point and shut down the system after the remaining threads have finished execution. The drawback of this approach is that different systems have different situations, and the control over the remaining execution threads is not precise enough. There is still a certain situation of forcibly killing service threads, resulting in abnormal interruption of normal requests. Against this background, we adopt a three-stage offline method to ensure the lossless shutdown of the system, and use the built-in agent of the system to achieve information reporting, upload calculation, and finally smooth shutdown. The detailed steps are as follows:
[0125] C1: Send a pre-offline notice to the business system.
[0126] C2: The agent collects service thread information and reports it to the operation and maintenance system at regular intervals in a loop. The default reporting frequency is once every 5 seconds, and it can be specially set according to different situations.
[0127] C3: After the operation and maintenance system receives the detailed thread information of the service, it will asynchronously generate a task to calculate the offline time. This task mainly traverses non-system thread information, including asynchronous threads such as the thread pool of the JVM, to ensure that there are no business logic threads being executed.
[0128] C4: After the task of calculating the offline time is completed, it will send a real offline notice to the business system, ensuring that there are no remaining threads in the business system being executed at this time.
[0129] The technical solution of the embodiment of the present application, based on the registry, proposes a smooth online and offline solution for a distributed system, aiming to solve the problems that may occur during the dynamic change process of services;
[0130] This solution is committed to ensuring that when the system goes online or offline, a smooth transition can be achieved, minimizing the impact on the stability and performance of the entire system;
[0131] Through the registry, dynamic discovery and configuration management of services are realized, making the online and offline process more controllable and predictable.
[0132] In addition, the technical solution of the embodiment of the present application can better improve the availability and stability of the system for the seamless release during the system release and iteration process. During the service online and offline process, through service preheating, lossless traffic switching of the registry, adaptive waiting during the old instance offline, and active notification of service calls to refresh service information, etc.
[0133] Second, as shown in Figure 6 The embodiment of the present application provides a system smooth online and offline device based on the registry. The device includes:
[0134] A preparation module for deploying the image file of the service to be launched to a working node, allocating a virtual container, and constructing a corresponding container instance;
[0135] A registration module for performing a health check on the container instance of the service to be launched. If it is determined that the health is normal and the corresponding IP information is registered in the registration center, it is determined that the container instance of the service to be launched is successfully registered;
[0136] A switching module for publishing a shutdown request for the service to be shut down based on the IP information of the container instance of the service to be shut down and executing a smooth switching process between services;
[0137] A shutdown module for performing a shutdown operation on the container instance of the service to be shut down.
[0138] The embodiment of the present application realizes the lossless online and offline of a distributed system based on a registration center, which can support frequent iterations in enterprise-level development without affecting online services;
[0139] It provides strong support for the rapid iteration of the system, and this solution can adapt to the technical selection of any registration center;
[0140] It has good portability and operability. At the same time, it does not depend on any container orchestration framework in cloud native, has strong decoupling, strong adaptability, and can be compatible with most enterprise application scenarios; functions such as service preheating, accurate shutdown time calculation, and inter-service shutdown notification are specially added to ensure smooth online and realize true lossless traffic.
[0141] Further, the device further includes an information extraction module for obtaining the IP information of the container instance of the service to be shut down and persisting it to a preset database.
[0142] Further, the registration module is further configured to perform a health check on the container instance of the service to be launched. If it is determined that the health is abnormal and the number of corresponding instances in the registration center has not changed, the container instance of the service to be launched is deleted, and the virtual container corresponding to the service to be launched is deleted.
[0143] Further, the device further includes a deletion module for deleting the virtual container and container instance of the service to be shut down.
[0144] Further, the smooth switching process between services includes the following steps:
[0145] Based on the IP information of the container instance of the service to be shut down, obtain the acceptance shutdown notification interface corresponding to the container instance of the service to be shut down, and identify whether there is a shutdown request for the service to be shut down;
[0146] If it exists, poll to obtain the IP information of the container instance of the service to be launched online, and update the local Ribbon cache.
[0147] Further, the offline module is further configured to respond to an offline request for the service to be offline, and calculate the corresponding required offline time;
[0148] The offline module is further configured to perform an offline operation on the container instance of the service to be offline based on the required offline time.
[0149] Further, the device further includes a service preheating module, which is configured to asynchronously calculate the preheating traffic coefficient ratio of the container instance of the service to be launched online;
[0150] The service preheating module is further configured to control the production traffic switching ratio according to the preheating traffic coefficient ratio when the traffic is switched in the registration center, and import the preheating traffic into the container instance of the service to be launched online to complete the service preheating.
[0151] Further, the device is further configured with a preheating traffic coefficient ratio calculation formula;
[0152] The preheating traffic coefficient ratio calculation formula is: Y = F(x, y, z); where,
[0153] Y is the preheating traffic coefficient ratio, x is the TPS of the target system, y is the startup registration time of the target system, and z is the target system weight ratio.
[0154] Further, the preparation module is further configured to build the container instance corresponding to the service to be launched online by using the Docker service based on the mirror file and virtual container of the service to be launched online.
[0155] It should be noted that for the system smooth online and offline device based on the registration center provided in the embodiments of the present application, its corresponding technical problems, technical means, and technical effects are similar to the principles of the system smooth online and offline method based on the registration center at the principle level.
[0156] In the description of the present application, it should be noted that the orientation or positional relationship indicated by terms such as "upper" and "lower" is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present application. Unless otherwise clearly specified and defined, the terms "installed", "connected", and "coupled" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances.
[0157] It should be noted that in the present application, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the said element.
[0158] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features claimed herein.
Claims
1. A system smooth online and offline method based on a registration center, characterized in that: The method comprises the following steps: Deploy the image file of the service to be launched to the working node, allocate a virtual container, and build the corresponding container instance; Perform a health detection on the container instance of the service to be launched, and if it is determined to be healthy and normal and the corresponding IP information is registered in the registration center, it is determined that the container instance of the service to be launched is successfully registered; Based on the IP information of the container instance of the service to be taken offline, a request for taking offline of the service to be taken offline is issued, and a smooth switching process between services is performed; Perform a shutdown operation on the container instance of the service to be shut down.
2. The system smooth online and offline method based on the registration center as claimed in claim 1, characterized in that: The method further comprises the following steps: The IP information of the container instance of the service to be taken offline is obtained and persisted in a preset database.
3. The system smooth online and offline method based on the registration center as claimed in claim 1, characterized in that: The method further comprises the following steps: Perform a health detection on the container instance of the service to be launched, and if it is determined that the health is abnormal and the number of instances corresponding to the registration center has not changed, delete the container instance of the service to be launched, and delete the virtual container corresponding to the service to be launched.
4. The system smooth online and offline method based on the registration center as claimed in claim 1, characterized in that: After performing the offline operation on the container instance of the service to be offline, the method includes the following steps: Delete the virtual container and container instance of the service to be taken offline.
5. The system smooth online and offline method based on the registration center as claimed in claim 1, characterized in that: The inter-service smooth switching process includes the following steps: Based on the IP information of the container instance of the offline service, obtain the offline notification receiving interface corresponding to the container instance of the offline service, and identify whether there is an offline request for the service to be offline; If it exists, poll to obtain the IP information of the container instance of the service to be launched, and update the local Ribbon cache.
6. The system smooth online and offline method based on the registration center as claimed in claim 1, characterized in that: The performing an offline operation on the container instance of the service to be offline comprises the following steps: Responding to a request to go offline for the service to be taken offline, and calculating a corresponding time required to go offline; Based on the offline time required, an offline operation is performed on the container instance of the service to be offline.
7. The system smooth online and offline method based on the registration center as claimed in claim 1, characterized in that: The method further includes a service preheating process, which includes the following steps: Asynchronously calculating and obtaining a preheating flow coefficient ratio of the container instance of the service to be launched; When the registration center performs traffic switching, the production traffic switching ratio is controlled according to the preheating traffic coefficient ratio, and the preheating traffic is introduced into the container instance of the service to be launched to complete the service preheating.
8. The system smooth online and offline method based on the registration center as claimed in claim 7, characterized in that: The method is configured with a preheating flow coefficient ratio calculation formula; The calculation formula of the preheating flow coefficient ratio is: Y=F(x, y, z); wherein, Y is the preheating flow coefficient ratio, x is the TPS of the target system, y is the start-up registration time of the target system, and z is the target system weight ratio.
9. The system smooth online and offline method based on the registration center as claimed in claim 1, characterized in that: Deploy the image file of the service to be launched to the working node, allocate a virtual container, and build the corresponding container instance, including the following steps: Based on the image file of the service to be launched and the virtual container, a container instance corresponding to the service to be launched is constructed using the Docker service.
10. A system smooth online and offline device based on a registration center, characterized in that: The device comprises: A preparation module, which is used to deploy the image file of the service to be launched to the working node, allocate a virtual container, and build the corresponding container instance; A registration module, which is used to perform health detection on the container instance of the service to be launched, and if it is determined to be healthy and normal and the corresponding IP information is registered in the registration center, it is determined that the container instance of the service to be launched is successfully registered; A switching module, which is used to issue an offline request for the service to be offline based on the IP information of the container instance of the service to be offline, and execute a smooth switching process between services; The offline module is used to perform an offline operation on the container instance of the service to be offline.
Citation Information
Cited By
Traffic smooth migration method and system for micro-service instances
CN122395264A
Traffic smoothing migration method and system of micro-service instance
CN122395264B
